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
@@ -56,6 +56,11 @@ var action_1 = require("../../action/index.js");
56
56
  var utils_1 = require("../../utils/index.js");
57
57
  var pxhd_1 = require("../../pxhd/index.js");
58
58
  var DecideActionPhase_1 = require("./DecideActionPhase.js");
59
+ /**
60
+ * The `RiskApiPhase` class is responsible for making the synchronous Risk API request when necessary. If a Risk API call
61
+ * is made, it will also update the context with the Risk API response, product data (invoking each product's
62
+ * `enrichContextFromRiskApi` method), and update the context decision.
63
+ */
59
64
  var RiskApiPhase = /** @class */ (function (_super) {
60
65
  __extends(RiskApiPhase, _super);
61
66
  function RiskApiPhase(products, riskApiClient) {
@@ -124,14 +129,20 @@ var RiskApiPhase = /** @class */ (function (_super) {
124
129
  if (!riskResponse) {
125
130
  return;
126
131
  }
127
- (0, utils_1.transferExistingProperties)(riskResponse, context, {
128
- score: 'score',
129
- uuid: 'uuid',
130
- action: 'blockAction',
131
- dataEnrichment: 'pxde',
132
- telemetryRequested: 'shouldSendTelemetry',
133
- });
132
+ if (riskResponse.score != null) {
133
+ context.score = riskResponse.score;
134
+ }
135
+ if (riskResponse.action) {
136
+ context.blockAction = riskResponse.action;
137
+ }
138
+ if (riskResponse.uuid) {
139
+ context.uuid = riskResponse.uuid;
140
+ }
141
+ if (riskResponse.telemetryRequested) {
142
+ context.shouldSendTelemetry = true;
143
+ }
134
144
  if (riskResponse.dataEnrichment) {
145
+ context.pxde = riskResponse.dataEnrichment;
135
146
  context.pxdeVerified = true;
136
147
  }
137
148
  if (riskResponse.pxhd) {
@@ -36,23 +36,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.SendAsyncActivitiesOnResponsePhase = void 0;
40
- var SendAsyncActivitiesOnResponsePhase = /** @class */ (function () {
41
- function SendAsyncActivitiesOnResponsePhase(activityClient) {
39
+ exports.SendAsyncActivitiesPhase = void 0;
40
+ var action_1 = require("../../action/index.js");
41
+ /**
42
+ * The `SendAsyncActivitiesPhase` class is responsible for sending all necessary asynchronous activities based on the context.
43
+ */
44
+ var SendAsyncActivitiesPhase = /** @class */ (function () {
45
+ function SendAsyncActivitiesPhase(activityClient) {
42
46
  this.activityClient = activityClient;
43
47
  }
44
- SendAsyncActivitiesOnResponsePhase.prototype.execute = function (context) {
48
+ SendAsyncActivitiesPhase.prototype.execute = function (context) {
45
49
  return __awaiter(this, void 0, void 0, function () {
46
50
  return __generator(this, function (_a) {
47
51
  switch (_a.label) {
48
- case 0: return [4 /*yield*/, this.activityClient.sendActivities(context)];
52
+ case 0:
53
+ if (![action_1.Action.PASS_REQUEST, action_1.Action.BLOCK, action_1.Action.SIMULATED_BLOCK].includes(context.action)) return [3 /*break*/, 2];
54
+ return [4 /*yield*/, this.activityClient.sendActivities(context)];
49
55
  case 1:
50
56
  _a.sent();
51
- return [2 /*return*/, { done: false }];
57
+ _a.label = 2;
58
+ case 2: return [2 /*return*/, { done: false }];
52
59
  }
53
60
  });
54
61
  });
55
62
  };
56
- return SendAsyncActivitiesOnResponsePhase;
63
+ return SendAsyncActivitiesPhase;
57
64
  }());
58
- exports.SendAsyncActivitiesOnResponsePhase = SendAsyncActivitiesOnResponsePhase;
65
+ exports.SendAsyncActivitiesPhase = SendAsyncActivitiesPhase;
@@ -37,6 +37,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.SendLogsPhase = void 0;
40
+ /**
41
+ * The `SendLogsPhase` class is responsible for sending logs to the HUMAN logging service.
42
+ */
40
43
  var SendLogsPhase = /** @class */ (function () {
41
44
  function SendLogsPhase(_config, logServiceClient) {
42
45
  this.logServiceClient = logServiceClient;
@@ -37,6 +37,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.SendTelemetryActivityPhase = void 0;
40
+ /**
41
+ * The `SendTelemetryActivityPhase` class is responsible for sending the telemetry activity if necessary.
42
+ */
40
43
  var SendTelemetryActivityPhase = /** @class */ (function () {
41
44
  function SendTelemetryActivityPhase(telemetry) {
42
45
  this.telemetry = telemetry;
@@ -37,6 +37,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.UpdateRemoteConfigPhase = void 0;
40
+ /**
41
+ * The `UpdateRemoteConfigPhase` class is responsible for updating the remote configuration if necessary.
42
+ */
40
43
  var UpdateRemoteConfigPhase = /** @class */ (function () {
41
44
  function UpdateRemoteConfigPhase(config, remoteConfigManager) {
42
45
  this.config = config;
@@ -25,8 +25,7 @@ __exportStar(require("./CreateBlockResponsePhase.js"), exports);
25
25
  __exportStar(require("./ModifyIncomingRequestPhase.js"), exports);
26
26
  __exportStar(require("./EnrichContextFromResponsePhase.js"), exports);
27
27
  __exportStar(require("./ModifyOutgoingResponsePhase.js"), exports);
28
- __exportStar(require("./SendAsyncActivitiesOnRequestPhase.js"), exports);
29
- __exportStar(require("./SendAsyncActivitiesOnResponsePhase.js"), exports);
28
+ __exportStar(require("./SendAsyncActivitiesPhase.js"), exports);
30
29
  __exportStar(require("./AdditionalActivityHandlerPhase.js"), exports);
31
30
  __exportStar(require("./CompositePhase.js"), exports);
32
31
  __exportStar(require("./SendLogsPhase.js"), exports);
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IPhase.js"), exports);
18
18
  __exportStar(require("./PhaseResult.js"), exports);
19
19
  __exportStar(require("./impl/index.js"), exports);
20
- __exportStar(require("./flow/index.js"), exports);
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.BodyLoginSuccessfulParser = void 0;
40
40
  var BodyLoginSuccessfulParser = /** @class */ (function () {
41
41
  function BodyLoginSuccessfulParser(regex) {
42
- this.bodyRegex = new RegExp(regex);
42
+ this.bodyRegex = regex;
43
43
  }
44
44
  BodyLoginSuccessfulParser.prototype.isLoginSuccessful = function (response) {
45
45
  return __awaiter(this, void 0, void 0, function () {
@@ -11,13 +11,16 @@ var LoginSuccessfulParserFactory = /** @class */ (function () {
11
11
  function LoginSuccessfulParserFactory() {
12
12
  }
13
13
  LoginSuccessfulParserFactory.create = function (config, endpointConfig) {
14
- var _a;
14
+ var _a, _b;
15
15
  var ciDefaultLoginSuccessfulReportingMethod = config.ciDefaultLoginSuccessfulReportingMethod, ciDefaultLoginSuccessfulBodyRegex = config.ciDefaultLoginSuccessfulBodyRegex, ciDefaultLoginSuccessfulStatus = config.ciDefaultLoginSuccessfulStatus, ciDefaultLoginSuccessfulCustomCallback = config.ciDefaultLoginSuccessfulCustomCallback, ciDefaultLoginSuccessfulHeaderName = config.ciDefaultLoginSuccessfulHeaderName, ciDefaultLoginSuccessfulHeaderValue = config.ciDefaultLoginSuccessfulHeaderValue;
16
16
  var login_successful_reporting_method = endpointConfig.login_successful_reporting_method, login_successful_callback = endpointConfig.login_successful_callback, login_successful_statuses = endpointConfig.login_successful_statuses, login_successful_body_regex = endpointConfig.login_successful_body_regex, login_successful_header_name = endpointConfig.login_successful_header_name, login_successful_header_value = endpointConfig.login_successful_header_value;
17
17
  var reportingMethod = (_a = login_successful_reporting_method !== null && login_successful_reporting_method !== void 0 ? login_successful_reporting_method : ciDefaultLoginSuccessfulReportingMethod) !== null && _a !== void 0 ? _a : LoginSuccessfulReportingMethod_1.LoginSuccessfulReportingMethod.STATUS;
18
18
  switch (reportingMethod) {
19
19
  case LoginSuccessfulReportingMethod_1.LoginSuccessfulReportingMethod.BODY:
20
- return new BodyLoginSuccessfulParser_1.BodyLoginSuccessfulParser(login_successful_body_regex !== null && login_successful_body_regex !== void 0 ? login_successful_body_regex : ciDefaultLoginSuccessfulBodyRegex);
20
+ var bodyRegex = login_successful_body_regex !== null && login_successful_body_regex !== void 0 ? login_successful_body_regex : ciDefaultLoginSuccessfulBodyRegex;
21
+ return new BodyLoginSuccessfulParser_1.BodyLoginSuccessfulParser(typeof bodyRegex === 'string'
22
+ ? ((_b = (0, utils_1.convertRegexStringToRegex)(bodyRegex)) !== null && _b !== void 0 ? _b : new RegExp(bodyRegex))
23
+ : bodyRegex);
21
24
  case LoginSuccessfulReportingMethod_1.LoginSuccessfulReportingMethod.CUSTOM:
22
25
  var callback = login_successful_callback !== null && login_successful_callback !== void 0 ? login_successful_callback : ciDefaultLoginSuccessfulCustomCallback;
23
26
  if (!callback) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CredentialIntelligenceEndpointMatcherFactory = void 0;
4
+ var utils_1 = require("../../../../utils/index.js");
4
5
  var ExactPathEndpointMatcher_1 = require("./ExactPathEndpointMatcher.js");
5
6
  var RegexPathEndpointMatcher_1 = require("./RegexPathEndpointMatcher.js");
6
7
  var PathType_1 = require("./PathType.js");
@@ -8,10 +9,11 @@ var CredentialIntelligenceEndpointMatcherFactory = /** @class */ (function () {
8
9
  function CredentialIntelligenceEndpointMatcherFactory() {
9
10
  }
10
11
  CredentialIntelligenceEndpointMatcherFactory.create = function (_a) {
12
+ var _b;
11
13
  var path_type = _a.path_type, path = _a.path, method = _a.method;
12
14
  switch (path_type) {
13
15
  case PathType_1.PathType.REGEX:
14
- return new RegexPathEndpointMatcher_1.RegexPathEndpointMatcher(new RegExp(path), method.toUpperCase());
16
+ return new RegexPathEndpointMatcher_1.RegexPathEndpointMatcher((_b = (0, utils_1.convertRegexStringToRegex)(path)) !== null && _b !== void 0 ? _b : new RegExp(path), method.toUpperCase());
15
17
  case PathType_1.PathType.EXACT:
16
18
  default:
17
19
  return new ExactPathEndpointMatcher_1.ExactPathEndpointMatcher(path, method.toUpperCase());
@@ -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.GetRiskApiClientV2 = void 0;
19
+ var abstract_1 = require("./abstract/index.js");
20
+ var http_1 = require("../../http/index.js");
21
+ var risk_response_1 = require("../risk_response/index.js");
22
+ var model_1 = require("../model/index.js");
23
+ var utils_1 = require("../utils.js");
24
+ var GetRiskApiClientV2 = /** @class */ (function (_super) {
25
+ __extends(GetRiskApiClientV2, _super);
26
+ function GetRiskApiClientV2(config, httpClient) {
27
+ return _super.call(this, config, httpClient) || this;
28
+ }
29
+ GetRiskApiClientV2.prototype.createRiskRequest = function (context) {
30
+ return new http_1.OutgoingRequestImpl({
31
+ method: http_1.HttpMethod.GET,
32
+ url: this.getRiskUrl(),
33
+ headers: this.getRiskActivityHeaders(context),
34
+ });
35
+ };
36
+ GetRiskApiClientV2.prototype.getRiskActivityHeaders = function (context) {
37
+ var riskHeaders = this.getRiskHeaders();
38
+ var requestHeaders = this.getRequestHeadersForRisk(context);
39
+ var riskActivityHeaders = this.riskActivityToHeaders((0, utils_1.createRiskApiActivity)(this.config, context));
40
+ return Object.assign(requestHeaders, riskActivityHeaders, riskHeaders);
41
+ };
42
+ GetRiskApiClientV2.prototype.getRequestHeadersForRisk = function (context) {
43
+ var HEADERS_TO_DELETE = [http_1.CONTENT_LENGTH_HEADER_NAME, http_1.CONTENT_TYPE_HEADER_NAME, http_1.AUTHORIZATION_HEADER_NAME];
44
+ var headers = {};
45
+ Object.entries(context.requestData.headers).forEach(function (_a) {
46
+ var key = _a[0], value = _a[1];
47
+ if (!HEADERS_TO_DELETE.includes(key.toLowerCase())) {
48
+ headers[key] = value.concat();
49
+ }
50
+ });
51
+ return headers;
52
+ };
53
+ GetRiskApiClientV2.prototype.riskActivityToHeaders = function (riskActivity) {
54
+ var headers = {};
55
+ this.addHeadersFromObject(headers, riskActivity, model_1.RISK_ACTIVITY_FIELDS_TO_HEADER_NAMES);
56
+ this.addHeadersFromObject(headers, riskActivity.request, model_1.RISK_ACTIVITY_REQUEST_FIELDS_TO_HEADER_NAMES);
57
+ this.addHeadersFromObject(headers, riskActivity.additional, model_1.RISK_ACTIVITY_ADDITIONAL_FIELDS_TO_HEADER_NAMES);
58
+ return headers;
59
+ };
60
+ GetRiskApiClientV2.prototype.addHeadersFromObject = function (headers, object, headerNamesMap) {
61
+ Object.entries(object).forEach(function (_a) {
62
+ var key = _a[0], value = _a[1];
63
+ var headerConversionObject = headerNamesMap[key];
64
+ if (headerConversionObject && value != null) {
65
+ var header = headerConversionObject.header, convertToString = headerConversionObject.convertToString;
66
+ var strValue = convertToString
67
+ ? convertToString(value)
68
+ : typeof value === 'string'
69
+ ? value
70
+ : "".concat(value);
71
+ headers[header] = [strValue];
72
+ }
73
+ });
74
+ };
75
+ GetRiskApiClientV2.prototype.createRiskResponse = function (response) {
76
+ return new risk_response_1.GetRiskResponseV2(response);
77
+ };
78
+ return GetRiskApiClientV2;
79
+ }(abstract_1.RiskApiClientBase));
80
+ exports.GetRiskApiClientV2 = GetRiskApiClientV2;
@@ -17,15 +17,15 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PostRiskApiClientV2 = void 0;
19
19
  var risk_response_1 = require("../risk_response/index.js");
20
- var PostRiskApiClientBase_1 = require("./PostRiskApiClientBase.js");
20
+ var abstract_1 = require("./abstract/index.js");
21
21
  var PostRiskApiClientV2 = /** @class */ (function (_super) {
22
22
  __extends(PostRiskApiClientV2, _super);
23
23
  function PostRiskApiClientV2(config, httpClient) {
24
24
  return _super.call(this, config, httpClient) || this;
25
25
  }
26
26
  PostRiskApiClientV2.prototype.createRiskResponse = function (response) {
27
- return new risk_response_1.DefaultRiskResponseV2(response);
27
+ return new risk_response_1.PostRiskResponseV2(response);
28
28
  };
29
29
  return PostRiskApiClientV2;
30
- }(PostRiskApiClientBase_1.PostRiskApiClientBase));
30
+ }(abstract_1.PostRiskApiClientBase));
31
31
  exports.PostRiskApiClientV2 = PostRiskApiClientV2;
@@ -16,16 +16,16 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PostRiskApiClientV3 = void 0;
19
- var PostRiskApiClientBase_1 = require("./PostRiskApiClientBase.js");
20
19
  var risk_response_1 = require("../risk_response/index.js");
20
+ var abstract_1 = require("./abstract/index.js");
21
21
  var PostRiskApiClientV3 = /** @class */ (function (_super) {
22
22
  __extends(PostRiskApiClientV3, _super);
23
23
  function PostRiskApiClientV3(config, httpClient) {
24
24
  return _super.call(this, config, httpClient) || this;
25
25
  }
26
26
  PostRiskApiClientV3.prototype.createRiskResponse = function (response) {
27
- return new risk_response_1.DefaultRiskResponseV3(response);
27
+ return new risk_response_1.PostRiskResponseV3(response);
28
28
  };
29
29
  return PostRiskApiClientV3;
30
- }(PostRiskApiClientBase_1.PostRiskApiClientBase));
30
+ }(abstract_1.PostRiskApiClientBase));
31
31
  exports.PostRiskApiClientV3 = PostRiskApiClientV3;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,43 @@
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.PostRiskApiClientBase = void 0;
19
+ var RiskApiClientBase_1 = require("./RiskApiClientBase.js");
20
+ var http_1 = require("../../../http/index.js");
21
+ var utils_1 = require("../../utils.js");
22
+ var http_2 = require("../../../http/index.js");
23
+ var PostRiskApiClientBase = /** @class */ (function (_super) {
24
+ __extends(PostRiskApiClientBase, _super);
25
+ function PostRiskApiClientBase() {
26
+ return _super !== null && _super.apply(this, arguments) || this;
27
+ }
28
+ PostRiskApiClientBase.prototype.createRiskRequest = function (context) {
29
+ var url = this.getRiskUrl();
30
+ var headers = this.getRiskHeaders();
31
+ var body = JSON.stringify((0, utils_1.createRiskApiActivity)(this.config, context));
32
+ var method = http_1.HttpMethod.POST;
33
+ return new http_1.OutgoingRequestImpl({ url: url, method: method, headers: headers, body: body });
34
+ };
35
+ PostRiskApiClientBase.prototype.getRiskHeaders = function () {
36
+ var _a;
37
+ return Object.assign((_a = {},
38
+ _a[http_2.CONTENT_TYPE_HEADER_NAME] = [http_2.ContentType.APPLICATION_JSON],
39
+ _a), _super.prototype.getRiskHeaders.call(this));
40
+ };
41
+ return PostRiskApiClientBase;
42
+ }(RiskApiClientBase_1.RiskApiClientBase));
43
+ exports.PostRiskApiClientBase = PostRiskApiClientBase;
@@ -1,15 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -47,14 +36,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
36
  }
48
37
  };
49
38
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.isEnforcerTimeoutError = exports.PostRiskApiClientBase = void 0;
51
- var http_1 = require("../../http/index.js");
52
- var utils_1 = require("../../utils/index.js");
53
- var activities_1 = require("../../activities/index.js");
54
- var constants_1 = require("../constants.js");
55
- var model_1 = require("../model/index.js");
56
- var PostRiskApiClientBase = /** @class */ (function () {
57
- function PostRiskApiClientBase(config, httpClient) {
39
+ exports.isEnforcerTimeoutError = exports.RiskApiClientBase = void 0;
40
+ var http_1 = require("../../../http/index.js");
41
+ var utils_1 = require("../../../utils/index.js");
42
+ var activities_1 = require("../../../activities/index.js");
43
+ var constants_1 = require("../../constants.js");
44
+ var model_1 = require("../../model/index.js");
45
+ var RiskApiClientBase = /** @class */ (function () {
46
+ function RiskApiClientBase(config, httpClient) {
58
47
  this.config = config;
59
48
  this.httpClient = httpClient;
60
49
  }
@@ -63,9 +52,9 @@ var PostRiskApiClientBase = /** @class */ (function () {
63
52
  * @param context
64
53
  * @returns Promise<RiskApiData>
65
54
  */
66
- PostRiskApiClientBase.prototype.executeRiskApi = function (context) {
55
+ RiskApiClientBase.prototype.executeRiskApi = function (context) {
67
56
  return __awaiter(this, void 0, void 0, function () {
68
- var response, riskResponse, riskApiData, riskActivity, err_1;
57
+ var response, riskResponse, riskApiData, riskRequest, err_1;
69
58
  return __generator(this, function (_a) {
70
59
  switch (_a.label) {
71
60
  case 0:
@@ -73,8 +62,8 @@ var PostRiskApiClientBase = /** @class */ (function () {
73
62
  _a.label = 1;
74
63
  case 1:
75
64
  _a.trys.push([1, 8, , 10]);
76
- riskActivity = this.createRiskActivity(context);
77
- return [4 /*yield*/, this.sendRiskActivity(riskActivity, riskApiData, context)];
65
+ riskRequest = this.createRiskRequest(context);
66
+ return [4 /*yield*/, this.sendRiskActivity(riskRequest, riskApiData, context)];
78
67
  case 2:
79
68
  response = _a.sent();
80
69
  if (!((response === null || response === void 0 ? void 0 : response.status) !== 200)) return [3 /*break*/, 4];
@@ -104,52 +93,17 @@ var PostRiskApiClientBase = /** @class */ (function () {
104
93
  });
105
94
  });
106
95
  };
107
- /**
108
- * Creates the RiskActivity payload
109
- * @param context
110
- * @returns RiskActivity
111
- * @protected
112
- */
113
- PostRiskApiClientBase.prototype.createRiskActivity = function (context) {
114
- var _a, _b, _c;
115
- var riskActivity = {
116
- vid: context.vid,
117
- client_uuid: context.uuid,
118
- pxhd: (_a = context.pxhd) === null || _a === void 0 ? void 0 : _a.value,
119
- request: {
120
- socket_ip: context.requestData.ip,
121
- headers: this.formatRiskHeadersField(context.requestData.headers),
122
- url: context.requestData.url.href,
123
- },
124
- additional: __assign(__assign({}, (0, activities_1.createCommonActivityDetails)(this.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() }),
125
- };
126
- return this.finalizeRiskActivity(riskActivity);
127
- };
128
- /**
129
- * Protected function in case expansions or alterations to the risk activity are needed for certain platforms.
130
- * @param riskActivity
131
- * @returns RiskActivity
132
- * @protected
133
- */
134
- PostRiskApiClientBase.prototype.finalizeRiskActivity = function (riskActivity) {
135
- return riskActivity;
136
- };
137
- PostRiskApiClientBase.prototype.formatRiskHeadersField = function (headers) {
96
+ RiskApiClientBase.prototype.formatRiskHeadersField = function (headers) {
138
97
  var headersWithoutSensitive = (0, utils_1.removeSensitiveHeaders)(headers, this.config.sensitiveHeaders);
139
98
  return (0, activities_1.toHeaderEntryArray)(headersWithoutSensitive);
140
99
  };
141
- PostRiskApiClientBase.prototype.sendRiskActivity = function (riskActivity, riskApiData, context) {
100
+ RiskApiClientBase.prototype.sendRiskActivity = function (riskRequest, riskApiData, context) {
142
101
  return __awaiter(this, void 0, void 0, function () {
143
- var url, headers, body, method, riskRequest, startTime, response, endTime;
102
+ var startTime, response, endTime;
144
103
  return __generator(this, function (_a) {
145
104
  switch (_a.label) {
146
105
  case 0:
147
- url = this.getRiskUrl();
148
- headers = this.getRiskHeaders();
149
- body = JSON.stringify(riskActivity);
150
- method = http_1.HttpMethod.POST;
151
- riskRequest = new http_1.OutgoingRequestImpl({ url: url, method: method, headers: headers, body: body });
152
- context.logger.debug("sending risk api to ".concat(url));
106
+ context.logger.debug("sending risk api to ".concat(riskRequest.url));
153
107
  startTime = Date.now();
154
108
  return [4 /*yield*/, this.httpClient.send(riskRequest, { timeoutMs: this.config.s2sTimeout })];
155
109
  case 1:
@@ -162,21 +116,20 @@ var PostRiskApiClientBase = /** @class */ (function () {
162
116
  });
163
117
  });
164
118
  };
165
- PostRiskApiClientBase.prototype.getRiskUrl = function () {
119
+ RiskApiClientBase.prototype.getRiskUrl = function () {
166
120
  return "".concat(this.config.backendScoreApiUrl).concat(constants_1.RISK_API_ENDPOINT);
167
121
  };
168
- PostRiskApiClientBase.prototype.getRiskHeaders = function () {
122
+ RiskApiClientBase.prototype.getRiskHeaders = function () {
169
123
  var _a;
170
124
  return _a = {},
171
- _a[http_1.CONTENT_TYPE_HEADER_NAME] = [http_1.ContentType.APPLICATION_JSON],
172
125
  _a[http_1.AUTHORIZATION_HEADER_NAME] = [(0, utils_1.getAuthorizationHeader)(this.config.authToken)],
173
126
  _a;
174
127
  };
175
- PostRiskApiClientBase.prototype.handleS2STimeout = function (riskApiData) {
128
+ RiskApiClientBase.prototype.handleS2STimeout = function (riskApiData) {
176
129
  riskApiData.riskApiCallResult = model_1.RiskApiCallResult.TIMEOUT;
177
130
  return riskApiData;
178
131
  };
179
- PostRiskApiClientBase.prototype.handleS2SError = function (riskApiData, context, response, error) {
132
+ RiskApiClientBase.prototype.handleS2SError = function (riskApiData, context, response, error) {
180
133
  return __awaiter(this, void 0, void 0, function () {
181
134
  var _a, _b, _c, errorMessage, existingMessage;
182
135
  var _d, _e, _f;
@@ -228,9 +181,9 @@ var PostRiskApiClientBase = /** @class */ (function () {
228
181
  });
229
182
  });
230
183
  };
231
- return PostRiskApiClientBase;
184
+ return RiskApiClientBase;
232
185
  }());
233
- exports.PostRiskApiClientBase = PostRiskApiClientBase;
186
+ exports.RiskApiClientBase = RiskApiClientBase;
234
187
  var isEnforcerTimeoutError = function (err) {
235
188
  return typeof err === 'object' && !!err && 'name' in err && err.name === utils_1.EnforcerErrorName.ENFORCER_TIMEOUT_ERROR;
236
189
  };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./PostRiskApiClientBase.js"), exports);
18
+ __exportStar(require("./RiskApiClientBase.js"), exports);
19
+ __exportStar(require("./IRiskApiClient.js"), exports);
@@ -14,7 +14,7 @@ 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("./IRiskApiClient.js"), exports);
18
- __exportStar(require("./PostRiskApiClientBase.js"), exports);
19
17
  __exportStar(require("./PostRiskApiClientV2.js"), exports);
20
18
  __exportStar(require("./PostRiskApiClientV3.js"), exports);
19
+ __exportStar(require("./abstract/index.js"), exports);
20
+ __exportStar(require("./GetRiskApiClientV2.js"), exports);
@@ -18,3 +18,4 @@ __exportStar(require("./model/index.js"), exports);
18
18
  __exportStar(require("./risk_response/index.js"), exports);
19
19
  __exportStar(require("./client/index.js"), exports);
20
20
  __exportStar(require("./constants.js"), exports);
21
+ __exportStar(require("./utils.js"), exports);