@ama-sdk/core 10.0.0-next.8 → 11.0.0-next.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 (366) hide show
  1. package/README.md +51 -31
  2. package/cjs/clients/api-angular-client.js +6 -2
  3. package/cjs/clients/api-beacon-client.js +3 -2
  4. package/cjs/clients/api-fetch-client.js +9 -4
  5. package/cjs/fwk/Reviver.js +3 -3
  6. package/cjs/fwk/api.helpers.js +9 -10
  7. package/cjs/fwk/api.js +2 -2
  8. package/cjs/fwk/date.js +4 -39
  9. package/cjs/fwk/errors.js +10 -11
  10. package/cjs/fwk/index.js +1 -0
  11. package/cjs/fwk/logger.js +9 -0
  12. package/cjs/fwk/mocks/alf-mock-adapter.js +1 -8
  13. package/cjs/fwk/mocks/base-mock-adapter.js +0 -12
  14. package/cjs/plugins/additional-params/additional-params.request.js +5 -5
  15. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  16. package/cjs/plugins/api-key/api-key.request.js +2 -2
  17. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +77 -105
  18. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +9 -98
  19. package/cjs/plugins/client-facts/client-facts.request.js +5 -7
  20. package/cjs/plugins/concurrent/concurrent.fetch.js +2 -2
  21. package/cjs/plugins/core/plugin.js +1 -3
  22. package/cjs/plugins/custom-info/custom-info.reply.js +0 -1
  23. package/cjs/plugins/index.js +0 -21
  24. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +7 -9
  25. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +1 -0
  26. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +5 -4
  27. package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
  28. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +1 -3
  29. package/cjs/plugins/perf-metric/perf-metric.fetch.js +2 -5
  30. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -14
  31. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +3 -1
  32. package/cjs/plugins/retry/retry.fetch.js +2 -3
  33. package/cjs/plugins/session-id/session-id.request.js +10 -11
  34. package/cjs/plugins/session-id/session-id.spec.js +12 -8
  35. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +2 -4
  36. package/cjs/plugins/timeout/timeout.fetch.js +75 -15
  37. package/cjs/plugins/timeout/timeout.spec.js +102 -3
  38. package/cjs/plugins/url-rewrite/url-rewrite.request.js +2 -2
  39. package/cjs/plugins/wait-for/wait-for.fetch.js +2 -2
  40. package/cjs/public_api.js +1 -0
  41. package/cjs/utils/crypto.js +5 -5
  42. package/cjs/utils/encoder.js +0 -5
  43. package/cjs/{plugins/gateway-token → utils}/index.js +5 -2
  44. package/cjs/utils/json-token.js +11 -13
  45. package/cjs/utils/json-token.spec.js +4 -2
  46. package/cjs/utils/mime-types.js +22 -0
  47. package/cli/clear-index.cjs +25 -0
  48. package/cli/clear-index.cjs.map +1 -0
  49. package/cli/clear-index.d.cts +3 -0
  50. package/cli/clear-index.d.cts.map +1 -0
  51. package/cli/files-pack.cjs +84 -0
  52. package/cli/files-pack.cjs.map +1 -0
  53. package/cli/files-pack.d.cts +3 -0
  54. package/cli/files-pack.d.cts.map +1 -0
  55. package/cli/package.json +3 -0
  56. package/esm2015/clients/api-angular-client.js +6 -2
  57. package/esm2015/clients/api-beacon-client.js +3 -2
  58. package/esm2015/clients/api-fetch-client.js +9 -4
  59. package/esm2015/fwk/Reviver.js +0 -3
  60. package/esm2015/fwk/api.helpers.js +3 -3
  61. package/esm2015/fwk/api.interface.js +1 -1
  62. package/esm2015/fwk/api.js +2 -2
  63. package/esm2015/fwk/core/api-client.js +0 -1
  64. package/esm2015/fwk/core/base-api-constructor.js +0 -1
  65. package/esm2015/fwk/date.js +1 -38
  66. package/esm2015/fwk/errors.js +2 -3
  67. package/esm2015/fwk/index.js +1 -0
  68. package/esm2015/fwk/logger.js +6 -0
  69. package/esm2015/fwk/mocks/alf-mock-adapter.js +1 -9
  70. package/esm2015/fwk/mocks/base-mock-adapter.js +0 -12
  71. package/esm2015/fwk/mocks/encoded-api-request.js +3 -1
  72. package/esm2015/fwk/mocks/helpers.js +0 -2
  73. package/esm2015/fwk/mocks/mock-adapter.js +1 -1
  74. package/esm2015/fwk/mocks/path-object.js +1 -1
  75. package/esm2015/plugins/additional-params/additional-params.request.js +2 -3
  76. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -3
  77. package/esm2015/plugins/api-key/api-key.request.js +2 -2
  78. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +84 -118
  79. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +10 -99
  80. package/esm2015/plugins/client-facts/client-facts.request.js +14 -7
  81. package/esm2015/plugins/concurrent/concurrent.fetch.js +2 -2
  82. package/esm2015/plugins/core/fetch-plugin.js +4 -1
  83. package/esm2015/plugins/core/plugin.js +1 -1
  84. package/esm2015/plugins/core/reply-plugin.js +4 -1
  85. package/esm2015/plugins/core/request-plugin.js +4 -1
  86. package/esm2015/plugins/custom-info/custom-info.reply.js +0 -1
  87. package/esm2015/plugins/index.js +0 -4
  88. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +3 -7
  89. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +1 -0
  90. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -4
  91. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +3 -3
  92. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +1 -3
  93. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -5
  94. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -21
  95. package/esm2015/plugins/retry/retry.fetch.js +2 -3
  96. package/esm2015/plugins/session-id/session-id.request.js +10 -11
  97. package/esm2015/plugins/session-id/session-id.spec.js +12 -8
  98. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +10 -10
  99. package/esm2015/plugins/timeout/timeout.fetch.js +70 -12
  100. package/esm2015/plugins/timeout/timeout.spec.js +102 -3
  101. package/esm2015/plugins/url-rewrite/url-rewrite.request.js +2 -2
  102. package/esm2015/plugins/wait-for/wait-for.fetch.js +4 -3
  103. package/esm2015/public_api.js +1 -0
  104. package/esm2015/utils/crypto.js +0 -4
  105. package/esm2015/utils/encoder.js +0 -5
  106. package/esm2015/utils/ie11.js +0 -1
  107. package/esm2015/utils/index.js +5 -0
  108. package/esm2015/utils/json-token.js +2 -7
  109. package/esm2015/utils/json-token.spec.js +4 -2
  110. package/esm2015/utils/mime-types.js +7 -0
  111. package/package.json +51 -36
  112. package/schematics/ng-add/index.d.ts.map +1 -1
  113. package/schematics/ng-add/index.js +38 -20
  114. package/schematics/ng-add/index.js.map +1 -1
  115. package/schematics/ng-add/schema.json +2 -2
  116. package/src/clients/api-angular-client.d.ts.map +1 -1
  117. package/src/clients/api-angular-client.js +3 -2
  118. package/src/clients/api-angular-client.js.map +1 -1
  119. package/src/clients/api-beacon-client.d.ts +0 -1
  120. package/src/clients/api-beacon-client.d.ts.map +1 -1
  121. package/src/clients/api-beacon-client.js +1 -3
  122. package/src/clients/api-beacon-client.js.map +1 -1
  123. package/src/clients/api-fetch-client.d.ts +0 -1
  124. package/src/clients/api-fetch-client.d.ts.map +1 -1
  125. package/src/clients/api-fetch-client.js +5 -5
  126. package/src/clients/api-fetch-client.js.map +1 -1
  127. package/src/fwk/Reviver.d.ts +0 -3
  128. package/src/fwk/Reviver.d.ts.map +1 -1
  129. package/src/fwk/Reviver.js +0 -3
  130. package/src/fwk/Reviver.js.map +1 -1
  131. package/src/fwk/api.helpers.d.ts +2 -1
  132. package/src/fwk/api.helpers.d.ts.map +1 -1
  133. package/src/fwk/api.helpers.js +2 -1
  134. package/src/fwk/api.helpers.js.map +1 -1
  135. package/src/fwk/core/api-client.d.ts +0 -4
  136. package/src/fwk/core/api-client.d.ts.map +1 -1
  137. package/src/fwk/core/api-client.js +0 -1
  138. package/src/fwk/core/api-client.js.map +1 -1
  139. package/src/fwk/core/base-api-constructor.d.ts +3 -2
  140. package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
  141. package/src/fwk/core/base-api-constructor.js +0 -1
  142. package/src/fwk/core/base-api-constructor.js.map +1 -1
  143. package/src/fwk/date.d.ts +0 -15
  144. package/src/fwk/date.d.ts.map +1 -1
  145. package/src/fwk/date.js +0 -36
  146. package/src/fwk/date.js.map +1 -1
  147. package/src/fwk/index.d.ts +1 -0
  148. package/src/fwk/index.d.ts.map +1 -1
  149. package/src/fwk/index.js +1 -0
  150. package/src/fwk/index.js.map +1 -1
  151. package/src/fwk/logger.d.ts +39 -0
  152. package/src/fwk/logger.d.ts.map +1 -0
  153. package/src/fwk/logger.js +2 -0
  154. package/src/fwk/logger.js.map +1 -0
  155. package/src/fwk/mocks/alf-mock-adapter.d.ts +0 -1
  156. package/src/fwk/mocks/alf-mock-adapter.d.ts.map +1 -1
  157. package/src/fwk/mocks/alf-mock-adapter.js +0 -7
  158. package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
  159. package/src/fwk/mocks/base-mock-adapter.d.ts +0 -4
  160. package/src/fwk/mocks/base-mock-adapter.d.ts.map +1 -1
  161. package/src/fwk/mocks/base-mock-adapter.js +0 -10
  162. package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
  163. package/src/fwk/mocks/helpers.d.ts +0 -2
  164. package/src/fwk/mocks/helpers.d.ts.map +1 -1
  165. package/src/fwk/mocks/helpers.js +0 -2
  166. package/src/fwk/mocks/helpers.js.map +1 -1
  167. package/src/fwk/mocks/mock-adapter.d.ts +0 -10
  168. package/src/fwk/mocks/mock-adapter.d.ts.map +1 -1
  169. package/src/fwk/mocks/random-mock-adapter.d.ts +1 -1
  170. package/src/fwk/mocks/random-mock-adapter.d.ts.map +1 -1
  171. package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
  172. package/src/plugins/additional-params/additional-params-sync.request.d.ts +1 -2
  173. package/src/plugins/additional-params/additional-params-sync.request.d.ts.map +1 -1
  174. package/src/plugins/additional-params/additional-params-sync.request.js +0 -1
  175. package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
  176. package/src/plugins/additional-params/additional-params.request.d.ts +1 -3
  177. package/src/plugins/additional-params/additional-params.request.d.ts.map +1 -1
  178. package/src/plugins/additional-params/additional-params.request.js +0 -2
  179. package/src/plugins/additional-params/additional-params.request.js.map +1 -1
  180. package/src/plugins/api-configuration-override/api-configuration-override.request.d.ts +2 -4
  181. package/src/plugins/api-configuration-override/api-configuration-override.request.d.ts.map +1 -1
  182. package/src/plugins/api-configuration-override/api-configuration-override.request.js +0 -2
  183. package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
  184. package/src/plugins/api-key/api-key.request.d.ts +2 -3
  185. package/src/plugins/api-key/api-key.request.d.ts.map +1 -1
  186. package/src/plugins/api-key/api-key.request.js +0 -1
  187. package/src/plugins/api-key/api-key.request.js.map +1 -1
  188. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +16 -31
  189. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
  190. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +20 -61
  191. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
  192. package/src/plugins/client-facts/client-facts.request.d.ts +15 -8
  193. package/src/plugins/client-facts/client-facts.request.d.ts.map +1 -1
  194. package/src/plugins/client-facts/client-facts.request.js +12 -5
  195. package/src/plugins/client-facts/client-facts.request.js.map +1 -1
  196. package/src/plugins/concurrent/concurrent.fetch.d.ts +1 -2
  197. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
  198. package/src/plugins/concurrent/concurrent.fetch.js +0 -1
  199. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
  200. package/src/plugins/core/fetch-plugin.d.ts +7 -4
  201. package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
  202. package/src/plugins/core/plugin.d.ts +15 -2
  203. package/src/plugins/core/plugin.d.ts.map +1 -1
  204. package/src/plugins/core/reply-plugin.d.ts +8 -5
  205. package/src/plugins/core/reply-plugin.d.ts.map +1 -1
  206. package/src/plugins/core/request-plugin.d.ts +11 -3
  207. package/src/plugins/core/request-plugin.d.ts.map +1 -1
  208. package/src/plugins/custom-info/custom-info.reply.d.ts +1 -3
  209. package/src/plugins/custom-info/custom-info.reply.d.ts.map +1 -1
  210. package/src/plugins/custom-info/custom-info.reply.js +0 -2
  211. package/src/plugins/custom-info/custom-info.reply.js.map +1 -1
  212. package/src/plugins/exception/exception.reply.d.ts +1 -1
  213. package/src/plugins/exception/exception.reply.d.ts.map +1 -1
  214. package/src/plugins/exception/exception.reply.js.map +1 -1
  215. package/src/plugins/fetch-cache/fetch-cache.request.d.ts +3 -3
  216. package/src/plugins/fetch-cache/fetch-cache.request.d.ts.map +1 -1
  217. package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts +1 -1
  218. package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts.map +1 -1
  219. package/src/plugins/index.d.ts +0 -4
  220. package/src/plugins/index.d.ts.map +1 -1
  221. package/src/plugins/index.js +0 -4
  222. package/src/plugins/index.js.map +1 -1
  223. package/src/plugins/json-token/json-token.reply.d.ts +0 -1
  224. package/src/plugins/json-token/json-token.reply.d.ts.map +1 -1
  225. package/src/plugins/json-token/json-token.reply.js +0 -1
  226. package/src/plugins/json-token/json-token.reply.js.map +1 -1
  227. package/src/plugins/json-token/json-token.request.d.ts +2 -3
  228. package/src/plugins/json-token/json-token.request.d.ts.map +1 -1
  229. package/src/plugins/json-token/json-token.request.js +0 -1
  230. package/src/plugins/json-token/json-token.request.js.map +1 -1
  231. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts +2 -8
  232. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
  233. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +0 -6
  234. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
  235. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
  236. package/src/plugins/mock-intercept/mock-intercept.fetch.js +3 -2
  237. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
  238. package/src/plugins/mock-intercept/mock-intercept.request.d.ts +1 -1
  239. package/src/plugins/mock-intercept/mock-intercept.request.d.ts.map +1 -1
  240. package/src/plugins/mock-intercept/mock-intercept.request.js +1 -1
  241. package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
  242. package/src/plugins/perf-metric/perf-metric.fetch.d.ts +0 -3
  243. package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
  244. package/src/plugins/perf-metric/perf-metric.fetch.js +0 -3
  245. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
  246. package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts +19 -21
  247. package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
  248. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js +18 -20
  249. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
  250. package/src/plugins/retry/retry.fetch.d.ts +8 -7
  251. package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
  252. package/src/plugins/retry/retry.fetch.js +0 -2
  253. package/src/plugins/retry/retry.fetch.js.map +1 -1
  254. package/src/plugins/session-id/session-id.request.d.ts +7 -6
  255. package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
  256. package/src/plugins/session-id/session-id.request.js +11 -12
  257. package/src/plugins/session-id/session-id.request.js.map +1 -1
  258. package/src/plugins/si-token/si-token.request.d.ts +0 -1
  259. package/src/plugins/si-token/si-token.request.d.ts.map +1 -1
  260. package/src/plugins/si-token/si-token.request.js +0 -1
  261. package/src/plugins/si-token/si-token.request.js.map +1 -1
  262. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.d.ts +10 -11
  263. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.d.ts.map +1 -1
  264. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +8 -9
  265. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
  266. package/src/plugins/timeout/timeout.fetch.d.ts +31 -2
  267. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
  268. package/src/plugins/timeout/timeout.fetch.js +62 -10
  269. package/src/plugins/timeout/timeout.fetch.js.map +1 -1
  270. package/src/plugins/url-rewrite/url-rewrite.request.d.ts +1 -2
  271. package/src/plugins/url-rewrite/url-rewrite.request.d.ts.map +1 -1
  272. package/src/plugins/url-rewrite/url-rewrite.request.js +0 -1
  273. package/src/plugins/url-rewrite/url-rewrite.request.js.map +1 -1
  274. package/src/plugins/wait-for/wait-for.fetch.d.ts +2 -3
  275. package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -1
  276. package/src/plugins/wait-for/wait-for.fetch.js +2 -2
  277. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
  278. package/src/public_api.d.ts +1 -0
  279. package/src/public_api.d.ts.map +1 -1
  280. package/src/public_api.js +1 -0
  281. package/src/public_api.js.map +1 -1
  282. package/src/utils/crypto.d.ts +0 -4
  283. package/src/utils/crypto.d.ts.map +1 -1
  284. package/src/utils/crypto.js +0 -4
  285. package/src/utils/crypto.js.map +1 -1
  286. package/src/utils/encoder.d.ts +0 -1
  287. package/src/utils/encoder.d.ts.map +1 -1
  288. package/src/utils/encoder.js +0 -5
  289. package/src/utils/encoder.js.map +1 -1
  290. package/src/utils/ie11.d.ts +0 -1
  291. package/src/utils/ie11.d.ts.map +1 -1
  292. package/src/utils/ie11.js +0 -1
  293. package/src/utils/ie11.js.map +1 -1
  294. package/src/utils/index.d.ts +6 -0
  295. package/src/utils/index.d.ts.map +1 -0
  296. package/src/utils/index.js +6 -0
  297. package/src/utils/index.js.map +1 -0
  298. package/src/utils/json-token.d.ts +0 -3
  299. package/src/utils/json-token.d.ts.map +1 -1
  300. package/src/utils/json-token.js +0 -5
  301. package/src/utils/json-token.js.map +1 -1
  302. package/src/utils/mime-types.d.ts +7 -0
  303. package/src/utils/mime-types.d.ts.map +1 -0
  304. package/src/utils/mime-types.js +9 -0
  305. package/src/utils/mime-types.js.map +1 -0
  306. package/cjs/plugins/fetch-options/fetch-options.request.js +0 -87
  307. package/cjs/plugins/fetch-options/fetch-options.spec.js +0 -280
  308. package/cjs/plugins/fetch-options/index.js +0 -18
  309. package/cjs/plugins/gateway-token/gateway-authentication.js +0 -275
  310. package/cjs/plugins/gateway-token/gateway-token.request.js +0 -388
  311. package/cjs/plugins/gateway-token/gateway-token.spec.js +0 -360
  312. package/cjs/plugins/imperva/imperva.fetch.js +0 -307
  313. package/cjs/plugins/imperva/imperva.spec.js +0 -347
  314. package/cjs/plugins/imperva/index.js +0 -18
  315. package/cjs/plugins/public-facts/index.js +0 -18
  316. package/cjs/plugins/public-facts/public-facts.request.js +0 -101
  317. package/cjs/plugins/public-facts/public-facts.spec.js +0 -367
  318. package/esm2015/plugins/fetch-options/fetch-options.request.js +0 -81
  319. package/esm2015/plugins/fetch-options/fetch-options.spec.js +0 -276
  320. package/esm2015/plugins/fetch-options/index.js +0 -1
  321. package/esm2015/plugins/gateway-token/gateway-authentication.js +0 -262
  322. package/esm2015/plugins/gateway-token/gateway-token.request.js +0 -406
  323. package/esm2015/plugins/gateway-token/gateway-token.spec.js +0 -356
  324. package/esm2015/plugins/gateway-token/index.js +0 -2
  325. package/esm2015/plugins/imperva/imperva.fetch.js +0 -303
  326. package/esm2015/plugins/imperva/imperva.spec.js +0 -343
  327. package/esm2015/plugins/imperva/index.js +0 -1
  328. package/esm2015/plugins/public-facts/index.js +0 -1
  329. package/esm2015/plugins/public-facts/public-facts.request.js +0 -138
  330. package/esm2015/plugins/public-facts/public-facts.spec.js +0 -363
  331. package/src/plugins/fetch-options/fetch-options.request.d.ts +0 -26
  332. package/src/plugins/fetch-options/fetch-options.request.d.ts.map +0 -1
  333. package/src/plugins/fetch-options/fetch-options.request.js +0 -22
  334. package/src/plugins/fetch-options/fetch-options.request.js.map +0 -1
  335. package/src/plugins/fetch-options/index.d.ts +0 -2
  336. package/src/plugins/fetch-options/index.d.ts.map +0 -1
  337. package/src/plugins/fetch-options/index.js +0 -2
  338. package/src/plugins/fetch-options/index.js.map +0 -1
  339. package/src/plugins/gateway-token/gateway-authentication.d.ts +0 -105
  340. package/src/plugins/gateway-token/gateway-authentication.d.ts.map +0 -1
  341. package/src/plugins/gateway-token/gateway-authentication.js +0 -74
  342. package/src/plugins/gateway-token/gateway-authentication.js.map +0 -1
  343. package/src/plugins/gateway-token/gateway-token.request.d.ts +0 -97
  344. package/src/plugins/gateway-token/gateway-token.request.d.ts.map +0 -1
  345. package/src/plugins/gateway-token/gateway-token.request.js +0 -127
  346. package/src/plugins/gateway-token/gateway-token.request.js.map +0 -1
  347. package/src/plugins/gateway-token/index.d.ts +0 -3
  348. package/src/plugins/gateway-token/index.d.ts.map +0 -1
  349. package/src/plugins/gateway-token/index.js +0 -3
  350. package/src/plugins/gateway-token/index.js.map +0 -1
  351. package/src/plugins/imperva/imperva.fetch.d.ts +0 -33
  352. package/src/plugins/imperva/imperva.fetch.d.ts.map +0 -1
  353. package/src/plugins/imperva/imperva.fetch.js +0 -41
  354. package/src/plugins/imperva/imperva.fetch.js.map +0 -1
  355. package/src/plugins/imperva/index.d.ts +0 -2
  356. package/src/plugins/imperva/index.d.ts.map +0 -1
  357. package/src/plugins/imperva/index.js +0 -2
  358. package/src/plugins/imperva/index.js.map +0 -1
  359. package/src/plugins/public-facts/index.d.ts +0 -2
  360. package/src/plugins/public-facts/index.d.ts.map +0 -1
  361. package/src/plugins/public-facts/index.js +0 -2
  362. package/src/plugins/public-facts/index.js.map +0 -1
  363. package/src/plugins/public-facts/public-facts.request.d.ts +0 -89
  364. package/src/plugins/public-facts/public-facts.request.d.ts.map +0 -1
  365. package/src/plugins/public-facts/public-facts.request.js +0 -62
  366. package/src/plugins/public-facts/public-facts.request.js.map +0 -1
@@ -1,356 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _define_property(obj, key, value) {
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _ts_generator(thisArg, body) {
44
- var f, y, t, g, _ = {
45
- label: 0,
46
- sent: function() {
47
- if (t[0] & 1) throw t[1];
48
- return t[1];
49
- },
50
- trys: [],
51
- ops: []
52
- };
53
- return g = {
54
- next: verb(0),
55
- "throw": verb(1),
56
- "return": verb(2)
57
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
58
- return this;
59
- }), g;
60
- function verb(n) {
61
- return function(v) {
62
- return step([
63
- n,
64
- v
65
- ]);
66
- };
67
- }
68
- function step(op) {
69
- if (f) throw new TypeError("Generator is already executing.");
70
- while(_)try {
71
- 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;
72
- if (y = 0, t) op = [
73
- op[0] & 2,
74
- t.value
75
- ];
76
- switch(op[0]){
77
- case 0:
78
- case 1:
79
- t = op;
80
- break;
81
- case 4:
82
- _.label++;
83
- return {
84
- value: op[1],
85
- done: false
86
- };
87
- case 5:
88
- _.label++;
89
- y = op[1];
90
- op = [
91
- 0
92
- ];
93
- continue;
94
- case 7:
95
- op = _.ops.pop();
96
- _.trys.pop();
97
- continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
100
- _ = 0;
101
- continue;
102
- }
103
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
104
- _.label = op[1];
105
- break;
106
- }
107
- if (op[0] === 6 && _.label < t[1]) {
108
- _.label = t[1];
109
- t = op;
110
- break;
111
- }
112
- if (t && _.label < t[2]) {
113
- _.label = t[2];
114
- _.ops.push(op);
115
- break;
116
- }
117
- if (t[2]) _.ops.pop();
118
- _.trys.pop();
119
- continue;
120
- }
121
- op = body.call(thisArg, _);
122
- } catch (e) {
123
- op = [
124
- 6,
125
- e
126
- ];
127
- y = 0;
128
- } finally{
129
- f = t = 0;
130
- }
131
- if (op[0] & 5) throw op[1];
132
- return {
133
- value: op[0] ? op[1] : void 0,
134
- done: true
135
- };
136
- }
137
- }
138
- import { Oauth2Api } from "./gateway-authentication";
139
- import { GatewayTokenRequestPlugin } from "./gateway-token.request";
140
- // Storage Mock
141
- var storageMock = function() {
142
- var storage = {};
143
- return {
144
- setItem: function(key, value) {
145
- storage[key] = value || "";
146
- },
147
- getItem: function(key) {
148
- return key in storage ? storage[key] : null;
149
- },
150
- removeItem: function(key) {
151
- delete storage[key];
152
- }
153
- };
154
- };
155
- describe("Gateway token plugin", function() {
156
- var defaultGetParams = {
157
- defaultTest: "ok"
158
- };
159
- var defaultBody = "default";
160
- var defaultUrl = "http://test.com/truc";
161
- var defaultGatewayAPIConfig = {
162
- baseUrl: defaultUrl,
163
- gatewayClientId: "RgquoWaPkKmZ7acKUu1A2meEYVo94az7",
164
- gatewayClientSecret: "AdUgFh4hu1dUUIE1"
165
- };
166
- var options;
167
- beforeEach(function() {
168
- var headers = new Headers();
169
- headers.append("Content-Type", "image/jpeg");
170
- headers.append("Accept-Encoding", "gzip");
171
- options = {
172
- method: "get",
173
- queryParams: defaultGetParams,
174
- headers: headers,
175
- body: defaultBody,
176
- basePath: defaultUrl
177
- };
178
- global.sessionStorage = storageMock();
179
- sessionStorage.removeItem("gateway-auth-tokens");
180
- });
181
- afterAll(function() {
182
- global.sessionStorage = undefined;
183
- });
184
- it("should get the token from session storage", /*#__PURE__*/ _async_to_generator(function() {
185
- var tempToken, sessionStorageKey, gatewayPlugin, spy, runner, e;
186
- return _ts_generator(this, function(_state) {
187
- switch(_state.label){
188
- case 0:
189
- tempToken = "qhxZi73NEaeUoHDttkRpXlKPgbUv";
190
- sessionStorageKey = "".concat(defaultGatewayAPIConfig.gatewayClientId, "-default");
191
- sessionStorage.setItem("gateway-auth-tokens", JSON.stringify(_define_property({}, sessionStorageKey, {
192
- expiresAt: Date.now() + 28800 * 1000,
193
- token: tempToken
194
- })));
195
- gatewayPlugin = new GatewayTokenRequestPlugin("".concat(defaultGatewayAPIConfig.baseUrl, "/v1/security/oauth2"), defaultGatewayAPIConfig.gatewayClientId, defaultGatewayAPIConfig.gatewayClientSecret, defaultUrl);
196
- spy = jest.spyOn(Oauth2Api.prototype, "postAccessToken");
197
- runner = gatewayPlugin.load();
198
- return [
199
- 4,
200
- runner.transform(options)
201
- ];
202
- case 1:
203
- e = _state.sent();
204
- expect(spy).not.toHaveBeenCalled();
205
- expect(e.headers.get("authorization")).toBe("Bearer ".concat(tempToken));
206
- return [
207
- 2
208
- ];
209
- }
210
- });
211
- }));
212
- it("should call the gateway api to take the token and save it in session storage", /*#__PURE__*/ _async_to_generator(function() {
213
- var gatewayPlugin, accessToken, sessionStorageKey, spy, runner, e, tokenValue;
214
- return _ts_generator(this, function(_state) {
215
- switch(_state.label){
216
- case 0:
217
- gatewayPlugin = new GatewayTokenRequestPlugin("".concat(defaultGatewayAPIConfig.baseUrl, "/v1/security/oauth2"), defaultGatewayAPIConfig.gatewayClientId, defaultGatewayAPIConfig.gatewayClientSecret, defaultUrl);
218
- accessToken = "1234567890";
219
- sessionStorageKey = "".concat(defaultGatewayAPIConfig.gatewayClientId, "-default");
220
- spy = jest.spyOn(Oauth2Api.prototype, "postAccessToken").mockReturnValue(Promise.resolve({
221
- /* eslint-disable @typescript-eslint/naming-convention, camelcase */ access_token: accessToken,
222
- expires_in: 300,
223
- token_type: "Bearer"
224
- }));
225
- runner = gatewayPlugin.load();
226
- return [
227
- 4,
228
- runner.transform(options)
229
- ];
230
- case 1:
231
- e = _state.sent();
232
- expect(spy).toHaveBeenCalled();
233
- expect(e.headers.get("authorization")).toBe("Bearer ".concat(accessToken));
234
- tokenValue = JSON.parse(sessionStorage.getItem("gateway-auth-tokens"))[sessionStorageKey];
235
- expect(tokenValue.token).toBe(accessToken);
236
- return [
237
- 2
238
- ];
239
- }
240
- });
241
- }));
242
- it("should call the gateway api if the token in session storage is expired", /*#__PURE__*/ _async_to_generator(function() {
243
- var gatewayPlugin, sessionStorageKey, expectedToken, spy, runner, e, tokenValue;
244
- return _ts_generator(this, function(_state) {
245
- switch(_state.label){
246
- case 0:
247
- gatewayPlugin = new GatewayTokenRequestPlugin("".concat(defaultGatewayAPIConfig.baseUrl, "/v1/security/oauth2"), defaultGatewayAPIConfig.gatewayClientId, defaultGatewayAPIConfig.gatewayClientSecret, defaultUrl);
248
- sessionStorageKey = "".concat(defaultGatewayAPIConfig.gatewayClientId, "-default");
249
- sessionStorage.setItem("gateway-auth-tokens", JSON.stringify(_define_property({}, sessionStorageKey, {
250
- expiresAt: Date.now(),
251
- token: "qhxZi73NEaeUoHDttkRpXlKPgbUv"
252
- })));
253
- expectedToken = "1234567890";
254
- spy = jest.spyOn(Oauth2Api.prototype, "postAccessToken").mockReturnValue(Promise.resolve({
255
- /* eslint-disable @typescript-eslint/naming-convention, camelcase */ access_token: expectedToken,
256
- expires_in: 300,
257
- token_type: "Bearer"
258
- }));
259
- runner = gatewayPlugin.load();
260
- return [
261
- 4,
262
- runner.transform(options)
263
- ];
264
- case 1:
265
- e = _state.sent();
266
- expect(spy).toHaveBeenCalled();
267
- expect(e.headers.get("authorization")).toBe("Bearer ".concat(expectedToken));
268
- tokenValue = JSON.parse(sessionStorage.getItem("gateway-auth-tokens"))[sessionStorageKey];
269
- expect(tokenValue.token).toBe(expectedToken);
270
- return [
271
- 2
272
- ];
273
- }
274
- });
275
- }));
276
- it("should save the token in session storage with the reference of the provided guest office ID", /*#__PURE__*/ _async_to_generator(function() {
277
- var guestOfficeId, sessionStorageKey, gatewayPlugin, expectedToken, spy, runner, e, tokenValue;
278
- return _ts_generator(this, function(_state) {
279
- switch(_state.label){
280
- case 0:
281
- guestOfficeId = "XXXXXX";
282
- sessionStorageKey = "".concat(defaultGatewayAPIConfig.gatewayClientId, "-").concat(guestOfficeId);
283
- gatewayPlugin = new GatewayTokenRequestPlugin("".concat(defaultGatewayAPIConfig.baseUrl, "/v1/security/oauth2"), defaultGatewayAPIConfig.gatewayClientId, defaultGatewayAPIConfig.gatewayClientSecret, defaultUrl, guestOfficeId);
284
- expectedToken = "1234567890";
285
- spy = jest.spyOn(Oauth2Api.prototype, "postAccessToken").mockReturnValue(Promise.resolve({
286
- /* eslint-disable @typescript-eslint/naming-convention, camelcase */ access_token: expectedToken,
287
- expires_in: 300,
288
- token_type: "Bearer"
289
- }));
290
- runner = gatewayPlugin.load();
291
- return [
292
- 4,
293
- runner.transform(options)
294
- ];
295
- case 1:
296
- e = _state.sent();
297
- expect(spy).toHaveBeenCalled();
298
- expect(e.headers.get("authorization")).toBe("Bearer ".concat(expectedToken));
299
- tokenValue = JSON.parse(sessionStorage.getItem("gateway-auth-tokens"))[sessionStorageKey];
300
- expect(tokenValue.token).toBe(expectedToken);
301
- return [
302
- 2
303
- ];
304
- }
305
- });
306
- }));
307
- it("should save the token in session storage with the reference", /*#__PURE__*/ _async_to_generator(function() {
308
- var guestOfficeId, sessionStorageKey, guestOfficeIdRule, gatewayPlugin, isFirstCall, expectedToken1, expectedToken2, spy, runner, tokenValue;
309
- return _ts_generator(this, function(_state) {
310
- switch(_state.label){
311
- case 0:
312
- guestOfficeId = "XXXXXX";
313
- sessionStorageKey = "".concat(defaultGatewayAPIConfig.gatewayClientId, "-").concat(guestOfficeId);
314
- guestOfficeIdRule = function() {
315
- return Promise.resolve(guestOfficeId);
316
- };
317
- gatewayPlugin = new GatewayTokenRequestPlugin("".concat(defaultGatewayAPIConfig.baseUrl, "/v1/security/oauth2"), defaultGatewayAPIConfig.gatewayClientId, defaultGatewayAPIConfig.gatewayClientSecret, defaultUrl, guestOfficeIdRule);
318
- isFirstCall = true;
319
- expectedToken1 = "111111111";
320
- expectedToken2 = "222222222";
321
- spy = jest.spyOn(Oauth2Api.prototype, "postAccessToken").mockImplementation(function() {
322
- return Promise.resolve({
323
- /* eslint-disable @typescript-eslint/naming-convention, camelcase */ access_token: isFirstCall ? "111111111" : "222222222",
324
- expires_in: 300,
325
- token_type: "Bearer"
326
- });
327
- });
328
- runner = gatewayPlugin.load();
329
- return [
330
- 4,
331
- runner.transform(options)
332
- ];
333
- case 1:
334
- _state.sent();
335
- expect(spy).toHaveBeenCalled();
336
- tokenValue = JSON.parse(sessionStorage.getItem("gateway-auth-tokens"))[sessionStorageKey];
337
- expect(tokenValue.token).toBe(expectedToken1);
338
- isFirstCall = false;
339
- guestOfficeId = "YYYYYY";
340
- sessionStorageKey = "".concat(defaultGatewayAPIConfig.gatewayClientId, "-").concat(guestOfficeId);
341
- return [
342
- 4,
343
- runner.transform(options)
344
- ];
345
- case 2:
346
- _state.sent();
347
- expect(spy).toHaveBeenCalled();
348
- tokenValue = JSON.parse(sessionStorage.getItem("gateway-auth-tokens"))[sessionStorageKey];
349
- expect(tokenValue.token).toBe(expectedToken2);
350
- return [
351
- 2
352
- ];
353
- }
354
- });
355
- }));
356
- });
@@ -1,2 +0,0 @@
1
- export * from "./gateway-authentication";
2
- export * from "./gateway-token.request";
@@ -1,303 +0,0 @@
1
- function _assert_this_initialized(self) {
2
- if (self === void 0) {
3
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
- }
5
- return self;
6
- }
7
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8
- try {
9
- var info = gen[key](arg);
10
- var value = info.value;
11
- } catch (error) {
12
- reject(error);
13
- return;
14
- }
15
- if (info.done) {
16
- resolve(value);
17
- } else {
18
- Promise.resolve(value).then(_next, _throw);
19
- }
20
- }
21
- function _async_to_generator(fn) {
22
- return function() {
23
- var self = this, args = arguments;
24
- return new Promise(function(resolve, reject) {
25
- var gen = fn.apply(self, args);
26
- function _next(value) {
27
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
28
- }
29
- function _throw(err) {
30
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
31
- }
32
- _next(undefined);
33
- });
34
- };
35
- }
36
- function _class_call_check(instance, Constructor) {
37
- if (!(instance instanceof Constructor)) {
38
- throw new TypeError("Cannot call a class as a function");
39
- }
40
- }
41
- function _define_property(obj, key, value) {
42
- if (key in obj) {
43
- Object.defineProperty(obj, key, {
44
- value: value,
45
- enumerable: true,
46
- configurable: true,
47
- writable: true
48
- });
49
- } else {
50
- obj[key] = value;
51
- }
52
- return obj;
53
- }
54
- function _get_prototype_of(o) {
55
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
56
- return o.__proto__ || Object.getPrototypeOf(o);
57
- };
58
- return _get_prototype_of(o);
59
- }
60
- function _inherits(subClass, superClass) {
61
- if (typeof superClass !== "function" && superClass !== null) {
62
- throw new TypeError("Super expression must either be null or a function");
63
- }
64
- subClass.prototype = Object.create(superClass && superClass.prototype, {
65
- constructor: {
66
- value: subClass,
67
- writable: true,
68
- configurable: true
69
- }
70
- });
71
- if (superClass) _set_prototype_of(subClass, superClass);
72
- }
73
- function _object_spread(target) {
74
- for(var i = 1; i < arguments.length; i++){
75
- var source = arguments[i] != null ? arguments[i] : {};
76
- var ownKeys = Object.keys(source);
77
- if (typeof Object.getOwnPropertySymbols === "function") {
78
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
79
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
80
- }));
81
- }
82
- ownKeys.forEach(function(key) {
83
- _define_property(target, key, source[key]);
84
- });
85
- }
86
- return target;
87
- }
88
- function _possible_constructor_return(self, call) {
89
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
90
- return call;
91
- }
92
- return _assert_this_initialized(self);
93
- }
94
- function _set_prototype_of(o, p) {
95
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
96
- o.__proto__ = p;
97
- return o;
98
- };
99
- return _set_prototype_of(o, p);
100
- }
101
- function _type_of(obj) {
102
- "@swc/helpers - typeof";
103
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
104
- }
105
- function _is_native_reflect_construct() {
106
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
107
- if (Reflect.construct.sham) return false;
108
- if (typeof Proxy === "function") return true;
109
- try {
110
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
111
- return true;
112
- } catch (e) {
113
- return false;
114
- }
115
- }
116
- function _create_super(Derived) {
117
- var hasNativeReflectConstruct = _is_native_reflect_construct();
118
- return function _createSuperInternal() {
119
- var Super = _get_prototype_of(Derived), result;
120
- if (hasNativeReflectConstruct) {
121
- var NewTarget = _get_prototype_of(this).constructor;
122
- result = Reflect.construct(Super, arguments, NewTarget);
123
- } else {
124
- result = Super.apply(this, arguments);
125
- }
126
- return _possible_constructor_return(this, result);
127
- };
128
- }
129
- function _ts_generator(thisArg, body) {
130
- var f, y, t, g, _ = {
131
- label: 0,
132
- sent: function() {
133
- if (t[0] & 1) throw t[1];
134
- return t[1];
135
- },
136
- trys: [],
137
- ops: []
138
- };
139
- return g = {
140
- next: verb(0),
141
- "throw": verb(1),
142
- "return": verb(2)
143
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
144
- return this;
145
- }), g;
146
- function verb(n) {
147
- return function(v) {
148
- return step([
149
- n,
150
- v
151
- ]);
152
- };
153
- }
154
- function step(op) {
155
- if (f) throw new TypeError("Generator is already executing.");
156
- while(_)try {
157
- 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;
158
- if (y = 0, t) op = [
159
- op[0] & 2,
160
- t.value
161
- ];
162
- switch(op[0]){
163
- case 0:
164
- case 1:
165
- t = op;
166
- break;
167
- case 4:
168
- _.label++;
169
- return {
170
- value: op[1],
171
- done: false
172
- };
173
- case 5:
174
- _.label++;
175
- y = op[1];
176
- op = [
177
- 0
178
- ];
179
- continue;
180
- case 7:
181
- op = _.ops.pop();
182
- _.trys.pop();
183
- continue;
184
- default:
185
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
186
- _ = 0;
187
- continue;
188
- }
189
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
190
- _.label = op[1];
191
- break;
192
- }
193
- if (op[0] === 6 && _.label < t[1]) {
194
- _.label = t[1];
195
- t = op;
196
- break;
197
- }
198
- if (t && _.label < t[2]) {
199
- _.label = t[2];
200
- _.ops.push(op);
201
- break;
202
- }
203
- if (t[2]) _.ops.pop();
204
- _.trys.pop();
205
- continue;
206
- }
207
- op = body.call(thisArg, _);
208
- } catch (e) {
209
- op = [
210
- 6,
211
- e
212
- ];
213
- y = 0;
214
- } finally{
215
- f = t = 0;
216
- }
217
- if (op[0] & 5) throw op[1];
218
- return {
219
- value: op[0] ? op[1] : void 0,
220
- done: true
221
- };
222
- }
223
- }
224
- import { WaitForFetch } from "../wait-for";
225
- /** Options default values */ var defaultOptions = {
226
- allowCallOnTimeout: true,
227
- delayBetweenTriesInMilliseconds: 250,
228
- maximumTries: 4,
229
- cookieName: "reese84"
230
- };
231
- /**
232
- * Creates a CanStartConditionFunction with respect to the given ImpervaFetchOptions
233
- *
234
- * @param options
235
- */ var startConditionFactory = function(options) {
236
- var cookieRegExp = new RegExp("\\b".concat(options.cookieName, "="));
237
- return /*#__PURE__*/ _async_to_generator(function() {
238
- var i;
239
- return _ts_generator(this, function(_state) {
240
- switch(_state.label){
241
- case 0:
242
- i = options.maximumTries - 1;
243
- _state.label = 1;
244
- case 1:
245
- if (!(i >= 0)) return [
246
- 3,
247
- 4
248
- ];
249
- if (cookieRegExp.test(document.cookie)) {
250
- return [
251
- 2,
252
- {
253
- result: true
254
- }
255
- ];
256
- }
257
- if (!(i > 0)) return [
258
- 3,
259
- 3
260
- ];
261
- return [
262
- 4,
263
- new Promise(function(resolve) {
264
- return setTimeout(resolve, options.delayBetweenTriesInMilliseconds);
265
- })
266
- ];
267
- case 2:
268
- _state.sent();
269
- _state.label = 3;
270
- case 3:
271
- i--;
272
- return [
273
- 3,
274
- 1
275
- ];
276
- case 4:
277
- return [
278
- 2,
279
- {
280
- result: options.allowCallOnTimeout
281
- }
282
- ];
283
- }
284
- });
285
- });
286
- };
287
- /**
288
- * Plugin that waits for a specific cookie to be present in the document before sending any call.
289
- * Designed specifically for Imperva implementations, can also be used with any cookie as long as they can be accessed
290
- * from javascript (not HostOnly)
291
- *
292
- * @deprecated use the BotProtectionFingerprintRequest plug-in instead, will be removed in v10
293
- */ export var ImpervaFetch = /*#__PURE__*/ function(WaitForFetch) {
294
- "use strict";
295
- _inherits(ImpervaFetch, WaitForFetch);
296
- var _super = _create_super(ImpervaFetch);
297
- function ImpervaFetch(customOptions) {
298
- _class_call_check(this, ImpervaFetch);
299
- var options = _object_spread({}, defaultOptions, customOptions);
300
- return _super.call(this, startConditionFactory(options));
301
- }
302
- return ImpervaFetch;
303
- }(WaitForFetch);