@ama-sdk/core 10.3.0-prerelease.8 → 10.3.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/cjs/clients/api-angular-client.js +36 -18
  2. package/cjs/clients/api-beacon-client.js +61 -19
  3. package/cjs/clients/api-fetch-client.js +60 -18
  4. package/cjs/fwk/api.helper.spec.js +20 -20
  5. package/cjs/fwk/api.helpers.js +14 -14
  6. package/cjs/fwk/core/api-client.js +1 -1
  7. package/cjs/fwk/core/base-api-constructor.js +1 -1
  8. package/cjs/fwk/date.js +9 -9
  9. package/cjs/fwk/date.spec.js +25 -25
  10. package/cjs/fwk/errors.js +3 -3
  11. package/cjs/fwk/mocks/alf-mock-adapter.js +4 -4
  12. package/cjs/fwk/mocks/base-mock-adapter.js +2 -2
  13. package/cjs/fwk/mocks/helpers.js +3 -3
  14. package/cjs/fwk/reviver.spec.js +19 -19
  15. package/cjs/plugins/additional-params/additional-params-sync.request.js +2 -2
  16. package/cjs/plugins/additional-params/additional-params.request.js +3 -3
  17. package/cjs/plugins/additional-params/additional-params.spec.js +30 -30
  18. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  19. package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +13 -13
  20. package/cjs/plugins/api-key/api-key.request.js +2 -2
  21. package/cjs/plugins/api-key/api-key.spec.js +11 -11
  22. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
  23. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +33 -33
  24. package/cjs/plugins/client-facts/client-facts.request.js +3 -3
  25. package/cjs/plugins/client-facts/client-facts.spec.js +27 -27
  26. package/cjs/plugins/concurrent/concurrent.spec.js +4 -4
  27. package/cjs/plugins/custom-info/custom-info.spec.js +15 -15
  28. package/cjs/plugins/exception/exception.reply.js +2 -2
  29. package/cjs/plugins/exception/exception.spec.js +15 -15
  30. package/cjs/plugins/fetch-cache/fetch-cache.request.js +4 -4
  31. package/cjs/plugins/fetch-cache/fetch-cache.spec.js +20 -20
  32. package/cjs/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  33. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +8 -8
  34. package/cjs/plugins/json-token/json-token.reply.js +5 -5
  35. package/cjs/plugins/json-token/json-token.request.js +4 -4
  36. package/cjs/plugins/json-token/json-token.spec.js +24 -24
  37. package/cjs/plugins/keepalive/keepalive.request.js +2 -2
  38. package/cjs/plugins/keepalive/keepalive.spec.js +4 -4
  39. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +11 -11
  40. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +25 -25
  41. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +3 -3
  42. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  43. package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
  44. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +28 -28
  45. package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
  46. package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +9 -9
  47. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +11 -11
  48. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +94 -94
  49. package/cjs/plugins/raw-response-info/raw-response-info.spec.js +12 -12
  50. package/cjs/plugins/retry/retry.spec.js +20 -20
  51. package/cjs/plugins/reviver/reviver.spec.js +4 -4
  52. package/cjs/plugins/session-id/session-id.request.js +6 -6
  53. package/cjs/plugins/session-id/session-id.spec.js +13 -13
  54. package/cjs/plugins/si-token/si-token.spec.js +9 -9
  55. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +4 -4
  56. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +44 -44
  57. package/cjs/plugins/timeout/timeout.fetch.js +11 -11
  58. package/cjs/plugins/timeout/timeout.spec.js +13 -13
  59. package/cjs/plugins/url-rewrite/url-rewrite.spec.js +9 -9
  60. package/cjs/plugins/wait-for/wait-for.spec.js +9 -9
  61. package/cjs/utils/crypto.js +14 -14
  62. package/cjs/utils/generic-api.js +253 -0
  63. package/cjs/utils/index.js +1 -0
  64. package/cjs/utils/json-token.js +30 -30
  65. package/cjs/utils/json-token.spec.js +31 -31
  66. package/cli/clear-index.cjs.map +1 -0
  67. package/cli/files-pack.cjs.map +1 -0
  68. package/esm2015/clients/api-angular-client.js +40 -22
  69. package/esm2015/clients/api-beacon-client.js +62 -20
  70. package/esm2015/clients/api-fetch-client.js +64 -22
  71. package/esm2015/clients/index.js +2 -2
  72. package/esm2015/fwk/api.helper.spec.js +21 -21
  73. package/esm2015/fwk/api.helpers.js +14 -14
  74. package/esm2015/fwk/core/api-client.js +1 -1
  75. package/esm2015/fwk/core/base-api-constructor.js +1 -1
  76. package/esm2015/fwk/core/index.js +2 -2
  77. package/esm2015/fwk/date.js +9 -9
  78. package/esm2015/fwk/date.spec.js +26 -26
  79. package/esm2015/fwk/errors.js +3 -3
  80. package/esm2015/fwk/index.js +10 -10
  81. package/esm2015/fwk/mocks/alf-mock-adapter.js +6 -6
  82. package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
  83. package/esm2015/fwk/mocks/helpers.js +3 -3
  84. package/esm2015/fwk/mocks/index.js +10 -10
  85. package/esm2015/fwk/mocks/random-mock-adapter.js +1 -1
  86. package/esm2015/fwk/mocks/sequential-mock-adapter.js +1 -1
  87. package/esm2015/fwk/reviver.spec.js +20 -20
  88. package/esm2015/plugins/additional-params/additional-params-sync.request.js +3 -3
  89. package/esm2015/plugins/additional-params/additional-params.request.js +3 -3
  90. package/esm2015/plugins/additional-params/additional-params.spec.js +32 -32
  91. package/esm2015/plugins/additional-params/index.js +2 -2
  92. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  93. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +14 -14
  94. package/esm2015/plugins/api-configuration-override/index.js +1 -1
  95. package/esm2015/plugins/api-key/api-key.request.js +2 -2
  96. package/esm2015/plugins/api-key/api-key.spec.js +12 -12
  97. package/esm2015/plugins/api-key/index.js +1 -1
  98. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
  99. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +34 -34
  100. package/esm2015/plugins/bot-protection-fingerprint/index.js +1 -1
  101. package/esm2015/plugins/client-facts/client-facts.request.js +4 -4
  102. package/esm2015/plugins/client-facts/client-facts.spec.js +28 -28
  103. package/esm2015/plugins/client-facts/index.js +1 -1
  104. package/esm2015/plugins/concurrent/concurrent.spec.js +5 -5
  105. package/esm2015/plugins/concurrent/index.js +1 -1
  106. package/esm2015/plugins/core/index.js +4 -4
  107. package/esm2015/plugins/custom-info/custom-info.spec.js +17 -17
  108. package/esm2015/plugins/custom-info/index.js +1 -1
  109. package/esm2015/plugins/exception/exception.reply.js +4 -4
  110. package/esm2015/plugins/exception/exception.spec.js +18 -18
  111. package/esm2015/plugins/exception/index.js +1 -1
  112. package/esm2015/plugins/fetch-cache/fetch-cache.request.js +4 -4
  113. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +21 -21
  114. package/esm2015/plugins/fetch-cache/index.js +1 -1
  115. package/esm2015/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  116. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +9 -9
  117. package/esm2015/plugins/fetch-credentials/index.js +1 -1
  118. package/esm2015/plugins/index.js +25 -25
  119. package/esm2015/plugins/json-token/index.js +2 -2
  120. package/esm2015/plugins/json-token/json-token.reply.js +5 -5
  121. package/esm2015/plugins/json-token/json-token.request.js +4 -4
  122. package/esm2015/plugins/json-token/json-token.spec.js +27 -27
  123. package/esm2015/plugins/keepalive/index.js +1 -1
  124. package/esm2015/plugins/keepalive/keepalive.request.js +2 -2
  125. package/esm2015/plugins/keepalive/keepalive.spec.js +5 -5
  126. package/esm2015/plugins/mgw-mdw-auth/index.js +1 -1
  127. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +13 -13
  128. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +27 -27
  129. package/esm2015/plugins/mock-intercept/index.js +2 -2
  130. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -5
  131. package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  132. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +4 -4
  133. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +32 -32
  134. package/esm2015/plugins/perf-metric/index.js +1 -1
  135. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -2
  136. package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +10 -10
  137. package/esm2015/plugins/pii-tokenizer/index.js +1 -1
  138. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -12
  139. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +96 -96
  140. package/esm2015/plugins/raw-response-info/index.js +1 -1
  141. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +14 -14
  142. package/esm2015/plugins/retry/index.js +1 -1
  143. package/esm2015/plugins/retry/retry.fetch.js +1 -1
  144. package/esm2015/plugins/retry/retry.spec.js +21 -21
  145. package/esm2015/plugins/reviver/index.js +1 -1
  146. package/esm2015/plugins/reviver/reviver.spec.js +6 -6
  147. package/esm2015/plugins/session-id/index.js +1 -1
  148. package/esm2015/plugins/session-id/session-id.request.js +7 -7
  149. package/esm2015/plugins/session-id/session-id.spec.js +14 -14
  150. package/esm2015/plugins/si-token/index.js +1 -1
  151. package/esm2015/plugins/si-token/si-token.request.js +1 -1
  152. package/esm2015/plugins/si-token/si-token.spec.js +10 -10
  153. package/esm2015/plugins/simple-api-key-authentication/index.js +1 -1
  154. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +5 -5
  155. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +46 -46
  156. package/esm2015/plugins/timeout/index.js +1 -1
  157. package/esm2015/plugins/timeout/timeout.fetch.js +12 -12
  158. package/esm2015/plugins/timeout/timeout.spec.js +15 -15
  159. package/esm2015/plugins/url-rewrite/index.js +1 -1
  160. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +10 -10
  161. package/esm2015/plugins/wait-for/index.js +1 -1
  162. package/esm2015/plugins/wait-for/wait-for.spec.js +10 -10
  163. package/esm2015/public_api.js +4 -4
  164. package/esm2015/utils/crypto.js +15 -15
  165. package/esm2015/utils/generic-api.js +245 -0
  166. package/esm2015/utils/index.js +6 -5
  167. package/esm2015/utils/json-token.js +32 -32
  168. package/esm2015/utils/json-token.spec.js +32 -32
  169. package/package.json +7 -7
  170. package/schematics/ng-add/index.js.map +1 -0
  171. package/schematics/ng-add/schema.js.map +1 -0
  172. package/src/clients/api-angular-client.d.ts +6 -3
  173. package/src/clients/api-angular-client.d.ts.map +1 -1
  174. package/src/clients/api-angular-client.js +23 -11
  175. package/src/clients/api-angular-client.js.map +1 -1
  176. package/src/clients/api-beacon-client.d.ts +7 -5
  177. package/src/clients/api-beacon-client.d.ts.map +1 -1
  178. package/src/clients/api-beacon-client.js +22 -14
  179. package/src/clients/api-beacon-client.js.map +1 -1
  180. package/src/clients/api-fetch-client.d.ts +5 -3
  181. package/src/clients/api-fetch-client.d.ts.map +1 -1
  182. package/src/clients/api-fetch-client.js +22 -11
  183. package/src/clients/api-fetch-client.js.map +1 -1
  184. package/src/fwk/api.helpers.d.ts +1 -1
  185. package/src/fwk/api.helpers.d.ts.map +1 -1
  186. package/src/fwk/api.helpers.js +1 -1
  187. package/src/fwk/api.helpers.js.map +1 -1
  188. package/src/fwk/core/api-client.d.ts +36 -1
  189. package/src/fwk/core/api-client.d.ts.map +1 -1
  190. package/src/fwk/core/api-client.js.map +1 -1
  191. package/src/plugins/core/plugin.d.ts +6 -1
  192. package/src/plugins/core/plugin.d.ts.map +1 -1
  193. package/src/plugins/core/reply-plugin.d.ts +0 -2
  194. package/src/plugins/core/reply-plugin.d.ts.map +1 -1
  195. package/src/utils/generic-api.d.ts +39 -0
  196. package/src/utils/generic-api.d.ts.map +1 -0
  197. package/src/utils/generic-api.js +43 -0
  198. package/src/utils/generic-api.js.map +1 -0
  199. package/src/utils/index.d.ts +1 -0
  200. package/src/utils/index.d.ts.map +1 -1
  201. package/src/utils/index.js +1 -0
  202. package/src/utils/index.js.map +1 -1
@@ -122,10 +122,10 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { akamaiTelemetryRetrieverFactory, BotProtectionFingerprintRequest, impervaProtectionRetrieverFactory } from "./bot-protection-fingerprint.request";
126
- describe("BotProtectionFingerprint", function() {
127
- describe("Retrievers", function() {
128
- describe("impervaProtectionRetrieverFactory", function() {
125
+ import { akamaiTelemetryRetrieverFactory, BotProtectionFingerprintRequest, impervaProtectionRetrieverFactory } from './bot-protection-fingerprint.request';
126
+ describe('BotProtectionFingerprint', function() {
127
+ describe('Retrievers', function() {
128
+ describe('impervaProtectionRetrieverFactory', function() {
129
129
  var consoleMock;
130
130
  var windowBackup;
131
131
  var tokenValue;
@@ -137,12 +137,12 @@ describe("BotProtectionFingerprint", function() {
137
137
  };
138
138
  var protectionReject = {
139
139
  token: function() {
140
- return Promise.reject("error");
140
+ return Promise.reject('error');
141
141
  }
142
142
  };
143
143
  var registerEvent = function(protection) {
144
144
  var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
145
- Object.defineProperty(global.window, "protectionLoaded", {
145
+ Object.defineProperty(global.window, 'protectionLoaded', {
146
146
  set: function(handler) {
147
147
  setTimeout(function() {
148
148
  return handler(protection || protectionResolve);
@@ -152,19 +152,19 @@ describe("BotProtectionFingerprint", function() {
152
152
  });
153
153
  };
154
154
  beforeEach(function() {
155
- consoleMock = jest.spyOn(console, "error").mockImplementation();
155
+ consoleMock = jest.spyOn(console, 'error').mockImplementation();
156
156
  windowBackup = global.window;
157
157
  // eslint-disable-next-line no-global-assign
158
158
  global.window = {};
159
159
  retriever = impervaProtectionRetrieverFactory(50, 50);
160
- tokenValue = "dummyToken";
160
+ tokenValue = 'dummyToken';
161
161
  });
162
162
  afterEach(function() {
163
163
  // eslint-disable-next-line no-global-assign
164
164
  global.window = windowBackup;
165
165
  consoleMock.mockReset();
166
166
  });
167
- it("Should return undefined and log if no Protection object is received.", /*#__PURE__*/ _async_to_generator(function() {
167
+ it('Should return undefined and log if no Protection object is received.', /*#__PURE__*/ _async_to_generator(function() {
168
168
  var promise;
169
169
  return _ts_generator(this, function(_state) {
170
170
  switch(_state.label){
@@ -192,7 +192,7 @@ describe("BotProtectionFingerprint", function() {
192
192
  }
193
193
  });
194
194
  }));
195
- it("Should return undefined and log if no Protection object is received within configured timeout.", /*#__PURE__*/ _async_to_generator(function() {
195
+ it('Should return undefined and log if no Protection object is received within configured timeout.', /*#__PURE__*/ _async_to_generator(function() {
196
196
  var promise;
197
197
  return _ts_generator(this, function(_state) {
198
198
  switch(_state.label){
@@ -221,7 +221,7 @@ describe("BotProtectionFingerprint", function() {
221
221
  }
222
222
  });
223
223
  }));
224
- it("Should return undefined and log if token promise rejected.", /*#__PURE__*/ _async_to_generator(function() {
224
+ it('Should return undefined and log if token promise rejected.', /*#__PURE__*/ _async_to_generator(function() {
225
225
  var promise;
226
226
  return _ts_generator(this, function(_state) {
227
227
  switch(_state.label){
@@ -250,7 +250,7 @@ describe("BotProtectionFingerprint", function() {
250
250
  }
251
251
  });
252
252
  }));
253
- it("Should return the token if everything happened within timeout values.", /*#__PURE__*/ _async_to_generator(function() {
253
+ it('Should return the token if everything happened within timeout values.', /*#__PURE__*/ _async_to_generator(function() {
254
254
  var promise, newPromise;
255
255
  return _ts_generator(this, function(_state) {
256
256
  switch(_state.label){
@@ -271,7 +271,7 @@ describe("BotProtectionFingerprint", function() {
271
271
  expect.apply(void 0, [
272
272
  _state.sent()
273
273
  ]).toBe(tokenValue);
274
- tokenValue = "newToken";
274
+ tokenValue = 'newToken';
275
275
  newPromise = retriever();
276
276
  return [
277
277
  4,
@@ -296,51 +296,51 @@ describe("BotProtectionFingerprint", function() {
296
296
  });
297
297
  }));
298
298
  });
299
- describe("akamaiTelemetryRetrieverFactory", function() {
300
- it("Should return undefined if bmak object doesn't exist.", function() {
299
+ describe('akamaiTelemetryRetrieverFactory', function() {
300
+ it('Should return undefined if bmak object doesn\'t exist.', function() {
301
301
  expect(akamaiTelemetryRetrieverFactory()()).toBeUndefined();
302
302
  expect(akamaiTelemetryRetrieverFactory({})()).toBeUndefined();
303
303
  // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
304
304
  expect(akamaiTelemetryRetrieverFactory({
305
- get_telemetry: "test"
305
+ get_telemetry: 'test'
306
306
  })()).toBeUndefined();
307
307
  });
308
- it("Should return telemetry", function() {
308
+ it('Should return telemetry', function() {
309
309
  // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
310
310
  expect(akamaiTelemetryRetrieverFactory({
311
311
  get_telemetry: function() {
312
- return "telemetryValue";
312
+ return 'telemetryValue';
313
313
  }
314
- })()).toBe("telemetryValue");
314
+ })()).toBe('telemetryValue');
315
315
  global.window = {};
316
316
  // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
317
317
  global.window.bmak = {
318
318
  get_telemetry: function() {
319
- return "telemetryValue2";
319
+ return 'telemetryValue2';
320
320
  }
321
321
  };
322
- expect(akamaiTelemetryRetrieverFactory()()).toBe("telemetryValue2");
322
+ expect(akamaiTelemetryRetrieverFactory()()).toBe('telemetryValue2');
323
323
  global.window = undefined;
324
324
  });
325
325
  });
326
326
  });
327
- describe("Plug-in", function() {
327
+ describe('Plug-in', function() {
328
328
  var mockedRequest;
329
329
  var mockedFingerprint;
330
330
  var fingerprintRetriever;
331
- var destinationHeaderName = "test-header";
331
+ var destinationHeaderName = 'test-header';
332
332
  beforeEach(function() {
333
333
  mockedFingerprint = undefined;
334
334
  mockedRequest = {
335
- method: "get",
336
- basePath: "toto",
335
+ method: 'get',
336
+ basePath: 'toto',
337
337
  headers: new Headers()
338
338
  };
339
339
  fingerprintRetriever = jest.fn().mockImplementation(function() {
340
340
  return mockedFingerprint;
341
341
  });
342
342
  });
343
- it("Should add the fingerprint header if a fingerprint is found.", /*#__PURE__*/ _async_to_generator(function() {
343
+ it('Should add the fingerprint header if a fingerprint is found.', /*#__PURE__*/ _async_to_generator(function() {
344
344
  var plugin, newRequest;
345
345
  return _ts_generator(this, function(_state) {
346
346
  switch(_state.label){
@@ -351,7 +351,7 @@ describe("BotProtectionFingerprint", function() {
351
351
  pollerOptions: undefined,
352
352
  pollOnlyOnce: false
353
353
  }).load();
354
- mockedFingerprint = "fingerprint";
354
+ mockedFingerprint = 'fingerprint';
355
355
  return [
356
356
  4,
357
357
  plugin.transform(mockedRequest)
@@ -366,7 +366,7 @@ describe("BotProtectionFingerprint", function() {
366
366
  }
367
367
  });
368
368
  }));
369
- it("Should' add the fingerprint header if no fingerprint is found with no poller.", /*#__PURE__*/ _async_to_generator(function() {
369
+ it('Should\' add the fingerprint header if no fingerprint is found with no poller.', /*#__PURE__*/ _async_to_generator(function() {
370
370
  var plugin, newRequest;
371
371
  return _ts_generator(this, function(_state) {
372
372
  switch(_state.label){
@@ -391,7 +391,7 @@ describe("BotProtectionFingerprint", function() {
391
391
  }
392
392
  });
393
393
  }));
394
- it("Should add the fingerprint header if there is no fingerprint after the configured poller has finished running.", /*#__PURE__*/ _async_to_generator(function() {
394
+ it('Should add the fingerprint header if there is no fingerprint after the configured poller has finished running.', /*#__PURE__*/ _async_to_generator(function() {
395
395
  var plugin, newRequestPromise, newRequest;
396
396
  return _ts_generator(this, function(_state) {
397
397
  switch(_state.label){
@@ -426,7 +426,7 @@ describe("BotProtectionFingerprint", function() {
426
426
  }
427
427
  });
428
428
  }));
429
- it("Should add the fingerprint header if initially not found but added before the poller ended.", /*#__PURE__*/ _async_to_generator(function() {
429
+ it('Should add the fingerprint header if initially not found but added before the poller ended.', /*#__PURE__*/ _async_to_generator(function() {
430
430
  var plugin, newRequestPromise, newRequest;
431
431
  return _ts_generator(this, function(_state) {
432
432
  switch(_state.label){
@@ -441,7 +441,7 @@ describe("BotProtectionFingerprint", function() {
441
441
  pollOnlyOnce: false
442
442
  }).load();
443
443
  setTimeout(function() {
444
- return mockedFingerprint = "fingerprint";
444
+ return mockedFingerprint = 'fingerprint';
445
445
  }, 350);
446
446
  newRequestPromise = plugin.transform(mockedRequest);
447
447
  return [
@@ -450,7 +450,7 @@ describe("BotProtectionFingerprint", function() {
450
450
  ];
451
451
  case 1:
452
452
  _state.sent();
453
- mockedFingerprint = "fingerprint";
453
+ mockedFingerprint = 'fingerprint';
454
454
  return [
455
455
  4,
456
456
  jest.runAllTimersAsync()
@@ -471,7 +471,7 @@ describe("BotProtectionFingerprint", function() {
471
471
  }
472
472
  });
473
473
  }));
474
- it("Should poll twice if configured.", /*#__PURE__*/ _async_to_generator(function() {
474
+ it('Should poll twice if configured.', /*#__PURE__*/ _async_to_generator(function() {
475
475
  var plugin, promise;
476
476
  return _ts_generator(this, function(_state) {
477
477
  switch(_state.label){
@@ -519,7 +519,7 @@ describe("BotProtectionFingerprint", function() {
519
519
  }
520
520
  });
521
521
  }));
522
- it("Shouldn't poll twice if configured.", /*#__PURE__*/ _async_to_generator(function() {
522
+ it('Shouldn\'t poll twice if configured.', /*#__PURE__*/ _async_to_generator(function() {
523
523
  var plugin, promise;
524
524
  return _ts_generator(this, function(_state) {
525
525
  switch(_state.label){
@@ -1 +1 @@
1
- export * from "./bot-protection-fingerprint.request";
1
+ export * from './bot-protection-fingerprint.request';
@@ -169,14 +169,14 @@ function _ts_generator(thisArg, body) {
169
169
  };
170
170
  }
171
171
  }
172
- import { createJwtEncoder } from "../../utils/json-token";
172
+ import { createJwtEncoder } from '../../utils/json-token';
173
173
  /**
174
174
  * Creates a JWT encoding function which transforms the provided Facts as a unsecured JWT format https://tools.ietf.org/html/rfc7519#section-6
175
175
  */ export function createJwtFactsEncoder() {
176
176
  var jwtEncoder = createJwtEncoder();
177
177
  var jwtPayload = function(data) {
178
178
  return _object_spread({
179
- sub: "fact"
179
+ sub: 'fact'
180
180
  }, data);
181
181
  };
182
182
  return function(data) {
@@ -257,7 +257,7 @@ import { createJwtEncoder } from "../../utils/json-token";
257
257
  /** Global facts that will be sent with every request */ _define_property(this, "globalFacts", void 0);
258
258
  /** Private facts that will be sent as-is with every request */ _define_property(this, "privateFacts", void 0);
259
259
  _define_property(this, "jwtEncoder", createJwtFactsEncoder());
260
- this.headerName = options.headerName || "ama-client-facts";
260
+ this.headerName = options.headerName || 'ama-client-facts';
261
261
  this.globalFacts = options.initialGlobalFacts;
262
262
  this.privateFacts = options.privateFacts;
263
263
  this.factsFactory = options.factsFactory;
@@ -292,7 +292,7 @@ import { createJwtEncoder } from "../../utils/json-token";
292
292
  return _ts_generator(this, function(_state) {
293
293
  switch(_state.label){
294
294
  case 0:
295
- if (!(typeof _this.factsFactory === "function")) return [
295
+ if (!(typeof _this.factsFactory === 'function')) return [
296
296
  3,
297
297
  2
298
298
  ];
@@ -150,37 +150,37 @@ function _ts_generator(thisArg, body) {
150
150
  };
151
151
  }
152
152
  }
153
- import { ClientFactsRequestPlugin, createJwtFactsEncoder } from "./client-facts.request";
153
+ import { ClientFactsRequestPlugin, createJwtFactsEncoder } from './client-facts.request';
154
154
  var defaultFacts = {
155
- foo: "one",
156
- bar: "two"
155
+ foo: 'one',
156
+ bar: 'two'
157
157
  };
158
158
  var specificFacts = {
159
- bar: "three",
160
- specific: "I am specific"
159
+ bar: 'three',
160
+ specific: 'I am specific'
161
161
  };
162
- var encryptedPrivateFacts = "GuTVpr8JxjTj1Umlmph5h5sP00c2RfIUjJIw5iYMHarSXA8sYUIuEKTUDdC5fVkcmKXi4qd3W5y/VGQcKCo0bba3JlfBGviegpGVRvug/vfH2VYTsUyAyBFdcG+CiI4dY+0/Nn48G656KxRygBkxmg==";
162
+ var encryptedPrivateFacts = 'GuTVpr8JxjTj1Umlmph5h5sP00c2RfIUjJIw5iYMHarSXA8sYUIuEKTUDdC5fVkcmKXi4qd3W5y/VGQcKCo0bba3JlfBGviegpGVRvug/vfH2VYTsUyAyBFdcG+CiI4dY+0/Nn48G656KxRygBkxmg==';
163
163
  var jwtFactsEncoder = createJwtFactsEncoder();
164
- var defaultHeader = "ama-client-facts";
165
- describe("Client Facts request plugin", function() {
164
+ var defaultHeader = 'ama-client-facts';
165
+ describe('Client Facts request plugin', function() {
166
166
  var options;
167
167
  var specificOptions;
168
168
  beforeEach(function() {
169
169
  options = {
170
- basePath: "dummypath",
170
+ basePath: 'dummypath',
171
171
  headers: new Headers(),
172
- method: "GET"
172
+ method: 'GET'
173
173
  };
174
174
  specificOptions = {
175
- basePath: "/order",
175
+ basePath: '/order',
176
176
  headers: new Headers(),
177
- method: "POST"
177
+ method: 'POST'
178
178
  };
179
179
  });
180
- it("Should encode the public facts as unsecured JWT", function() {
181
- expect(jwtFactsEncoder(defaultFacts)).toEqual("eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJmYWN0IiwiZm9vIjoib25lIiwiYmFyIjoidHdvIn0.");
180
+ it('Should encode the public facts as unsecured JWT', function() {
181
+ expect(jwtFactsEncoder(defaultFacts)).toEqual('eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJmYWN0IiwiZm9vIjoib25lIiwiYmFyIjoidHdvIn0.');
182
182
  });
183
- it("Should apply global facts to every requests to the default header", /*#__PURE__*/ _async_to_generator(function() {
183
+ it('Should apply global facts to every requests to the default header', /*#__PURE__*/ _async_to_generator(function() {
184
184
  var plugin, firstOptions, secondOptions;
185
185
  return _ts_generator(this, function(_state) {
186
186
  switch(_state.label){
@@ -211,14 +211,14 @@ describe("Client Facts request plugin", function() {
211
211
  }
212
212
  });
213
213
  }));
214
- it("Should allow to configure header name", /*#__PURE__*/ _async_to_generator(function() {
214
+ it('Should allow to configure header name', /*#__PURE__*/ _async_to_generator(function() {
215
215
  var plugin, newOptions;
216
216
  return _ts_generator(this, function(_state) {
217
217
  switch(_state.label){
218
218
  case 0:
219
219
  plugin = new ClientFactsRequestPlugin({
220
220
  initialGlobalFacts: defaultFacts,
221
- headerName: "dummy"
221
+ headerName: 'dummy'
222
222
  });
223
223
  return [
224
224
  4,
@@ -226,7 +226,7 @@ describe("Client Facts request plugin", function() {
226
226
  ];
227
227
  case 1:
228
228
  newOptions = _state.sent();
229
- expect(newOptions.headers.has("dummy")).toBeTruthy();
229
+ expect(newOptions.headers.has('dummy')).toBeTruthy();
230
230
  expect(newOptions.headers.has(defaultHeader)).toBeFalsy();
231
231
  return [
232
232
  2
@@ -234,7 +234,7 @@ describe("Client Facts request plugin", function() {
234
234
  }
235
235
  });
236
236
  }));
237
- it("Should allow to change facts via a function", /*#__PURE__*/ _async_to_generator(function() {
237
+ it('Should allow to change facts via a function', /*#__PURE__*/ _async_to_generator(function() {
238
238
  var plugin, newOptions;
239
239
  return _ts_generator(this, function(_state) {
240
240
  switch(_state.label){
@@ -243,7 +243,7 @@ describe("Client Facts request plugin", function() {
243
243
  initialGlobalFacts: defaultFacts
244
244
  });
245
245
  plugin.setGlobalFacts({
246
- foo: "bar"
246
+ foo: 'bar'
247
247
  });
248
248
  return [
249
249
  4,
@@ -253,7 +253,7 @@ describe("Client Facts request plugin", function() {
253
253
  newOptions = _state.sent();
254
254
  expect(newOptions.headers.has(defaultHeader)).toBeTruthy();
255
255
  expect(newOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder({
256
- foo: "bar"
256
+ foo: 'bar'
257
257
  }));
258
258
  return [
259
259
  2
@@ -261,14 +261,14 @@ describe("Client Facts request plugin", function() {
261
261
  }
262
262
  });
263
263
  }));
264
- it("Should allow to return facts only for specific requests thanks to factories", /*#__PURE__*/ _async_to_generator(function() {
264
+ it('Should allow to return facts only for specific requests thanks to factories', /*#__PURE__*/ _async_to_generator(function() {
265
265
  var plugin, newOptions, newSpecificOptions;
266
266
  return _ts_generator(this, function(_state) {
267
267
  switch(_state.label){
268
268
  case 0:
269
269
  plugin = new ClientFactsRequestPlugin({
270
270
  factsFactory: function(request) {
271
- if (request.basePath.includes("/order") && request.method !== "GET") {
271
+ if (request.basePath.includes('/order') && request.method !== 'GET') {
272
272
  return specificFacts;
273
273
  }
274
274
  return {};
@@ -295,7 +295,7 @@ describe("Client Facts request plugin", function() {
295
295
  }
296
296
  });
297
297
  }));
298
- it("Should allow to set private facts", /*#__PURE__*/ _async_to_generator(function() {
298
+ it('Should allow to set private facts', /*#__PURE__*/ _async_to_generator(function() {
299
299
  var plugin, newOptions;
300
300
  return _ts_generator(this, function(_state) {
301
301
  switch(_state.label){
@@ -317,7 +317,7 @@ describe("Client Facts request plugin", function() {
317
317
  }
318
318
  });
319
319
  }));
320
- it("Specific facts should have priority over global facts", /*#__PURE__*/ _async_to_generator(function() {
320
+ it('Specific facts should have priority over global facts', /*#__PURE__*/ _async_to_generator(function() {
321
321
  var plugin, newSpecificOptions;
322
322
  return _ts_generator(this, function(_state) {
323
323
  switch(_state.label){
@@ -325,7 +325,7 @@ describe("Client Facts request plugin", function() {
325
325
  plugin = new ClientFactsRequestPlugin({
326
326
  initialGlobalFacts: defaultFacts,
327
327
  factsFactory: function(request) {
328
- if (request.basePath.includes("/order") && request.method !== "GET") {
328
+ if (request.basePath.includes('/order') && request.method !== 'GET') {
329
329
  return specificFacts;
330
330
  }
331
331
  return {};
@@ -345,14 +345,14 @@ describe("Client Facts request plugin", function() {
345
345
  }
346
346
  });
347
347
  }));
348
- it("Factories should be allowed to be asynchronous and return a Promise of facts", /*#__PURE__*/ _async_to_generator(function() {
348
+ it('Factories should be allowed to be asynchronous and return a Promise of facts', /*#__PURE__*/ _async_to_generator(function() {
349
349
  var plugin, promise, newSpecificOptions;
350
350
  return _ts_generator(this, function(_state) {
351
351
  switch(_state.label){
352
352
  case 0:
353
353
  plugin = new ClientFactsRequestPlugin({
354
354
  factsFactory: function(request) {
355
- if (request.basePath.includes("/order") && request.method !== "GET") {
355
+ if (request.basePath.includes('/order') && request.method !== 'GET') {
356
356
  return new Promise(function(resolve) {
357
357
  return setTimeout(function() {
358
358
  return resolve(specificFacts);
@@ -1 +1 @@
1
- export * from "./client-facts.request";
1
+ export * from './client-facts.request';
@@ -122,9 +122,9 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { ConcurrentFetch } from "./concurrent.fetch";
126
- describe("Concurrent Fetch Plugin", function() {
127
- it("should start if the limit is not reach", /*#__PURE__*/ _async_to_generator(function() {
125
+ import { ConcurrentFetch } from './concurrent.fetch';
126
+ describe('Concurrent Fetch Plugin', function() {
127
+ it('should start if the limit is not reach', /*#__PURE__*/ _async_to_generator(function() {
128
128
  var plugin, runner, canStart;
129
129
  return _ts_generator(this, function(_state) {
130
130
  switch(_state.label){
@@ -145,7 +145,7 @@ describe("Concurrent Fetch Plugin", function() {
145
145
  }
146
146
  });
147
147
  }));
148
- it("should retrieve the fetchcall in the pool", function() {
148
+ it('should retrieve the fetchcall in the pool', function() {
149
149
  var plugin = new ConcurrentFetch(3);
150
150
  var call = new Promise(function(resolve) {
151
151
  return setTimeout(function() {
@@ -162,7 +162,7 @@ describe("Concurrent Fetch Plugin", function() {
162
162
  void plugin.load({}).transform(test);
163
163
  expect(plugin.pool[2]).toBe(test);
164
164
  });
165
- it("should start only when the pool is available", /*#__PURE__*/ _async_to_generator(function() {
165
+ it('should start only when the pool is available', /*#__PURE__*/ _async_to_generator(function() {
166
166
  var plugin, resolves, call0, call1, result, runner1, canStart1, runner2, pCanStart2;
167
167
  return _ts_generator(this, function(_state) {
168
168
  switch(_state.label){
@@ -1 +1 @@
1
- export * from "./concurrent.fetch";
1
+ export * from './concurrent.fetch';
@@ -1,4 +1,4 @@
1
- export * from "./plugin";
2
- export * from "./fetch-plugin";
3
- export * from "./request-plugin";
4
- export * from "./reply-plugin";
1
+ export * from './plugin';
2
+ export * from './fetch-plugin';
3
+ export * from './request-plugin';
4
+ export * from './reply-plugin';
@@ -122,16 +122,16 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { ApiTypes } from "../../fwk/api";
126
- import { CustomInfoReply } from "./custom-info.reply";
127
- describe("Custom info reply plugin", function() {
128
- it("should add the content of the custom information in the reply", /*#__PURE__*/ _async_to_generator(function() {
125
+ import { ApiTypes } from '../../fwk/api';
126
+ import { CustomInfoReply } from './custom-info.reply';
127
+ describe('Custom info reply plugin', function() {
128
+ it('should add the content of the custom information in the reply', /*#__PURE__*/ _async_to_generator(function() {
129
129
  var customInfo, plugin, runner, newData;
130
130
  return _ts_generator(this, function(_state) {
131
131
  switch(_state.label){
132
132
  case 0:
133
133
  customInfo = {
134
- key: "value",
134
+ key: 'value',
135
135
  nested: {
136
136
  field: 10
137
137
  }
@@ -148,7 +148,7 @@ describe("Custom info reply plugin", function() {
148
148
  case 1:
149
149
  newData = _state.sent();
150
150
  expect(newData.customInfo).toEqual({
151
- key: "value",
151
+ key: 'value',
152
152
  nested: {
153
153
  field: 10
154
154
  }
@@ -159,18 +159,18 @@ describe("Custom info reply plugin", function() {
159
159
  }
160
160
  });
161
161
  }));
162
- it("should merge the contents of the two custom info", /*#__PURE__*/ _async_to_generator(function() {
162
+ it('should merge the contents of the two custom info', /*#__PURE__*/ _async_to_generator(function() {
163
163
  var customInfo1, plugin1, customInfo2, plugin2, runner1, runner2, newData, _;
164
164
  return _ts_generator(this, function(_state) {
165
165
  switch(_state.label){
166
166
  case 0:
167
167
  customInfo1 = {
168
- key0: "dummy",
169
- key1: "value"
168
+ key0: 'dummy',
169
+ key1: 'value'
170
170
  };
171
171
  plugin1 = new CustomInfoReply(customInfo1);
172
172
  customInfo2 = {
173
- key1: "override",
173
+ key1: 'override',
174
174
  key2: 42
175
175
  };
176
176
  plugin2 = new CustomInfoReply(customInfo2);
@@ -197,8 +197,8 @@ describe("Custom info reply plugin", function() {
197
197
  case 2:
198
198
  newData = _state.sent();
199
199
  expect(newData.customInfo).toEqual({
200
- key0: "dummy",
201
- key1: "override",
200
+ key0: 'dummy',
201
+ key1: 'override',
202
202
  key2: 42
203
203
  });
204
204
  return [
@@ -207,19 +207,19 @@ describe("Custom info reply plugin", function() {
207
207
  }
208
208
  });
209
209
  }));
210
- it("should invalidate custom info", function() {
210
+ it('should invalidate custom info', function() {
211
211
  var plugin = new CustomInfoReply({});
212
212
  var data = {
213
- originalData: "OK"
213
+ originalData: 'OK'
214
214
  };
215
215
  expect(plugin.hasCustomInfo(data)).toBeFalsy();
216
216
  });
217
- it("should validate custom info", function() {
217
+ it('should validate custom info', function() {
218
218
  var plugin = new CustomInfoReply({});
219
219
  var data = {
220
- originalData: "OK",
220
+ originalData: 'OK',
221
221
  customInfo: {
222
- a: "b"
222
+ a: 'b'
223
223
  }
224
224
  };
225
225
  expect(plugin.hasCustomInfo(data)).toBeTruthy();
@@ -1 +1 @@
1
- export * from "./custom-info.reply";
1
+ export * from './custom-info.reply';
@@ -30,8 +30,8 @@ function _define_property(obj, key, value) {
30
30
  }
31
31
  return obj;
32
32
  }
33
- import { ApiTypes } from "../../fwk/api";
34
- import { EmptyResponseError, RequestFailedError } from "../../fwk/errors";
33
+ import { ApiTypes } from '../../fwk/api';
34
+ import { EmptyResponseError, RequestFailedError } from '../../fwk/errors';
35
35
  /**
36
36
  * Plugin to fire an exception on wrong response / data
37
37
  */ export var ExceptionReply = /*#__PURE__*/ function() {
@@ -59,8 +59,8 @@ import { EmptyResponseError, RequestFailedError } from "../../fwk/errors";
59
59
  };
60
60
  var error;
61
61
  if (!context.response) {
62
- error = new EmptyResponseError("Fail to Fetch", undefined, errorContext);
63
- } else if (context.apiType === ApiTypes.DAPI && context.response.status === 200 && (!res || !res.data && typeof res.errors !== "undefined" // Some DAPI replies have data as optional, so we only throw if response contains errors
62
+ error = new EmptyResponseError('Fail to Fetch', undefined, errorContext);
63
+ } else if (context.apiType === ApiTypes.DAPI && context.response.status === 200 && (!res || !res.data && typeof res.errors !== 'undefined' // Some DAPI replies have data as optional, so we only throw if response contains errors
64
64
  )) {
65
65
  error = new EmptyResponseError(context.response.statusText, res, errorContext);
66
66
  } else if (!context.response.ok) {