@ama-sdk/core 11.6.0-prerelease.2 → 11.6.0-prerelease.21

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 (316) hide show
  1. package/cjs/clients/api-angular-client.js +12 -4
  2. package/cjs/clients/api-beacon-client.js +1 -2
  3. package/cjs/clients/api-fetch-client.js +15 -24
  4. package/cjs/fwk/api.helper.spec.js +1 -1
  5. package/cjs/fwk/api.helpers.js +20 -24
  6. package/cjs/fwk/core/api-client.js +2 -1
  7. package/cjs/fwk/core/index.js +1 -1
  8. package/cjs/fwk/date.js +26 -27
  9. package/cjs/fwk/date.spec.js +4 -2
  10. package/cjs/fwk/ignore-enum.type.js +1 -2
  11. package/cjs/fwk/index.js +1 -1
  12. package/cjs/fwk/mocks/alf-mock-adapter.js +7 -6
  13. package/cjs/fwk/mocks/base-mock-adapter.js +3 -3
  14. package/cjs/fwk/mocks/helpers.js +15 -7
  15. package/cjs/fwk/mocks/index.js +3 -3
  16. package/cjs/fwk/{Reviver.js → reviver.js} +1 -2
  17. package/cjs/fwk/reviver.spec.js +9 -9
  18. package/cjs/plugins/additional-params/index.js +1 -1
  19. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +3 -3
  20. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +7 -10
  21. package/cjs/plugins/client-facts/client-facts.request.js +5 -5
  22. package/cjs/plugins/concurrent/concurrent.fetch.js +5 -9
  23. package/cjs/plugins/core/index.js +2 -2
  24. package/cjs/plugins/custom-info/custom-info.reply.js +2 -2
  25. package/cjs/plugins/exception/exception.spec.js +1 -1
  26. package/cjs/plugins/fetch-cache/fetch-cache.request.js +1 -1
  27. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +4 -4
  28. package/cjs/plugins/json-token/json-token.reply.js +6 -6
  29. package/cjs/plugins/json-token/json-token.request.js +1 -1
  30. package/cjs/plugins/json-token/json-token.spec.js +7 -9
  31. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +0 -2
  32. package/cjs/plugins/mock-intercept/index.js +1 -1
  33. package/cjs/plugins/mock-intercept/mock-intercept.angular.js +4 -4
  34. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +0 -2
  35. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +5 -4
  36. package/cjs/plugins/perf-metric/perf-metric.fetch.js +10 -2
  37. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -11
  38. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +5 -6
  39. package/cjs/plugins/retry/retry.fetch.js +17 -32
  40. package/cjs/plugins/retry/retry.spec.js +4 -4
  41. package/cjs/plugins/session-id/session-id.request.js +4 -4
  42. package/cjs/plugins/session-id/session-id.spec.js +2 -2
  43. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +1 -1
  44. package/cjs/plugins/timeout/timeout.fetch.js +14 -6
  45. package/cjs/plugins/wait-for/wait-for.fetch.js +3 -3
  46. package/cjs/plugins/wait-for/wait-for.spec.js +1 -1
  47. package/cjs/utils/crypto.js +7 -7
  48. package/cjs/utils/encoder.js +9 -17
  49. package/cjs/utils/generic-api.js +1 -2
  50. package/cjs/utils/ie11.js +1 -0
  51. package/cjs/utils/index.js +1 -1
  52. package/cjs/utils/json-token.js +7 -7
  53. package/cjs/utils/json-token.spec.js +14 -11
  54. package/cjs/utils/mime-types.js +1 -1
  55. package/esm2015/clients/api-angular-client.js +12 -4
  56. package/esm2015/clients/api-beacon-client.js +1 -2
  57. package/esm2015/clients/api-fetch-client.js +15 -24
  58. package/esm2015/fwk/api.helper.spec.js +1 -1
  59. package/esm2015/fwk/api.helpers.js +24 -30
  60. package/esm2015/fwk/core/api-client.js +2 -1
  61. package/esm2015/fwk/core/index.js +1 -1
  62. package/esm2015/fwk/date.js +30 -29
  63. package/esm2015/fwk/date.spec.js +4 -2
  64. package/esm2015/fwk/ignore-enum.type.js +1 -2
  65. package/esm2015/fwk/index.js +1 -1
  66. package/esm2015/fwk/mocks/alf-mock-adapter.js +7 -6
  67. package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
  68. package/esm2015/fwk/mocks/helpers.js +15 -7
  69. package/esm2015/fwk/mocks/index.js +3 -3
  70. package/esm2015/fwk/{Reviver.js → reviver.js} +2 -2
  71. package/esm2015/fwk/reviver.spec.js +1 -1
  72. package/esm2015/plugins/additional-params/index.js +1 -1
  73. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +3 -3
  74. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +7 -10
  75. package/esm2015/plugins/client-facts/client-facts.request.js +5 -5
  76. package/esm2015/plugins/concurrent/concurrent.fetch.js +5 -9
  77. package/esm2015/plugins/core/index.js +2 -2
  78. package/esm2015/plugins/custom-info/custom-info.reply.js +2 -2
  79. package/esm2015/plugins/exception/exception.spec.js +1 -1
  80. package/esm2015/plugins/fetch-cache/fetch-cache.request.js +1 -1
  81. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +4 -4
  82. package/esm2015/plugins/json-token/json-token.reply.js +6 -6
  83. package/esm2015/plugins/json-token/json-token.request.js +1 -1
  84. package/esm2015/plugins/json-token/json-token.spec.js +7 -9
  85. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +0 -2
  86. package/esm2015/plugins/mock-intercept/index.js +1 -1
  87. package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +4 -4
  88. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +0 -2
  89. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +5 -4
  90. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +10 -2
  91. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -11
  92. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +5 -6
  93. package/esm2015/plugins/retry/retry.fetch.js +17 -32
  94. package/esm2015/plugins/retry/retry.spec.js +4 -4
  95. package/esm2015/plugins/session-id/session-id.request.js +4 -4
  96. package/esm2015/plugins/session-id/session-id.spec.js +2 -2
  97. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +1 -1
  98. package/esm2015/plugins/timeout/timeout.fetch.js +15 -8
  99. package/esm2015/plugins/wait-for/wait-for.fetch.js +3 -3
  100. package/esm2015/plugins/wait-for/wait-for.spec.js +1 -1
  101. package/esm2015/utils/crypto.js +7 -7
  102. package/esm2015/utils/encoder.js +9 -17
  103. package/esm2015/utils/generic-api.js +1 -2
  104. package/esm2015/utils/ie11.js +1 -0
  105. package/esm2015/utils/index.js +1 -1
  106. package/esm2015/utils/json-token.js +7 -7
  107. package/esm2015/utils/json-token.spec.js +8 -10
  108. package/esm2015/utils/mime-types.js +1 -1
  109. package/package.json +19 -13
  110. package/schematics/ng-add/index.d.ts.map +1 -1
  111. package/schematics/ng-add/index.js +24 -26
  112. package/schematics/ng-add/schema.d.ts.map +1 -1
  113. package/src/clients/api-angular-client.d.ts +2 -2
  114. package/src/clients/api-angular-client.d.ts.map +1 -1
  115. package/src/clients/api-angular-client.js +11 -9
  116. package/src/clients/api-angular-client.js.map +1 -1
  117. package/src/clients/api-beacon-client.d.ts +1 -1
  118. package/src/clients/api-beacon-client.d.ts.map +1 -1
  119. package/src/clients/api-beacon-client.js +2 -3
  120. package/src/clients/api-beacon-client.js.map +1 -1
  121. package/src/clients/api-fetch-client.d.ts +2 -2
  122. package/src/clients/api-fetch-client.d.ts.map +1 -1
  123. package/src/clients/api-fetch-client.js +14 -21
  124. package/src/clients/api-fetch-client.js.map +1 -1
  125. package/src/fwk/api.helpers.d.ts +6 -8
  126. package/src/fwk/api.helpers.d.ts.map +1 -1
  127. package/src/fwk/api.helpers.js +22 -31
  128. package/src/fwk/api.helpers.js.map +1 -1
  129. package/src/fwk/api.interface.d.ts.map +1 -1
  130. package/src/fwk/core/api-client.d.ts +3 -3
  131. package/src/fwk/core/api-client.d.ts.map +1 -1
  132. package/src/fwk/core/api-client.js +8 -7
  133. package/src/fwk/core/api-client.js.map +1 -1
  134. package/src/fwk/core/base-api-constructor.d.ts +1 -1
  135. package/src/fwk/core/base-api-constructor.d.ts.map +1 -1
  136. package/src/fwk/core/base-api-constructor.js.map +1 -1
  137. package/src/fwk/core/index.d.ts +1 -1
  138. package/src/fwk/core/index.d.ts.map +1 -1
  139. package/src/fwk/core/index.js +1 -1
  140. package/src/fwk/core/index.js.map +1 -1
  141. package/src/fwk/date.d.ts +6 -18
  142. package/src/fwk/date.d.ts.map +1 -1
  143. package/src/fwk/date.js +25 -28
  144. package/src/fwk/date.js.map +1 -1
  145. package/src/fwk/errors.d.ts.map +1 -1
  146. package/src/fwk/errors.js.map +1 -1
  147. package/src/fwk/ignore-enum.type.d.ts.map +1 -1
  148. package/src/fwk/index.d.ts +1 -1
  149. package/src/fwk/index.js +1 -1
  150. package/src/fwk/mocks/alf-mock-adapter.d.ts.map +1 -1
  151. package/src/fwk/mocks/alf-mock-adapter.js +11 -10
  152. package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
  153. package/src/fwk/mocks/base-mock-adapter.d.ts.map +1 -1
  154. package/src/fwk/mocks/base-mock-adapter.js +4 -4
  155. package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
  156. package/src/fwk/mocks/encoded-api-request.d.ts +1 -1
  157. package/src/fwk/mocks/encoded-api-request.d.ts.map +1 -1
  158. package/src/fwk/mocks/helpers.d.ts.map +1 -1
  159. package/src/fwk/mocks/helpers.js +8 -7
  160. package/src/fwk/mocks/helpers.js.map +1 -1
  161. package/src/fwk/mocks/index.d.ts +3 -3
  162. package/src/fwk/mocks/index.d.ts.map +1 -1
  163. package/src/fwk/mocks/index.js +3 -3
  164. package/src/fwk/mocks/index.js.map +1 -1
  165. package/src/fwk/mocks/mock-adapter.d.ts +1 -1
  166. package/src/fwk/mocks/mock-adapter.d.ts.map +1 -1
  167. package/src/fwk/mocks/path-object.d.ts.map +1 -1
  168. package/src/fwk/mocks/random-mock-adapter.d.ts.map +1 -1
  169. package/src/fwk/mocks/random-mock-adapter.js +1 -1
  170. package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
  171. package/src/fwk/mocks/sequential-mock-adapter.d.ts.map +1 -1
  172. package/src/fwk/mocks/sequential-mock-adapter.js +1 -1
  173. package/src/fwk/mocks/sequential-mock-adapter.js.map +1 -1
  174. package/src/fwk/{Reviver.d.ts → reviver.d.ts} +2 -1
  175. package/src/fwk/reviver.d.ts.map +1 -0
  176. package/src/fwk/{Reviver.js → reviver.js} +3 -3
  177. package/src/fwk/reviver.js.map +1 -0
  178. package/src/plugins/abort/abort.fetch.d.ts.map +1 -1
  179. package/src/plugins/abort/abort.fetch.js.map +1 -1
  180. package/src/plugins/additional-params/additional-params-sync.request.d.ts.map +1 -1
  181. package/src/plugins/additional-params/additional-params-sync.request.js +1 -1
  182. package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
  183. package/src/plugins/additional-params/additional-params.request.d.ts.map +1 -1
  184. package/src/plugins/additional-params/additional-params.request.js.map +1 -1
  185. package/src/plugins/additional-params/index.d.ts +1 -1
  186. package/src/plugins/additional-params/index.d.ts.map +1 -1
  187. package/src/plugins/additional-params/index.js +1 -1
  188. package/src/plugins/additional-params/index.js.map +1 -1
  189. package/src/plugins/api-configuration-override/api-configuration-override.request.d.ts.map +1 -1
  190. package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
  191. package/src/plugins/api-key/api-key.request.d.ts.map +1 -1
  192. package/src/plugins/api-key/api-key.request.js.map +1 -1
  193. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +10 -10
  194. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
  195. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
  196. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
  197. package/src/plugins/client-facts/client-facts.request.d.ts +1 -1
  198. package/src/plugins/client-facts/client-facts.request.d.ts.map +1 -1
  199. package/src/plugins/client-facts/client-facts.request.js +5 -5
  200. package/src/plugins/client-facts/client-facts.request.js.map +1 -1
  201. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
  202. package/src/plugins/concurrent/concurrent.fetch.js +1 -6
  203. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
  204. package/src/plugins/core/angular-plugin.d.ts +1 -1
  205. package/src/plugins/core/angular-plugin.d.ts.map +1 -1
  206. package/src/plugins/core/fetch-plugin.d.ts.map +1 -1
  207. package/src/plugins/core/index.d.ts +2 -2
  208. package/src/plugins/core/index.d.ts.map +1 -1
  209. package/src/plugins/core/index.js +2 -2
  210. package/src/plugins/core/index.js.map +1 -1
  211. package/src/plugins/core/plugin.d.ts.map +1 -1
  212. package/src/plugins/core/reply-plugin.d.ts +1 -1
  213. package/src/plugins/core/reply-plugin.d.ts.map +1 -1
  214. package/src/plugins/core/request-plugin.d.ts.map +1 -1
  215. package/src/plugins/custom-info/custom-info.reply.d.ts.map +1 -1
  216. package/src/plugins/custom-info/custom-info.reply.js +1 -1
  217. package/src/plugins/custom-info/custom-info.reply.js.map +1 -1
  218. package/src/plugins/exception/exception.reply.d.ts +1 -0
  219. package/src/plugins/exception/exception.reply.d.ts.map +1 -1
  220. package/src/plugins/exception/exception.reply.js +6 -5
  221. package/src/plugins/exception/exception.reply.js.map +1 -1
  222. package/src/plugins/fetch-cache/fetch-cache.request.d.ts.map +1 -1
  223. package/src/plugins/fetch-cache/fetch-cache.request.js +3 -3
  224. package/src/plugins/fetch-cache/fetch-cache.request.js.map +1 -1
  225. package/src/plugins/fetch-credentials/fetch-credentials.request.d.ts.map +1 -1
  226. package/src/plugins/fetch-credentials/fetch-credentials.request.js.map +1 -1
  227. package/src/plugins/json-token/json-token.reply.d.ts.map +1 -1
  228. package/src/plugins/json-token/json-token.reply.js +6 -6
  229. package/src/plugins/json-token/json-token.reply.js.map +1 -1
  230. package/src/plugins/json-token/json-token.request.d.ts.map +1 -1
  231. package/src/plugins/json-token/json-token.request.js +1 -1
  232. package/src/plugins/json-token/json-token.request.js.map +1 -1
  233. package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -1
  234. package/src/plugins/keepalive/keepalive.request.js +1 -1
  235. package/src/plugins/keepalive/keepalive.request.js.map +1 -1
  236. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
  237. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +3 -3
  238. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
  239. package/src/plugins/mock-intercept/index.d.ts +1 -1
  240. package/src/plugins/mock-intercept/index.d.ts.map +1 -1
  241. package/src/plugins/mock-intercept/index.js +1 -1
  242. package/src/plugins/mock-intercept/index.js.map +1 -1
  243. package/src/plugins/mock-intercept/mock-intercept.angular.d.ts +1 -1
  244. package/src/plugins/mock-intercept/mock-intercept.angular.d.ts.map +1 -1
  245. package/src/plugins/mock-intercept/mock-intercept.angular.js +15 -11
  246. package/src/plugins/mock-intercept/mock-intercept.angular.js.map +1 -1
  247. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -1
  248. package/src/plugins/mock-intercept/mock-intercept.fetch.js +4 -6
  249. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
  250. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +1 -1
  251. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -1
  252. package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -1
  253. package/src/plugins/mock-intercept/mock-intercept.request.d.ts.map +1 -1
  254. package/src/plugins/mock-intercept/mock-intercept.request.js +4 -3
  255. package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
  256. package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -1
  257. package/src/plugins/perf-metric/perf-metric.fetch.js +4 -3
  258. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
  259. package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
  260. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js +5 -10
  261. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
  262. package/src/plugins/raw-response-info/raw-response-info.reply.d.ts +0 -1
  263. package/src/plugins/raw-response-info/raw-response-info.reply.d.ts.map +1 -1
  264. package/src/plugins/raw-response-info/raw-response-info.reply.js +0 -1
  265. package/src/plugins/raw-response-info/raw-response-info.reply.js.map +1 -1
  266. package/src/plugins/retry/retry.fetch.d.ts.map +1 -1
  267. package/src/plugins/retry/retry.fetch.js +5 -4
  268. package/src/plugins/retry/retry.fetch.js.map +1 -1
  269. package/src/plugins/reviver/reviver.reply.d.ts +1 -1
  270. package/src/plugins/reviver/reviver.reply.d.ts.map +1 -1
  271. package/src/plugins/reviver/reviver.reply.js.map +1 -1
  272. package/src/plugins/session-id/session-id.request.d.ts +1 -1
  273. package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
  274. package/src/plugins/session-id/session-id.request.js +5 -3
  275. package/src/plugins/session-id/session-id.request.js.map +1 -1
  276. package/src/plugins/si-token/si-token.request.d.ts.map +1 -1
  277. package/src/plugins/si-token/si-token.request.js +1 -1
  278. package/src/plugins/si-token/si-token.request.js.map +1 -1
  279. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.d.ts.map +1 -1
  280. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +1 -1
  281. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
  282. package/src/plugins/timeout/timeout.fetch.d.ts +1 -2
  283. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
  284. package/src/plugins/timeout/timeout.fetch.js +14 -12
  285. package/src/plugins/timeout/timeout.fetch.js.map +1 -1
  286. package/src/plugins/url-rewrite/url-rewrite.request.d.ts.map +1 -1
  287. package/src/plugins/url-rewrite/url-rewrite.request.js.map +1 -1
  288. package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -1
  289. package/src/plugins/wait-for/wait-for.fetch.js +2 -2
  290. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
  291. package/src/utils/crypto.d.ts.map +1 -1
  292. package/src/utils/crypto.js +7 -7
  293. package/src/utils/crypto.js.map +1 -1
  294. package/src/utils/encoder.d.ts +1 -1
  295. package/src/utils/encoder.d.ts.map +1 -1
  296. package/src/utils/encoder.js +22 -28
  297. package/src/utils/encoder.js.map +1 -1
  298. package/src/utils/generic-api.d.ts +1 -2
  299. package/src/utils/generic-api.d.ts.map +1 -1
  300. package/src/utils/generic-api.js +3 -6
  301. package/src/utils/generic-api.js.map +1 -1
  302. package/src/utils/ie11.d.ts.map +1 -1
  303. package/src/utils/ie11.js +1 -0
  304. package/src/utils/ie11.js.map +1 -1
  305. package/src/utils/index.d.ts +1 -1
  306. package/src/utils/index.d.ts.map +1 -1
  307. package/src/utils/index.js +1 -1
  308. package/src/utils/index.js.map +1 -1
  309. package/src/utils/json-token.d.ts.map +1 -1
  310. package/src/utils/json-token.js +12 -12
  311. package/src/utils/json-token.js.map +1 -1
  312. package/src/utils/mime-types.d.ts.map +1 -1
  313. package/src/utils/mime-types.js +1 -1
  314. package/src/utils/mime-types.js.map +1 -1
  315. package/src/fwk/Reviver.d.ts.map +0 -1
  316. package/src/fwk/Reviver.js.map +0 -1
@@ -225,10 +225,10 @@ function _ts_generator(thisArg, body) {
225
225
  };
226
226
  }
227
227
  }
228
- import { ExceptionReply } from '../plugins/exception';
229
- import { ReviverReply } from '../plugins/reviver';
230
228
  import { extractQueryParams, filterUndefinedValues, getResponseReviver, prepareUrl, processFormData, tokenizeRequestOptions } from '../fwk/api.helpers';
231
229
  import { CanceledCallError, EmptyResponseError, ResponseJSONParseError } from '../fwk/errors';
230
+ import { ExceptionReply } from '../plugins/exception';
231
+ import { ReviverReply } from '../plugins/reviver';
232
232
  var DEFAULT_OPTIONS = {
233
233
  replyPlugins: [
234
234
  new ReviverReply(),
@@ -410,17 +410,12 @@ var DEFAULT_OPTIONS = {
410
410
  case 2:
411
411
  canStart = _state.sent();
412
412
  isCanceledBy = canStart.indexOf(false);
413
- if (isCanceledBy >= 0) {
414
- // One of the fetch plugins cancelled the execution of the call
415
- asyncResponse = Promise.reject(new CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy, _this.options.fetchPlugins[isCanceledBy], {
416
- apiName: apiName,
417
- operationId: operationId,
418
- url: url,
419
- origin: origin
420
- }));
421
- } else {
422
- asyncResponse = fetch(url, options);
423
- }
413
+ asyncResponse = isCanceledBy === -1 ? fetch(url, options) : Promise.reject(new CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy, _this.options.fetchPlugins[isCanceledBy], {
414
+ apiName: apiName,
415
+ operationId: operationId,
416
+ url: url,
417
+ origin: origin
418
+ }));
424
419
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
425
420
  try {
426
421
  for(_iterator = loadedPlugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
@@ -459,16 +454,12 @@ var DEFAULT_OPTIONS = {
459
454
  ];
460
455
  case 5:
461
456
  e = _state.sent();
462
- if (_instanceof(e, CanceledCallError)) {
463
- exception = e;
464
- } else {
465
- exception = new EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
466
- apiName: apiName,
467
- operationId: operationId,
468
- url: url,
469
- origin: origin
470
- });
471
- }
457
+ exception = _instanceof(e, CanceledCallError) ? e : new EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
458
+ apiName: apiName,
459
+ operationId: operationId,
460
+ url: url,
461
+ origin: origin
462
+ });
472
463
  return [
473
464
  3,
474
465
  6
@@ -484,7 +475,7 @@ var DEFAULT_OPTIONS = {
484
475
  origin: origin
485
476
  });
486
477
  }
487
- // eslint-disable-next-line no-console
478
+ // eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12.
488
479
  reviver = getResponseReviver(revivers, response, operationId, {
489
480
  disableFallback: _this.options.disableFallback,
490
481
  log: console.error
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable no-console */ import { getResponseReviver } from '@ama-sdk/core';
1
+ /* eslint-disable no-console -- only using the reference */ import { getResponseReviver } from '@ama-sdk/core';
2
2
  describe('getResponseReviver - revivers by status code', function() {
3
3
  var revivers = {
4
4
  202: jest.fn(),
@@ -83,8 +83,8 @@ function _unsupported_iterable_to_array(o, minLen) {
83
83
  }).map(function(name) {
84
84
  return "".concat(name, "=").concat(queryParameters[name]);
85
85
  }).join('&');
86
- var paramsPrefix = url.indexOf('?') > -1 ? '&' : '?';
87
- return url + (!queryPart ? '' : paramsPrefix + queryPart);
86
+ var paramsPrefix = url.includes('?') ? '&' : '?';
87
+ return url + (queryPart ? paramsPrefix + queryPart : '');
88
88
  }
89
89
  /**
90
90
  * Returns a map containing the query parameters
@@ -104,36 +104,34 @@ function _unsupported_iterable_to_array(o, minLen) {
104
104
  * @param object JSON object to filter
105
105
  * @returns an object without undefined values
106
106
  */ export function filterUndefinedValues(object) {
107
- return !object ? {} : Object.keys(object).filter(function(objectKey) {
107
+ return object ? Object.keys(object).filter(function(objectKey) {
108
108
  return typeof object[objectKey] !== 'undefined';
109
109
  }).reduce(function(acc, objectKey) {
110
110
  acc[objectKey] = object[objectKey];
111
111
  return acc;
112
- }, {});
112
+ }, {}) : {};
113
113
  }
114
114
  /**
115
115
  * Receives an object containing key/value pairs
116
116
  * Encodes this object to match application/x-www-urlencoded or multipart/form-data
117
117
  * @param data
118
118
  * @param type
119
- * @param data
120
- * @param type
121
119
  */ export function processFormData(data, type) {
122
120
  var encodedData;
123
- /* eslint-disable guard-for-in */ if (type === 'multipart/form-data') {
121
+ if (type === 'multipart/form-data') {
124
122
  var formData = new FormData();
125
- for(var i in data){
126
- formData.append(i, data[i]);
127
- }
123
+ Object.entries(data).forEach(function(param) {
124
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
125
+ return formData.append(key, value);
126
+ });
128
127
  encodedData = formData;
129
128
  } else {
130
- var formData1 = [];
131
- for(var i1 in data){
132
- formData1.push("".concat(i1, "=").concat(encodeURIComponent(data[i1])));
133
- }
134
- encodedData = formData1.join('&');
129
+ encodedData = Object.entries(data).map(function(param) {
130
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
131
+ return "".concat(key, "=").concat(encodeURIComponent(value));
132
+ }).join('&');
135
133
  }
136
- /* eslint-enable guard-for-in */ return encodedData;
134
+ return encodedData;
137
135
  }
138
136
  /**
139
137
  * Computes tokens based on the given list of PII parameter names.
@@ -177,29 +175,25 @@ function _unsupported_iterable_to_array(o, minLen) {
177
175
  * Fallback to the lowest status code's reviver.
178
176
  * Does not try to match non-successful responses as error are handled separately
179
177
  * @param revivers
180
- * @param endpoint
181
178
  * @param response
182
- * @param options
183
- * @param options.disableFallback
184
- * @param options.log
185
- */ export function getResponseReviver(revivers, response, // eslint-disable-next-line no-console
186
- endpoint) {
187
- var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
188
- disableFallback: false,
189
- log: console.error
190
- };
179
+ * @param endpoint
180
+ * @param options `{ disableFallback: false, log: console.error }` by default
181
+ * @param options.disableFallback `false` by default
182
+ * @param options.log `() => {}` by default -- warning: default value will change to `console.error` in Otter v12.
183
+ */ export function getResponseReviver(revivers, response, endpoint, options) {
184
+ // eslint-disable-next-line no-console -- set as default value
185
+ var _ref = options !== null && options !== void 0 ? options : {}, _ref_disableFallback = _ref.disableFallback, disableFallback = _ref_disableFallback === void 0 ? false : _ref_disableFallback, tmp = _ref.log, logMsg = tmp === void 0 ? options ? function() {} : console.error : tmp;
191
186
  var logPrefix = "API status code error for ".concat(endpoint || 'unknown', " endpoint");
192
- var logMsg = options.log || function() {};
193
187
  if (!response || !response.ok) {
194
188
  return undefined;
195
189
  }
196
190
  if (typeof revivers === 'function' || typeof revivers === 'undefined') {
197
191
  return revivers;
198
192
  }
199
- if (response.status && Object.keys(revivers).indexOf("".concat(response.status)) > -1) {
193
+ if (response.status && Object.keys(revivers).includes("".concat(response.status))) {
200
194
  return revivers[response.status];
201
195
  }
202
- if (options === null || options === void 0 ? void 0 : options.disableFallback) {
196
+ if (disableFallback) {
203
197
  logMsg("".concat(logPrefix, " - Missing ").concat(response.status, " from API specification - fallback is deactivated, no revive will run on this response"));
204
198
  return undefined;
205
199
  }
@@ -219,7 +213,7 @@ endpoint) {
219
213
  statusCode: Number.MAX_SAFE_INTEGER,
220
214
  reviver: undefined
221
215
  });
222
- var fallbackLog = Number.MAX_SAFE_INTEGER !== fallback.statusCode ? "Fallback to ".concat(fallback.statusCode, "'s reviver") : 'No fallback found';
216
+ var fallbackLog = Number.MAX_SAFE_INTEGER === fallback.statusCode ? 'No fallback found' : "Fallback to ".concat(fallback.statusCode, "'s reviver");
223
217
  logMsg("".concat(logPrefix, " - Unknown ").concat(response.status || 'undefined', " code returned by the API - ").concat(fallbackLog));
224
218
  return fallback.reviver;
225
219
  }
@@ -2,5 +2,6 @@
2
2
  * Check if the object is an Api Client object
3
3
  * @param client object to check
4
4
  */ export function isApiClient(client) {
5
- return client && !!client.options && typeof client.extractQueryParams === 'function' && typeof client.getRequestOptions === 'function' && typeof client.prepareUrl === 'function' && typeof client.processFormData === 'function' && typeof client.processCall === 'function';
5
+ var apiClient = client;
6
+ return !!apiClient && !!apiClient.options && typeof apiClient.extractQueryParams === 'function' && typeof apiClient.getRequestOptions === 'function' && typeof apiClient.prepareUrl === 'function' && typeof apiClient.processFormData === 'function' && typeof apiClient.processCall === 'function';
6
7
  }
@@ -1,2 +1,2 @@
1
- export * from './base-api-constructor';
2
1
  export * from './api-client';
2
+ export * from './base-api-constructor';
@@ -1,4 +1,5 @@
1
- /* eslint-disable */ function _array_like_to_array(arr, len) {
1
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
2
+ function _array_like_to_array(arr, len) {
2
3
  if (len == null || len > arr.length) len = arr.length;
3
4
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
5
  return arr2;
@@ -149,10 +150,10 @@ function _is_native_reflect_construct() {
149
150
  return !!result;
150
151
  })();
151
152
  }
153
+ // eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle -- keep to not introduce breaking change
152
154
  export var _NativeDateClass = Date;
153
155
  /**
154
156
  * Specific padding for number
155
- *
156
157
  * @param val number
157
158
  * @param digits minimal number of digits to display
158
159
  */ export function pad(val) {
@@ -160,7 +161,9 @@ export var _NativeDateClass = Date;
160
161
  var str = "".concat(val);
161
162
  return '0'.repeat(Math.max(0, digits - str.length)) + str;
162
163
  }
163
- export var CommonDate = /*#__PURE__*/ function(Date1) {
164
+ /**
165
+ * Removes timezone information from ISO8601 strings
166
+ */ export var CommonDate = /*#__PURE__*/ function(Date1) {
164
167
  "use strict";
165
168
  _inherits(CommonDate, Date1);
166
169
  function CommonDate() {
@@ -168,27 +171,23 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
168
171
  args[_key] = arguments[_key];
169
172
  }
170
173
  _class_call_check(this, CommonDate);
171
- if (args) {
172
- if (typeof args[0] === 'string') {
173
- var idxT = args[0].lastIndexOf('T');
174
- // TZD = time zone designator (Z or +hh:mm or -hh:mm)
175
- var idx = args[0].lastIndexOf('Z');
176
- if (idx < 0) {
177
- idx = args[0].lastIndexOf('+');
178
- }
179
- if (idx < 0 && idxT > 0) {
180
- var relativeIdx = args[0].substring(idxT).lastIndexOf('-');
181
- idx = relativeIdx > 0 ? relativeIdx + idxT : relativeIdx;
182
- }
183
- if (idx > 0) {
184
- args[0] = args[0].substring(0, idx);
185
- }
186
- var TIME_ZONE_OFFSET = _construct(Date, _to_consumable_array(args)).getTimezoneOffset();
187
- if (idxT > 0) {
188
- args[0] += "".concat(TIME_ZONE_OFFSET < 0 ? '+' : '-').concat(pad(Math.floor(Math.abs(TIME_ZONE_OFFSET / 60))), ":").concat(pad(Math.abs(TIME_ZONE_OFFSET % 60)));
189
- }
190
- } else if (_instanceof(args[0], CommonDate)) {
191
- args[0] = args[0];
174
+ if (args && typeof args[0] === 'string') {
175
+ var idxT = args[0].lastIndexOf('T');
176
+ // TZD = time zone designator (Z or +hh:mm or -hh:mm)
177
+ var idx = args[0].lastIndexOf('Z');
178
+ if (idx < 0) {
179
+ idx = args[0].lastIndexOf('+');
180
+ }
181
+ if (idx < 0 && idxT > 0) {
182
+ var relativeIdx = args[0].substring(idxT).lastIndexOf('-');
183
+ idx = relativeIdx > 0 ? relativeIdx + idxT : relativeIdx;
184
+ }
185
+ if (idx > 0) {
186
+ args[0] = args[0].substring(0, idx);
187
+ }
188
+ var TIME_ZONE_OFFSET = _construct(Date, _to_consumable_array(args)).getTimezoneOffset();
189
+ if (idxT > 0) {
190
+ args[0] += "".concat(TIME_ZONE_OFFSET < 0 ? '+' : '-').concat(pad(Math.floor(Math.abs(TIME_ZONE_OFFSET / 60))), ":").concat(pad(Math.abs(TIME_ZONE_OFFSET % 60)));
192
191
  }
193
192
  }
194
193
  return _call_super(this, CommonDate, _to_consumable_array(args));
@@ -214,7 +213,7 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
214
213
  args[_key] = arguments[_key];
215
214
  }
216
215
  _class_call_check(this, Date1);
217
- if (args && typeof args[0] === 'string' && args[0].lastIndexOf('T') < 0) {
216
+ if (args && typeof args[0] === 'string' && !args[0].includes('T')) {
218
217
  args[0] = "".concat(args[0], "T00:00:00Z");
219
218
  } else if (_instanceof(args[0], _NativeDateClass)) {
220
219
  args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
@@ -226,7 +225,8 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
226
225
  key: "_Date",
227
226
  value: /**
228
227
  * To ensure that users cannot use a standard Date instead of utils.Date
229
- */ function _Date() {}
228
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
229
+ function _Date() {}
230
230
  },
231
231
  {
232
232
  key: "toJSON",
@@ -240,9 +240,8 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
240
240
  key: "equals",
241
241
  value: /**
242
242
  * Compare if two dates are equals.
243
- *
244
243
  * @param {Date} date the date to compare
245
- * @return {boolean} true if the dates are equals.
244
+ * @returns {boolean} true if the dates are equals.
246
245
  */ function equals(date) {
247
246
  if (!date) {
248
247
  return false;
@@ -261,6 +260,7 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
261
260
  args[_key] = arguments[_key];
262
261
  }
263
262
  _class_call_check(this, DateTime);
263
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- type is explicitly `any`
264
264
  return _call_super(this, DateTime, _to_consumable_array(args));
265
265
  }
266
266
  _create_class(DateTime, [
@@ -268,7 +268,8 @@ export var CommonDate = /*#__PURE__*/ function(Date1) {
268
268
  key: "_DateTime",
269
269
  value: /**
270
270
  * To ensure that users cannot use a standard Date instead of utils.DateTime
271
- */ function _DateTime() {}
271
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
272
+ function _DateTime() {}
272
273
  }
273
274
  ]);
274
275
  return DateTime;
@@ -1,7 +1,7 @@
1
1
  import { utils } from './date';
2
2
  describe('DateTime', function() {
3
3
  it('should support timestamp', function() {
4
- var ts = new Date().getTime();
4
+ var ts = Date.now();
5
5
  var dateUtils = new utils.DateTime(ts);
6
6
  expect(dateUtils.getTime()).toEqual(ts);
7
7
  });
@@ -15,6 +15,7 @@ describe('DateTime', function() {
15
15
  });
16
16
  it('should support json conversions', function() {
17
17
  var originalDate = new utils.DateTime(new Date());
18
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- we test the JSON conversion
18
19
  var jsonDate = JSON.parse(JSON.stringify(originalDate));
19
20
  expect(new utils.DateTime(jsonDate)).toEqual(originalDate);
20
21
  });
@@ -52,7 +53,7 @@ describe('DateTime', function() {
52
53
  });
53
54
  describe('Date', function() {
54
55
  it('should support timestamp', function() {
55
- var ts = new Date().getTime();
56
+ var ts = Date.now();
56
57
  var dateUtils = new utils.Date(ts);
57
58
  expect(dateUtils.getTime()).toEqual(ts);
58
59
  });
@@ -66,6 +67,7 @@ describe('Date', function() {
66
67
  });
67
68
  it('should support json conversions', function() {
68
69
  var originalDate = new utils.Date(new Date());
70
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- we test the JSON conversion
69
71
  var jsonDate = JSON.parse(JSON.stringify(originalDate));
70
72
  expect(new utils.Date(jsonDate)).toEqual(originalDate);
71
73
  });
@@ -1,2 +1 @@
1
- /** Type helper to ignore the constraint on literal union type (enum) of an SDK model */ // eslint-disable-next-line @typescript-eslint/ban-types
2
- export { };
1
+ /** Type helper to ignore the constraint on literal union type (enum) of an SDK model */ export { };
@@ -7,4 +7,4 @@ export * from './errors';
7
7
  export * from './ignore-enum.type';
8
8
  export * from './logger';
9
9
  export * from './mocks/index';
10
- export * from './Reviver';
10
+ export * from './reviver';
@@ -178,19 +178,19 @@ import { getOperationId, getPath } from './helpers';
178
178
  import { SequentialMockAdapter } from './sequential-mock-adapter';
179
179
  /**
180
180
  * a new call is detected thanks to the timestamp printed by ALF on a new line, ex: "2021/12/16 18:21:28.312472 "
181
- */ var logNewCallRegex = RegExp(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}\b/gm);
181
+ */ var logNewCallRegex = new RegExp(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}\b/gm);
182
182
  /**
183
183
  * the correlation Id is printed this way by ALF, ex: CorrID=0001W37ZH480AJ,
184
- */ var correlationIdRegex = RegExp(/CorrID=([^,]*),/);
184
+ */ var correlationIdRegex = new RegExp(/CorrID=([^,]*),/);
185
185
  /**
186
186
  * a request is logged with its HTTP method and the path targetted on a new line, ex: "GET /1ASIUAIRFAC/v2/shopping..."
187
- */ var requestRegex = RegExp(/^(POST|GET|PATCH|DELETE) \/([^\s]*)/m);
187
+ */ var requestRegex = new RegExp(/^(POST|GET|PATCH|DELETE) \/(\S*)/m);
188
188
  /**
189
189
  * a request is logged with its HTTP version and the HTTP status on a new line, ex: "HTTP/1.1 200 OK"
190
- */ var responseRegex = RegExp(/^(HTTP\/1.1 \d{3})/m);
190
+ */ var responseRegex = new RegExp(/^(HTTP\/1.1 \d{3})/m);
191
191
  /**
192
192
  * the response data is logged with its JSON content on a new line
193
- */ var requestResponseJsonRegexp = RegExp(/(^{.*}$)/m);
193
+ */ var requestResponseJsonRegexp = new RegExp(/(^{.*}$)/m);
194
194
  /**
195
195
  * Split the logs
196
196
  * @param log alf log
@@ -210,7 +210,7 @@ import { SequentialMockAdapter } from './sequential-mock-adapter';
210
210
  if (match && match[1] && match[2]) {
211
211
  // the match looks like this 1ASIUAIRFAC/v2/shopping/carts/19DXNCKB931CYX3S?refresh=true
212
212
  // so we remove the SAP information at the beginning and URL parameters at the end if any
213
- var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].indexOf('?') > -1 ? match[2].indexOf('?') : match[2].length);
213
+ var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].includes('?') ? match[2].indexOf('?') : match[2].length);
214
214
  var method = match[1];
215
215
  var pathObject = getPath(requestUrl, operationAdapter, method);
216
216
  if (pathObject) {
@@ -317,6 +317,7 @@ import { SequentialMockAdapter } from './sequential-mock-adapter';
317
317
  mockMap[alfCall.operationId] = [];
318
318
  }
319
319
  mockMap[alfCall.operationId].push({
320
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- type is explicitly `any`
320
321
  mockData: alfCall.response ? JSON.parse(alfCall.response) : ''
321
322
  });
322
323
  return mockMap;
@@ -166,10 +166,10 @@ import { getOperationId, getPath } from './helpers';
166
166
  _define_property(this, "mockFactory", void 0);
167
167
  this.pathObjects = pathObjects;
168
168
  this.mocks = {};
169
- if (typeof mockMap !== 'function') {
170
- this.mocks = mockMap;
171
- } else {
169
+ if (typeof mockMap === 'function') {
172
170
  this.mockFactory = mockMap;
171
+ } else {
172
+ this.mocks = mockMap;
173
173
  }
174
174
  }
175
175
  _create_class(BaseMockAdapter, [
@@ -36,12 +36,12 @@
36
36
  return newMatches;
37
37
  }, []);
38
38
  var lastIndex = -1;
39
- var nextIndex = -1;
40
39
  while(matches.length > 1){
41
- matches = matches.reduce(function(newMatches, match) {
40
+ var result = matches.reduce(function(param, match) {
41
+ var newMatches = param.matches, nextIndex = param.nextIndex;
42
42
  var newIndex = match.segments.findIndex(function(segment) {
43
43
  return segment.startsWith('{') && segment.endsWith('}');
44
- }, lastIndex + 1);
44
+ });
45
45
  // Complete static match so use some value that can't be exceeded
46
46
  if (newIndex === -1) {
47
47
  newIndex = Infinity;
@@ -54,11 +54,19 @@
54
54
  } else if (newIndex === nextIndex) {
55
55
  newMatches.push(match);
56
56
  }
57
- return newMatches;
58
- }, []);
57
+ return {
58
+ matches: newMatches,
59
+ nextIndex: nextIndex
60
+ };
61
+ }, {
62
+ matches: [],
63
+ nextIndex: -1
64
+ });
65
+ var next = result.nextIndex;
66
+ matches = result.matches;
59
67
  // At this point we have tried to filter the matches but there are multiple matches that are identical and cannot
60
68
  // be filtered further. Trying to filter on the HTTP method if provided, then choose the first match.
61
- if (lastIndex === nextIndex) {
69
+ if (lastIndex === next) {
62
70
  if (method) {
63
71
  // Try to filter the multiple matches based on the HTTP method
64
72
  matches.splice(0, matches.findIndex(function(match) {
@@ -67,7 +75,7 @@
67
75
  }
68
76
  matches.splice(1);
69
77
  }
70
- lastIndex = nextIndex;
78
+ lastIndex = next;
71
79
  }
72
80
  return matches.length > 0 ? pathObjects[matches[0].index] : undefined;
73
81
  }
@@ -1,10 +1,10 @@
1
1
  export * from './alf-mock-adapter';
2
+ export * from './base-mock-adapter';
2
3
  export * from './encoded-api-request';
3
- export * from './mock-adapter';
4
+ export * from './helpers';
4
5
  export * from './mock';
6
+ export * from './mock-adapter';
5
7
  export * from './operation';
6
8
  export * from './path-object';
7
- export * from './base-mock-adapter';
8
- export * from './helpers';
9
9
  export * from './random-mock-adapter';
10
10
  export * from './sequential-mock-adapter';
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Used in case of maps (dictionaries): All values of the map must be of the same type. reviveWithType will be called
3
3
  * for each of these elements.
4
+ * @param data
4
5
  * @param dictionaries
5
6
  * @param reviver
6
7
  * @param options Reviver options
@@ -11,8 +12,7 @@
11
12
  }
12
13
  var revived = {};
13
14
  for(var key in data){
14
- // eslint-disable-next-line no-prototype-builtins
15
- if (data.hasOwnProperty(key)) {
15
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
16
16
  revived[key] = reviver(data[key], dictionaries, options);
17
17
  }
18
18
  }
@@ -1,4 +1,4 @@
1
- import { reviveArray, reviveDictionarizedArray, reviveMap } from './Reviver';
1
+ import { reviveArray, reviveDictionarizedArray, reviveMap } from './reviver';
2
2
  describe('Revivers :', function() {
3
3
  it('reviveDictionarizedArray', function() {
4
4
  var dictionary = {
@@ -1,2 +1,2 @@
1
- export * from './additional-params.request';
2
1
  export * from './additional-params-sync.request';
2
+ export * from './additional-params.request';
@@ -168,7 +168,7 @@ function _ts_generator(thisArg, body) {
168
168
  var getProtection = function() {
169
169
  return new Promise(function(resolve, reject) {
170
170
  var timeout = setTimeout(function() {
171
- return reject("[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Protection object was received in time.\nIf the application runs on a domain that is not protected by Imperva, this plugin should be disabled.");
171
+ return reject(new Error("[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Protection object was received in time.\nIf the application runs on a domain that is not protected by Imperva, this plugin should be disabled."));
172
172
  }, protectionTimeout);
173
173
  window.protectionLoaded = function(protectionObject) {
174
174
  protection = protectionObject;
@@ -229,7 +229,7 @@ function _ts_generator(thisArg, body) {
229
229
  ];
230
230
  case 6:
231
231
  e1 = _state.sent();
232
- (logger || console).error('[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Token was received in time.');
232
+ (logger || console).error('[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Token was received in time.', e1);
233
233
  return [
234
234
  2
235
235
  ];
@@ -250,7 +250,7 @@ function _ts_generator(thisArg, body) {
250
250
  * Will return the telemetry, or undefined if bmak object is not found
251
251
  * @param bmakOpt BMak object from Akamai. Default to `window.bmak` on browser if not provided.
252
252
  */ export function akamaiTelemetryRetrieverFactory(bmakOpt) {
253
- var bmak = bmakOpt || (typeof window !== 'undefined' ? window.bmak : undefined);
253
+ var bmak = bmakOpt || (typeof window === 'undefined' ? undefined : window.bmak);
254
254
  return function() {
255
255
  if (!bmak || !(typeof bmak.get_telemetry === 'function')) {
256
256
  return;
@@ -137,7 +137,7 @@ describe('BotProtectionFingerprint', function() {
137
137
  };
138
138
  var protectionReject = {
139
139
  token: function() {
140
- return Promise.reject('error');
140
+ return Promise.reject(new Error('error'));
141
141
  }
142
142
  };
143
143
  var registerEvent = function(protection) {
@@ -154,13 +154,11 @@ describe('BotProtectionFingerprint', function() {
154
154
  beforeEach(function() {
155
155
  consoleMock = jest.spyOn(console, 'error').mockImplementation();
156
156
  windowBackup = global.window;
157
- // eslint-disable-next-line no-global-assign
158
157
  global.window = {};
159
158
  retriever = impervaProtectionRetrieverFactory(50, 50);
160
159
  tokenValue = 'dummyToken';
161
160
  });
162
161
  afterEach(function() {
163
- // eslint-disable-next-line no-global-assign
164
162
  global.window = windowBackup;
165
163
  consoleMock.mockReset();
166
164
  });
@@ -184,7 +182,7 @@ describe('BotProtectionFingerprint', function() {
184
182
  expect.apply(void 0, [
185
183
  _state.sent()
186
184
  ]).toBeUndefined();
187
- // eslint-disable-next-line no-console
185
+ // eslint-disable-next-line no-console -- console.error is not called here
188
186
  expect(console.error).toHaveBeenCalledTimes(1);
189
187
  return [
190
188
  2
@@ -213,7 +211,7 @@ describe('BotProtectionFingerprint', function() {
213
211
  expect.apply(void 0, [
214
212
  _state.sent()
215
213
  ]).toBeUndefined();
216
- // eslint-disable-next-line no-console
214
+ // eslint-disable-next-line no-console -- console.error is not called here
217
215
  expect(console.error).toHaveBeenCalledTimes(1);
218
216
  return [
219
217
  2
@@ -242,7 +240,7 @@ describe('BotProtectionFingerprint', function() {
242
240
  expect.apply(void 0, [
243
241
  _state.sent()
244
242
  ]).toBeUndefined();
245
- // eslint-disable-next-line no-console
243
+ // eslint-disable-next-line no-console -- console.error is not called here
246
244
  expect(console.error).toHaveBeenCalledTimes(1);
247
245
  return [
248
246
  2
@@ -287,7 +285,7 @@ describe('BotProtectionFingerprint', function() {
287
285
  expect.apply(void 0, [
288
286
  _state.sent()
289
287
  ]).toBe(tokenValue);
290
- // eslint-disable-next-line no-console
288
+ // eslint-disable-next-line no-console -- console.error is not called here
291
289
  expect(console.error).not.toHaveBeenCalled();
292
290
  return [
293
291
  2
@@ -300,20 +298,19 @@ describe('BotProtectionFingerprint', function() {
300
298
  it('Should return undefined if bmak object doesn\'t exist.', function() {
301
299
  expect(akamaiTelemetryRetrieverFactory()()).toBeUndefined();
302
300
  expect(akamaiTelemetryRetrieverFactory({})()).toBeUndefined();
303
- // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
304
301
  expect(akamaiTelemetryRetrieverFactory({
305
302
  get_telemetry: 'test'
306
303
  })()).toBeUndefined();
307
304
  });
308
305
  it('Should return telemetry', function() {
309
- // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
306
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- naming convention imposed by Akamai
310
307
  expect(akamaiTelemetryRetrieverFactory({
311
308
  get_telemetry: function() {
312
309
  return 'telemetryValue';
313
310
  }
314
311
  })()).toBe('telemetryValue');
315
312
  global.window = {};
316
- // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
313
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- naming convention imposed by Akamai
317
314
  global.window.bmak = {
318
315
  get_telemetry: function() {
319
316
  return 'telemetryValue2';