perimeterx-js-core 0.24.4 → 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 (314) 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 +26 -6
  12. package/lib/cjs/config/index.js +0 -1
  13. package/lib/cjs/config/remote_config/RemoteConfigUtils.js +12 -2
  14. package/lib/cjs/config/remote_config/index.js +2 -2
  15. package/lib/cjs/config/remote_config/manager/DefaultRemoteConfigManager.js +191 -0
  16. package/lib/cjs/config/remote_config/manager/index.js +18 -0
  17. package/lib/cjs/config/remote_config/model/index.js +1 -1
  18. package/lib/cjs/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.js +139 -0
  19. package/lib/cjs/config/remote_config/update_parser/index.js +18 -0
  20. package/lib/cjs/context/DefaultContext.js +26 -4
  21. package/lib/cjs/context/SerializedContext.js +6 -1
  22. package/lib/cjs/context/interfaces/RemoteConfigUpdateData.js +2 -0
  23. package/lib/cjs/context/interfaces/index.js +1 -0
  24. package/lib/cjs/enforcer/EnforcerBase.js +77 -32
  25. package/lib/cjs/enforcer/IPostEnforcer.js +2 -0
  26. package/lib/cjs/enforcer/index.js +1 -0
  27. package/lib/cjs/enforcer/utils.js +34 -38
  28. package/lib/cjs/{phase/flow → flow}/EndEnforcerFlow.js +13 -7
  29. package/lib/cjs/{phase/flow → flow}/EnforceFlow.js +10 -15
  30. package/lib/cjs/{phase/flow → flow}/FilterFlow.js +12 -12
  31. package/lib/cjs/flow/Flow.js +60 -0
  32. package/lib/cjs/flow/IFlow.js +2 -0
  33. package/lib/cjs/{phase/flow → flow}/PostEnforceFlow.js +6 -6
  34. package/lib/cjs/{phase/flow → flow}/index.js +2 -0
  35. package/lib/cjs/index.js +1 -0
  36. package/lib/cjs/phase/impl/AdditionalActivityHandlerPhase.js +3 -0
  37. package/lib/cjs/phase/impl/ClearLogsPhase.js +3 -0
  38. package/lib/cjs/phase/impl/CompositePhase.js +9 -0
  39. package/lib/cjs/phase/impl/CreateBlockResponsePhase.js +16 -0
  40. package/lib/cjs/phase/impl/DecideActionPhase.js +11 -0
  41. package/lib/cjs/phase/impl/EnrichContextFromRequestPhase.js +13 -9
  42. package/lib/cjs/phase/impl/EnrichContextFromResponsePhase.js +4 -0
  43. package/lib/cjs/phase/impl/FilterPhase.js +4 -0
  44. package/lib/cjs/phase/impl/FirstPartyPhase.js +5 -0
  45. package/lib/cjs/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.js +80 -0
  46. package/lib/cjs/phase/impl/IdentifyTelemetryRequestPhase.js +5 -0
  47. package/lib/cjs/phase/impl/ModifyIncomingRequestPhase.js +5 -0
  48. package/lib/cjs/phase/impl/ModifyOutgoingResponsePhase.js +5 -0
  49. package/lib/cjs/phase/impl/ParseTokenPhase.js +14 -7
  50. package/lib/cjs/phase/impl/PreflightPhase.js +4 -0
  51. package/lib/cjs/phase/impl/RiskApiPhase.js +18 -7
  52. package/lib/cjs/phase/impl/{SendAsyncActivitiesOnResponsePhase.js → SendAsyncActivitiesPhase.js} +15 -8
  53. package/lib/cjs/phase/impl/SendLogsPhase.js +3 -0
  54. package/lib/cjs/phase/impl/SendTelemetryActivityPhase.js +3 -0
  55. package/lib/cjs/phase/impl/UpdateRemoteConfigPhase.js +10 -14
  56. package/lib/cjs/phase/impl/index.js +3 -3
  57. package/lib/cjs/phase/index.js +0 -1
  58. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
  59. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +5 -2
  60. package/lib/cjs/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +3 -1
  61. package/lib/cjs/risk_api/client/GetRiskApiClientV2.js +80 -0
  62. package/lib/cjs/risk_api/client/PostRiskApiClientV2.js +3 -3
  63. package/lib/cjs/risk_api/client/PostRiskApiClientV3.js +3 -3
  64. package/lib/cjs/risk_api/client/abstract/IRiskApiClient.js +2 -0
  65. package/lib/cjs/risk_api/client/abstract/PostRiskApiClientBase.js +43 -0
  66. package/lib/cjs/risk_api/client/{PostRiskApiClientBase.js → abstract/RiskApiClientBase.js} +22 -69
  67. package/lib/cjs/risk_api/client/abstract/index.js +19 -0
  68. package/lib/cjs/risk_api/client/index.js +2 -2
  69. package/lib/cjs/risk_api/index.js +1 -0
  70. package/lib/cjs/risk_api/model/GetRiskRequestHeaders.js +185 -0
  71. package/lib/cjs/risk_api/model/GetRiskResponseHeaders.js +16 -0
  72. package/lib/cjs/risk_api/model/index.js +2 -0
  73. package/lib/cjs/{phase/impl/SendAsyncActivitiesOnRequestPhase.js → risk_api/risk_response/PostRiskResponseBase.js} +26 -30
  74. package/lib/cjs/risk_api/risk_response/RiskResponseBase.js +11 -8
  75. package/lib/cjs/risk_api/risk_response/index.js +1 -0
  76. package/lib/cjs/risk_api/risk_response/serialize/SerializedRiskResponse.js +5 -1
  77. package/lib/cjs/risk_api/risk_response/v2/GetRiskResponseV2.js +80 -0
  78. package/lib/cjs/risk_api/risk_response/v2/{DefaultRiskResponseV2.js → PostRiskResponseV2.js} +10 -10
  79. package/lib/cjs/risk_api/risk_response/v2/index.js +2 -1
  80. package/lib/cjs/risk_api/risk_response/v3/{DefaultRiskResponseV3.js → PostRiskResponseV3.js} +10 -10
  81. package/lib/cjs/risk_api/risk_response/v3/index.js +1 -1
  82. package/lib/cjs/risk_api/utils.js +36 -0
  83. package/lib/cjs/telemetry/DefaultTelemetry.js +12 -9
  84. package/lib/cjs/utils/constants.js +1 -1
  85. package/lib/cjs/utils/utils.js +1 -19
  86. package/lib/esm/action/Action.js +15 -0
  87. package/lib/esm/action/ActionPriorityOrder.js +4 -0
  88. package/lib/esm/action/utils.js +20 -0
  89. package/lib/esm/activities/HttpActivityClient.js +61 -1
  90. package/lib/esm/activities/HttpBatchedActivityClient.js +7 -0
  91. package/lib/esm/activities/utils.js +128 -63
  92. package/lib/esm/additional_activity_handler/AdditionalActivityHandlerUtils.js +6 -0
  93. package/lib/esm/blocker/BlockerBase.js +14 -0
  94. package/lib/esm/blocker/JsonBlockerBase.js +5 -0
  95. package/lib/esm/blocker/utils.js +13 -0
  96. package/lib/esm/config/ConfigurationBase.js +23 -8
  97. package/lib/esm/config/index.js +0 -1
  98. package/lib/esm/config/remote_config/RemoteConfigUtils.js +11 -2
  99. package/lib/esm/config/remote_config/index.js +2 -2
  100. package/lib/esm/config/remote_config/manager/DefaultRemoteConfigManager.js +87 -0
  101. package/lib/esm/config/remote_config/manager/index.js +2 -0
  102. package/lib/esm/config/remote_config/model/index.js +1 -1
  103. package/lib/esm/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.js +60 -0
  104. package/lib/esm/config/remote_config/update_parser/index.js +2 -0
  105. package/lib/esm/context/DefaultContext.js +23 -6
  106. package/lib/esm/context/SerializedContext.js +7 -2
  107. package/lib/esm/context/interfaces/RemoteConfigUpdateData.js +1 -0
  108. package/lib/esm/context/interfaces/index.js +1 -0
  109. package/lib/esm/enforcer/EnforcerBase.js +46 -6
  110. package/lib/esm/enforcer/IPostEnforcer.js +1 -0
  111. package/lib/esm/enforcer/index.js +1 -0
  112. package/lib/esm/enforcer/utils.js +32 -17
  113. package/lib/esm/flow/EndEnforcerFlow.js +18 -0
  114. package/lib/esm/flow/EnforceFlow.js +14 -0
  115. package/lib/esm/{phase/flow → flow}/FilterFlow.js +8 -8
  116. package/lib/esm/flow/Flow.js +56 -0
  117. package/lib/esm/flow/IFlow.js +1 -0
  118. package/lib/esm/flow/PostEnforceFlow.js +10 -0
  119. package/lib/esm/{phase/flow → flow}/index.js +2 -0
  120. package/lib/esm/index.js +1 -0
  121. package/lib/esm/logger/LoggerBase.js +1 -1
  122. package/lib/esm/phase/impl/AdditionalActivityHandlerPhase.js +3 -0
  123. package/lib/esm/phase/impl/ClearLogsPhase.js +3 -0
  124. package/lib/esm/phase/impl/CompositePhase.js +9 -0
  125. package/lib/esm/phase/impl/CreateBlockResponsePhase.js +16 -1
  126. package/lib/esm/phase/impl/DecideActionPhase.js +11 -0
  127. package/lib/esm/phase/impl/EnrichContextFromRequestPhase.js +9 -0
  128. package/lib/esm/phase/impl/EnrichContextFromResponsePhase.js +4 -0
  129. package/lib/esm/phase/impl/FilterPhase.js +4 -0
  130. package/lib/esm/phase/impl/FirstPartyPhase.js +5 -0
  131. package/lib/esm/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.js +29 -0
  132. package/lib/esm/phase/impl/IdentifyTelemetryRequestPhase.js +5 -0
  133. package/lib/esm/phase/impl/ModifyIncomingRequestPhase.js +5 -0
  134. package/lib/esm/phase/impl/ModifyOutgoingResponsePhase.js +5 -0
  135. package/lib/esm/phase/impl/ParseTokenPhase.js +15 -8
  136. package/lib/esm/phase/impl/PreflightPhase.js +4 -0
  137. package/lib/esm/phase/impl/RiskApiPhase.js +19 -8
  138. package/lib/esm/phase/impl/SendAsyncActivitiesPhase.js +16 -0
  139. package/lib/esm/phase/impl/SendLogsPhase.js +3 -0
  140. package/lib/esm/phase/impl/SendTelemetryActivityPhase.js +3 -0
  141. package/lib/esm/phase/impl/UpdateRemoteConfigPhase.js +9 -13
  142. package/lib/esm/phase/impl/index.js +3 -3
  143. package/lib/esm/phase/index.js +0 -1
  144. package/lib/esm/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
  145. package/lib/esm/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +5 -2
  146. package/lib/esm/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +2 -1
  147. package/lib/esm/risk_api/client/GetRiskApiClientV2.js +57 -0
  148. package/lib/esm/risk_api/client/PostRiskApiClientV2.js +3 -3
  149. package/lib/esm/risk_api/client/PostRiskApiClientV3.js +3 -3
  150. package/lib/esm/risk_api/client/abstract/IRiskApiClient.js +1 -0
  151. package/lib/esm/risk_api/client/abstract/PostRiskApiClientBase.js +18 -0
  152. package/lib/esm/risk_api/client/{PostRiskApiClientBase.js → abstract/RiskApiClientBase.js} +10 -49
  153. package/lib/esm/risk_api/client/abstract/index.js +3 -0
  154. package/lib/esm/risk_api/client/index.js +2 -2
  155. package/lib/esm/risk_api/index.js +1 -0
  156. package/lib/esm/risk_api/model/GetRiskRequestHeaders.js +182 -0
  157. package/lib/esm/risk_api/model/GetRiskResponseHeaders.js +13 -0
  158. package/lib/esm/risk_api/model/index.js +2 -0
  159. package/lib/esm/risk_api/risk_response/PostRiskResponseBase.js +6 -0
  160. package/lib/esm/risk_api/risk_response/RiskResponseBase.js +5 -1
  161. package/lib/esm/risk_api/risk_response/index.js +1 -0
  162. package/lib/esm/risk_api/risk_response/serialize/SerializedRiskResponse.js +5 -1
  163. package/lib/esm/risk_api/risk_response/v2/GetRiskResponseV2.js +52 -0
  164. package/lib/esm/risk_api/risk_response/v2/{DefaultRiskResponseV2.js → PostRiskResponseV2.js} +2 -2
  165. package/lib/esm/risk_api/risk_response/v2/index.js +2 -1
  166. package/lib/esm/risk_api/risk_response/v3/{DefaultRiskResponseV3.js → PostRiskResponseV3.js} +2 -2
  167. package/lib/esm/risk_api/risk_response/v3/index.js +1 -1
  168. package/lib/esm/risk_api/utils.js +23 -0
  169. package/lib/esm/telemetry/DefaultTelemetry.js +13 -10
  170. package/lib/esm/utils/constants.js +1 -1
  171. package/lib/esm/utils/utils.js +0 -16
  172. package/lib/types/action/Action.d.ts +15 -0
  173. package/lib/types/action/ActionData.d.ts +3 -0
  174. package/lib/types/action/ActionPriorityOrder.d.ts +4 -0
  175. package/lib/types/action/Decision.d.ts +9 -0
  176. package/lib/types/action/ProductAction.d.ts +3 -0
  177. package/lib/types/action/utils.d.ts +20 -0
  178. package/lib/types/activities/HttpActivityClient.d.ts +57 -1
  179. package/lib/types/activities/HttpBatchedActivityClient.d.ts +7 -0
  180. package/lib/types/activities/IActivityClient.d.ts +4 -1
  181. package/lib/types/activities/model/AsyncActivity.d.ts +3 -0
  182. package/lib/types/activities/model/AsyncActivityDetails.d.ts +12 -0
  183. package/lib/types/activities/model/CommonActivityDetails.d.ts +3 -0
  184. package/lib/types/activities/utils.d.ts +14 -0
  185. package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +6 -0
  186. package/lib/types/blocker/BlockerBase.d.ts +21 -0
  187. package/lib/types/blocker/IBlocker.d.ts +8 -0
  188. package/lib/types/blocker/IConditionalBlocker.d.ts +4 -0
  189. package/lib/types/blocker/JsonBlockerBase.d.ts +12 -0
  190. package/lib/types/blocker/model/BlockData.d.ts +3 -0
  191. package/lib/types/blocker/utils.d.ts +13 -0
  192. package/lib/types/config/ConfigurationBase.d.ts +25 -2
  193. package/lib/types/config/IConfiguration.d.ts +7 -2
  194. package/lib/types/config/index.d.ts +0 -1
  195. package/lib/types/config/params/CoreConfigurationParams.d.ts +22 -1
  196. package/lib/types/config/params/RemoteConfigurationParams.d.ts +3 -0
  197. package/lib/types/config/params/StaticConfigurationParams.d.ts +3 -0
  198. package/lib/types/config/remote_config/RemoteConfigUtils.d.ts +2 -1
  199. package/lib/types/config/remote_config/index.d.ts +2 -2
  200. package/lib/types/config/remote_config/manager/DefaultRemoteConfigManager.d.ts +23 -0
  201. package/lib/types/config/remote_config/manager/IRemoteConfigManager.d.ts +7 -0
  202. package/lib/types/config/remote_config/manager/index.d.ts +2 -0
  203. package/lib/types/config/remote_config/model/RemoteConfigNotifyRequestPayload.d.ts +3 -0
  204. package/lib/types/config/remote_config/model/index.d.ts +1 -1
  205. package/lib/types/config/remote_config/service_client/HttpRemoteConfigServiceClient.d.ts +2 -2
  206. package/lib/types/config/remote_config/service_client/IRemoteConfigServiceClient.d.ts +2 -2
  207. package/lib/types/config/remote_config/storage_client/IRemoteConfigStorageClient.d.ts +1 -1
  208. package/lib/types/config/remote_config/update_parser/DefaultNotifyRemoteConfigUpdateParser.d.ts +22 -0
  209. package/lib/types/config/remote_config/update_parser/IRemoteConfigUpdateParser.d.ts +5 -0
  210. package/lib/types/config/remote_config/update_parser/index.d.ts +2 -0
  211. package/lib/types/context/ContextJson.d.ts +6 -2
  212. package/lib/types/context/DefaultContext.d.ts +9 -3
  213. package/lib/types/context/SerializedContext.d.ts +7 -2
  214. package/lib/types/context/interfaces/IContext.d.ts +4 -3
  215. package/lib/types/context/interfaces/RemoteConfigUpdateData.d.ts +4 -0
  216. package/lib/types/context/interfaces/index.d.ts +1 -0
  217. package/lib/types/custom_parameters/CustomParameters.d.ts +3 -0
  218. package/lib/types/enforcer/EnforcerBase.d.ts +50 -13
  219. package/lib/types/enforcer/EnforcerOptions.d.ts +3 -2
  220. package/lib/types/enforcer/IEnforcer.d.ts +1 -2
  221. package/lib/types/enforcer/IPostEnforcer.d.ts +3 -0
  222. package/lib/types/enforcer/index.d.ts +1 -0
  223. package/lib/types/enforcer/utils.d.ts +7 -1
  224. package/lib/types/first_party/IFirstParty.d.ts +1 -1
  225. package/lib/types/flow/EndEnforcerFlow.d.ts +8 -0
  226. package/lib/types/flow/EnforceFlow.d.ts +8 -0
  227. package/lib/types/flow/FilterFlow.d.ts +11 -0
  228. package/lib/types/flow/Flow.d.ts +13 -0
  229. package/lib/types/flow/IFlow.d.ts +57 -0
  230. package/lib/types/flow/PostEnforceFlow.d.ts +6 -0
  231. package/lib/types/{phase/flow → flow}/index.d.ts +2 -0
  232. package/lib/types/index.d.ts +1 -0
  233. package/lib/types/logger/ILogger.d.ts +4 -0
  234. package/lib/types/logger/LoggerBase.d.ts +1 -1
  235. package/lib/types/phase/IPhase.d.ts +9 -0
  236. package/lib/types/phase/PhaseResult.d.ts +11 -0
  237. package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -0
  238. package/lib/types/phase/impl/ClearLogsPhase.d.ts +3 -0
  239. package/lib/types/phase/impl/CompositePhase.d.ts +9 -0
  240. package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +11 -1
  241. package/lib/types/phase/impl/DecideActionPhase.d.ts +11 -0
  242. package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +9 -0
  243. package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +4 -0
  244. package/lib/types/phase/impl/FilterPhase.d.ts +4 -0
  245. package/lib/types/phase/impl/FirstPartyPhase.d.ts +5 -0
  246. package/lib/types/phase/impl/IdentifyRemoteConfigNotifyRequestPhase.d.ts +14 -0
  247. package/lib/types/phase/impl/IdentifyTelemetryRequestPhase.d.ts +5 -0
  248. package/lib/types/phase/impl/ModifyIncomingRequestPhase.d.ts +5 -0
  249. package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +5 -0
  250. package/lib/types/phase/impl/ParseTokenPhase.d.ts +3 -0
  251. package/lib/types/phase/impl/PreflightPhase.d.ts +4 -0
  252. package/lib/types/phase/impl/RiskApiPhase.d.ts +5 -0
  253. package/lib/types/phase/impl/{SendAsyncActivitiesOnResponsePhase.d.ts → SendAsyncActivitiesPhase.d.ts} +5 -2
  254. package/lib/types/phase/impl/SendLogsPhase.d.ts +3 -0
  255. package/lib/types/phase/impl/SendTelemetryActivityPhase.d.ts +3 -0
  256. package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +6 -5
  257. package/lib/types/phase/impl/index.d.ts +3 -3
  258. package/lib/types/phase/index.d.ts +0 -1
  259. package/lib/types/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +1 -1
  260. package/lib/types/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.d.ts +1 -1
  261. package/lib/types/products/interfaces/IProduct.d.ts +28 -0
  262. package/lib/types/products/interfaces/ProductDataType.d.ts +1 -1
  263. package/lib/types/risk_api/client/GetRiskApiClientV2.d.ts +15 -0
  264. package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +1 -1
  265. package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +2 -2
  266. package/lib/types/risk_api/client/{IRiskApiClient.d.ts → abstract/IRiskApiClient.d.ts} +1 -1
  267. package/lib/types/risk_api/client/abstract/PostRiskApiClientBase.d.ts +8 -0
  268. package/lib/types/risk_api/client/abstract/RiskApiClientBase.d.ts +26 -0
  269. package/lib/types/risk_api/client/abstract/index.d.ts +3 -0
  270. package/lib/types/risk_api/client/index.d.ts +2 -2
  271. package/lib/types/risk_api/index.d.ts +1 -0
  272. package/lib/types/risk_api/model/GetRiskRequestHeaders.d.ts +17 -0
  273. package/lib/types/risk_api/model/GetRiskResponseHeaders.d.ts +3 -0
  274. package/lib/types/risk_api/model/index.d.ts +2 -0
  275. package/lib/types/risk_api/risk_response/IRiskResponse.d.ts +2 -0
  276. package/lib/types/risk_api/risk_response/PostRiskResponseBase.d.ts +7 -0
  277. package/lib/types/risk_api/risk_response/RiskResponseBase.d.ts +3 -1
  278. package/lib/types/risk_api/risk_response/index.d.ts +1 -0
  279. package/lib/types/risk_api/risk_response/serialize/SerializedRiskResponse.d.ts +1 -0
  280. package/lib/types/risk_api/risk_response/v2/GetRiskResponseV2.d.ts +11 -0
  281. package/lib/types/risk_api/risk_response/v2/{DefaultRiskResponseV2.d.ts → PostRiskResponseV2.d.ts} +2 -2
  282. package/lib/types/risk_api/risk_response/v2/index.d.ts +2 -1
  283. package/lib/types/risk_api/risk_response/v3/{DefaultRiskResponseV3.d.ts → PostRiskResponseV3.d.ts} +2 -2
  284. package/lib/types/risk_api/risk_response/v3/index.d.ts +1 -1
  285. package/lib/types/risk_api/utils.d.ts +69 -0
  286. package/lib/types/telemetry/model/TelemetryActivity.d.ts +1 -1
  287. package/lib/types/utils/constants.d.ts +1 -1
  288. package/lib/types/utils/utils.d.ts +0 -5
  289. package/package.json +13 -13
  290. package/lib/cjs/config/ConfigurationBuilderBase.js +0 -135
  291. package/lib/cjs/config/remote_config/DefaultRemoteConfigUpdater.js +0 -200
  292. package/lib/esm/config/ConfigurationBuilderBase.js +0 -66
  293. package/lib/esm/config/remote_config/DefaultRemoteConfigUpdater.js +0 -99
  294. package/lib/esm/phase/flow/EndEnforcerFlow.js +0 -12
  295. package/lib/esm/phase/flow/EnforceFlow.js +0 -18
  296. package/lib/esm/phase/flow/PostEnforceFlow.js +0 -10
  297. package/lib/esm/phase/impl/SendAsyncActivitiesOnRequestPhase.js +0 -16
  298. package/lib/esm/phase/impl/SendAsyncActivitiesOnResponsePhase.js +0 -10
  299. package/lib/types/config/ConfigurationBuilderBase.d.ts +0 -13
  300. package/lib/types/config/remote_config/DefaultRemoteConfigUpdater.d.ts +0 -34
  301. package/lib/types/config/remote_config/IRemoteConfigUpdater.d.ts +0 -6
  302. package/lib/types/config/remote_config/model/RemoteConfigUpdateRequestData.d.ts +0 -3
  303. package/lib/types/phase/flow/EndEnforcerFlow.d.ts +0 -8
  304. package/lib/types/phase/flow/EnforceFlow.d.ts +0 -8
  305. package/lib/types/phase/flow/FilterFlow.d.ts +0 -11
  306. package/lib/types/phase/flow/PostEnforceFlow.d.ts +0 -6
  307. package/lib/types/phase/impl/SendAsyncActivitiesOnRequestPhase.d.ts +0 -10
  308. package/lib/types/risk_api/client/PostRiskApiClientBase.d.ts +0 -40
  309. /package/lib/cjs/config/remote_config/{IRemoteConfigUpdater.js → manager/IRemoteConfigManager.js} +0 -0
  310. /package/lib/cjs/config/remote_config/model/{RemoteConfigUpdateRequestData.js → RemoteConfigNotifyRequestPayload.js} +0 -0
  311. /package/lib/cjs/{risk_api/client/IRiskApiClient.js → config/remote_config/update_parser/IRemoteConfigUpdateParser.js} +0 -0
  312. /package/lib/esm/config/remote_config/{IRemoteConfigUpdater.js → manager/IRemoteConfigManager.js} +0 -0
  313. /package/lib/esm/config/remote_config/model/{RemoteConfigUpdateRequestData.js → RemoteConfigNotifyRequestPayload.js} +0 -0
  314. /package/lib/esm/{risk_api/client/IRiskApiClient.js → config/remote_config/update_parser/IRemoteConfigUpdateParser.js} +0 -0
@@ -54,6 +54,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.EnrichContextFromRequestPhase = void 0;
55
55
  var custom_parameters_1 = require("../../custom_parameters/index.js");
56
56
  var DecideActionPhase_1 = require("./DecideActionPhase.js");
57
+ /**
58
+ * `EnrichContextFromRequestPhase` adds data to the context from the request. This includes parsing the data enrichment cookie,
59
+ * adding GraphQL data, custom parameters, and enriching the context with any product-specific data by calling each product's
60
+ * `enrichContextFromRequest` method. (As an example, this is where the Credential Intelligence product enriches the context by
61
+ * extracting login credentials and adding them to the product data of the request.) It then updates the context's final action
62
+ * and reasons based on the enriched data.
63
+ *
64
+ * Note: This phase should come after the `ParseTokenPhase`, since the Bot Defender product uses the parsed token to determine its recommended action.
65
+ */
57
66
  var EnrichContextFromRequestPhase = /** @class */ (function (_super) {
58
67
  __extends(EnrichContextFromRequestPhase, _super);
59
68
  function EnrichContextFromRequestPhase(config, products, dataEnrichment, graphQLParser) {
@@ -131,18 +140,13 @@ var EnrichContextFromRequestPhase = /** @class */ (function (_super) {
131
140
  return __generator(this, function (_a) {
132
141
  switch (_a.label) {
133
142
  case 0: return [4 /*yield*/, Promise.all(Object.entries(this.products).map(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
134
- var _c, _d;
135
143
  var name = _b[0], product = _b[1];
136
- return __generator(this, function (_e) {
137
- switch (_e.label) {
138
- case 0:
139
- // @ts-ignore
140
- _c = context.productData;
141
- _d = name;
142
- return [4 /*yield*/, (product === null || product === void 0 ? void 0 : product.enrichContextFromRequest(context))];
144
+ return __generator(this, function (_c) {
145
+ switch (_c.label) {
146
+ case 0: return [4 /*yield*/, (product === null || product === void 0 ? void 0 : product.enrichContextFromRequest(context))];
143
147
  case 1:
144
148
  // @ts-ignore
145
- _c[_d] = _e.sent();
149
+ context.productData[name] = _c.sent();
146
150
  return [2 /*return*/];
147
151
  }
148
152
  });
@@ -38,6 +38,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.EnrichContextFromResponsePhase = void 0;
40
40
  var utils_1 = require("../../utils/index.js");
41
+ /**
42
+ * `EnrichContextFromResponsePhase` enriches the context with response data. Each product's `enrichContextFromResponse`
43
+ * method is called since every product may use the response data differently.
44
+ */
41
45
  var EnrichContextFromResponsePhase = /** @class */ (function () {
42
46
  function EnrichContextFromResponsePhase(config, products) {
43
47
  this.config = config;
@@ -37,6 +37,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.FilterPhase = void 0;
40
+ /**
41
+ * The `FilterPhase` class checks if the provided filters indicate that the incoming HTTP request should be filtered from the flow.
42
+ * If any filter returns `true` for `shouldFilter`, the phase will stop further processing and return a `done` status.
43
+ */
40
44
  var FilterPhase = /** @class */ (function () {
41
45
  function FilterPhase(filters) {
42
46
  this.filters = filters;
@@ -38,6 +38,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.FirstPartyPhase = void 0;
40
40
  var http_1 = require("../../http/index.js");
41
+ /**
42
+ * The `FirstPartyPhase` class is responsible for handling first-party requests. If a first-party request is detected,
43
+ * it will create the `FirstPartyData`, send the request to the configured endpoint using the provided HTTP client, and return
44
+ * a done status with the response. If an error occurs, it will return the default response.
45
+ */
41
46
  var FirstPartyPhase = /** @class */ (function () {
42
47
  function FirstPartyPhase(config, httpClient, firstParties) {
43
48
  this.config = config;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.IdentifyRemoteConfigNotifyRequestPhase = void 0;
40
+ var http_1 = require("../../http/index.js");
41
+ /**
42
+ * The `IdentifyRemoteConfigNotifyRequestPhase` class is responsible for identifying incoming remote config update requests.
43
+ * It checks if the request is a remote config update request and, if so, parses the request and updates the context accordingly.
44
+ * Note that the remote config is not updated during this phase; that occurs in the `UpdateRemoteConfigPhase`.
45
+ */
46
+ var IdentifyRemoteConfigNotifyRequestPhase = /** @class */ (function () {
47
+ function IdentifyRemoteConfigNotifyRequestPhase(remoteConfigUpdateParser) {
48
+ this.remoteConfigUpdateParser = remoteConfigUpdateParser;
49
+ }
50
+ IdentifyRemoteConfigNotifyRequestPhase.prototype.execute = function (context) {
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var _a, shouldUpdate, desiredVersion;
53
+ return __generator(this, function (_b) {
54
+ switch (_b.label) {
55
+ case 0: return [4 /*yield*/, this.remoteConfigUpdateParser.isUpdateRequest(context)];
56
+ case 1:
57
+ if (!(_b.sent())) {
58
+ return [2 /*return*/, { done: false }];
59
+ }
60
+ context.shouldSendLogs = true;
61
+ return [4 /*yield*/, this.remoteConfigUpdateParser.parseUpdate(context)];
62
+ case 2:
63
+ _a = _b.sent(), shouldUpdate = _a.shouldUpdate, desiredVersion = _a.desiredVersion;
64
+ context.remoteConfigUpdateData.shouldUpdate = shouldUpdate;
65
+ context.remoteConfigUpdateData.desiredVersion = desiredVersion;
66
+ return [2 /*return*/, {
67
+ done: true,
68
+ response: new http_1.MinimalResponseImpl({
69
+ status: shouldUpdate ? 200 : 400,
70
+ body: shouldUpdate ? 'OK' : 'Bad Request',
71
+ headers: {},
72
+ }),
73
+ }];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ return IdentifyRemoteConfigNotifyRequestPhase;
79
+ }());
80
+ exports.IdentifyRemoteConfigNotifyRequestPhase = IdentifyRemoteConfigNotifyRequestPhase;
@@ -37,6 +37,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.IdentifyTelemetryRequestPhase = void 0;
40
+ /**
41
+ * The `IdentifyTelemetryRequestPhase` class is responsible for identifying incoming telemetry requests.
42
+ * It checks if the request is a telemetry request and, if so, parses the request and updates the context accordingly.
43
+ * Note that the telemetry activity is not sent during this phase; that occurs in the `SendTelemetryActivityPhase`.
44
+ */
40
45
  var IdentifyTelemetryRequestPhase = /** @class */ (function () {
41
46
  function IdentifyTelemetryRequestPhase(telemetry) {
42
47
  this.telemetry = telemetry;
@@ -37,6 +37,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.ModifyIncomingRequestPhase = void 0;
40
+ /**
41
+ * The `ModifyIncomingRequestPhase` class is responsible for modifying the incoming HTTP request prior to forwarding the
42
+ * request to the origin server or cache. This phase invokes each product's `modifyIncomingRequest` method. (As an example,
43
+ * this is where the Credential Intelligence product adds the compromised credentials header to the request if needed.)
44
+ */
40
45
  var ModifyIncomingRequestPhase = /** @class */ (function () {
41
46
  function ModifyIncomingRequestPhase(products) {
42
47
  this.products = products;
@@ -39,6 +39,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.ModifyOutgoingResponsePhase = void 0;
40
40
  var pxhd_1 = require("../../pxhd/index.js");
41
41
  var http_1 = require("../../http/index.js");
42
+ /**
43
+ * The `ModifyOutgoingResponsePhase` class is responsible for modifying the outgoing HTTP response prior to returning it
44
+ * to the end user. This phase invokes each product's `modifyOutgoingResponse` method, as well as adding the PXHD cookie.
45
+ * If snippet injection is supported and enabled, it also occurs in this phase.
46
+ */
42
47
  var ModifyOutgoingResponsePhase = /** @class */ (function () {
43
48
  function ModifyOutgoingResponsePhase(config, products, snippetRetriever, snippetInjector) {
44
49
  this.config = config;
@@ -39,6 +39,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.ParseTokenPhase = void 0;
40
40
  var risk_token_1 = require("../../risk_token/index.js");
41
41
  var utils_1 = require("../../utils/index.js");
42
+ /**
43
+ * The `ParseTokenPhase` class is responsible for parsing the risk token from the incoming request and updating the context.
44
+ */
42
45
  var ParseTokenPhase = /** @class */ (function () {
43
46
  function ParseTokenPhase(tokenParser) {
44
47
  this.tokenParser = tokenParser;
@@ -59,14 +62,18 @@ var ParseTokenPhase = /** @class */ (function () {
59
62
  };
60
63
  ParseTokenPhase.prototype.addTokenDataToContext = function (context, tokenData) {
61
64
  Object.assign(context.tokenData, tokenData);
62
- if (tokenData.tokenParseResult === risk_token_1.TokenParseResult.SUCCESSFUL) {
63
- (0, utils_1.transferExistingProperties)(tokenData.token, context, {
64
- vid: 'vid',
65
- uuid: 'uuid',
66
- score: 'score',
67
- action: 'blockAction',
68
- });
65
+ if (tokenData.tokenParseResult === risk_token_1.TokenParseResult.SUCCESSFUL && tokenData.token) {
66
+ if (tokenData.token.score != null) {
67
+ context.score = tokenData.token.score;
68
+ }
69
+ if (tokenData.token.action) {
70
+ context.blockAction = tokenData.token.action;
71
+ }
72
+ if (tokenData.token.uuid) {
73
+ context.uuid = tokenData.token.uuid;
74
+ }
69
75
  if (tokenData.token.vid) {
76
+ context.vid = tokenData.token.vid;
70
77
  context.vidSource = utils_1.VidSource.RISK_COOKIE;
71
78
  }
72
79
  }
@@ -37,6 +37,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.PreflightPhase = void 0;
40
+ /**
41
+ * The `PreflightPhase` class is responsible for handling preflight requests in CORS (Cross-Origin Resource Sharing).
42
+ * This includes filtering preflight requests or invoking the preflight custom handler if configured.
43
+ */
40
44
  var PreflightPhase = /** @class */ (function () {
41
45
  function PreflightPhase(config, cors) {
42
46
  this.corsSupportEnabled = config.corsSupportEnabled;
@@ -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,34 +37,30 @@ 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
- function UpdateRemoteConfigPhase(config, remoteConfigUpdater) {
44
+ function UpdateRemoteConfigPhase(config, remoteConfigManager) {
42
45
  this.config = config;
43
- this.remoteConfigUpdater = remoteConfigUpdater;
46
+ this.remoteConfigManager = remoteConfigManager;
44
47
  }
45
48
  UpdateRemoteConfigPhase.prototype.execute = function (context) {
46
49
  return __awaiter(this, void 0, void 0, function () {
47
- var isSuccessful;
48
50
  return __generator(this, function (_a) {
49
51
  switch (_a.label) {
50
52
  case 0:
51
- if (!this.remoteConfigUpdater.isUpdateRemoteConfigRequest(context)) return [3 /*break*/, 2];
52
- return [4 /*yield*/, this.remoteConfigUpdater.updateRemoteConfig(context)];
53
+ if (!this.remoteConfigManager.shouldUpdateRemoteConfig(context)) return [3 /*break*/, 2];
54
+ context.shouldSendLogs = true;
55
+ return [4 /*yield*/, this.remoteConfigManager.updateRemoteConfig(context)];
53
56
  case 1:
54
- isSuccessful = _a.sent();
55
- return [2 /*return*/, { done: true, response: this.getUpdateConfigResponse(isSuccessful) }];
57
+ _a.sent();
58
+ _a.label = 2;
56
59
  case 2: return [2 /*return*/, { done: false }];
57
60
  }
58
61
  });
59
62
  });
60
63
  };
61
- UpdateRemoteConfigPhase.prototype.getUpdateConfigResponse = function (isSuccessful) {
62
- return {
63
- status: isSuccessful ? 200 : 400,
64
- body: isSuccessful ? 'OK' : 'Bad Request',
65
- headers: {},
66
- };
67
- };
68
64
  return UpdateRemoteConfigPhase;
69
65
  }());
70
66
  exports.UpdateRemoteConfigPhase = UpdateRemoteConfigPhase;
@@ -25,12 +25,12 @@ __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);
33
- __exportStar(require("./UpdateRemoteConfigPhase.js"), exports);
34
32
  __exportStar(require("./ClearLogsPhase.js"), exports);
33
+ __exportStar(require("./IdentifyRemoteConfigNotifyRequestPhase.js"), exports);
34
+ __exportStar(require("./UpdateRemoteConfigPhase.js"), exports);
35
35
  __exportStar(require("./IdentifyTelemetryRequestPhase.js"), exports);
36
36
  __exportStar(require("./SendTelemetryActivityPhase.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 });