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

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
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "ApiAngularClient", {
8
8
  return ApiAngularClient;
9
9
  }
10
10
  });
11
- var _exception = require("../plugins/exception");
12
- var _reviver = require("../plugins/reviver");
13
11
  var _apihelpers = require("../fwk/api.helpers");
14
12
  var _errors = require("../fwk/errors");
13
+ var _exception = require("../plugins/exception");
14
+ var _reviver = require("../plugins/reviver");
15
15
  function _array_like_to_array(arr, len) {
16
16
  if (len == null || len > arr.length) len = arr.length;
17
17
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -81,6 +81,13 @@ function _define_property(obj, key, value) {
81
81
  }
82
82
  return obj;
83
83
  }
84
+ function _instanceof(left, right) {
85
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
86
+ return !!right[Symbol.hasInstance](left);
87
+ } else {
88
+ return left instanceof right;
89
+ }
90
+ }
84
91
  function _iterable_to_array(iter) {
85
92
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
86
93
  }
@@ -427,6 +434,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
427
434
  next: function(res) {
428
435
  return data = res;
429
436
  },
437
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors -- subscription forwards the error from the httpRequest to asyncResponse promise
430
438
  error: function(err) {
431
439
  return reject(err);
432
440
  },
@@ -437,7 +445,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
437
445
  metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
438
446
  metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
439
447
  subscription.unsubscribe();
440
- reject(metadataSignal.reason);
448
+ reject(_instanceof(metadataSignal.reason, Error) ? metadataSignal.reason : new Error(metadataSignal.reason.toString()));
441
449
  });
442
450
  });
443
451
  return [
@@ -464,7 +472,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
464
472
  4
465
473
  ];
466
474
  case 4:
467
- // eslint-disable-next-line no-console
475
+ // 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.
468
476
  reviver = (0, _apihelpers.getResponseReviver)(revivers, response, operationId, {
469
477
  disableFallback: _this.options.disableFallback,
470
478
  log: console.error
@@ -96,8 +96,7 @@ var DEFAULT_OPTIONS = {
96
96
  * Determine if the given value is a promise
97
97
  * @deprecated Use the one exposed by {@link @ama-sdk/client-beacon}, will be removed in v13
98
98
  * @param value The value to test
99
- */ // NOTE: the `extends unknown` is required for ESM build with TSC
100
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
99
+ */ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint -- the `extends unknown` is required for ESM build with TSC
101
100
  var isPromise = function(value) {
102
101
  return _instanceof(value, Promise);
103
102
  };
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "ApiFetchClient", {
8
8
  return ApiFetchClient;
9
9
  }
10
10
  });
11
- var _exception = require("../plugins/exception");
12
- var _reviver = require("../plugins/reviver");
13
11
  var _apihelpers = require("../fwk/api.helpers");
14
12
  var _errors = require("../fwk/errors");
13
+ var _exception = require("../plugins/exception");
14
+ var _reviver = require("../plugins/reviver");
15
15
  function _array_like_to_array(arr, len) {
16
16
  if (len == null || len > arr.length) len = arr.length;
17
17
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -417,17 +417,12 @@ var ApiFetchClient = /*#__PURE__*/ function() {
417
417
  case 2:
418
418
  canStart = _state.sent();
419
419
  isCanceledBy = canStart.indexOf(false);
420
- if (isCanceledBy >= 0) {
421
- // One of the fetch plugins cancelled the execution of the call
422
- asyncResponse = Promise.reject(new _errors.CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy, _this.options.fetchPlugins[isCanceledBy], {
423
- apiName: apiName,
424
- operationId: operationId,
425
- url: url,
426
- origin: origin
427
- }));
428
- } else {
429
- asyncResponse = fetch(url, options);
430
- }
420
+ asyncResponse = isCanceledBy === -1 ? fetch(url, options) : Promise.reject(new _errors.CanceledCallError("Is canceled by the plugin ".concat(isCanceledBy), isCanceledBy, _this.options.fetchPlugins[isCanceledBy], {
421
+ apiName: apiName,
422
+ operationId: operationId,
423
+ url: url,
424
+ origin: origin
425
+ }));
431
426
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
432
427
  try {
433
428
  for(_iterator = loadedPlugins[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
@@ -466,16 +461,12 @@ var ApiFetchClient = /*#__PURE__*/ function() {
466
461
  ];
467
462
  case 5:
468
463
  e = _state.sent();
469
- if (_instanceof(e, _errors.CanceledCallError)) {
470
- exception = e;
471
- } else {
472
- exception = new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
473
- apiName: apiName,
474
- operationId: operationId,
475
- url: url,
476
- origin: origin
477
- });
478
- }
464
+ exception = _instanceof(e, _errors.CanceledCallError) ? e : new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
465
+ apiName: apiName,
466
+ operationId: operationId,
467
+ url: url,
468
+ origin: origin
469
+ });
479
470
  return [
480
471
  3,
481
472
  6
@@ -491,7 +482,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
491
482
  origin: origin
492
483
  });
493
484
  }
494
- // eslint-disable-next-line no-console
485
+ // 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.
495
486
  reviver = (0, _apihelpers.getResponseReviver)(revivers, response, operationId, {
496
487
  disableFallback: _this.options.disableFallback,
497
488
  log: console.error
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable no-console */ "use strict";
1
+ /* eslint-disable no-console -- only using the reference */ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
@@ -112,8 +112,8 @@ function prepareUrl(url) {
112
112
  }).map(function(name) {
113
113
  return "".concat(name, "=").concat(queryParameters[name]);
114
114
  }).join('&');
115
- var paramsPrefix = url.indexOf('?') > -1 ? '&' : '?';
116
- return url + (!queryPart ? '' : paramsPrefix + queryPart);
115
+ var paramsPrefix = url.includes('?') ? '&' : '?';
116
+ return url + (queryPart ? paramsPrefix + queryPart : '');
117
117
  }
118
118
  function extractQueryParams(data, names) {
119
119
  return names.filter(function(name) {
@@ -125,29 +125,29 @@ function extractQueryParams(data, names) {
125
125
  }, {});
126
126
  }
127
127
  function filterUndefinedValues(object) {
128
- return !object ? {} : Object.keys(object).filter(function(objectKey) {
128
+ return object ? Object.keys(object).filter(function(objectKey) {
129
129
  return typeof object[objectKey] !== 'undefined';
130
130
  }).reduce(function(acc, objectKey) {
131
131
  acc[objectKey] = object[objectKey];
132
132
  return acc;
133
- }, {});
133
+ }, {}) : {};
134
134
  }
135
135
  function processFormData(data, type) {
136
136
  var encodedData;
137
- /* eslint-disable guard-for-in */ if (type === 'multipart/form-data') {
137
+ if (type === 'multipart/form-data') {
138
138
  var formData = new FormData();
139
- for(var i in data){
140
- formData.append(i, data[i]);
141
- }
139
+ Object.entries(data).forEach(function(param) {
140
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
141
+ return formData.append(key, value);
142
+ });
142
143
  encodedData = formData;
143
144
  } else {
144
- var formData1 = [];
145
- for(var i1 in data){
146
- formData1.push("".concat(i1, "=").concat(encodeURIComponent(data[i1])));
147
- }
148
- encodedData = formData1.join('&');
145
+ encodedData = Object.entries(data).map(function(param) {
146
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
147
+ return "".concat(key, "=").concat(encodeURIComponent(value));
148
+ }).join('&');
149
149
  }
150
- /* eslint-enable guard-for-in */ return encodedData;
150
+ return encodedData;
151
151
  }
152
152
  function computePiiParameterTokens(piiParameterNames) {
153
153
  return piiParameterNames.reduce(function(tokens, parameterName) {
@@ -174,24 +174,20 @@ function tokenizeRequestOptions(tokenizedUrl, queryParameters, piiParamTokens, d
174
174
  queryParams: tokenizedQueryParams
175
175
  };
176
176
  }
177
- function getResponseReviver(revivers, response, // eslint-disable-next-line no-console
178
- endpoint) {
179
- var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
180
- disableFallback: false,
181
- log: console.error
182
- };
177
+ function getResponseReviver(revivers, response, endpoint, options) {
178
+ // eslint-disable-next-line no-console -- set as default value
179
+ 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;
183
180
  var logPrefix = "API status code error for ".concat(endpoint || 'unknown', " endpoint");
184
- var logMsg = options.log || function() {};
185
181
  if (!response || !response.ok) {
186
182
  return undefined;
187
183
  }
188
184
  if (typeof revivers === 'function' || typeof revivers === 'undefined') {
189
185
  return revivers;
190
186
  }
191
- if (response.status && Object.keys(revivers).indexOf("".concat(response.status)) > -1) {
187
+ if (response.status && Object.keys(revivers).includes("".concat(response.status))) {
192
188
  return revivers[response.status];
193
189
  }
194
- if (options === null || options === void 0 ? void 0 : options.disableFallback) {
190
+ if (disableFallback) {
195
191
  logMsg("".concat(logPrefix, " - Missing ").concat(response.status, " from API specification - fallback is deactivated, no revive will run on this response"));
196
192
  return undefined;
197
193
  }
@@ -211,7 +207,7 @@ endpoint) {
211
207
  statusCode: Number.MAX_SAFE_INTEGER,
212
208
  reviver: undefined
213
209
  });
214
- var fallbackLog = Number.MAX_SAFE_INTEGER !== fallback.statusCode ? "Fallback to ".concat(fallback.statusCode, "'s reviver") : 'No fallback found';
210
+ var fallbackLog = Number.MAX_SAFE_INTEGER === fallback.statusCode ? 'No fallback found' : "Fallback to ".concat(fallback.statusCode, "'s reviver");
215
211
  logMsg("".concat(logPrefix, " - Unknown ").concat(response.status || 'undefined', " code returned by the API - ").concat(fallbackLog));
216
212
  return fallback.reviver;
217
213
  }
@@ -9,5 +9,6 @@ Object.defineProperty(exports, "isApiClient", {
9
9
  }
10
10
  });
11
11
  function isApiClient(client) {
12
- return client && !!client.options && typeof client.extractQueryParams === 'function' && typeof client.getRequestOptions === 'function' && typeof client.prepareUrl === 'function' && typeof client.processFormData === 'function' && typeof client.processCall === 'function';
12
+ var apiClient = client;
13
+ return !!apiClient && !!apiClient.options && typeof apiClient.extractQueryParams === 'function' && typeof apiClient.getRequestOptions === 'function' && typeof apiClient.prepareUrl === 'function' && typeof apiClient.processFormData === 'function' && typeof apiClient.processCall === 'function';
13
14
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./base-api-constructor"), exports);
6
5
  _export_star(require("./api-client"), exports);
6
+ _export_star(require("./base-api-constructor"), exports);
7
7
  function _export_star(from, to) {
8
8
  Object.keys(from).forEach(function(k) {
9
9
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
package/cjs/fwk/date.js CHANGED
@@ -1,4 +1,5 @@
1
- /* eslint-disable */ "use strict";
1
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
2
+ "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
4
5
  });
@@ -187,27 +188,23 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
187
188
  args[_key] = arguments[_key];
188
189
  }
189
190
  _class_call_check(this, CommonDate);
190
- if (args) {
191
- if (typeof args[0] === 'string') {
192
- var idxT = args[0].lastIndexOf('T');
193
- // TZD = time zone designator (Z or +hh:mm or -hh:mm)
194
- var idx = args[0].lastIndexOf('Z');
195
- if (idx < 0) {
196
- idx = args[0].lastIndexOf('+');
197
- }
198
- if (idx < 0 && idxT > 0) {
199
- var relativeIdx = args[0].substring(idxT).lastIndexOf('-');
200
- idx = relativeIdx > 0 ? relativeIdx + idxT : relativeIdx;
201
- }
202
- if (idx > 0) {
203
- args[0] = args[0].substring(0, idx);
204
- }
205
- var TIME_ZONE_OFFSET = _construct(Date, _to_consumable_array(args)).getTimezoneOffset();
206
- if (idxT > 0) {
207
- 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)));
208
- }
209
- } else if (_instanceof(args[0], CommonDate)) {
210
- args[0] = args[0];
191
+ if (args && typeof args[0] === 'string') {
192
+ var idxT = args[0].lastIndexOf('T');
193
+ // TZD = time zone designator (Z or +hh:mm or -hh:mm)
194
+ var idx = args[0].lastIndexOf('Z');
195
+ if (idx < 0) {
196
+ idx = args[0].lastIndexOf('+');
197
+ }
198
+ if (idx < 0 && idxT > 0) {
199
+ var relativeIdx = args[0].substring(idxT).lastIndexOf('-');
200
+ idx = relativeIdx > 0 ? relativeIdx + idxT : relativeIdx;
201
+ }
202
+ if (idx > 0) {
203
+ args[0] = args[0].substring(0, idx);
204
+ }
205
+ var TIME_ZONE_OFFSET = _construct(Date, _to_consumable_array(args)).getTimezoneOffset();
206
+ if (idxT > 0) {
207
+ 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)));
211
208
  }
212
209
  }
213
210
  return _call_super(this, CommonDate, _to_consumable_array(args));
@@ -233,7 +230,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
233
230
  args[_key] = arguments[_key];
234
231
  }
235
232
  _class_call_check(this, Date1);
236
- if (args && typeof args[0] === 'string' && args[0].lastIndexOf('T') < 0) {
233
+ if (args && typeof args[0] === 'string' && !args[0].includes('T')) {
237
234
  args[0] = "".concat(args[0], "T00:00:00Z");
238
235
  } else if (_instanceof(args[0], _NativeDateClass)) {
239
236
  args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
@@ -245,7 +242,8 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
245
242
  key: "_Date",
246
243
  value: /**
247
244
  * To ensure that users cannot use a standard Date instead of utils.Date
248
- */ function _Date() {}
245
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
246
+ function _Date() {}
249
247
  },
250
248
  {
251
249
  key: "toJSON",
@@ -259,9 +257,8 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
259
257
  key: "equals",
260
258
  value: /**
261
259
  * Compare if two dates are equals.
262
- *
263
260
  * @param {Date} date the date to compare
264
- * @return {boolean} true if the dates are equals.
261
+ * @returns {boolean} true if the dates are equals.
265
262
  */ function equals(date) {
266
263
  if (!date) {
267
264
  return false;
@@ -280,6 +277,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
280
277
  args[_key] = arguments[_key];
281
278
  }
282
279
  _class_call_check(this, DateTime);
280
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- type is explicitly `any`
283
281
  return _call_super(this, DateTime, _to_consumable_array(args));
284
282
  }
285
283
  _create_class(DateTime, [
@@ -287,7 +285,8 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
287
285
  key: "_DateTime",
288
286
  value: /**
289
287
  * To ensure that users cannot use a standard Date instead of utils.DateTime
290
- */ function _DateTime() {}
288
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention -- keep to not introduce breaking change
289
+ function _DateTime() {}
291
290
  }
292
291
  ]);
293
292
  return DateTime;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  var _date = require("./date");
6
6
  describe('DateTime', function() {
7
7
  it('should support timestamp', function() {
8
- var ts = new Date().getTime();
8
+ var ts = Date.now();
9
9
  var dateUtils = new _date.utils.DateTime(ts);
10
10
  expect(dateUtils.getTime()).toEqual(ts);
11
11
  });
@@ -19,6 +19,7 @@ describe('DateTime', function() {
19
19
  });
20
20
  it('should support json conversions', function() {
21
21
  var originalDate = new _date.utils.DateTime(new Date());
22
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- we test the JSON conversion
22
23
  var jsonDate = JSON.parse(JSON.stringify(originalDate));
23
24
  expect(new _date.utils.DateTime(jsonDate)).toEqual(originalDate);
24
25
  });
@@ -56,7 +57,7 @@ describe('DateTime', function() {
56
57
  });
57
58
  describe('Date', function() {
58
59
  it('should support timestamp', function() {
59
- var ts = new Date().getTime();
60
+ var ts = Date.now();
60
61
  var dateUtils = new _date.utils.Date(ts);
61
62
  expect(dateUtils.getTime()).toEqual(ts);
62
63
  });
@@ -70,6 +71,7 @@ describe('Date', function() {
70
71
  });
71
72
  it('should support json conversions', function() {
72
73
  var originalDate = new _date.utils.Date(new Date());
74
+ // eslint-disable-next-line unicorn/prefer-structured-clone -- we test the JSON conversion
73
75
  var jsonDate = JSON.parse(JSON.stringify(originalDate));
74
76
  expect(new _date.utils.Date(jsonDate)).toEqual(originalDate);
75
77
  });
@@ -1,5 +1,4 @@
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
- "use strict";
1
+ /** Type helper to ignore the constraint on literal union type (enum) of an SDK model */ "use strict";
3
2
  Object.defineProperty(exports, "__esModule", {
4
3
  value: true
5
4
  });
package/cjs/fwk/index.js CHANGED
@@ -11,7 +11,7 @@ _export_star(require("./errors"), exports);
11
11
  _export_star(require("./ignore-enum.type"), exports);
12
12
  _export_star(require("./logger"), exports);
13
13
  _export_star(require("./mocks/index"), exports);
14
- _export_star(require("./Reviver"), exports);
14
+ _export_star(require("./reviver"), exports);
15
15
  function _export_star(from, to) {
16
16
  Object.keys(from).forEach(function(k) {
17
17
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -188,19 +188,19 @@ function _ts_generator(thisArg, body) {
188
188
  }
189
189
  /**
190
190
  * a new call is detected thanks to the timestamp printed by ALF on a new line, ex: "2021/12/16 18:21:28.312472 "
191
- */ var logNewCallRegex = RegExp(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}\b/gm);
191
+ */ var logNewCallRegex = new RegExp(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}\b/gm);
192
192
  /**
193
193
  * the correlation Id is printed this way by ALF, ex: CorrID=0001W37ZH480AJ,
194
- */ var correlationIdRegex = RegExp(/CorrID=([^,]*),/);
194
+ */ var correlationIdRegex = new RegExp(/CorrID=([^,]*),/);
195
195
  /**
196
196
  * a request is logged with its HTTP method and the path targetted on a new line, ex: "GET /1ASIUAIRFAC/v2/shopping..."
197
- */ var requestRegex = RegExp(/^(POST|GET|PATCH|DELETE) \/([^\s]*)/m);
197
+ */ var requestRegex = new RegExp(/^(POST|GET|PATCH|DELETE) \/(\S*)/m);
198
198
  /**
199
199
  * a request is logged with its HTTP version and the HTTP status on a new line, ex: "HTTP/1.1 200 OK"
200
- */ var responseRegex = RegExp(/^(HTTP\/1.1 \d{3})/m);
200
+ */ var responseRegex = new RegExp(/^(HTTP\/1.1 \d{3})/m);
201
201
  /**
202
202
  * the response data is logged with its JSON content on a new line
203
- */ var requestResponseJsonRegexp = RegExp(/(^{.*}$)/m);
203
+ */ var requestResponseJsonRegexp = new RegExp(/(^{.*}$)/m);
204
204
  /**
205
205
  * Split the logs
206
206
  * @param log alf log
@@ -220,7 +220,7 @@ function _ts_generator(thisArg, body) {
220
220
  if (match && match[1] && match[2]) {
221
221
  // the match looks like this 1ASIUAIRFAC/v2/shopping/carts/19DXNCKB931CYX3S?refresh=true
222
222
  // so we remove the SAP information at the beginning and URL parameters at the end if any
223
- var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].indexOf('?') > -1 ? match[2].indexOf('?') : match[2].length);
223
+ var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].includes('?') ? match[2].indexOf('?') : match[2].length);
224
224
  var method = match[1];
225
225
  var pathObject = (0, _helpers.getPath)(requestUrl, operationAdapter, method);
226
226
  if (pathObject) {
@@ -327,6 +327,7 @@ function _ts_generator(thisArg, body) {
327
327
  mockMap[alfCall.operationId] = [];
328
328
  }
329
329
  mockMap[alfCall.operationId].push({
330
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- type is explicitly `any`
330
331
  mockData: alfCall.response ? JSON.parse(alfCall.response) : ''
331
332
  });
332
333
  return mockMap;
@@ -174,10 +174,10 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
174
174
  _define_property(this, "mockFactory", void 0);
175
175
  this.pathObjects = pathObjects;
176
176
  this.mocks = {};
177
- if (typeof mockMap !== 'function') {
178
- this.mocks = mockMap;
179
- } else {
177
+ if (typeof mockMap === 'function') {
180
178
  this.mockFactory = mockMap;
179
+ } else {
180
+ this.mocks = mockMap;
181
181
  }
182
182
  }
183
183
  _create_class(BaseMockAdapter, [
@@ -45,12 +45,12 @@ function getPath(requestUrl, pathObjects, method) {
45
45
  return newMatches;
46
46
  }, []);
47
47
  var lastIndex = -1;
48
- var nextIndex = -1;
49
48
  while(matches.length > 1){
50
- matches = matches.reduce(function(newMatches, match) {
49
+ var result = matches.reduce(function(param, match) {
50
+ var newMatches = param.matches, nextIndex = param.nextIndex;
51
51
  var newIndex = match.segments.findIndex(function(segment) {
52
52
  return segment.startsWith('{') && segment.endsWith('}');
53
- }, lastIndex + 1);
53
+ });
54
54
  // Complete static match so use some value that can't be exceeded
55
55
  if (newIndex === -1) {
56
56
  newIndex = Infinity;
@@ -63,11 +63,19 @@ function getPath(requestUrl, pathObjects, method) {
63
63
  } else if (newIndex === nextIndex) {
64
64
  newMatches.push(match);
65
65
  }
66
- return newMatches;
67
- }, []);
66
+ return {
67
+ matches: newMatches,
68
+ nextIndex: nextIndex
69
+ };
70
+ }, {
71
+ matches: [],
72
+ nextIndex: -1
73
+ });
74
+ var next = result.nextIndex;
75
+ matches = result.matches;
68
76
  // At this point we have tried to filter the matches but there are multiple matches that are identical and cannot
69
77
  // be filtered further. Trying to filter on the HTTP method if provided, then choose the first match.
70
- if (lastIndex === nextIndex) {
78
+ if (lastIndex === next) {
71
79
  if (method) {
72
80
  // Try to filter the multiple matches based on the HTTP method
73
81
  matches.splice(0, matches.findIndex(function(match) {
@@ -76,7 +84,7 @@ function getPath(requestUrl, pathObjects, method) {
76
84
  }
77
85
  matches.splice(1);
78
86
  }
79
- lastIndex = nextIndex;
87
+ lastIndex = next;
80
88
  }
81
89
  return matches.length > 0 ? pathObjects[matches[0].index] : undefined;
82
90
  }
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  _export_star(require("./alf-mock-adapter"), exports);
6
+ _export_star(require("./base-mock-adapter"), exports);
6
7
  _export_star(require("./encoded-api-request"), exports);
7
- _export_star(require("./mock-adapter"), exports);
8
+ _export_star(require("./helpers"), exports);
8
9
  _export_star(require("./mock"), exports);
10
+ _export_star(require("./mock-adapter"), exports);
9
11
  _export_star(require("./operation"), exports);
10
12
  _export_star(require("./path-object"), exports);
11
- _export_star(require("./base-mock-adapter"), exports);
12
- _export_star(require("./helpers"), exports);
13
13
  _export_star(require("./random-mock-adapter"), exports);
14
14
  _export_star(require("./sequential-mock-adapter"), exports);
15
15
  function _export_star(from, to) {
@@ -26,8 +26,7 @@ function reviveMap(data) {
26
26
  }
27
27
  var revived = {};
28
28
  for(var key in data){
29
- // eslint-disable-next-line no-prototype-builtins
30
- if (data.hasOwnProperty(key)) {
29
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
31
30
  revived[key] = reviver(data[key], dictionaries, options);
32
31
  }
33
32
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- var _Reviver = require("./Reviver");
5
+ var _reviver = require("./reviver");
6
6
  describe('Revivers :', function() {
7
7
  it('reviveDictionarizedArray', function() {
8
8
  var dictionary = {
@@ -13,13 +13,13 @@ describe('Revivers :', function() {
13
13
  p2: 'v2'
14
14
  }
15
15
  };
16
- expect((0, _Reviver.reviveDictionarizedArray)(undefined, {}, function(data) {
16
+ expect((0, _reviver.reviveDictionarizedArray)(undefined, {}, function(data) {
17
17
  return data;
18
18
  })).toBeUndefined();
19
- expect((0, _Reviver.reviveDictionarizedArray)([], {}, function(data) {
19
+ expect((0, _reviver.reviveDictionarizedArray)([], {}, function(data) {
20
20
  return data;
21
21
  })).toEqual({});
22
- expect((0, _Reviver.reviveDictionarizedArray)([
22
+ expect((0, _reviver.reviveDictionarizedArray)([
23
23
  'id1',
24
24
  'id2'
25
25
  ], {}, function(data) {
@@ -28,10 +28,10 @@ describe('Revivers :', function() {
28
28
  id1: undefined,
29
29
  id2: undefined
30
30
  });
31
- expect((0, _Reviver.reviveDictionarizedArray)([], dictionary, function(data) {
31
+ expect((0, _reviver.reviveDictionarizedArray)([], dictionary, function(data) {
32
32
  return data;
33
33
  })).toEqual({});
34
- var result = (0, _Reviver.reviveDictionarizedArray)([
34
+ var result = (0, _reviver.reviveDictionarizedArray)([
35
35
  'id1',
36
36
  'id2'
37
37
  ], dictionary, function(data) {
@@ -49,7 +49,7 @@ describe('Revivers :', function() {
49
49
  var options = {
50
50
  logger: jest.fn()
51
51
  };
52
- (0, _Reviver.reviveArray)([
52
+ (0, _reviver.reviveArray)([
53
53
  1
54
54
  ], null, reviver, options);
55
55
  expect(reviver).toHaveBeenCalledWith(1, null, options);
@@ -62,7 +62,7 @@ describe('Revivers :', function() {
62
62
  var dictionary = {
63
63
  key: 'test'
64
64
  };
65
- (0, _Reviver.reviveDictionarizedArray)([
65
+ (0, _reviver.reviveDictionarizedArray)([
66
66
  'key'
67
67
  ], dictionary, reviver, options);
68
68
  expect(reviver).toHaveBeenCalledWith('test', dictionary, options);
@@ -75,7 +75,7 @@ describe('Revivers :', function() {
75
75
  var dictionary = {
76
76
  key: 'test'
77
77
  };
78
- (0, _Reviver.reviveMap)([
78
+ (0, _reviver.reviveMap)([
79
79
  'key'
80
80
  ], dictionary, reviver, options);
81
81
  expect(reviver).toHaveBeenCalledWith('key', dictionary, options);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./additional-params.request"), exports);
6
5
  _export_star(require("./additional-params-sync.request"), exports);
6
+ _export_star(require("./additional-params.request"), exports);
7
7
  function _export_star(from, to) {
8
8
  Object.keys(from).forEach(function(k) {
9
9
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {