@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
@@ -122,7 +122,7 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { akamaiTelemetryRetrieverFactory, BotProtectionFingerprintRequest, cookieRetrieverFactory, impervaLocalStorageRetrieverFactory, impervaProtectionRetrieverFactory } from "./bot-protection-fingerprint.request";
125
+ import { akamaiTelemetryRetrieverFactory, BotProtectionFingerprintRequest, impervaProtectionRetrieverFactory } from "./bot-protection-fingerprint.request";
126
126
  describe("BotProtectionFingerprint", function() {
127
127
  describe("Retrievers", function() {
128
128
  describe("impervaProtectionRetrieverFactory", function() {
@@ -152,7 +152,7 @@ describe("BotProtectionFingerprint", function() {
152
152
  });
153
153
  };
154
154
  beforeEach(function() {
155
- consoleMock = jest.spyOn(console, "warn").mockImplementation();
155
+ consoleMock = jest.spyOn(console, "error").mockImplementation();
156
156
  windowBackup = global.window;
157
157
  // eslint-disable-next-line no-global-assign
158
158
  global.window = {};
@@ -184,7 +184,8 @@ describe("BotProtectionFingerprint", function() {
184
184
  expect.apply(void 0, [
185
185
  _state.sent()
186
186
  ]).toBeUndefined();
187
- expect(console.warn).toHaveBeenCalledTimes(1);
187
+ // eslint-disable-next-line no-console
188
+ expect(console.error).toHaveBeenCalledTimes(1);
188
189
  return [
189
190
  2
190
191
  ];
@@ -212,7 +213,8 @@ describe("BotProtectionFingerprint", function() {
212
213
  expect.apply(void 0, [
213
214
  _state.sent()
214
215
  ]).toBeUndefined();
215
- expect(console.warn).toHaveBeenCalledTimes(1);
216
+ // eslint-disable-next-line no-console
217
+ expect(console.error).toHaveBeenCalledTimes(1);
216
218
  return [
217
219
  2
218
220
  ];
@@ -240,7 +242,8 @@ describe("BotProtectionFingerprint", function() {
240
242
  expect.apply(void 0, [
241
243
  _state.sent()
242
244
  ]).toBeUndefined();
243
- expect(console.warn).toHaveBeenCalledTimes(1);
245
+ // eslint-disable-next-line no-console
246
+ expect(console.error).toHaveBeenCalledTimes(1);
244
247
  return [
245
248
  2
246
249
  ];
@@ -284,7 +287,8 @@ describe("BotProtectionFingerprint", function() {
284
287
  expect.apply(void 0, [
285
288
  _state.sent()
286
289
  ]).toBe(tokenValue);
287
- expect(console.warn).not.toHaveBeenCalled();
290
+ // eslint-disable-next-line no-console
291
+ expect(console.error).not.toHaveBeenCalled();
288
292
  return [
289
293
  2
290
294
  ];
@@ -292,99 +296,6 @@ describe("BotProtectionFingerprint", function() {
292
296
  });
293
297
  }));
294
298
  });
295
- describe("cookieRetrieverFactory", function() {
296
- var documentBackup;
297
- var cookieName = "test1";
298
- var cookieValue = "value1";
299
- var cookieName2 = "test2";
300
- var cookieValue2 = "value2";
301
- var fullCookie = "".concat(cookieName, "=").concat(cookieValue);
302
- var fullCookie2 = "".concat(cookieName2, "=").concat(cookieValue2);
303
- var retriever = cookieRetrieverFactory(cookieName);
304
- var retriever2 = cookieRetrieverFactory(cookieName2);
305
- beforeEach(function() {
306
- documentBackup = global.document;
307
- global.document = {};
308
- });
309
- afterEach(function() {
310
- global.document = documentBackup;
311
- });
312
- it("Should throw if document is not defined.", function() {
313
- global.document = undefined;
314
- expect(retriever).toThrow();
315
- });
316
- it("Should return undefined if no cookies are there.", function() {
317
- expect(retriever()).not.toBeDefined();
318
- });
319
- it("Should return undefined if cookies are there but not the one specified.", function() {
320
- global.document.cookie = fullCookie2;
321
- expect(retriever()).not.toBeDefined();
322
- });
323
- it("Should return the value of the cookie with the name specified when present.", function() {
324
- global.document.cookie = "".concat(fullCookie, "; ").concat(fullCookie2);
325
- expect(retriever()).toBe(cookieValue);
326
- expect(retriever2()).toBe(cookieValue2);
327
- global.document.cookie = "".concat(fullCookie2, "; ").concat(fullCookie);
328
- expect(retriever()).toBe(cookieValue);
329
- expect(retriever2()).toBe(cookieValue2);
330
- });
331
- });
332
- describe("impervaLocalStorageRetrieverFactory", function() {
333
- var localStorageBackup;
334
- var localStorageValue;
335
- var localStorageMock = {
336
- getItem: function(key) {
337
- return localStorageValue[key];
338
- },
339
- setItem: function(key, value) {
340
- return localStorageValue[key] = value;
341
- }
342
- };
343
- var storageKey = "fingerprint";
344
- var validEntry = {
345
- token: "testtoken",
346
- renewTime: Date.now() + 1000 * 60 * 60
347
- };
348
- var expiredEntry = {
349
- token: "testtoken",
350
- renewTime: Date.now() - 1
351
- };
352
- var retriever = impervaLocalStorageRetrieverFactory(storageKey);
353
- var retrieverIgnoreExpired = impervaLocalStorageRetrieverFactory(storageKey, true);
354
- beforeEach(function() {
355
- localStorageValue = {};
356
- localStorageBackup = global.localStorage;
357
- global.localStorage = localStorageMock;
358
- });
359
- afterEach(function() {
360
- global.localStorage = localStorageBackup;
361
- });
362
- it("Should throw if localStorage is not defined.", function() {
363
- global.localStorage = undefined;
364
- expect(retriever).toThrow();
365
- });
366
- it("Should return undefined if the storage doesn't contain the specified key.", function() {
367
- expect(retriever()).not.toBeDefined();
368
- });
369
- it("Should return undefined if the storage contains a malformed entry.", function() {
370
- localStorageMock.setItem(storageKey, "malformed json");
371
- expect(retriever()).not.toBeDefined();
372
- localStorageMock.setItem(storageKey, '{"random": "property"}');
373
- expect(retriever()).not.toBeDefined();
374
- });
375
- it("Should return the stored token if still valid", function() {
376
- localStorageMock.setItem(storageKey, JSON.stringify(validEntry));
377
- expect(retriever()).toBe(validEntry.token);
378
- });
379
- it("Should return undefined by default if the stored token has expired", function() {
380
- localStorageMock.setItem(storageKey, JSON.stringify(expiredEntry));
381
- expect(retriever()).not.toBeDefined();
382
- });
383
- it("Should return expired token if configured to do so.", function() {
384
- localStorageMock.setItem(storageKey, JSON.stringify(expiredEntry));
385
- expect(retrieverIgnoreExpired()).toBe(expiredEntry.token);
386
- });
387
- });
388
299
  describe("akamaiTelemetryRetrieverFactory", function() {
389
300
  it("Should return undefined if bmak object doesn't exist.", function() {
390
301
  expect(akamaiTelemetryRetrieverFactory()()).toBeUndefined();
@@ -84,13 +84,13 @@ function _ts_generator(thisArg, body) {
84
84
  trys: [],
85
85
  ops: []
86
86
  };
87
- return(g = {
87
+ return g = {
88
88
  next: verb(0),
89
89
  "throw": verb(1),
90
90
  "return": verb(2)
91
91
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
92
92
  return this;
93
- }), g);
93
+ }), g;
94
94
  function verb(n) {
95
95
  return function(v) {
96
96
  return step([
@@ -189,20 +189,22 @@ import { createJwtEncoder } from "../../utils/json-token";
189
189
  * Private facts are represented as strings.
190
190
  *
191
191
  * The plugin allows to define two layers of facts:
192
- * - Global: synchronous map of facts sent with every request
193
- * - Request: function that is called with all the request information where you can return specific facts for every request
192
+ * - Global: synchronous map of facts sent with every request
193
+ * - Request: function that is called with all the request information where you can return specific facts for every request
194
194
  * If both are defined for a request, the priority is given to request specific facts.
195
195
  *
196
196
  * Facts are added to every requests as a Header that is configurable.
197
197
  * Public facts are stringified and encoded in base64 before.
198
- *
199
198
  * @example only global public facts
199
+ * ```typescript
200
200
  * const clientFactsPlugin = new ClientFactsRequestPlugin<BookingPublicFacts>({
201
201
  * initialGlobalFacts: {
202
202
  * country: 'FRA'
203
203
  * }
204
204
  * });
205
+ * ```
205
206
  * @example request public facts
207
+ * ```typescript
206
208
  * const clientFactsPlugin = new ClientFactsRequestPlugin<BookingPublicFacts>({
207
209
  * factsFactory: (request) => {
208
210
  * if (request.basePath.includes('/order/')) {
@@ -213,7 +215,9 @@ import { createJwtEncoder } from "../../utils/json-token";
213
215
  * return {};
214
216
  * }
215
217
  * });
218
+ * ```
216
219
  * @example global public facts based on Store value
220
+ * ```typescript
217
221
  * const clientFactsPlugin = new ClientFactsRequestPlugin<BookingPublicFacts>({});
218
222
  *
219
223
  * store.pipe(
@@ -222,7 +226,9 @@ import { createJwtEncoder } from "../../utils/json-token";
222
226
  * const facts = getFactsFromOrder(order);
223
227
  * clientFactsPlugin.setGlobalFacts(facts);
224
228
  * });
229
+ * ```
225
230
  * @example request public facts based on Store value
231
+ * ```typescript
226
232
  * const clientFactsPlugin = new ClientactsRequestPlugin<BookingPublicFacts>({
227
233
  * factsFactory: (request) => {
228
234
  * if (request.basePath.includes('/order/') && request.method !== 'GET') {
@@ -235,10 +241,13 @@ import { createJwtEncoder } from "../../utils/json-token";
235
241
  * return {};
236
242
  * }
237
243
  * });
244
+ * ```
238
245
  * @example private facts based on encrypted POST parameter
246
+ * ```typescript
239
247
  * const clientFactsPlugin = new ClientFactsRequestPlugin({
240
248
  * privateFacts: requestParametersService.getPostParameter('private-facts')
241
249
  * });
250
+ * ```
242
251
  */ export var ClientFactsRequestPlugin = /*#__PURE__*/ function() {
243
252
  "use strict";
244
253
  function ClientFactsRequestPlugin(options) {
@@ -258,7 +267,6 @@ import { createJwtEncoder } from "../../utils/json-token";
258
267
  key: "setGlobalFacts",
259
268
  value: /**
260
269
  * Change the value of the global facts
261
- *
262
270
  * @param facts
263
271
  */ function setGlobalFacts(facts) {
264
272
  this.globalFacts = facts;
@@ -268,7 +276,6 @@ import { createJwtEncoder } from "../../utils/json-token";
268
276
  key: "setPrivateFacts",
269
277
  value: /**
270
278
  * Change the value of the private facts
271
- *
272
279
  * @param facts
273
280
  */ function setPrivateFacts(facts) {
274
281
  this.privateFacts = facts;
@@ -69,13 +69,13 @@ function _ts_generator(thisArg, body) {
69
69
  trys: [],
70
70
  ops: []
71
71
  };
72
- return(g = {
72
+ return g = {
73
73
  next: verb(0),
74
74
  "throw": verb(1),
75
75
  "return": verb(2)
76
76
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
77
77
  return this;
78
- }), g);
78
+ }), g;
79
79
  function verb(n) {
80
80
  return function(v) {
81
81
  return step([
@@ -1 +1,4 @@
1
- export { };
1
+ /**
2
+ * Interface of a Fetch plugin.
3
+ * The plugin will be run around the Fetch call
4
+ */ export { };
@@ -1,3 +1,3 @@
1
1
  /**
2
- * Interface of a runnable plugin
2
+ * Interface of an async input for plugins
3
3
  */ export { };
@@ -1 +1,4 @@
1
- export { };
1
+ /**
2
+ * Interface of an SDK reply plugin.
3
+ * The plugin will be run on the reply of a call
4
+ */ export { };
@@ -1 +1,4 @@
1
- export { };
1
+ /**
2
+ * Interface of an SDK request plugin.
3
+ * The plugin will be run on the request of a call
4
+ */ export { };
@@ -44,7 +44,6 @@ function _define_property(obj, key, value) {
44
44
  key: "hasCustomInfo",
45
45
  value: /**
46
46
  * Checks if the reply has a customInfo node
47
- *
48
47
  * @param reply
49
48
  */ // eslint-disable-next-line no-use-before-define
50
49
  function hasCustomInfo(reply) {
@@ -9,15 +9,11 @@ export * from "./custom-info/index";
9
9
  export * from "./exception/index";
10
10
  export * from "./fetch-cache/index";
11
11
  export * from "./fetch-credentials/index";
12
- export * from "./fetch-options/index";
13
- export * from "./gateway-token/index";
14
- export * from "./imperva/index";
15
12
  export * from "./json-token/index";
16
13
  export * from "./keepalive/index";
17
14
  export * from "./mock-intercept/index";
18
15
  export * from "./perf-metric/index";
19
16
  export * from "./pii-tokenizer/index";
20
- export { PublicFactsRequestPlugin, PublicFactsRequestPluginOptions, PublicFactsFactory } from "./public-facts/index";
21
17
  export * from "./raw-response-info/index";
22
18
  export * from "./retry/index";
23
19
  export * from "./reviver/index";
@@ -69,13 +69,13 @@ function _ts_generator(thisArg, body) {
69
69
  trys: [],
70
70
  ops: []
71
71
  };
72
- return(g = {
72
+ return g = {
73
73
  next: verb(0),
74
74
  "throw": verb(1),
75
75
  "return": verb(2)
76
76
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
77
77
  return this;
78
- }), g);
78
+ }), g;
79
79
  function verb(n) {
80
80
  return function(v) {
81
81
  return step([
@@ -159,7 +159,6 @@ import { ab2str, str2ab } from "../../utils/crypto";
159
159
  import { createBase64Encoder, createBase64UrlEncoder } from "../../utils/json-token";
160
160
  /**
161
161
  * Computes the SHA256 digest of the given string
162
- *
163
162
  * @param value Value to hash
164
163
  */ export function sha256(value) {
165
164
  return _sha256.apply(this, arguments);
@@ -206,7 +205,6 @@ function _sha256() {
206
205
  * Generates hash-based message authentication code using cryptographic hash function HmacSHA256 and the provided
207
206
  * secret key
208
207
  * Should only be in a NodeJS MDW context
209
- *
210
208
  * @param value Value to hash
211
209
  * @param secretKey Secret cryptographic key
212
210
  */ export function hmacSHA256(value, secretKey) {
@@ -290,7 +288,6 @@ function _sha256() {
290
288
  key: "generateMicroGatewayAuthenticationSignatureKey",
291
289
  value: /**
292
290
  * Computes the key used to sign the JWS
293
- *
294
291
  * @param payload JWT payload
295
292
  * @param basePath Resource path
296
293
  */ function generateMicroGatewayAuthenticationSignatureKey(payload, basePath) {
@@ -320,7 +317,6 @@ function _sha256() {
320
317
  key: "sign",
321
318
  value: /**
322
319
  * Generates the signed JWT based on provided payload and secret key
323
- *
324
320
  * @param payload JWT payload
325
321
  * @param secretKey secret key used to generate the signature
326
322
  */ function sign(payload, secretKey) {
@@ -333,7 +329,6 @@ function _sha256() {
333
329
  key: "generateJWS",
334
330
  value: /**
335
331
  * Generates a signed Json Web Token
336
- *
337
332
  * @param path Resource path
338
333
  */ function generateJWS(path) {
339
334
  var _this = this;
@@ -369,6 +364,7 @@ function _sha256() {
369
364
  return _ts_generator(this, function(_state) {
370
365
  switch(_state.label){
371
366
  case 0:
367
+ // Handle Authorization Tokens
372
368
  url = new URL(data.basePath);
373
369
  return [
374
370
  4,
@@ -313,6 +313,7 @@ describe("JSON auth token request plugin", function() {
313
313
  ];
314
314
  case 3:
315
315
  secretKey = _state.sent();
316
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
316
317
  message = "".concat(base64UrlEncoder(JSON.stringify(header)), ".").concat(base64UrlEncoder(JSON.stringify(payload)));
317
318
  signCheck = base64UrlEncoder(hmacSHA256(message, secretKey));
318
319
  expect(signature).toEqual(signCheck);
@@ -76,13 +76,13 @@ function _ts_generator(thisArg, body) {
76
76
  trys: [],
77
77
  ops: []
78
78
  };
79
- return(g = {
79
+ return g = {
80
80
  next: verb(0),
81
81
  "throw": verb(1),
82
82
  "return": verb(2)
83
83
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
84
84
  return this;
85
- }), g);
85
+ }), g;
86
86
  function verb(n) {
87
87
  return function(v) {
88
88
  return step([
@@ -199,6 +199,7 @@ import { MockInterceptRequest } from "./mock-intercept.request";
199
199
  case 1:
200
200
  _state.sent();
201
201
  responsePromise = fetchCall;
202
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
202
203
  if (!context.options.headers || !_instanceof(context.options.headers, Headers) || !context.options.headers.has(CUSTOM_MOCK_OPERATION_ID_HEADER)) {
203
204
  return [
204
205
  2,
@@ -241,6 +242,7 @@ import { MockInterceptRequest } from "./mock-intercept.request";
241
242
  });
242
243
  _state.label = 6;
243
244
  case 6:
245
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
244
246
  operationId = context.options.headers.get(CUSTOM_MOCK_OPERATION_ID_HEADER);
245
247
  try {
246
248
  mock = _this.options.adapter.getLatestMock(operationId);
@@ -258,8 +260,7 @@ import { MockInterceptRequest } from "./mock-intercept.request";
258
260
  })
259
261
  ];
260
262
  } catch (e) {
261
- // eslint-disable-next-line no-console
262
- console.error("Failed to retrieve the latest mock for Operation ID ".concat(operationId, ", fallback to default mock"));
263
+ (context.logger || console).error("Failed to retrieve the latest mock for Operation ID ".concat(operationId, ", fallback to default mock"));
263
264
  return [
264
265
  2,
265
266
  responsePromise
@@ -108,13 +108,13 @@ function _ts_generator(thisArg, body) {
108
108
  trys: [],
109
109
  ops: []
110
110
  };
111
- return(g = {
111
+ return g = {
112
112
  next: verb(0),
113
113
  "throw": verb(1),
114
114
  "return": verb(2)
115
115
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
116
116
  return this;
117
- }), g);
117
+ }), g;
118
118
  function verb(n) {
119
119
  return function(v) {
120
120
  return step([
@@ -211,7 +211,7 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, CUSTOM_MOCK_REQUEST_HEADER } from "./m
211
211
  _create_class(MockInterceptRequest, [
212
212
  {
213
213
  key: "load",
214
- value: function load() {
214
+ value: /** @inheritdoc */ function load() {
215
215
  var _this = this;
216
216
  return {
217
217
  transform: function() {
@@ -144,13 +144,11 @@ var testMock = {
144
144
  };
145
145
  var getMockSpy = jest.fn().mockReturnValue(testMock);
146
146
  var getLatestMockSpy = jest.fn().mockReturnValue(testMock);
147
- var getOperationIdSpy = jest.fn().mockReturnValue("testOperation");
148
147
  var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve("testOperation"));
149
148
  var initializeSpy = jest.fn().mockReturnValue(Promise.resolve());
150
149
  var testMockAdapter = {
151
150
  getMock: getMockSpy,
152
151
  getLatestMock: getLatestMockSpy,
153
- getOperationId: getOperationIdSpy,
154
152
  initialize: initializeSpy,
155
153
  retrieveOperationId: retrieveOperationIdSpy
156
154
  };
@@ -205,6 +203,7 @@ describe("Mock intercept", function() {
205
203
  return _ts_generator(this, function(_state) {
206
204
  switch(_state.label){
207
205
  case 0:
206
+ // Disabled because Blob URL is not supported on NodeJS
208
207
  plugin = new MockInterceptRequest({
209
208
  adapter: testMockAdapter
210
209
  });
@@ -242,7 +241,6 @@ describe("Mock intercept", function() {
242
241
  initialize: initializeSpy,
243
242
  getMock: getMockSpy,
244
243
  getLatestMock: getLatestMockSpy,
245
- getOperationId: getOperationIdSpy,
246
244
  retrieveOperationId: retrieveOperationIdSpy
247
245
  };
248
246
  plugin = new MockInterceptFetch({
@@ -108,13 +108,13 @@ function _ts_generator(thisArg, body) {
108
108
  trys: [],
109
109
  ops: []
110
110
  };
111
- return(g = {
111
+ return g = {
112
112
  next: verb(0),
113
113
  "throw": verb(1),
114
114
  "return": verb(2)
115
115
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
116
116
  return this;
117
- }), g);
117
+ }), g;
118
118
  function verb(n) {
119
119
  return function(v) {
120
120
  return step([
@@ -226,7 +226,6 @@ import { v4 } from "uuid";
226
226
  key: "openMark",
227
227
  value: /**
228
228
  * Opens a mark associated to a call.
229
- *
230
229
  * @param url URL of the call associated to the mark to open
231
230
  * @param requestOptions Options of the call associated to the mark to open
232
231
  */ function openMark(url, requestOptions) {
@@ -244,7 +243,6 @@ import { v4 } from "uuid";
244
243
  key: "closeMark",
245
244
  value: /**
246
245
  * Closes the mark matching the given mark id.
247
- *
248
246
  * @param markId Id of the mark to close
249
247
  * @param response Response of the call associated to the mark to close
250
248
  */ function closeMark(markId, response) {
@@ -265,7 +263,6 @@ import { v4 } from "uuid";
265
263
  key: "closeMarkWithError",
266
264
  value: /**
267
265
  * Closes the mark matching the given mark id with an error.
268
- *
269
266
  * @param markId Id of the mark to close
270
267
  * @param error Optional error of the call associated to the mark to close
271
268
  */ function closeMarkWithError(markId, error) {
@@ -84,13 +84,13 @@ function _ts_generator(thisArg, body) {
84
84
  trys: [],
85
85
  ops: []
86
86
  };
87
- return(g = {
87
+ return g = {
88
88
  next: verb(0),
89
89
  "throw": verb(1),
90
90
  "return": verb(2)
91
91
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
92
92
  return this;
93
- }), g);
93
+ }), g;
94
94
  function verb(n) {
95
95
  return function(v) {
96
96
  return step([
@@ -172,7 +172,6 @@ function _ts_generator(thisArg, body) {
172
172
  import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
173
173
  /**
174
174
  * Creates a JWT encoding function which transforms the provided token-value associations as a unsecured JWT format https://tools.ietf.org/html/rfc7519#section-6
175
- *
176
175
  * @param applicationId Identifier of the application
177
176
  * @param expirationDelay Delay after which the generated JWT has to be considered obsolete (in seconds)
178
177
  */ export function createJwtPiiEncoder(applicationId) {
@@ -195,7 +194,6 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
195
194
  }
196
195
  /**
197
196
  * Creates a JWE encoding function which transforms the provided token-value associations into a secured JWT format https://tools.ietf.org/html/rfc7519
198
- *
199
197
  * @param applicationId Identifier of the application
200
198
  * @param expirationDelay Delay after which the generated JWE has to be considered obsolete (in seconds). Default to 3600s.
201
199
  * @param key Object containing the public key and its id
@@ -227,24 +225,23 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
227
225
  * If the key parameter is specified, the generated token will be encrypted.
228
226
  *
229
227
  * There are two modes:
230
- * - JWT Encoder, which encodes a token with the provided values
231
- * - DeepLink, which just appends a provided token to the headers.
232
- * It is used if deepLinkOptions is provided, overriding the JWT Encoder.
228
+ * - JWT Encoder, which encodes a token with the provided values
229
+ * - DeepLink, which just appends a provided token to the headers.
230
+ * It is used if deepLinkOptions is provided, overriding the JWT Encoder.
233
231
  *
234
232
  * Note that the tokenization should be enabled in the ApiClient to use the JWT Encoder mode but it's
235
233
  * not necessary for the DeepLink mode.
236
- *
237
- *
238
234
  * @example JWT
239
- *
235
+ *```typescript
240
236
  * const client = new ApiFetchClient({
241
237
  * basePath: 'https://my.proxy.address'
242
238
  * requestPlugins: [
243
239
  * new PiiTokenizerRequest({applicationId: 'EXAMPLE_JWT'})
244
240
  * ]
245
241
  * })
242
+ * ```
246
243
  * @example JWE without publicProperties
247
- *
244
+ * ```typescript
248
245
  * const client = new ApiFetchClient({
249
246
  * basePath: 'https://my.proxy.address'
250
247
  * requestPlugins: [
@@ -253,8 +250,9 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
253
250
  * new PiiTokenizerRequest({applicationId: 'EXAMPLE_JWE', key: {publickKey: myPublicKey, keyId: myKeyId}})
254
251
  * ]
255
252
  * })
253
+ * ```
256
254
  * @example JWE with publicProperties
257
- *
255
+ * ```typescript
258
256
  * const client = new ApiFetchClient({
259
257
  * basePath: 'https://my.proxy.address'
260
258
  * requestPlugins: [
@@ -262,8 +260,9 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
262
260
  * new PiiTokenizerRequest({applicationId: 'EXAMPLE_JWE', key: {publickKey: myPublicKey, keyId: myKeyId}, publicProperties: ['iss', 'sub', 'myPublicProperty']})
263
261
  * ]
264
262
  * })
263
+ * ```
265
264
  * @example DeepLink
266
- *
265
+ * ```typescript
267
266
  * const client = new ApiFetchClient({
268
267
  * basePath: 'https://my.proxy.address'
269
268
  * requestPlugins: [
@@ -277,6 +276,7 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
277
276
  * // Call with DeepLink, the parameters are passed as tokens
278
277
  * // DeepLink Options are provided, hence DeepLink will be used
279
278
  * await cartApi.retrieveCart({cartId: '$cartId$', lastName: '$lastName$'}, {deepLinkOptions})
279
+ * ```
280
280
  */ export var PiiTokenizerRequest = /*#__PURE__*/ function() {
281
281
  "use strict";
282
282
  function PiiTokenizerRequest(options) {
@@ -302,9 +302,9 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
302
302
  key: "appendEncodedToken",
303
303
  value: /**
304
304
  * Append the generated token based on the request options to the tokens header
305
- *
306
305
  * @param requestOptions Request options to generate the token
307
- */ function appendEncodedToken(requestOptions) {
306
+ * @param logger Logger (optional, fallback to console logger if undefined)
307
+ */ function appendEncodedToken(requestOptions, logger) {
308
308
  var _this = this;
309
309
  return _async_to_generator(function() {
310
310
  var e;
@@ -329,8 +329,7 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
329
329
  case 2:
330
330
  e = _state.sent();
331
331
  if (_this.silent) {
332
- // eslint-disable-next-line no-console
333
- console.error("Couldn't encode the token");
332
+ (logger || console).error("Couldn't encode the token");
334
333
  } else {
335
334
  throw new Error("Couldn't encode the token");
336
335
  }
@@ -349,7 +348,7 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
349
348
  },
350
349
  {
351
350
  key: "load",
352
- value: function load() {
351
+ value: /** @inheritdoc */ function load(context) {
353
352
  var _this = this;
354
353
  return {
355
354
  transform: function() {
@@ -376,8 +375,7 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
376
375
  3,
377
376
  2
378
377
  ];
379
- // eslint-disable-next-line no-console
380
- console.error("No tokenized options found. Please make sure tokenization is enabled on your ApiClient");
378
+ ((context === null || context === void 0 ? void 0 : context.logger) || console).error("No tokenized options found. Please make sure tokenization is enabled on your ApiClient");
381
379
  return [
382
380
  3,
383
381
  4
@@ -391,7 +389,7 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
391
389
  data.queryParams = _object_spread({}, data.queryParams, data.tokenizedOptions.queryParams);
392
390
  return [
393
391
  4,
394
- _this.appendEncodedToken(data)
392
+ _this.appendEncodedToken(data, context === null || context === void 0 ? void 0 : context.logger)
395
393
  ];
396
394
  case 3:
397
395
  token1 = _state.sent();