perimeterx-js-core 0.22.1 → 0.23.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 (297) hide show
  1. package/lib/cjs/action/utils.js +9 -2
  2. package/lib/cjs/activities/HttpActivityClient.js +1 -1
  3. package/lib/cjs/activities/utils.js +17 -14
  4. package/lib/cjs/blocker/BlockerBase.js +2 -2
  5. package/lib/cjs/config/ConfigurationBase.js +117 -100
  6. package/lib/cjs/config/defaults/DefaultConfigurationParams.js +5 -4
  7. package/lib/cjs/config/params/index.js +4 -7
  8. package/lib/cjs/config/remote_config/DefaultRemoteConfigUpdater.js +7 -2
  9. package/lib/cjs/config/remote_config/RemoteConfigUtils.js +1 -1
  10. package/lib/cjs/config/remote_config/service_client/HttpRemoteConfigServiceClient.js +3 -3
  11. package/lib/cjs/context/DefaultContext.js +9 -4
  12. package/lib/cjs/context/SerializedContext.js +1 -1
  13. package/lib/cjs/cors/DefaultCors.js +6 -2
  14. package/lib/cjs/enforcer/EnforcerBase.js +0 -1
  15. package/lib/cjs/enforcer/utils.js +5 -4
  16. package/lib/cjs/graphql/DefaultGraphQLParser.js +22 -17
  17. package/lib/cjs/http/utils/FormDataImpl.js +1 -1
  18. package/lib/cjs/impl/base64/BufferBase64Utils.js +2 -1
  19. package/lib/cjs/impl/hash/CryptoJSHashUtils.js +1 -1
  20. package/lib/cjs/impl/http/phin/PhinHttpClient.js +3 -3
  21. package/lib/cjs/impl/http/phin/PhinIncomingResponse.js +22 -6
  22. package/lib/cjs/impl/url/CustomImplUrlUtils.js +2 -2
  23. package/lib/cjs/impl/url/UrlImpl.js +4 -1
  24. package/lib/cjs/impl/url/UrlSearchParamsImpl.js +6 -5
  25. package/lib/cjs/phase/flow/EndEnforcerFlow.js +7 -1
  26. package/lib/cjs/phase/flow/EnforceFlow.js +1 -1
  27. package/lib/cjs/phase/flow/FilterFlow.js +18 -6
  28. package/lib/cjs/phase/impl/ClearLogsPhase.js +53 -0
  29. package/lib/cjs/phase/impl/CompositePhase.js +1 -1
  30. package/lib/cjs/phase/impl/CreateBlockResponsePhase.js +9 -7
  31. package/lib/cjs/phase/impl/EnrichContextFromRequestPhase.js +20 -22
  32. package/lib/cjs/phase/impl/EnrichContextFromResponsePhase.js +18 -21
  33. package/lib/cjs/phase/impl/FirstPartyPhase.js +9 -9
  34. package/lib/cjs/phase/impl/ModifyOutgoingResponsePhase.js +2 -2
  35. package/lib/cjs/phase/impl/RiskApiPhase.js +18 -19
  36. package/lib/cjs/phase/impl/SendLogsPhase.js +7 -11
  37. package/lib/cjs/phase/impl/index.js +1 -0
  38. package/lib/cjs/products/account_defender/AccountDefender.js +18 -10
  39. package/lib/cjs/products/bot_defender/BotDefender.js +10 -11
  40. package/lib/cjs/products/bot_defender/block/DefaultBotDefenderBlocker.js +1 -1
  41. package/lib/cjs/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +3 -2
  42. package/lib/cjs/products/bot_defender/first_party/IDefaultBotDefenderFirstPartyConfiguration.js +1 -0
  43. package/lib/cjs/products/credential_intelligence/CredentialIntelligence.js +13 -11
  44. package/lib/cjs/products/credential_intelligence/endpoint/CredentialEndpoint.js +3 -3
  45. package/lib/cjs/products/credential_intelligence/endpoint/CredentialEndpointManager.js +12 -14
  46. package/lib/cjs/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +5 -4
  47. package/lib/cjs/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.js +15 -3
  48. package/lib/cjs/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.js +3 -2
  49. package/lib/cjs/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.js +4 -3
  50. package/lib/cjs/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.js +10 -10
  51. package/lib/cjs/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.js +14 -14
  52. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +3 -4
  53. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.js +7 -6
  54. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.js +7 -1
  55. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +6 -2
  56. package/lib/cjs/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.js +3 -0
  57. package/lib/cjs/products/hype_sale_challenge/HypeSaleChallenge.js +11 -10
  58. package/lib/cjs/pxde/DefaultDataEnrichment.js +7 -4
  59. package/lib/cjs/pxhd/PXHDUtils.js +2 -1
  60. package/lib/cjs/risk_api/client/PostRiskApiClientBase.js +19 -15
  61. package/lib/cjs/risk_api/risk_response/v2/DefaultRiskResponseV2.js +4 -3
  62. package/lib/cjs/risk_token/index.js +2 -3
  63. package/lib/cjs/risk_token/parser/TokenParserBase.js +13 -10
  64. package/lib/cjs/risk_token/token/TokenBase.js +27 -0
  65. package/lib/cjs/risk_token/token/serialize/SerializedToken.js +5 -2
  66. package/lib/cjs/risk_token/token/v2/DefaultTokenV2.js +23 -43
  67. package/lib/cjs/risk_token/token/v3/DefaultTokenV3.js +23 -38
  68. package/lib/cjs/utils/constants.js +1 -1
  69. package/lib/cjs/utils/cookie_parser/StringSplitCookieParser.js +6 -2
  70. package/lib/cjs/utils/error/EnforcerConfigurationError.js +35 -0
  71. package/lib/cjs/utils/error/EnforcerErrorName.js +1 -0
  72. package/lib/cjs/utils/error/index.js +18 -7
  73. package/lib/cjs/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.js +5 -3
  74. package/lib/cjs/utils/utils.js +20 -14
  75. package/lib/esm/action/utils.js +8 -2
  76. package/lib/esm/activities/HttpActivityClient.js +1 -1
  77. package/lib/esm/activities/utils.js +15 -12
  78. package/lib/esm/blocker/BlockerBase.js +2 -2
  79. package/lib/esm/config/ConfigurationBase.js +117 -101
  80. package/lib/esm/config/defaults/DefaultConfigurationParams.js +3 -3
  81. package/lib/esm/config/params/index.js +4 -7
  82. package/lib/esm/config/remote_config/DefaultRemoteConfigUpdater.js +6 -2
  83. package/lib/esm/config/remote_config/RemoteConfigUtils.js +2 -2
  84. package/lib/esm/config/remote_config/service_client/HttpRemoteConfigServiceClient.js +3 -3
  85. package/lib/esm/context/DefaultContext.js +9 -5
  86. package/lib/esm/context/SerializedContext.js +1 -1
  87. package/lib/esm/cors/DefaultCors.js +6 -2
  88. package/lib/esm/enforcer/EnforcerBase.js +0 -1
  89. package/lib/esm/enforcer/utils.js +5 -5
  90. package/lib/esm/graphql/DefaultGraphQLParser.js +8 -8
  91. package/lib/esm/http/utils/FormDataImpl.js +1 -1
  92. package/lib/esm/impl/hash/CryptoJSHashUtils.js +2 -2
  93. package/lib/esm/impl/http/phin/PhinHttpClient.js +3 -3
  94. package/lib/esm/impl/http/phin/PhinIncomingResponse.js +14 -3
  95. package/lib/esm/impl/url/CustomImplUrlUtils.js +2 -2
  96. package/lib/esm/impl/url/UrlImpl.js +4 -1
  97. package/lib/esm/impl/url/UrlSearchParamsImpl.js +6 -4
  98. package/lib/esm/phase/flow/EndEnforcerFlow.js +7 -1
  99. package/lib/esm/phase/flow/EnforceFlow.js +1 -1
  100. package/lib/esm/phase/flow/FilterFlow.js +19 -7
  101. package/lib/esm/phase/flow/PostEnforceFlow.js +1 -1
  102. package/lib/esm/phase/impl/ClearLogsPhase.js +6 -0
  103. package/lib/esm/phase/impl/CompositePhase.js +1 -1
  104. package/lib/esm/phase/impl/CreateBlockResponsePhase.js +4 -2
  105. package/lib/esm/phase/impl/EnrichContextFromResponsePhase.js +6 -4
  106. package/lib/esm/phase/impl/ModifyOutgoingResponsePhase.js +1 -1
  107. package/lib/esm/phase/impl/RiskApiPhase.js +5 -4
  108. package/lib/esm/phase/impl/SendLogsPhase.js +2 -5
  109. package/lib/esm/phase/impl/index.js +1 -0
  110. package/lib/esm/products/account_defender/AccountDefender.js +17 -9
  111. package/lib/esm/products/bot_defender/BotDefender.js +7 -7
  112. package/lib/esm/products/bot_defender/block/DefaultBotDefenderBlocker.js +1 -1
  113. package/lib/esm/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +2 -2
  114. package/lib/esm/products/bot_defender/first_party/IDefaultBotDefenderFirstPartyConfiguration.js +1 -0
  115. package/lib/esm/products/credential_intelligence/CredentialIntelligence.js +8 -6
  116. package/lib/esm/products/credential_intelligence/endpoint/CredentialEndpoint.js +3 -3
  117. package/lib/esm/products/credential_intelligence/endpoint/CredentialEndpointManager.js +9 -5
  118. package/lib/esm/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +4 -4
  119. package/lib/esm/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.js +15 -3
  120. package/lib/esm/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.js +2 -2
  121. package/lib/esm/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.js +2 -2
  122. package/lib/esm/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.js +2 -2
  123. package/lib/esm/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.js +5 -2
  124. package/lib/esm/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +1 -1
  125. package/lib/esm/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.js +1 -1
  126. package/lib/esm/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.js +7 -1
  127. package/lib/esm/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +7 -3
  128. package/lib/esm/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.js +3 -0
  129. package/lib/esm/products/hype_sale_challenge/HypeSaleChallenge.js +10 -10
  130. package/lib/esm/pxde/DefaultDataEnrichment.js +5 -2
  131. package/lib/esm/pxhd/PXHDUtils.js +1 -1
  132. package/lib/esm/risk_api/client/PostRiskApiClientBase.js +7 -5
  133. package/lib/esm/risk_api/risk_response/v2/DefaultRiskResponseV2.js +3 -2
  134. package/lib/esm/risk_token/index.js +1 -1
  135. package/lib/esm/risk_token/parser/TokenParserBase.js +4 -2
  136. package/lib/esm/risk_token/token/TokenBase.js +12 -0
  137. package/lib/esm/risk_token/token/serialize/SerializedToken.js +5 -2
  138. package/lib/esm/risk_token/token/v2/DefaultTokenV2.js +12 -17
  139. package/lib/esm/risk_token/token/v3/DefaultTokenV3.js +21 -20
  140. package/lib/esm/utils/constants.js +1 -1
  141. package/lib/esm/utils/cookie_parser/StringSplitCookieParser.js +6 -2
  142. package/lib/esm/utils/error/EnforcerConfigurationError.js +12 -0
  143. package/lib/esm/utils/error/EnforcerErrorName.js +1 -0
  144. package/lib/esm/utils/error/index.js +4 -3
  145. package/lib/esm/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.js +4 -2
  146. package/lib/esm/utils/utils.js +15 -15
  147. package/lib/types/action/Decision.d.ts +2 -2
  148. package/lib/types/activities/HttpActivityClient.d.ts +3 -3
  149. package/lib/types/activities/HttpBatchedActivityClient.d.ts +2 -2
  150. package/lib/types/activities/model/AsyncActivityDetails.d.ts +1 -1
  151. package/lib/types/activities/utils.d.ts +13 -6775
  152. package/lib/types/additional_activity_handler/AdditionalActivityHandler.d.ts +2 -2
  153. package/lib/types/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +1 -1
  154. package/lib/types/blocker/BlockerBase.d.ts +1 -1
  155. package/lib/types/blocker/MobileBlocker.d.ts +3 -3
  156. package/lib/types/blocker/model/BlockData.d.ts +1 -1
  157. package/lib/types/blocker/utils.d.ts +1 -672
  158. package/lib/types/config/ConfigurationBase.d.ts +34 -33
  159. package/lib/types/config/ConfigurationBuilderBase.d.ts +6 -6
  160. package/lib/types/config/IConfiguration.d.ts +22 -22
  161. package/lib/types/config/defaults/DefaultConfigurationParams.d.ts +2 -2
  162. package/lib/types/config/params/ActiveConfigurationParams.d.ts +2 -0
  163. package/lib/types/config/params/AllConfigurationParams.d.ts +4 -0
  164. package/lib/types/config/params/{CommonConfigurationParams.d.ts → CoreConfigurationParams.d.ts} +45 -18
  165. package/lib/types/config/params/RemoteConfigurationParams.d.ts +2 -3
  166. package/lib/types/config/params/StaticConfigurationParams.d.ts +3 -3
  167. package/lib/types/config/params/index.d.ts +4 -7
  168. package/lib/types/config/remote_config/DefaultRemoteConfigUpdater.d.ts +14 -15
  169. package/lib/types/config/remote_config/RemoteConfigUtils.d.ts +2 -2
  170. package/lib/types/config/remote_config/model/RemoteConfigData.d.ts +2 -2
  171. package/lib/types/config/remote_config/service_client/HttpRemoteConfigServiceClient.d.ts +6 -6
  172. package/lib/types/config/remote_config/service_client/IRemoteConfigServiceClient.d.ts +2 -2
  173. package/lib/types/config/remote_config/storage_client/IRemoteConfigStorageClient.d.ts +3 -3
  174. package/lib/types/context/ContextJson.d.ts +3 -3
  175. package/lib/types/context/DefaultContext.d.ts +11 -11
  176. package/lib/types/context/SerializedContext.d.ts +8 -8
  177. package/lib/types/context/interfaces/IContext.d.ts +6 -6
  178. package/lib/types/context/interfaces/MobileData.d.ts +1 -1
  179. package/lib/types/context/interfaces/TokenData.d.ts +1 -1
  180. package/lib/types/cors/DefaultCors.d.ts +3 -3
  181. package/lib/types/cors/ICors.d.ts +3 -3
  182. package/lib/types/custom_parameters/CustomParametersFunction.d.ts +2 -2
  183. package/lib/types/custom_parameters/CustomParametersUtils.d.ts +2 -2
  184. package/lib/types/enforcer/EnforcerBase.d.ts +7 -8
  185. package/lib/types/enforcer/EnforcerOptions.d.ts +6 -6
  186. package/lib/types/enforcer/utils.d.ts +2 -2
  187. package/lib/types/graphql/DefaultGraphQLParser.d.ts +13 -12
  188. package/lib/types/graphql/ExtractGraphQLKeywordsFunction.d.ts +1 -1
  189. package/lib/types/graphql/IGraphQLParser.d.ts +1 -1
  190. package/lib/types/http/interfaces/IFormData.d.ts +1 -1
  191. package/lib/types/http/utils/FormDataImpl.d.ts +2 -2
  192. package/lib/types/http/utils/MultipartFormDataUtils.d.ts +2 -2
  193. package/lib/types/impl/cipher/CryptoCipherUtils.d.ts +0 -1
  194. package/lib/types/impl/hash/CryptoHashUtils.d.ts +0 -1
  195. package/lib/types/impl/hmac/CryptoHmacUtils.d.ts +0 -1
  196. package/lib/types/impl/http/phin/PhinIncomingResponse.d.ts +0 -1
  197. package/lib/types/impl/url/CustomImplUrlUtils.d.ts +2 -2
  198. package/lib/types/impl/url/UrlImpl.d.ts +3 -3
  199. package/lib/types/impl/url/UrlSearchParamsImpl.d.ts +1 -1
  200. package/lib/types/logger/DefaultLogger.d.ts +1 -1
  201. package/lib/types/logger/HttpLogServiceClient.d.ts +3 -3
  202. package/lib/types/logger/ILogger.d.ts +2 -2
  203. package/lib/types/logger/LoggerBase.d.ts +4 -4
  204. package/lib/types/monitored_request/MonitoredRequestUtils.d.ts +3 -2016
  205. package/lib/types/phase/flow/EndEnforcerFlow.d.ts +2 -2
  206. package/lib/types/phase/flow/EnforceFlow.d.ts +2 -2
  207. package/lib/types/phase/flow/FilterFlow.d.ts +7 -2
  208. package/lib/types/phase/flow/PostEnforceFlow.d.ts +2 -2
  209. package/lib/types/phase/impl/AdditionalActivityHandlerPhase.d.ts +3 -3
  210. package/lib/types/phase/impl/ClearLogsPhase.d.ts +6 -0
  211. package/lib/types/phase/impl/CreateBlockResponsePhase.d.ts +4 -4
  212. package/lib/types/phase/impl/EnrichContextFromRequestPhase.d.ts +3 -3
  213. package/lib/types/phase/impl/EnrichContextFromResponsePhase.d.ts +3 -3
  214. package/lib/types/phase/impl/FirstPartyPhase.d.ts +3 -3
  215. package/lib/types/phase/impl/ModifyOutgoingResponsePhase.d.ts +3 -3
  216. package/lib/types/phase/impl/PreflightPhase.d.ts +2 -2
  217. package/lib/types/phase/impl/RiskApiPhase.d.ts +1 -2
  218. package/lib/types/phase/impl/SendLogsPhase.d.ts +2 -3
  219. package/lib/types/phase/impl/UpdateRemoteConfigPhase.d.ts +3 -3
  220. package/lib/types/phase/impl/index.d.ts +1 -0
  221. package/lib/types/products/account_defender/AccountDefender.d.ts +7 -7
  222. package/lib/types/products/bot_defender/BotDefender.d.ts +12 -11
  223. package/lib/types/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +4 -4
  224. package/lib/types/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +12 -12
  225. package/lib/types/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +5 -5
  226. package/lib/types/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +5 -5
  227. package/lib/types/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +4 -4
  228. package/lib/types/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +2 -2
  229. package/lib/types/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +3 -3
  230. package/lib/types/products/bot_defender/first_party/utils.d.ts +7 -7
  231. package/lib/types/products/credential_intelligence/CredentialIntelligence.d.ts +9 -9
  232. package/lib/types/products/credential_intelligence/endpoint/CredentialEndpoint.d.ts +4 -4
  233. package/lib/types/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +4 -4
  234. package/lib/types/products/credential_intelligence/endpoint/CredentialEndpointManager.d.ts +2 -4
  235. package/lib/types/products/credential_intelligence/endpoint/ICredentialEndpoint.d.ts +3 -2
  236. package/lib/types/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.d.ts +2 -2
  237. package/lib/types/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.d.ts +3 -3
  238. package/lib/types/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.d.ts +1 -1
  239. package/lib/types/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +1 -1
  240. package/lib/types/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.d.ts +1 -1
  241. package/lib/types/products/credential_intelligence/model/CredentialIntelligenceData.d.ts +1 -1
  242. package/lib/types/products/hype_sale_challenge/HypeSaleChallenge.d.ts +8 -8
  243. package/lib/types/products/hype_sale_challenge/block/JsonHypeSaleChallengeBlocker.d.ts +3 -3
  244. package/lib/types/products/hype_sale_challenge/block/MobileHypeSaleChallengeBlocker.d.ts +2 -2
  245. package/lib/types/products/interfaces/IProduct.d.ts +3 -3
  246. package/lib/types/products/interfaces/ProductType.d.ts +2 -1
  247. package/lib/types/pxde/DefaultDataEnrichment.d.ts +2 -2
  248. package/lib/types/pxde/model/PxdeData.d.ts +1 -1
  249. package/lib/types/pxhd/PXHDUtils.d.ts +2 -1344
  250. package/lib/types/risk_api/client/PostRiskApiClientBase.d.ts +4 -3
  251. package/lib/types/risk_api/client/PostRiskApiClientV2.d.ts +2 -2
  252. package/lib/types/risk_api/client/PostRiskApiClientV3.d.ts +2 -2
  253. package/lib/types/risk_api/risk_response/IRiskResponse.d.ts +4 -4
  254. package/lib/types/risk_api/risk_response/RiskResponseBase.d.ts +13 -13
  255. package/lib/types/risk_api/risk_response/serialize/RiskResponseJson.d.ts +4 -4
  256. package/lib/types/risk_api/risk_response/serialize/SerializedRiskResponse.d.ts +10 -10
  257. package/lib/types/risk_api/risk_response/v2/DefaultRiskResponseV2.d.ts +1 -1
  258. package/lib/types/risk_api/risk_response/v3/DefaultRiskResponseV3.d.ts +1 -1
  259. package/lib/types/risk_token/index.d.ts +1 -1
  260. package/lib/types/risk_token/parser/DefaultTokenV2Parser.d.ts +3 -3
  261. package/lib/types/risk_token/parser/DefaultTokenV3Parser.d.ts +3 -3
  262. package/lib/types/risk_token/parser/TokenParserBase.d.ts +5 -5
  263. package/lib/types/risk_token/token/IToken.d.ts +7 -7
  264. package/lib/types/risk_token/token/TokenBase.d.ts +12 -12
  265. package/lib/types/risk_token/token/serialize/SerializedToken.d.ts +10 -10
  266. package/lib/types/risk_token/token/serialize/TokenJson.d.ts +5 -5
  267. package/lib/types/risk_token/token/v2/DefaultTokenV2.d.ts +7 -11
  268. package/lib/types/risk_token/token/v3/DefaultTokenV3.d.ts +9 -13
  269. package/lib/types/sensitive_request/SensitiveRequestUtils.d.ts +3 -1345
  270. package/lib/types/telemetry/DefaultTelemetry.d.ts +4 -4
  271. package/lib/types/telemetry/model/TelemetryActivity.d.ts +9 -9
  272. package/lib/types/utils/WaitsUntil.d.ts +1 -1
  273. package/lib/types/utils/constants.d.ts +1 -1
  274. package/lib/types/utils/error/EnforcerConfigurationError.d.ts +4 -0
  275. package/lib/types/utils/error/EnforcerErrorName.d.ts +2 -1
  276. package/lib/types/utils/error/index.d.ts +4 -3
  277. package/lib/types/utils/timestamp_hmac_header_validator/DefaultTimestampHmacHeaderValidator.d.ts +3 -3
  278. package/lib/types/utils/url/IUrlSearchParams.d.ts +1 -1
  279. package/lib/types/utils/utils.d.ts +12 -9
  280. package/package.json +1 -1
  281. package/lib/cjs/config/params/RemoteConfigurationParamsOnly.js +0 -2
  282. package/lib/cjs/config/params/StaticConfigurationParamsOnly.js +0 -2
  283. package/lib/cjs/config/params/TokenV3ConfigurationParamsOnly.js +0 -2
  284. package/lib/esm/config/params/RemoteConfigurationParamsOnly.js +0 -1
  285. package/lib/esm/config/params/StaticConfigurationParamsOnly.js +0 -1
  286. package/lib/esm/config/params/TokenV3ConfigurationParamsOnly.js +0 -1
  287. package/lib/types/config/params/BatchedActivitiesConfigParams.d.ts +0 -4
  288. package/lib/types/config/params/ConfigurationParams.d.ts +0 -4
  289. package/lib/types/config/params/RemoteConfigurationParamsOnly.d.ts +0 -10
  290. package/lib/types/config/params/StaticConfigurationParamsOnly.d.ts +0 -7
  291. package/lib/types/config/params/TokenV3ConfigurationParamsOnly.d.ts +0 -7
  292. /package/lib/cjs/config/params/{BatchedActivitiesConfigParams.js → ActiveConfigurationParams.js} +0 -0
  293. /package/lib/cjs/config/params/{CommonConfigurationParams.js → AllConfigurationParams.js} +0 -0
  294. /package/lib/cjs/config/params/{ConfigurationParams.js → CoreConfigurationParams.js} +0 -0
  295. /package/lib/esm/config/params/{BatchedActivitiesConfigParams.js → ActiveConfigurationParams.js} +0 -0
  296. /package/lib/esm/config/params/{CommonConfigurationParams.js → AllConfigurationParams.js} +0 -0
  297. /package/lib/esm/config/params/{ConfigurationParams.js → CoreConfigurationParams.js} +0 -0
@@ -45,9 +45,16 @@ var createDecision = function (tally) {
45
45
  return { action: action, reasons: tally[action] };
46
46
  }
47
47
  }
48
- return { action: Action_1.Action.PASS_REQUEST };
48
+ return { action: Action_1.Action.PASS_REQUEST, reasons: {} };
49
49
  };
50
50
  var getReasonForHighestPriorityProduct = function (reasons) {
51
- return reasons[products_1.PRODUCT_PRIORITY_ORDER.find(function (product) { return !!reasons[product]; })];
51
+ for (var _i = 0, PRODUCT_PRIORITY_ORDER_1 = products_1.PRODUCT_PRIORITY_ORDER; _i < PRODUCT_PRIORITY_ORDER_1.length; _i++) {
52
+ var productName = PRODUCT_PRIORITY_ORDER_1[_i];
53
+ var reason = reasons[productName];
54
+ if (reason) {
55
+ return reason;
56
+ }
57
+ }
58
+ return 'unknown_reason';
52
59
  };
53
60
  exports.getReasonForHighestPriorityProduct = getReasonForHighestPriorityProduct;
@@ -88,7 +88,7 @@ var HttpActivityClient = /** @class */ (function () {
88
88
  };
89
89
  HttpActivityClient.prototype.shouldCreateAdditionalS2SActivity = function (context) {
90
90
  return (this.shouldCreatePageRequestedActivity(context) &&
91
- context.productData.ci &&
91
+ !!context.productData.ci &&
92
92
  this.config.ciAutomaticAdditionalS2SEnabled);
93
93
  };
94
94
  HttpActivityClient.prototype.createBlockActivity = function (context) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toHeaderEntryArray = exports.createAdditionalS2SActivityDetails = exports.createBlockActivityDetails = exports.createPageRequestedActivityDetails = exports.addResponseDataToAsyncActivityCommonDetails = exports.addRiskApiDataToAsyncActivityCommonDetails = exports.addTokenDataToDetails = exports.addRequestDataToDetails = exports.addServerDataToDetails = exports.addTlsDataToDetails = exports.addProductDataToDetails = exports.addCustomParametersToDetails = exports.addConfigDataToDetails = exports.redactCookieSecret = exports.addRootContextDataToDetails = exports.createCommonActivityDetails = exports.createAsyncActivityCommonDetails = exports.createActivityDetails = exports.createAsyncActivity = void 0;
3
+ exports.toHeaderEntryArray = exports.createAdditionalS2SActivityDetails = exports.createBlockActivityDetails = exports.createPageRequestedActivityDetails = exports.addResponseDataToAsyncActivityCommonDetails = exports.addRiskApiDataToAsyncActivityCommonDetails = exports.addTokenDataToDetails = exports.addRequestDataToDetails = exports.addServerDataToDetails = exports.addTlsDataToDetails = exports.addProductDataToDetails = exports.addCustomParametersToDetails = exports.addConfigDataToDetails = exports.addRootContextDataToDetails = exports.createCommonActivityDetails = exports.createAsyncActivityCommonDetails = exports.createActivityDetails = exports.createAsyncActivity = void 0;
4
+ exports.redactCookieSecret = redactCookieSecret;
4
5
  var utils_1 = require("../utils");
5
6
  var products_1 = require("../products");
6
7
  var action_1 = require("../action");
@@ -51,7 +52,7 @@ var createAsyncActivityCommonDetails = function (context) {
51
52
  };
52
53
  exports.createAsyncActivityCommonDetails = createAsyncActivityCommonDetails;
53
54
  var createCommonActivityDetails = function (config, context) {
54
- var _a;
55
+ var _a, _b;
55
56
  var details = {
56
57
  module_version: config.moduleVersion,
57
58
  // Note: risk_mode currently reflects only Bot Defender mode
@@ -64,7 +65,7 @@ var createCommonActivityDetails = function (config, context) {
64
65
  (0, exports.addProductDataToDetails)(details, context.productData);
65
66
  (0, exports.addServerDataToDetails)(details, context.serverData);
66
67
  (0, exports.addTlsDataToDetails)(details, context.tlsData);
67
- (0, exports.addCustomParametersToDetails)(details, context.customParameters);
68
+ (0, exports.addCustomParametersToDetails)(details, (_b = context.customParameters) !== null && _b !== void 0 ? _b : null);
68
69
  return details;
69
70
  };
70
71
  exports.createCommonActivityDetails = createCommonActivityDetails;
@@ -84,7 +85,6 @@ exports.addRootContextDataToDetails = addRootContextDataToDetails;
84
85
  function redactCookieSecret(secret) {
85
86
  return '***'.concat(secret.substring(secret.length - 3, secret.length));
86
87
  }
87
- exports.redactCookieSecret = redactCookieSecret;
88
88
  var addConfigDataToDetails = function (details, config) {
89
89
  if (config.remoteConfigVersion) {
90
90
  details.remote_config_version = config.remoteConfigVersion;
@@ -193,8 +193,9 @@ var addResponseDataToAsyncActivityCommonDetails = function (details, context) {
193
193
  };
194
194
  exports.addResponseDataToAsyncActivityCommonDetails = addResponseDataToAsyncActivityCommonDetails;
195
195
  var createPageRequestedActivityDetails = function (context) {
196
- var details = {};
197
- details.pass_reason = (0, action_1.getReasonForHighestPriorityProduct)(context.reasons);
196
+ var details = {
197
+ pass_reason: (0, action_1.getReasonForHighestPriorityProduct)(context.reasons),
198
+ };
198
199
  (0, utils_1.transferExistingProperties)(context.riskApiData, details, {
199
200
  errorReason: 's2s_error_reason',
200
201
  errorHttpStatus: 's2s_error_http_status',
@@ -204,19 +205,21 @@ var createPageRequestedActivityDetails = function (context) {
204
205
  };
205
206
  exports.createPageRequestedActivityDetails = createPageRequestedActivityDetails;
206
207
  var createBlockActivityDetails = function (context) {
207
- var details = {};
208
- details.block_reason = (0, action_1.getReasonForHighestPriorityProduct)(context.reasons);
209
- details.simulated_block = context.action === action_1.Action.SIMULATED_BLOCK;
210
- (0, utils_1.transferExistingProperties)(context, details, {
211
- blockAction: 'block_action',
212
- score: 'block_score',
213
- });
214
- return details;
208
+ return {
209
+ block_reason: (0, action_1.getReasonForHighestPriorityProduct)(context.reasons),
210
+ simulated_block: context.action === action_1.Action.SIMULATED_BLOCK,
211
+ block_action: context.blockAction,
212
+ // @ts-ignore
213
+ block_score: context.score,
214
+ };
215
215
  };
216
216
  exports.createBlockActivityDetails = createBlockActivityDetails;
217
217
  var createAdditionalS2SActivityDetails = function (_a, _b) {
218
218
  var ciSendRawUsernameOnAdditionalS2SActivity = _a.ciSendRawUsernameOnAdditionalS2SActivity;
219
219
  var productData = _b.productData;
220
+ if (!productData.ci) {
221
+ throw new utils_1.EnforcerError("productData.ci is undefined");
222
+ }
220
223
  var _c = productData.ci, rawUsername = _c.rawUsername, isCompromised = _c.isCompromised, isLoginSuccessful = _c.isLoginSuccessful;
221
224
  var details = { login_successful: isLoginSuccessful };
222
225
  if (isCompromised &&
@@ -10,7 +10,7 @@ var BlockerBase = /** @class */ (function () {
10
10
  }
11
11
  BlockerBase.prototype.createBlockResponse = function (context) {
12
12
  var status = this.statusCode;
13
- var headers = this.createHeaders(context);
13
+ var headers = this.createHeaders();
14
14
  var body = this.createBlockBody(context);
15
15
  return new http_1.MinimalResponseImpl({
16
16
  status: status,
@@ -18,7 +18,7 @@ var BlockerBase = /** @class */ (function () {
18
18
  body: body,
19
19
  });
20
20
  };
21
- BlockerBase.prototype.createHeaders = function (context) {
21
+ BlockerBase.prototype.createHeaders = function () {
22
22
  var _a;
23
23
  return _a = {},
24
24
  _a[http_1.CONTENT_TYPE_HEADER_NAME] = [this.contentType],