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

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
@@ -127,8 +127,8 @@ function _ts_generator(thisArg, body) {
127
127
  };
128
128
  }
129
129
  }
130
- describe("Retry Fetch Plugin", function() {
131
- it("should not retry on success", /*#__PURE__*/ _async_to_generator(function() {
130
+ describe('Retry Fetch Plugin', function() {
131
+ it('should not retry on success', /*#__PURE__*/ _async_to_generator(function() {
132
132
  var condition, plugin, runner, call, res, ret;
133
133
  return _ts_generator(this, function(_state) {
134
134
  switch(_state.label){
@@ -136,11 +136,11 @@ describe("Retry Fetch Plugin", function() {
136
136
  condition = jest.fn().mockReturnValue(true);
137
137
  plugin = new _retryfetch.RetryFetch(1, condition);
138
138
  runner = plugin.load({
139
- url: "http://www.test.com",
139
+ url: 'http://www.test.com',
140
140
  fetchPlugins: []
141
141
  });
142
142
  call = Promise.resolve({
143
- text: "test",
143
+ text: 'test',
144
144
  ok: true
145
145
  });
146
146
  res = runner.transform(call);
@@ -152,7 +152,7 @@ describe("Retry Fetch Plugin", function() {
152
152
  case 1:
153
153
  ret = _state.sent();
154
154
  expect(ret).toEqual({
155
- text: "test",
155
+ text: 'test',
156
156
  ok: true
157
157
  });
158
158
  return [
@@ -161,7 +161,7 @@ describe("Retry Fetch Plugin", function() {
161
161
  }
162
162
  });
163
163
  }));
164
- it("should not retry if refused by the condition", /*#__PURE__*/ _async_to_generator(function() {
164
+ it('should not retry if refused by the condition', /*#__PURE__*/ _async_to_generator(function() {
165
165
  var conditionFalsy, plugin, runner, call, res;
166
166
  return _ts_generator(this, function(_state) {
167
167
  switch(_state.label){
@@ -169,11 +169,11 @@ describe("Retry Fetch Plugin", function() {
169
169
  conditionFalsy = jest.fn().mockReturnValue(false);
170
170
  plugin = new _retryfetch.RetryFetch(3, conditionFalsy);
171
171
  runner = plugin.load({
172
- url: "http://www.test.com",
172
+ url: 'http://www.test.com',
173
173
  fetchPlugins: []
174
174
  });
175
175
  call = Promise.resolve({
176
- text: "test",
176
+ text: 'test',
177
177
  ok: false,
178
178
  clone: function() {
179
179
  return {};
@@ -193,7 +193,7 @@ describe("Retry Fetch Plugin", function() {
193
193
  }
194
194
  });
195
195
  }));
196
- it("should retry on fetch rejection", /*#__PURE__*/ _async_to_generator(function() {
196
+ it('should retry on fetch rejection', /*#__PURE__*/ _async_to_generator(function() {
197
197
  var condition, plugin, runners, runner, call, callback;
198
198
  return _ts_generator(this, function(_state) {
199
199
  switch(_state.label){
@@ -202,12 +202,12 @@ describe("Retry Fetch Plugin", function() {
202
202
  plugin = new _retryfetch.RetryFetch(2, condition);
203
203
  runners = [];
204
204
  runner = plugin.load({
205
- url: "not an url",
205
+ url: 'not an url',
206
206
  fetchPlugins: runners
207
207
  });
208
208
  runners.push(runner);
209
209
  call = Promise.reject({
210
- text: "test",
210
+ text: 'test',
211
211
  ok: true
212
212
  });
213
213
  callback = jest.fn();
@@ -226,7 +226,7 @@ describe("Retry Fetch Plugin", function() {
226
226
  }
227
227
  });
228
228
  }));
229
- it("should retry on fetch rejection with wait", /*#__PURE__*/ _async_to_generator(function() {
229
+ it('should retry on fetch rejection with wait', /*#__PURE__*/ _async_to_generator(function() {
230
230
  var condition, delay, plugin, runners, runner, call, callback;
231
231
  return _ts_generator(this, function(_state) {
232
232
  switch(_state.label){
@@ -238,12 +238,12 @@ describe("Retry Fetch Plugin", function() {
238
238
  });
239
239
  runners = [];
240
240
  runner = plugin.load({
241
- url: "not an url",
241
+ url: 'not an url',
242
242
  fetchPlugins: runners
243
243
  });
244
244
  runners.push(runner);
245
245
  call = Promise.reject({
246
- text: "test",
246
+ text: 'test',
247
247
  ok: true
248
248
  });
249
249
  callback = jest.fn();
@@ -269,7 +269,7 @@ describe("Retry Fetch Plugin", function() {
269
269
  }
270
270
  });
271
271
  }));
272
- it("should retry on not ok call", /*#__PURE__*/ _async_to_generator(function() {
272
+ it('should retry on not ok call', /*#__PURE__*/ _async_to_generator(function() {
273
273
  var condition, plugin, runners, runner, call, callback;
274
274
  return _ts_generator(this, function(_state) {
275
275
  switch(_state.label){
@@ -278,12 +278,12 @@ describe("Retry Fetch Plugin", function() {
278
278
  plugin = new _retryfetch.RetryFetch(3, condition);
279
279
  runners = [];
280
280
  runner = plugin.load({
281
- url: "not an url",
281
+ url: 'not an url',
282
282
  fetchPlugins: runners
283
283
  });
284
284
  runners.push(runner);
285
285
  call = Promise.resolve({
286
- text: "test",
286
+ text: 'test',
287
287
  ok: false
288
288
  });
289
289
  callback = jest.fn();
@@ -302,7 +302,7 @@ describe("Retry Fetch Plugin", function() {
302
302
  }
303
303
  });
304
304
  }));
305
- it("should retry on not ok call with wait", /*#__PURE__*/ _async_to_generator(function() {
305
+ it('should retry on not ok call with wait', /*#__PURE__*/ _async_to_generator(function() {
306
306
  var condition, delay, plugin, runners, runner, call, callback;
307
307
  return _ts_generator(this, function(_state) {
308
308
  switch(_state.label){
@@ -314,12 +314,12 @@ describe("Retry Fetch Plugin", function() {
314
314
  });
315
315
  runners = [];
316
316
  runner = plugin.load({
317
- url: "not an url",
317
+ url: 'not an url',
318
318
  fetchPlugins: runners
319
319
  });
320
320
  runners.push(runner);
321
321
  call = Promise.resolve({
322
- text: "test",
322
+ text: 'test',
323
323
  ok: false
324
324
  });
325
325
  callback = jest.fn();
@@ -27,18 +27,51 @@ function _create_class(Constructor, protoProps, staticProps) {
27
27
  if (staticProps) _defineProperties(Constructor, staticProps);
28
28
  return Constructor;
29
29
  }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
43
+ function _object_spread(target) {
44
+ for(var i = 1; i < arguments.length; i++){
45
+ var source = arguments[i] != null ? arguments[i] : {};
46
+ var ownKeys = Object.keys(source);
47
+ if (typeof Object.getOwnPropertySymbols === "function") {
48
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
49
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
50
+ }));
51
+ }
52
+ ownKeys.forEach(function(key) {
53
+ _define_property(target, key, source[key]);
54
+ });
55
+ }
56
+ return target;
57
+ }
30
58
  var ReviverReply = /*#__PURE__*/ function() {
31
59
  "use strict";
32
- function ReviverReply() {
60
+ function ReviverReply(options) {
33
61
  _class_call_check(this, ReviverReply);
62
+ _define_property(this, "options", void 0);
63
+ this.options = options;
34
64
  }
35
65
  _create_class(ReviverReply, [
36
66
  {
37
67
  key: "load",
38
68
  value: function load(context) {
69
+ var options = _object_spread({
70
+ logger: context.logger
71
+ }, this.options);
39
72
  return {
40
73
  transform: function(data) {
41
- var ret = context.reviver && data ? context.reviver(data, context.dictionaries) : data || {};
74
+ var ret = context.reviver && data ? context.reviver(data, context.dictionaries, options) : data || {};
42
75
  return ret;
43
76
  }
44
77
  };
@@ -128,9 +128,9 @@ function _ts_generator(thisArg, body) {
128
128
  };
129
129
  }
130
130
  }
131
- describe("Reviver Reply Plugin", function() {
131
+ describe('Reviver Reply Plugin', function() {
132
132
  var reviver = jest.fn();
133
- it("should revive a specific data", /*#__PURE__*/ _async_to_generator(function() {
133
+ it('should revive a specific data', /*#__PURE__*/ _async_to_generator(function() {
134
134
  var plugin, runner, data;
135
135
  return _ts_generator(this, function(_state) {
136
136
  switch(_state.label){
@@ -148,14 +148,14 @@ describe("Reviver Reply Plugin", function() {
148
148
  ];
149
149
  case 1:
150
150
  _state.sent();
151
- expect(reviver).toHaveBeenCalledWith(data, undefined);
151
+ expect(reviver).toHaveBeenCalledWith(data, undefined, expect.any(Object));
152
152
  return [
153
153
  2
154
154
  ];
155
155
  }
156
156
  });
157
157
  }));
158
- it("should revive a specific data and dictionary", /*#__PURE__*/ _async_to_generator(function() {
158
+ it('should revive a specific data and dictionary', /*#__PURE__*/ _async_to_generator(function() {
159
159
  var dictionaries, plugin, runner, data;
160
160
  return _ts_generator(this, function(_state) {
161
161
  switch(_state.label){
@@ -175,14 +175,14 @@ describe("Reviver Reply Plugin", function() {
175
175
  ];
176
176
  case 1:
177
177
  _state.sent();
178
- expect(reviver).toHaveBeenCalledWith(data, dictionaries);
178
+ expect(reviver).toHaveBeenCalledWith(data, dictionaries, expect.any(Object));
179
179
  return [
180
180
  2
181
181
  ];
182
182
  }
183
183
  });
184
184
  }));
185
- it("should revive empty object in case of undefined data", /*#__PURE__*/ _async_to_generator(function() {
185
+ it('should revive empty object in case of undefined data', /*#__PURE__*/ _async_to_generator(function() {
186
186
  var dictionaries, plugin, runner, transformedData;
187
187
  return _ts_generator(this, function(_state) {
188
188
  switch(_state.label){
@@ -44,7 +44,7 @@ function _define_property(obj, key, value) {
44
44
  var SessionIdRequest = /*#__PURE__*/ function() {
45
45
  "use strict";
46
46
  function SessionIdRequest() {
47
- var sessionIdHeader = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "Ama-Client-Ref", activateRequestId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
47
+ var sessionIdHeader = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'Ama-Client-Ref', activateRequestId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
48
48
  _class_call_check(this, SessionIdRequest);
49
49
  /**
50
50
  * The request header in which the ID will be added. Use the same in multiple APIs if you want to aggregate logs
@@ -85,13 +85,14 @@ var SessionIdRequest = /*#__PURE__*/ function() {
85
85
  key: "generateSessionId",
86
86
  value: /**
87
87
  * Generates a session ID and stores it in session / backup storage.
88
+ * @param logger
88
89
  */ function generateSessionId(logger) {
89
90
  // Check if we already have a session ID in the shared memory
90
91
  if (SessionIdRequest.sharedMemory[this.sessionIdHeader]) {
91
92
  return SessionIdRequest.sharedMemory[this.sessionIdHeader];
92
93
  }
93
94
  // if not, check if we have one in session storage
94
- if (typeof sessionStorage !== "undefined") {
95
+ if (typeof sessionStorage !== 'undefined') {
95
96
  var sessionIdObjectFromStorage = sessionStorage.getItem(this.sessionIdHeader);
96
97
  if (sessionIdObjectFromStorage) {
97
98
  try {
@@ -110,7 +111,7 @@ var SessionIdRequest = /*#__PURE__*/ function() {
110
111
  this.logSessionId(sessionId, generatedTime, logger);
111
112
  // and store it
112
113
  SessionIdRequest.sharedMemory[this.sessionIdHeader] = sessionId;
113
- if (typeof sessionStorage !== "undefined") {
114
+ if (typeof sessionStorage !== 'undefined') {
114
115
  sessionStorage.setItem(this.sessionIdHeader, JSON.stringify({
115
116
  id: sessionId,
116
117
  generatedTime: generatedTime
@@ -124,19 +125,19 @@ var SessionIdRequest = /*#__PURE__*/ function() {
124
125
  value: /**
125
126
  * Generates a request ID.
126
127
  */ function generateRequestId() {
127
- var requestCountKey = this.sessionIdHeader + "-Request-Count";
128
+ var requestCountKey = this.sessionIdHeader + '-Request-Count';
128
129
  var requestCount = NaN;
129
130
  // Check if we already have a request count in the shared memory or session storage
130
131
  if (SessionIdRequest.sharedMemory[requestCountKey] !== undefined) {
131
132
  requestCount = SessionIdRequest.sharedMemory[requestCountKey];
132
- } else if (typeof sessionStorage !== "undefined") {
133
+ } else if (typeof sessionStorage !== 'undefined') {
133
134
  requestCount = +(sessionStorage.getItem(requestCountKey) || NaN);
134
135
  }
135
136
  // If the request count is not defined yet or if it has been corrupted somehow, we start at 0.
136
137
  requestCount = requestCount + 1 || 0;
137
138
  // Store the new request count
138
139
  SessionIdRequest.sharedMemory[requestCountKey] = requestCount;
139
- if (typeof sessionStorage !== "undefined") {
140
+ if (typeof sessionStorage !== 'undefined') {
140
141
  sessionStorage.setItem(requestCountKey, requestCount.toString());
141
142
  }
142
143
  return requestCount.toString(36);
@@ -127,18 +127,18 @@ function _ts_generator(thisArg, body) {
127
127
  };
128
128
  }
129
129
  }
130
- describe("Session ID Request Plugin", function() {
130
+ describe('Session ID Request Plugin', function() {
131
131
  var options;
132
- var TEST_KEY = "testKey";
133
- var TEST_KEY2 = "testKey2";
132
+ var TEST_KEY = 'testKey';
133
+ var TEST_KEY2 = 'testKey2';
134
134
  beforeEach(function() {
135
135
  options = {
136
136
  headers: new Headers(),
137
- basePath: "http://test.com/truc",
138
- method: "get"
137
+ basePath: 'http://test.com/truc',
138
+ method: 'get'
139
139
  };
140
140
  });
141
- it("should have the default id to Ama-Client-Ref", /*#__PURE__*/ _async_to_generator(function() {
141
+ it('should have the default id to Ama-Client-Ref', /*#__PURE__*/ _async_to_generator(function() {
142
142
  var plugin, runner, sessionId;
143
143
  return _ts_generator(this, function(_state) {
144
144
  switch(_state.label){
@@ -152,14 +152,14 @@ describe("Session ID Request Plugin", function() {
152
152
  ];
153
153
  case 1:
154
154
  _state.sent();
155
- expect(options.headers.get("Ama-Client-Ref")).toContain(sessionId);
155
+ expect(options.headers.get('Ama-Client-Ref')).toContain(sessionId);
156
156
  return [
157
157
  2
158
158
  ];
159
159
  }
160
160
  });
161
161
  }));
162
- it("should add the session ID to the headers", /*#__PURE__*/ _async_to_generator(function() {
162
+ it('should add the session ID to the headers', /*#__PURE__*/ _async_to_generator(function() {
163
163
  var plugin, runner, sessionId;
164
164
  return _ts_generator(this, function(_state) {
165
165
  switch(_state.label){
@@ -180,21 +180,21 @@ describe("Session ID Request Plugin", function() {
180
180
  }
181
181
  });
182
182
  }));
183
- it("second plugin with same header should use the ID that's already in memory", function() {
183
+ it('second plugin with same header should use the ID that\'s already in memory', function() {
184
184
  var plugin = new _sessionidrequest.SessionIdRequest(TEST_KEY);
185
185
  var plugin2 = new _sessionidrequest.SessionIdRequest(TEST_KEY);
186
186
  plugin.load();
187
187
  plugin2.load();
188
188
  expect(plugin.sessionId).toBe(plugin2.sessionId);
189
189
  });
190
- it("second plugin with different header should generate a new session ID", function() {
190
+ it('second plugin with different header should generate a new session ID', function() {
191
191
  var plugin = new _sessionidrequest.SessionIdRequest(TEST_KEY);
192
192
  var plugin2 = new _sessionidrequest.SessionIdRequest(TEST_KEY2);
193
193
  plugin.load();
194
194
  plugin2.load();
195
195
  expect(plugin.sessionId).not.toBe(plugin2.sessionId);
196
196
  });
197
- it("should generate a correctly formatted ID", /*#__PURE__*/ _async_to_generator(function() {
197
+ it('should generate a correctly formatted ID', /*#__PURE__*/ _async_to_generator(function() {
198
198
  var plugin, runner, sessionId;
199
199
  return _ts_generator(this, function(_state) {
200
200
  switch(_state.label){
@@ -209,14 +209,14 @@ describe("Session ID Request Plugin", function() {
209
209
  case 1:
210
210
  _state.sent();
211
211
  expect(sessionId).toMatch(/[a-zA-Z0-9-]{10,48}/);
212
- expect(options.headers.get("Ama-Client-Ref")).toMatch(new RegExp(sessionId + ":[0-9a-zA-Z]{1,10}"));
212
+ expect(options.headers.get('Ama-Client-Ref')).toMatch(new RegExp(sessionId + ':[0-9a-zA-Z]{1,10}'));
213
213
  return [
214
214
  2
215
215
  ];
216
216
  }
217
217
  });
218
218
  }));
219
- it("should be possible to deactivate the request ID part", /*#__PURE__*/ _async_to_generator(function() {
219
+ it('should be possible to deactivate the request ID part', /*#__PURE__*/ _async_to_generator(function() {
220
220
  var plugin, runner, sessionId;
221
221
  return _ts_generator(this, function(_state) {
222
222
  switch(_state.label){
@@ -127,27 +127,27 @@ function _ts_generator(thisArg, body) {
127
127
  };
128
128
  }
129
129
  }
130
- describe("SI Token Request Plugin", function() {
130
+ describe('SI Token Request Plugin', function() {
131
131
  var defaultGetParams = {
132
- defaultTest: "ok"
132
+ defaultTest: 'ok'
133
133
  };
134
- var defaultBody = "default";
134
+ var defaultBody = 'default';
135
135
  var options;
136
136
  beforeEach(function() {
137
137
  options = {
138
- method: "get",
138
+ method: 'get',
139
139
  queryParams: defaultGetParams,
140
140
  headers: new Headers(),
141
141
  body: defaultBody,
142
- basePath: "http://test.com/truc"
142
+ basePath: 'http://test.com/truc'
143
143
  };
144
144
  });
145
- it("should add a specified SI Tokens in query params", /*#__PURE__*/ _async_to_generator(function() {
145
+ it('should add a specified SI Tokens in query params', /*#__PURE__*/ _async_to_generator(function() {
146
146
  var plugin, runner, result;
147
147
  return _ts_generator(this, function(_state) {
148
148
  switch(_state.label){
149
149
  case 0:
150
- plugin = new _sitokenrequest.SiTokenRequest("SIToken1", "SIToken2");
150
+ plugin = new _sitokenrequest.SiTokenRequest('SIToken1', 'SIToken2');
151
151
  runner = plugin.load();
152
152
  return [
153
153
  4,
@@ -155,8 +155,8 @@ describe("SI Token Request Plugin", function() {
155
155
  ];
156
156
  case 1:
157
157
  result = _state.sent();
158
- expect(result.queryParams.SITK).toBe("SIToken1");
159
- expect(result.queryParams.SITK2).toBe("SIToken2");
158
+ expect(result.queryParams.SITK).toBe('SIToken1');
159
+ expect(result.queryParams.SITK2).toBe('SIToken2');
160
160
  return [
161
161
  2
162
162
  ];
@@ -183,8 +183,8 @@ function _ts_generator(thisArg, body) {
183
183
  /**
184
184
  * Default values of optional parameters
185
185
  */ var DEFAULT_OPTION = {
186
- apiKeyHeader: "x-api-key",
187
- contextHeader: "ama-ctx"
186
+ apiKeyHeader: 'x-api-key',
187
+ contextHeader: 'ama-ctx'
188
188
  };
189
189
  var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
190
190
  "use strict";
@@ -231,7 +231,7 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
231
231
  _tmp = [
232
232
  _this.options.apiKeyHeader
233
233
  ];
234
- if (!(typeof _this.apiKey === "string")) return [
234
+ if (!(typeof _this.apiKey === 'string')) return [
235
235
  3,
236
236
  1
237
237
  ];
@@ -256,7 +256,7 @@ var SimpleApiKeyAuthenticationRequest = /*#__PURE__*/ function() {
256
256
  3,
257
257
  7
258
258
  ];
259
- if (!(typeof _this.options.officeId === "string")) return [
259
+ if (!(typeof _this.options.officeId === 'string')) return [
260
260
  3,
261
261
  4
262
262
  ];