@ama-sdk/core 11.0.0-next.0 → 11.0.0-next.1

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 (268) hide show
  1. package/README.md +4 -1
  2. package/cjs/clients/api-angular-client.js +45 -23
  3. package/cjs/clients/api-beacon-client.js +64 -20
  4. package/cjs/clients/api-fetch-client.js +66 -21
  5. package/cjs/fwk/Reviver.js +7 -7
  6. package/cjs/fwk/api.helper.spec.js +20 -20
  7. package/cjs/fwk/api.helpers.js +14 -14
  8. package/cjs/fwk/core/api-client.js +1 -1
  9. package/cjs/fwk/core/base-api-constructor.js +1 -1
  10. package/cjs/fwk/date.js +9 -9
  11. package/cjs/fwk/date.spec.js +25 -25
  12. package/cjs/fwk/errors.js +3 -3
  13. package/cjs/fwk/mocks/alf-mock-adapter.js +4 -4
  14. package/cjs/fwk/mocks/base-mock-adapter.js +2 -2
  15. package/cjs/fwk/mocks/helpers.js +3 -3
  16. package/cjs/fwk/reviver.spec.js +46 -10
  17. package/cjs/plugins/additional-params/additional-params-sync.request.js +2 -2
  18. package/cjs/plugins/additional-params/additional-params.request.js +3 -3
  19. package/cjs/plugins/additional-params/additional-params.spec.js +30 -30
  20. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  21. package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +13 -13
  22. package/cjs/plugins/api-key/api-key.request.js +2 -2
  23. package/cjs/plugins/api-key/api-key.spec.js +11 -11
  24. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +6 -5
  25. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +33 -33
  26. package/cjs/plugins/client-facts/client-facts.request.js +3 -3
  27. package/cjs/plugins/client-facts/client-facts.spec.js +27 -27
  28. package/cjs/plugins/concurrent/concurrent.fetch.js +1 -0
  29. package/cjs/plugins/concurrent/concurrent.spec.js +4 -4
  30. package/cjs/plugins/custom-info/custom-info.spec.js +15 -15
  31. package/cjs/plugins/exception/exception.reply.js +2 -2
  32. package/cjs/plugins/exception/exception.spec.js +15 -15
  33. package/cjs/plugins/fetch-cache/fetch-cache.request.js +4 -4
  34. package/cjs/plugins/fetch-cache/fetch-cache.spec.js +20 -20
  35. package/cjs/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  36. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +8 -8
  37. package/cjs/plugins/json-token/json-token.reply.js +5 -5
  38. package/cjs/plugins/json-token/json-token.request.js +4 -4
  39. package/cjs/plugins/json-token/json-token.spec.js +24 -24
  40. package/cjs/plugins/keepalive/keepalive.request.js +2 -2
  41. package/cjs/plugins/keepalive/keepalive.spec.js +4 -4
  42. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +32 -40
  43. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +30 -26
  44. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +3 -3
  45. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  46. package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
  47. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +28 -28
  48. package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
  49. package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +9 -9
  50. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +11 -11
  51. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +94 -94
  52. package/cjs/plugins/raw-response-info/raw-response-info.spec.js +12 -12
  53. package/cjs/plugins/retry/retry.spec.js +20 -20
  54. package/cjs/plugins/reviver/reviver.reply.js +35 -2
  55. package/cjs/plugins/reviver/reviver.spec.js +6 -6
  56. package/cjs/plugins/session-id/session-id.request.js +7 -6
  57. package/cjs/plugins/session-id/session-id.spec.js +13 -13
  58. package/cjs/plugins/si-token/si-token.spec.js +9 -9
  59. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +4 -4
  60. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +44 -44
  61. package/cjs/plugins/timeout/timeout.fetch.js +12 -10
  62. package/cjs/plugins/timeout/timeout.spec.js +13 -13
  63. package/cjs/plugins/url-rewrite/url-rewrite.spec.js +9 -9
  64. package/cjs/plugins/wait-for/wait-for.spec.js +9 -9
  65. package/cjs/utils/crypto.js +14 -14
  66. package/cjs/utils/generic-api.js +253 -0
  67. package/cjs/utils/index.js +1 -0
  68. package/cjs/utils/json-token.js +30 -30
  69. package/cjs/utils/json-token.spec.js +31 -31
  70. package/cli/files-pack.cjs +12 -12
  71. package/cli/files-pack.cjs.map +1 -1
  72. package/esm2015/clients/api-angular-client.js +49 -27
  73. package/esm2015/clients/api-beacon-client.js +65 -21
  74. package/esm2015/clients/api-fetch-client.js +70 -25
  75. package/esm2015/clients/index.js +2 -2
  76. package/esm2015/fwk/Reviver.js +10 -7
  77. package/esm2015/fwk/api.helper.spec.js +21 -21
  78. package/esm2015/fwk/api.helpers.js +14 -14
  79. package/esm2015/fwk/core/api-client.js +1 -1
  80. package/esm2015/fwk/core/base-api-constructor.js +1 -1
  81. package/esm2015/fwk/core/index.js +2 -2
  82. package/esm2015/fwk/date.js +9 -9
  83. package/esm2015/fwk/date.spec.js +26 -26
  84. package/esm2015/fwk/errors.js +3 -3
  85. package/esm2015/fwk/index.js +10 -10
  86. package/esm2015/fwk/mocks/alf-mock-adapter.js +6 -6
  87. package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
  88. package/esm2015/fwk/mocks/helpers.js +3 -3
  89. package/esm2015/fwk/mocks/index.js +10 -10
  90. package/esm2015/fwk/mocks/random-mock-adapter.js +1 -1
  91. package/esm2015/fwk/mocks/sequential-mock-adapter.js +1 -1
  92. package/esm2015/fwk/reviver.spec.js +47 -11
  93. package/esm2015/plugins/additional-params/additional-params-sync.request.js +3 -3
  94. package/esm2015/plugins/additional-params/additional-params.request.js +3 -3
  95. package/esm2015/plugins/additional-params/additional-params.spec.js +32 -32
  96. package/esm2015/plugins/additional-params/index.js +2 -2
  97. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  98. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +14 -14
  99. package/esm2015/plugins/api-configuration-override/index.js +1 -1
  100. package/esm2015/plugins/api-key/api-key.request.js +2 -2
  101. package/esm2015/plugins/api-key/api-key.spec.js +12 -12
  102. package/esm2015/plugins/api-key/index.js +1 -1
  103. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +6 -6
  104. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +34 -34
  105. package/esm2015/plugins/bot-protection-fingerprint/index.js +1 -1
  106. package/esm2015/plugins/client-facts/client-facts.request.js +4 -4
  107. package/esm2015/plugins/client-facts/client-facts.spec.js +28 -28
  108. package/esm2015/plugins/client-facts/index.js +1 -1
  109. package/esm2015/plugins/concurrent/concurrent.fetch.js +1 -0
  110. package/esm2015/plugins/concurrent/concurrent.spec.js +5 -5
  111. package/esm2015/plugins/concurrent/index.js +1 -1
  112. package/esm2015/plugins/core/index.js +4 -4
  113. package/esm2015/plugins/custom-info/custom-info.spec.js +17 -17
  114. package/esm2015/plugins/custom-info/index.js +1 -1
  115. package/esm2015/plugins/exception/exception.reply.js +4 -4
  116. package/esm2015/plugins/exception/exception.spec.js +18 -18
  117. package/esm2015/plugins/exception/index.js +1 -1
  118. package/esm2015/plugins/fetch-cache/fetch-cache.request.js +4 -4
  119. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +21 -21
  120. package/esm2015/plugins/fetch-cache/index.js +1 -1
  121. package/esm2015/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  122. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +9 -9
  123. package/esm2015/plugins/fetch-credentials/index.js +1 -1
  124. package/esm2015/plugins/index.js +25 -25
  125. package/esm2015/plugins/json-token/index.js +2 -2
  126. package/esm2015/plugins/json-token/json-token.reply.js +5 -5
  127. package/esm2015/plugins/json-token/json-token.request.js +4 -4
  128. package/esm2015/plugins/json-token/json-token.spec.js +27 -27
  129. package/esm2015/plugins/keepalive/index.js +1 -1
  130. package/esm2015/plugins/keepalive/keepalive.request.js +2 -2
  131. package/esm2015/plugins/keepalive/keepalive.spec.js +5 -5
  132. package/esm2015/plugins/mgw-mdw-auth/index.js +1 -1
  133. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +34 -42
  134. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +32 -28
  135. package/esm2015/plugins/mock-intercept/index.js +2 -2
  136. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -5
  137. package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  138. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +4 -4
  139. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +32 -32
  140. package/esm2015/plugins/perf-metric/index.js +1 -1
  141. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -2
  142. package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +10 -10
  143. package/esm2015/plugins/pii-tokenizer/index.js +1 -1
  144. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -12
  145. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +96 -96
  146. package/esm2015/plugins/raw-response-info/index.js +1 -1
  147. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +14 -14
  148. package/esm2015/plugins/retry/index.js +1 -1
  149. package/esm2015/plugins/retry/retry.fetch.js +1 -1
  150. package/esm2015/plugins/retry/retry.spec.js +21 -21
  151. package/esm2015/plugins/reviver/index.js +1 -1
  152. package/esm2015/plugins/reviver/reviver.reply.js +35 -2
  153. package/esm2015/plugins/reviver/reviver.spec.js +8 -8
  154. package/esm2015/plugins/session-id/index.js +1 -1
  155. package/esm2015/plugins/session-id/session-id.request.js +8 -7
  156. package/esm2015/plugins/session-id/session-id.spec.js +14 -14
  157. package/esm2015/plugins/si-token/index.js +1 -1
  158. package/esm2015/plugins/si-token/si-token.request.js +1 -1
  159. package/esm2015/plugins/si-token/si-token.spec.js +10 -10
  160. package/esm2015/plugins/simple-api-key-authentication/index.js +1 -1
  161. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +5 -5
  162. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +46 -46
  163. package/esm2015/plugins/timeout/index.js +1 -1
  164. package/esm2015/plugins/timeout/timeout.fetch.js +13 -11
  165. package/esm2015/plugins/timeout/timeout.spec.js +15 -15
  166. package/esm2015/plugins/url-rewrite/index.js +1 -1
  167. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +10 -10
  168. package/esm2015/plugins/wait-for/index.js +1 -1
  169. package/esm2015/plugins/wait-for/wait-for.spec.js +10 -10
  170. package/esm2015/public_api.js +4 -4
  171. package/esm2015/utils/crypto.js +15 -15
  172. package/esm2015/utils/generic-api.js +245 -0
  173. package/esm2015/utils/index.js +6 -5
  174. package/esm2015/utils/json-token.js +32 -32
  175. package/esm2015/utils/json-token.spec.js +32 -32
  176. package/package.json +67 -40
  177. package/schematics/ng-add/index.d.ts +4 -2
  178. package/schematics/ng-add/index.d.ts.map +1 -1
  179. package/schematics/ng-add/index.js +58 -40
  180. package/schematics/ng-add/index.js.map +1 -1
  181. package/src/clients/api-angular-client.d.ts +6 -3
  182. package/src/clients/api-angular-client.d.ts.map +1 -1
  183. package/src/clients/api-angular-client.js +31 -16
  184. package/src/clients/api-angular-client.js.map +1 -1
  185. package/src/clients/api-beacon-client.d.ts +7 -5
  186. package/src/clients/api-beacon-client.d.ts.map +1 -1
  187. package/src/clients/api-beacon-client.js +24 -14
  188. package/src/clients/api-beacon-client.js.map +1 -1
  189. package/src/clients/api-fetch-client.d.ts +5 -3
  190. package/src/clients/api-fetch-client.d.ts.map +1 -1
  191. package/src/clients/api-fetch-client.js +26 -14
  192. package/src/clients/api-fetch-client.js.map +1 -1
  193. package/src/fwk/Reviver.d.ts +16 -4
  194. package/src/fwk/Reviver.d.ts.map +1 -1
  195. package/src/fwk/Reviver.js +9 -6
  196. package/src/fwk/Reviver.js.map +1 -1
  197. package/src/fwk/api.helpers.d.ts +1 -1
  198. package/src/fwk/api.helpers.d.ts.map +1 -1
  199. package/src/fwk/api.helpers.js +1 -1
  200. package/src/fwk/api.helpers.js.map +1 -1
  201. package/src/fwk/core/api-client.d.ts +36 -1
  202. package/src/fwk/core/api-client.d.ts.map +1 -1
  203. package/src/fwk/core/api-client.js.map +1 -1
  204. package/src/fwk/date.js.map +1 -1
  205. package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
  206. package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
  207. package/src/fwk/mocks/helpers.js.map +1 -1
  208. package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
  209. package/src/fwk/mocks/sequential-mock-adapter.js.map +1 -1
  210. package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
  211. package/src/plugins/additional-params/additional-params.request.js.map +1 -1
  212. package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
  213. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +1 -1
  214. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
  215. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +1 -1
  216. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
  217. package/src/plugins/client-facts/client-facts.request.js.map +1 -1
  218. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
  219. package/src/plugins/concurrent/concurrent.fetch.js +1 -0
  220. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
  221. package/src/plugins/core/plugin.d.ts +6 -1
  222. package/src/plugins/core/plugin.d.ts.map +1 -1
  223. package/src/plugins/core/reply-plugin.d.ts +0 -2
  224. package/src/plugins/core/reply-plugin.d.ts.map +1 -1
  225. package/src/plugins/core/request-plugin.d.ts +2 -0
  226. package/src/plugins/core/request-plugin.d.ts.map +1 -1
  227. package/src/plugins/exception/exception.reply.js.map +1 -1
  228. package/src/plugins/fetch-cache/fetch-cache.request.js.map +1 -1
  229. package/src/plugins/json-token/json-token.reply.js.map +1 -1
  230. package/src/plugins/json-token/json-token.request.js.map +1 -1
  231. package/src/plugins/keepalive/keepalive.request.js.map +1 -1
  232. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts +2 -2
  233. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
  234. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +26 -28
  235. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
  236. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
  237. package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
  238. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
  239. package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
  240. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
  241. package/src/plugins/raw-response-info/raw-response-info.reply.js.map +1 -1
  242. package/src/plugins/retry/retry.fetch.js.map +1 -1
  243. package/src/plugins/reviver/reviver.reply.d.ts +7 -0
  244. package/src/plugins/reviver/reviver.reply.d.ts.map +1 -1
  245. package/src/plugins/reviver/reviver.reply.js +12 -1
  246. package/src/plugins/reviver/reviver.reply.js.map +1 -1
  247. package/src/plugins/session-id/session-id.request.d.ts +1 -0
  248. package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
  249. package/src/plugins/session-id/session-id.request.js +1 -0
  250. package/src/plugins/session-id/session-id.request.js.map +1 -1
  251. package/src/plugins/si-token/si-token.request.js.map +1 -1
  252. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
  253. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
  254. package/src/plugins/timeout/timeout.fetch.js +2 -0
  255. package/src/plugins/timeout/timeout.fetch.js.map +1 -1
  256. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
  257. package/src/utils/crypto.js.map +1 -1
  258. package/src/utils/encoder.js.map +1 -1
  259. package/src/utils/generic-api.d.ts +39 -0
  260. package/src/utils/generic-api.d.ts.map +1 -0
  261. package/src/utils/generic-api.js +43 -0
  262. package/src/utils/generic-api.js.map +1 -0
  263. package/src/utils/index.d.ts +1 -0
  264. package/src/utils/index.d.ts.map +1 -1
  265. package/src/utils/index.js +1 -0
  266. package/src/utils/index.js.map +1 -1
  267. package/src/utils/json-token.d.ts.map +1 -1
  268. package/src/utils/json-token.js.map +1 -1
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @ama-sdk Core
2
2
 
3
+ [![Stable Version](https://img.shields.io/npm/v/@ama-sdk/core?style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/core)
4
+ [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-sdk/core?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/core)
5
+
3
6
  This package contains all the [plugins](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/plugins), helpers and object definitions to dialog with an API following the `ama-sdk` architecture.
4
7
 
5
8
  Please refer to the [ama-sdk-schematics](../schematics/README.md) package for getting started with an API based on `ama-sdk`.
@@ -46,7 +49,7 @@ A list of API Clients are provided by this package:
46
49
  ### Logs
47
50
 
48
51
  In order to ease the logging in the ama-sdk plugins, it is possible to connect to third-party logging services.
49
- This can be achieved by adding a `Logger` [implementation](/packages/@ama-sdk/core/src/fwk/logger.ts) to the options of an API client.
52
+ This can be achieved by adding a `Logger` [implementation](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core/src/fwk/logger.ts) to the options of an API client.
50
53
 
51
54
  For example, in the Otter showcase application, we could add a `ConsoleLogger` (from `@o3r/core`) as a parameter to the ApiFetchClient:
52
55
 
@@ -232,24 +232,18 @@ var ApiAngularClient = /*#__PURE__*/ function() {
232
232
  }
233
233
  },
234
234
  {
235
- key: "prepareOptions",
236
- value: function prepareOptions(url, method, queryParams, headers, body, tokenizedOptions, metadata) {
235
+ key: "getRequestOptions",
236
+ value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
237
237
  var _this = this;
238
238
  return _async_to_generator(function() {
239
- var options, opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, err;
239
+ var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
240
240
  return _ts_generator(this, function(_state) {
241
241
  switch(_state.label){
242
242
  case 0:
243
- options = {
244
- method: method,
245
- headers: new Headers((0, _apihelpers.filterUndefinedValues)(headers)),
246
- body: body,
247
- queryParams: (0, _apihelpers.filterUndefinedValues)(queryParams),
248
- basePath: url,
249
- tokenizedOptions: tokenizedOptions,
250
- metadata: metadata
251
- };
252
- opts = options;
243
+ opts = _object_spread_props(_object_spread({}, requestOptionsParameters), {
244
+ headers: new Headers((0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.headers)),
245
+ queryParams: (0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.queryParams)
246
+ });
253
247
  if (!_this.options.requestPlugins) return [
254
248
  3,
255
249
  8
@@ -274,7 +268,8 @@ var ApiAngularClient = /*#__PURE__*/ function() {
274
268
  return [
275
269
  4,
276
270
  plugin.load({
277
- logger: _this.options.logger
271
+ logger: _this.options.logger,
272
+ apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
278
273
  }).transform(opts)
279
274
  ];
280
275
  case 3:
@@ -322,6 +317,29 @@ var ApiAngularClient = /*#__PURE__*/ function() {
322
317
  })();
323
318
  }
324
319
  },
320
+ {
321
+ key: "prepareOptions",
322
+ value: /** @inheritdoc */ function prepareOptions(url, method, queryParams, headers, body, tokenizedOptions, metadata, api) {
323
+ var _this = this;
324
+ return _async_to_generator(function() {
325
+ return _ts_generator(this, function(_state) {
326
+ return [
327
+ 2,
328
+ _this.getRequestOptions({
329
+ headers: headers,
330
+ method: method,
331
+ basePath: url,
332
+ queryParams: queryParams,
333
+ body: body,
334
+ metadata: metadata,
335
+ tokenizedOptions: tokenizedOptions,
336
+ api: api
337
+ })
338
+ ];
339
+ });
340
+ })();
341
+ }
342
+ },
325
343
  {
326
344
  key: "prepareUrl",
327
345
  value: /** @inheritdoc */ function prepareUrl(url) {
@@ -346,11 +364,11 @@ var ApiAngularClient = /*#__PURE__*/ function() {
346
364
  value: function processCall(url, options, apiType, apiName, revivers, operationId) {
347
365
  var _this = this;
348
366
  return _async_to_generator(function() {
349
- var response, root, exception, origin, headers, controller, asyncResponse, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, pluginRunner, err;
367
+ var response, root, exception, origin, headers, asyncResponse, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, pluginRunner, err;
350
368
  return _ts_generator(this, function(_state) {
351
369
  switch(_state.label){
352
370
  case 0:
353
- origin = options.headers.get("Origin");
371
+ origin = options.headers.get('Origin');
354
372
  _state.label = 1;
355
373
  case 1:
356
374
  _state.trys.push([
@@ -360,14 +378,13 @@ var ApiAngularClient = /*#__PURE__*/ function() {
360
378
  4
361
379
  ]);
362
380
  headers = Object.fromEntries(options.headers.entries());
363
- controller = typeof AbortController !== "undefined" ? new AbortController() : undefined;
364
- if (controller) {
365
- options.signal = controller.signal;
366
- }
367
381
  asyncResponse = new Promise(function(resolve, reject) {
382
+ var _options_metadata;
368
383
  var data;
369
- _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
370
- observe: "response",
384
+ var metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
385
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
386
+ var subscription = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
387
+ observe: 'response',
371
388
  headers: headers
372
389
  })).subscribe({
373
390
  next: function(res) {
@@ -380,6 +397,11 @@ var ApiAngularClient = /*#__PURE__*/ function() {
380
397
  return resolve(data);
381
398
  }
382
399
  });
400
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
401
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
402
+ subscription.unsubscribe();
403
+ reject(metadataSignal.reason);
404
+ });
383
405
  });
384
406
  return [
385
407
  4,
@@ -394,7 +416,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
394
416
  ];
395
417
  case 3:
396
418
  e = _state.sent();
397
- exception = new _errors.EmptyResponseError(e.message || "Fail to Fetch", undefined, {
419
+ exception = new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
398
420
  apiName: apiName,
399
421
  operationId: operationId,
400
422
  url: url,
@@ -41,6 +41,13 @@ function _define_property(obj, key, value) {
41
41
  }
42
42
  return obj;
43
43
  }
44
+ function _instanceof(left, right) {
45
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
46
+ return !!right[Symbol.hasInstance](left);
47
+ } else {
48
+ return left instanceof right;
49
+ }
50
+ }
44
51
  function _object_spread(target) {
45
52
  for(var i = 1; i < arguments.length; i++){
46
53
  var source = arguments[i] != null ? arguments[i] : {};
@@ -56,6 +63,30 @@ function _object_spread(target) {
56
63
  }
57
64
  return target;
58
65
  }
66
+ function ownKeys(object, enumerableOnly) {
67
+ var keys = Object.keys(object);
68
+ if (Object.getOwnPropertySymbols) {
69
+ var symbols = Object.getOwnPropertySymbols(object);
70
+ if (enumerableOnly) {
71
+ symbols = symbols.filter(function(sym) {
72
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
73
+ });
74
+ }
75
+ keys.push.apply(keys, symbols);
76
+ }
77
+ return keys;
78
+ }
79
+ function _object_spread_props(target, source) {
80
+ source = source != null ? source : {};
81
+ if (Object.getOwnPropertyDescriptors) {
82
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
83
+ } else {
84
+ ownKeys(Object(source)).forEach(function(key) {
85
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
86
+ });
87
+ }
88
+ return target;
89
+ }
59
90
  var DEFAULT_OPTIONS = {
60
91
  replyPlugins: [],
61
92
  requestPlugins: [],
@@ -64,16 +95,18 @@ var DEFAULT_OPTIONS = {
64
95
  /**
65
96
  * Determine if the given value is a promise
66
97
  * @param value The value to test
67
- */ var isPromise = function(value) {
68
- return value && typeof value.then === "function";
98
+ */ // NOTE: the `extends unknown` is required for ESM build with TSC
99
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
100
+ var isPromise = function(value) {
101
+ return _instanceof(value, Promise);
69
102
  };
70
103
  var ApiBeaconClient = /*#__PURE__*/ function() {
71
104
  "use strict";
72
105
  function ApiBeaconClient(options) {
73
106
  _class_call_check(this, ApiBeaconClient);
74
107
  /** @inheritdoc */ _define_property(this, "options", void 0);
75
- if (typeof navigator === "undefined" || !navigator.sendBeacon) {
76
- throw new Error("Beacon API is not supported in this context");
108
+ if (typeof navigator === 'undefined' || !navigator.sendBeacon) {
109
+ throw new Error('Beacon API is not supported in this context');
77
110
  }
78
111
  this.options = _object_spread({}, DEFAULT_OPTIONS, options);
79
112
  }
@@ -85,28 +118,24 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
85
118
  }
86
119
  },
87
120
  {
88
- key: "prepareOptions",
89
- value: /** @inheritdoc */ function prepareOptions(url, method, queryParams, headers, body, tokenizedOptions, metadata) {
90
- if (method.toUpperCase() !== "POST") {
91
- throw new Error("Unsupported method: ".concat(method, ". The beacon API only supports POST."));
121
+ key: "getRequestOptions",
122
+ value: /** @inheritdoc */ function getRequestOptions(options) {
123
+ if (options.method.toUpperCase() !== 'POST') {
124
+ throw new Error("Unsupported method: ".concat(options.method, ". The beacon API only supports POST."));
92
125
  }
93
- var options = {
94
- method: method,
95
- headers: new Headers((0, _apihelpers.filterUndefinedValues)(headers)),
96
- body: body,
97
- queryParams: (0, _apihelpers.filterUndefinedValues)(queryParams),
98
- basePath: url,
99
- tokenizedOptions: tokenizedOptions,
100
- metadata: metadata
101
- };
102
- var opts = options;
126
+ var opts = _object_spread_props(_object_spread({}, options), {
127
+ headers: new Headers((0, _apihelpers.filterUndefinedValues)(options.headers)),
128
+ queryParams: (0, _apihelpers.filterUndefinedValues)(options.queryParams)
129
+ });
103
130
  if (this.options.requestPlugins) {
104
131
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
105
132
  try {
106
133
  for(var _iterator = this.options.requestPlugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
107
134
  var plugin = _step.value;
135
+ var _options_api;
108
136
  var changedOpt = plugin.load({
109
- logger: this.options.logger
137
+ logger: this.options.logger,
138
+ apiName: (_options_api = options.api) === null || _options_api === void 0 ? void 0 : _options_api.apiName
110
139
  }).transform(opts);
111
140
  if (isPromise(changedOpt)) {
112
141
  throw new Error("Request plugin ".concat(plugin.constructor.name, " has async transform method. Only sync methods are supported with the Beacon client."));
@@ -132,6 +161,21 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
132
161
  return Promise.resolve(opts);
133
162
  }
134
163
  },
164
+ {
165
+ key: "prepareOptions",
166
+ value: /** @inheritdoc */ function prepareOptions(url, method, queryParams, headers, body, tokenizedOptions, metadata, api) {
167
+ return this.getRequestOptions({
168
+ headers: headers,
169
+ method: method,
170
+ basePath: url,
171
+ queryParams: queryParams,
172
+ body: body,
173
+ metadata: metadata,
174
+ tokenizedOptions: tokenizedOptions,
175
+ api: api
176
+ });
177
+ }
178
+ },
135
179
  {
136
180
  key: "prepareUrl",
137
181
  value: /** @inheritdoc */ function prepareUrl(url, queryParameters) {
@@ -154,7 +198,7 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
154
198
  key: "processCall",
155
199
  value: /** @inheritdoc */ function processCall(url, options, _apiType, _apiName, _revivers, _operationId) {
156
200
  var headers = _object_spread({
157
- type: "application/json"
201
+ type: 'application/json'
158
202
  }, options.headers.entries());
159
203
  var blob = new Blob(options.body ? [
160
204
  JSON.stringify(options.body)
@@ -109,6 +109,30 @@ function _object_spread(target) {
109
109
  }
110
110
  return target;
111
111
  }
112
+ function ownKeys(object, enumerableOnly) {
113
+ var keys = Object.keys(object);
114
+ if (Object.getOwnPropertySymbols) {
115
+ var symbols = Object.getOwnPropertySymbols(object);
116
+ if (enumerableOnly) {
117
+ symbols = symbols.filter(function(sym) {
118
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
119
+ });
120
+ }
121
+ keys.push.apply(keys, symbols);
122
+ }
123
+ return keys;
124
+ }
125
+ function _object_spread_props(target, source) {
126
+ source = source != null ? source : {};
127
+ if (Object.getOwnPropertyDescriptors) {
128
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
129
+ } else {
130
+ ownKeys(Object(source)).forEach(function(key) {
131
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
132
+ });
133
+ }
134
+ return target;
135
+ }
112
136
  function _to_consumable_array(arr) {
113
137
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
114
138
  }
@@ -246,24 +270,18 @@ var ApiFetchClient = /*#__PURE__*/ function() {
246
270
  }
247
271
  },
248
272
  {
249
- key: "prepareOptions",
250
- value: /** @inheritdoc */ function prepareOptions(url, method, queryParams, headers, body, tokenizedOptions, metadata) {
273
+ key: "getRequestOptions",
274
+ value: /** @inheritdoc */ function getRequestOptions(requestOptionsParameters) {
251
275
  var _this = this;
252
276
  return _async_to_generator(function() {
253
- var options, opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, err;
277
+ var opts, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, _requestOptionsParameters_api, err;
254
278
  return _ts_generator(this, function(_state) {
255
279
  switch(_state.label){
256
280
  case 0:
257
- options = {
258
- method: method,
259
- headers: new Headers((0, _apihelpers.filterUndefinedValues)(headers)),
260
- body: body,
261
- queryParams: (0, _apihelpers.filterUndefinedValues)(queryParams),
262
- basePath: url,
263
- tokenizedOptions: tokenizedOptions,
264
- metadata: metadata
265
- };
266
- opts = options;
281
+ opts = _object_spread_props(_object_spread({}, requestOptionsParameters), {
282
+ headers: new Headers((0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.headers)),
283
+ queryParams: (0, _apihelpers.filterUndefinedValues)(requestOptionsParameters.queryParams)
284
+ });
267
285
  if (!_this.options.requestPlugins) return [
268
286
  3,
269
287
  8
@@ -288,7 +306,8 @@ var ApiFetchClient = /*#__PURE__*/ function() {
288
306
  return [
289
307
  4,
290
308
  plugin.load({
291
- logger: _this.options.logger
309
+ logger: _this.options.logger,
310
+ apiName: (_requestOptionsParameters_api = requestOptionsParameters.api) === null || _requestOptionsParameters_api === void 0 ? void 0 : _requestOptionsParameters_api.apiName
292
311
  }).transform(opts)
293
312
  ];
294
313
  case 3:
@@ -336,6 +355,29 @@ var ApiFetchClient = /*#__PURE__*/ function() {
336
355
  })();
337
356
  }
338
357
  },
358
+ {
359
+ key: "prepareOptions",
360
+ value: /** @inheritdoc */ function prepareOptions(url, method, queryParams, headers, body, tokenizedOptions, metadata, api) {
361
+ var _this = this;
362
+ return _async_to_generator(function() {
363
+ return _ts_generator(this, function(_state) {
364
+ return [
365
+ 2,
366
+ _this.getRequestOptions({
367
+ headers: headers,
368
+ method: method,
369
+ basePath: url,
370
+ queryParams: queryParams,
371
+ body: body,
372
+ metadata: metadata,
373
+ tokenizedOptions: tokenizedOptions,
374
+ api: api
375
+ })
376
+ ];
377
+ });
378
+ })();
379
+ }
380
+ },
339
381
  {
340
382
  key: "prepareUrl",
341
383
  value: /** @inheritdoc */ function prepareUrl(url) {
@@ -354,11 +396,11 @@ var ApiFetchClient = /*#__PURE__*/ function() {
354
396
  value: function processCall(url, options, apiType, apiName, revivers, operationId) {
355
397
  var _this = this;
356
398
  return _async_to_generator(function() {
357
- var response, asyncResponse, root, body, exception, origin, controller, loadedPlugins, _loadedPlugins, canStart, isCanceledBy, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, pluginRunner, err;
399
+ var response, asyncResponse, root, body, exception, origin, _options_metadata, metadataSignal, controller, loadedPlugins, _loadedPlugins, canStart, isCanceledBy, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, plugin, e, reviver, replyPlugins, parsedData, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, pluginRunner, err;
358
400
  return _ts_generator(this, function(_state) {
359
401
  switch(_state.label){
360
402
  case 0:
361
- origin = options.headers.get("Origin");
403
+ origin = options.headers.get('Origin');
362
404
  _state.label = 1;
363
405
  case 1:
364
406
  _state.trys.push([
@@ -367,10 +409,13 @@ var ApiFetchClient = /*#__PURE__*/ function() {
367
409
  ,
368
410
  6
369
411
  ]);
412
+ metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
413
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
370
414
  controller = new AbortController();
371
- if (controller) {
372
- options.signal = controller.signal;
373
- }
415
+ options.signal = controller.signal;
416
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
417
+ return controller.abort();
418
+ });
374
419
  loadedPlugins = [];
375
420
  if (_this.options.fetchPlugins) {
376
421
  ;
@@ -446,7 +491,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
446
491
  if (_instanceof(e, _errors.CanceledCallError)) {
447
492
  exception = e;
448
493
  } else {
449
- exception = new _errors.EmptyResponseError(e.message || "Fail to Fetch", undefined, {
494
+ exception = new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
450
495
  apiName: apiName,
451
496
  operationId: operationId,
452
497
  url: url,
@@ -461,7 +506,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
461
506
  try {
462
507
  root = body ? JSON.parse(body) : undefined;
463
508
  } catch (e) {
464
- exception = new _errors.ResponseJSONParseError(e.message || "Fail to parse response body", response && response.status || 0, body, {
509
+ exception = new _errors.ResponseJSONParseError(e.message || 'Fail to parse response body', response && response.status || 0, body, {
465
510
  apiName: apiName,
466
511
  operationId: operationId,
467
512
  url: url,
@@ -1,4 +1,4 @@
1
- /** Reviver type */ "use strict";
1
+ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
@@ -20,7 +20,7 @@ _export(exports, {
20
20
  }
21
21
  });
22
22
  function reviveMap(data) {
23
- var dictionaries = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, reviver = arguments.length > 2 ? arguments[2] : void 0;
23
+ var dictionaries = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, reviver = arguments.length > 2 ? arguments[2] : void 0, options = arguments.length > 3 ? arguments[3] : void 0;
24
24
  if (!data) {
25
25
  return undefined;
26
26
  }
@@ -28,27 +28,27 @@ function reviveMap(data) {
28
28
  for(var key in data){
29
29
  // eslint-disable-next-line no-prototype-builtins
30
30
  if (data.hasOwnProperty(key)) {
31
- revived[key] = reviver(data[key], dictionaries);
31
+ revived[key] = reviver(data[key], dictionaries, options);
32
32
  }
33
33
  }
34
34
  return revived;
35
35
  }
36
36
  function reviveArray(data) {
37
- var dictionaries = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, reviver = arguments.length > 2 ? arguments[2] : void 0;
37
+ var dictionaries = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, reviver = arguments.length > 2 ? arguments[2] : void 0, options = arguments.length > 3 ? arguments[3] : void 0;
38
38
  if (!data) {
39
39
  return undefined;
40
40
  }
41
41
  for(var i = 0; i < data.length; i++){
42
- data[i] = reviver(data[i], dictionaries);
42
+ data[i] = reviver(data[i], dictionaries, options);
43
43
  }
44
44
  return data;
45
45
  }
46
- function reviveDictionarizedArray(ids, dictionary, reviver) {
46
+ function reviveDictionarizedArray(ids, dictionary, reviver, options) {
47
47
  if (!ids) {
48
48
  return undefined;
49
49
  }
50
50
  return ids.reduce(function(map, id) {
51
- map[id] = reviver ? reviver(dictionary[id], dictionary) : dictionary[id];
51
+ map[id] = reviver ? reviver(dictionary[id], dictionary, options) : dictionary[id];
52
52
  return map;
53
53
  }, {});
54
54
  }
@@ -3,45 +3,45 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  var _core = require("@ama-sdk/core");
6
- describe("getResponseReviver - revivers by status code", function() {
6
+ describe('getResponseReviver - revivers by status code', function() {
7
7
  var revivers = {
8
8
  202: jest.fn(),
9
9
  201: jest.fn()
10
10
  };
11
11
  beforeEach(function() {
12
- jest.spyOn(console, "error");
12
+ jest.spyOn(console, 'error');
13
13
  });
14
14
  afterEach(function() {
15
15
  jest.clearAllMocks();
16
16
  });
17
- it("should not return a reviver for a non ok response", function() {
17
+ it('should not return a reviver for a non ok response', function() {
18
18
  expect((0, _core.getResponseReviver)(revivers, {
19
19
  status: 300,
20
20
  ok: false
21
21
  })).toBe(undefined);
22
22
  });
23
- it("should return a reason but not reviver for a 204 No Content Response", function() {
23
+ it('should return a reason but not reviver for a 204 No Content Response', function() {
24
24
  expect((0, _core.getResponseReviver)(revivers, {
25
25
  status: 204,
26
26
  ok: true
27
27
  })).toBe(undefined);
28
- expect(console.error).toHaveBeenCalledWith("API status code error for unknown endpoint - 204 response is not defined in the API specification");
28
+ expect(console.error).toHaveBeenCalledWith('API status code error for unknown endpoint - 204 response is not defined in the API specification');
29
29
  });
30
- it("should return the status code's reviver", function() {
30
+ it('should return the status code\'s reviver', function() {
31
31
  expect((0, _core.getResponseReviver)(revivers, {
32
32
  status: 202,
33
33
  ok: true
34
- }, "myEndpoint")).toBe(revivers[202]);
34
+ }, 'myEndpoint')).toBe(revivers[202]);
35
35
  expect(console.error).not.toHaveBeenCalled();
36
36
  });
37
- it("should fallback on the first defined status if the status code's reviver is not defined", function() {
37
+ it('should fallback on the first defined status if the status code\'s reviver is not defined', function() {
38
38
  expect((0, _core.getResponseReviver)(revivers, {
39
39
  status: undefined,
40
40
  ok: true
41
- }, "myEndpoint")).toBe(revivers[201]);
42
- expect(console.error).toHaveBeenCalledWith("API status code error for myEndpoint endpoint - Unknown undefined code returned by the API - Fallback to 201's reviver");
41
+ }, 'myEndpoint')).toBe(revivers[201]);
42
+ expect(console.error).toHaveBeenCalledWith('API status code error for myEndpoint endpoint - Unknown undefined code returned by the API - Fallback to 201\'s reviver');
43
43
  });
44
- it("should not fallback on 204 (No Content)'s reviver", function() {
44
+ it('should not fallback on 204 (No Content)\'s reviver', function() {
45
45
  var reviversWith204 = {
46
46
  204: jest.fn(),
47
47
  206: jest.fn()
@@ -49,33 +49,33 @@ describe("getResponseReviver - revivers by status code", function() {
49
49
  var fallback = (0, _core.getResponseReviver)(reviversWith204, {
50
50
  status: 201,
51
51
  ok: true
52
- }, "myEndpoint");
52
+ }, 'myEndpoint');
53
53
  expect(fallback).toBe(reviversWith204[206]);
54
54
  expect(fallback).not.toBe(reviversWith204[204]);
55
- expect(console.error).toHaveBeenCalledWith("API status code error for myEndpoint endpoint - Unknown 201 code returned by the API - Fallback to 206's reviver");
55
+ expect(console.error).toHaveBeenCalledWith('API status code error for myEndpoint endpoint - Unknown 201 code returned by the API - Fallback to 206\'s reviver');
56
56
  });
57
- it("should not fallback if the feature is deactivated", function() {
58
- jest.spyOn(console, "log");
57
+ it('should not fallback if the feature is deactivated', function() {
58
+ jest.spyOn(console, 'log');
59
59
  expect((0, _core.getResponseReviver)(revivers, {
60
60
  status: 206,
61
61
  ok: true
62
- }, "myEndpoint", {
62
+ }, 'myEndpoint', {
63
63
  disableFallback: true,
64
64
  log: console.log
65
65
  })).toBe(undefined);
66
66
  expect(console.error).not.toHaveBeenCalled();
67
- expect(console.log).toHaveBeenCalledWith("API status code error for myEndpoint endpoint - Missing 206 from API specification - fallback is deactivated, no revive will run on this response");
67
+ expect(console.log).toHaveBeenCalledWith('API status code error for myEndpoint endpoint - Missing 206 from API specification - fallback is deactivated, no revive will run on this response');
68
68
  });
69
69
  });
70
- describe("getResponseReviver - reviver as function", function() {
70
+ describe('getResponseReviver - reviver as function', function() {
71
71
  var reviver = jest.fn();
72
- it("should not return a reviver for a non ok response", function() {
72
+ it('should not return a reviver for a non ok response', function() {
73
73
  expect((0, _core.getResponseReviver)(reviver, {
74
74
  status: 300,
75
75
  ok: false
76
76
  })).toBe(undefined);
77
77
  });
78
- it("should only return the reviver if the endpoint reviver is a function or an undefined object", function() {
78
+ it('should only return the reviver if the endpoint reviver is a function or an undefined object', function() {
79
79
  expect((0, _core.getResponseReviver)(reviver, {
80
80
  status: 200,
81
81
  ok: true