@ama-sdk/core 10.3.0-prerelease.9 → 10.3.0-rc.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 (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
@@ -127,23 +127,23 @@ function _ts_generator(thisArg, body) {
127
127
  };
128
128
  }
129
129
  }
130
- describe("Api Key Request Plugin", function() {
130
+ describe('Api Key Request Plugin', function() {
131
131
  var options;
132
132
  beforeEach(function() {
133
133
  var headers = new Headers();
134
- jest.spyOn(headers, "append");
134
+ jest.spyOn(headers, 'append');
135
135
  options = {
136
136
  headers: 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 add the API Key to the headers", /*#__PURE__*/ _async_to_generator(function() {
141
+ it('should add the API Key to the headers', /*#__PURE__*/ _async_to_generator(function() {
142
142
  var plugin, runner;
143
143
  return _ts_generator(this, function(_state) {
144
144
  switch(_state.label){
145
145
  case 0:
146
- plugin = new _apikeyrequest.ApiKeyRequest("test", "testKey");
146
+ plugin = new _apikeyrequest.ApiKeyRequest('test', 'testKey');
147
147
  runner = plugin.load();
148
148
  return [
149
149
  4,
@@ -151,21 +151,21 @@ describe("Api Key Request Plugin", function() {
151
151
  ];
152
152
  case 1:
153
153
  _state.sent();
154
- expect(options.headers.append).toHaveBeenCalledWith("testKey", "test");
154
+ expect(options.headers.append).toHaveBeenCalledWith('testKey', 'test');
155
155
  return [
156
156
  2
157
157
  ];
158
158
  }
159
159
  });
160
160
  }));
161
- it("should execute the function to add the API Key to the headers", /*#__PURE__*/ _async_to_generator(function() {
161
+ it('should execute the function to add the API Key to the headers', /*#__PURE__*/ _async_to_generator(function() {
162
162
  var plugin, runner;
163
163
  return _ts_generator(this, function(_state) {
164
164
  switch(_state.label){
165
165
  case 0:
166
166
  plugin = new _apikeyrequest.ApiKeyRequest(function() {
167
- return Promise.resolve("test");
168
- }, "testKey");
167
+ return Promise.resolve('test');
168
+ }, 'testKey');
169
169
  runner = plugin.load();
170
170
  return [
171
171
  4,
@@ -173,7 +173,7 @@ describe("Api Key Request Plugin", function() {
173
173
  ];
174
174
  case 1:
175
175
  _state.sent();
176
- expect(options.headers.append).toHaveBeenCalledWith("testKey", "test");
176
+ expect(options.headers.append).toHaveBeenCalledWith('testKey', 'test');
177
177
  return [
178
178
  2
179
179
  ];
@@ -177,8 +177,8 @@ function _ts_generator(thisArg, body) {
177
177
  }
178
178
  function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
179
179
  var protection;
180
- if (typeof window === "undefined") {
181
- throw new Error("impervaProtectionRetrieverFactory should be used in a browser context.");
180
+ if (typeof window === 'undefined') {
181
+ throw new Error('impervaProtectionRetrieverFactory should be used in a browser context.');
182
182
  }
183
183
  var getProtection = function() {
184
184
  return new Promise(function(resolve, reject) {
@@ -244,7 +244,7 @@ function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
244
244
  ];
245
245
  case 6:
246
246
  e1 = _state.sent();
247
- (logger || console).error("[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Token was received in time.");
247
+ (logger || console).error('[SDK][Plug-in][BotProtectionFingerprintRequest] Timeout: no Token was received in time.');
248
248
  return [
249
249
  2
250
250
  ];
@@ -261,9 +261,9 @@ function impervaProtectionRetrieverFactory(protectionTimeout, tokenTimeout) {
261
261
  }();
262
262
  }
263
263
  function akamaiTelemetryRetrieverFactory(bmakOpt) {
264
- var bmak = bmakOpt || (typeof window !== "undefined" ? window.bmak : undefined);
264
+ var bmak = bmakOpt || (typeof window !== 'undefined' ? window.bmak : undefined);
265
265
  return function() {
266
- if (!bmak || !(typeof bmak.get_telemetry === "function")) {
266
+ if (!bmak || !(typeof bmak.get_telemetry === 'function')) {
267
267
  return;
268
268
  }
269
269
  return bmak.get_telemetry();
@@ -127,9 +127,9 @@ function _ts_generator(thisArg, body) {
127
127
  };
128
128
  }
129
129
  }
130
- describe("BotProtectionFingerprint", function() {
131
- describe("Retrievers", function() {
132
- describe("impervaProtectionRetrieverFactory", function() {
130
+ describe('BotProtectionFingerprint', function() {
131
+ describe('Retrievers', function() {
132
+ describe('impervaProtectionRetrieverFactory', function() {
133
133
  var consoleMock;
134
134
  var windowBackup;
135
135
  var tokenValue;
@@ -141,12 +141,12 @@ describe("BotProtectionFingerprint", function() {
141
141
  };
142
142
  var protectionReject = {
143
143
  token: function() {
144
- return Promise.reject("error");
144
+ return Promise.reject('error');
145
145
  }
146
146
  };
147
147
  var registerEvent = function(protection) {
148
148
  var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
149
- Object.defineProperty(global.window, "protectionLoaded", {
149
+ Object.defineProperty(global.window, 'protectionLoaded', {
150
150
  set: function(handler) {
151
151
  setTimeout(function() {
152
152
  return handler(protection || protectionResolve);
@@ -156,19 +156,19 @@ describe("BotProtectionFingerprint", function() {
156
156
  });
157
157
  };
158
158
  beforeEach(function() {
159
- consoleMock = jest.spyOn(console, "error").mockImplementation();
159
+ consoleMock = jest.spyOn(console, 'error').mockImplementation();
160
160
  windowBackup = global.window;
161
161
  // eslint-disable-next-line no-global-assign
162
162
  global.window = {};
163
163
  retriever = (0, _botprotectionfingerprintrequest.impervaProtectionRetrieverFactory)(50, 50);
164
- tokenValue = "dummyToken";
164
+ tokenValue = 'dummyToken';
165
165
  });
166
166
  afterEach(function() {
167
167
  // eslint-disable-next-line no-global-assign
168
168
  global.window = windowBackup;
169
169
  consoleMock.mockReset();
170
170
  });
171
- it("Should return undefined and log if no Protection object is received.", /*#__PURE__*/ _async_to_generator(function() {
171
+ it('Should return undefined and log if no Protection object is received.', /*#__PURE__*/ _async_to_generator(function() {
172
172
  var promise;
173
173
  return _ts_generator(this, function(_state) {
174
174
  switch(_state.label){
@@ -196,7 +196,7 @@ describe("BotProtectionFingerprint", function() {
196
196
  }
197
197
  });
198
198
  }));
199
- it("Should return undefined and log if no Protection object is received within configured timeout.", /*#__PURE__*/ _async_to_generator(function() {
199
+ it('Should return undefined and log if no Protection object is received within configured timeout.', /*#__PURE__*/ _async_to_generator(function() {
200
200
  var promise;
201
201
  return _ts_generator(this, function(_state) {
202
202
  switch(_state.label){
@@ -225,7 +225,7 @@ describe("BotProtectionFingerprint", function() {
225
225
  }
226
226
  });
227
227
  }));
228
- it("Should return undefined and log if token promise rejected.", /*#__PURE__*/ _async_to_generator(function() {
228
+ it('Should return undefined and log if token promise rejected.', /*#__PURE__*/ _async_to_generator(function() {
229
229
  var promise;
230
230
  return _ts_generator(this, function(_state) {
231
231
  switch(_state.label){
@@ -254,7 +254,7 @@ describe("BotProtectionFingerprint", function() {
254
254
  }
255
255
  });
256
256
  }));
257
- it("Should return the token if everything happened within timeout values.", /*#__PURE__*/ _async_to_generator(function() {
257
+ it('Should return the token if everything happened within timeout values.', /*#__PURE__*/ _async_to_generator(function() {
258
258
  var promise, newPromise;
259
259
  return _ts_generator(this, function(_state) {
260
260
  switch(_state.label){
@@ -275,7 +275,7 @@ describe("BotProtectionFingerprint", function() {
275
275
  expect.apply(void 0, [
276
276
  _state.sent()
277
277
  ]).toBe(tokenValue);
278
- tokenValue = "newToken";
278
+ tokenValue = 'newToken';
279
279
  newPromise = retriever();
280
280
  return [
281
281
  4,
@@ -300,51 +300,51 @@ describe("BotProtectionFingerprint", function() {
300
300
  });
301
301
  }));
302
302
  });
303
- describe("akamaiTelemetryRetrieverFactory", function() {
304
- it("Should return undefined if bmak object doesn't exist.", function() {
303
+ describe('akamaiTelemetryRetrieverFactory', function() {
304
+ it('Should return undefined if bmak object doesn\'t exist.', function() {
305
305
  expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)()()).toBeUndefined();
306
306
  expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)({})()).toBeUndefined();
307
307
  // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
308
308
  expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)({
309
- get_telemetry: "test"
309
+ get_telemetry: 'test'
310
310
  })()).toBeUndefined();
311
311
  });
312
- it("Should return telemetry", function() {
312
+ it('Should return telemetry', function() {
313
313
  // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
314
314
  expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)({
315
315
  get_telemetry: function() {
316
- return "telemetryValue";
316
+ return 'telemetryValue';
317
317
  }
318
- })()).toBe("telemetryValue");
318
+ })()).toBe('telemetryValue');
319
319
  global.window = {};
320
320
  // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase
321
321
  global.window.bmak = {
322
322
  get_telemetry: function() {
323
- return "telemetryValue2";
323
+ return 'telemetryValue2';
324
324
  }
325
325
  };
326
- expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)()()).toBe("telemetryValue2");
326
+ expect((0, _botprotectionfingerprintrequest.akamaiTelemetryRetrieverFactory)()()).toBe('telemetryValue2');
327
327
  global.window = undefined;
328
328
  });
329
329
  });
330
330
  });
331
- describe("Plug-in", function() {
331
+ describe('Plug-in', function() {
332
332
  var mockedRequest;
333
333
  var mockedFingerprint;
334
334
  var fingerprintRetriever;
335
- var destinationHeaderName = "test-header";
335
+ var destinationHeaderName = 'test-header';
336
336
  beforeEach(function() {
337
337
  mockedFingerprint = undefined;
338
338
  mockedRequest = {
339
- method: "get",
340
- basePath: "toto",
339
+ method: 'get',
340
+ basePath: 'toto',
341
341
  headers: new Headers()
342
342
  };
343
343
  fingerprintRetriever = jest.fn().mockImplementation(function() {
344
344
  return mockedFingerprint;
345
345
  });
346
346
  });
347
- it("Should add the fingerprint header if a fingerprint is found.", /*#__PURE__*/ _async_to_generator(function() {
347
+ it('Should add the fingerprint header if a fingerprint is found.', /*#__PURE__*/ _async_to_generator(function() {
348
348
  var plugin, newRequest;
349
349
  return _ts_generator(this, function(_state) {
350
350
  switch(_state.label){
@@ -355,7 +355,7 @@ describe("BotProtectionFingerprint", function() {
355
355
  pollerOptions: undefined,
356
356
  pollOnlyOnce: false
357
357
  }).load();
358
- mockedFingerprint = "fingerprint";
358
+ mockedFingerprint = 'fingerprint';
359
359
  return [
360
360
  4,
361
361
  plugin.transform(mockedRequest)
@@ -370,7 +370,7 @@ describe("BotProtectionFingerprint", function() {
370
370
  }
371
371
  });
372
372
  }));
373
- it("Should' add the fingerprint header if no fingerprint is found with no poller.", /*#__PURE__*/ _async_to_generator(function() {
373
+ it('Should\' add the fingerprint header if no fingerprint is found with no poller.', /*#__PURE__*/ _async_to_generator(function() {
374
374
  var plugin, newRequest;
375
375
  return _ts_generator(this, function(_state) {
376
376
  switch(_state.label){
@@ -395,7 +395,7 @@ describe("BotProtectionFingerprint", function() {
395
395
  }
396
396
  });
397
397
  }));
398
- it("Should add the fingerprint header if there is no fingerprint after the configured poller has finished running.", /*#__PURE__*/ _async_to_generator(function() {
398
+ it('Should add the fingerprint header if there is no fingerprint after the configured poller has finished running.', /*#__PURE__*/ _async_to_generator(function() {
399
399
  var plugin, newRequestPromise, newRequest;
400
400
  return _ts_generator(this, function(_state) {
401
401
  switch(_state.label){
@@ -430,7 +430,7 @@ describe("BotProtectionFingerprint", function() {
430
430
  }
431
431
  });
432
432
  }));
433
- it("Should add the fingerprint header if initially not found but added before the poller ended.", /*#__PURE__*/ _async_to_generator(function() {
433
+ it('Should add the fingerprint header if initially not found but added before the poller ended.', /*#__PURE__*/ _async_to_generator(function() {
434
434
  var plugin, newRequestPromise, newRequest;
435
435
  return _ts_generator(this, function(_state) {
436
436
  switch(_state.label){
@@ -445,7 +445,7 @@ describe("BotProtectionFingerprint", function() {
445
445
  pollOnlyOnce: false
446
446
  }).load();
447
447
  setTimeout(function() {
448
- return mockedFingerprint = "fingerprint";
448
+ return mockedFingerprint = 'fingerprint';
449
449
  }, 350);
450
450
  newRequestPromise = plugin.transform(mockedRequest);
451
451
  return [
@@ -454,7 +454,7 @@ describe("BotProtectionFingerprint", function() {
454
454
  ];
455
455
  case 1:
456
456
  _state.sent();
457
- mockedFingerprint = "fingerprint";
457
+ mockedFingerprint = 'fingerprint';
458
458
  return [
459
459
  4,
460
460
  jest.runAllTimersAsync()
@@ -475,7 +475,7 @@ describe("BotProtectionFingerprint", function() {
475
475
  }
476
476
  });
477
477
  }));
478
- it("Should poll twice if configured.", /*#__PURE__*/ _async_to_generator(function() {
478
+ it('Should poll twice if configured.', /*#__PURE__*/ _async_to_generator(function() {
479
479
  var plugin, promise;
480
480
  return _ts_generator(this, function(_state) {
481
481
  switch(_state.label){
@@ -523,7 +523,7 @@ describe("BotProtectionFingerprint", function() {
523
523
  }
524
524
  });
525
525
  }));
526
- it("Shouldn't poll twice if configured.", /*#__PURE__*/ _async_to_generator(function() {
526
+ it('Shouldn\'t poll twice if configured.', /*#__PURE__*/ _async_to_generator(function() {
527
527
  var plugin, promise;
528
528
  return _ts_generator(this, function(_state) {
529
529
  switch(_state.label){
@@ -192,7 +192,7 @@ function createJwtFactsEncoder() {
192
192
  var jwtEncoder = (0, _jsontoken.createJwtEncoder)();
193
193
  var jwtPayload = function(data) {
194
194
  return _object_spread({
195
- sub: "fact"
195
+ sub: 'fact'
196
196
  }, data);
197
197
  };
198
198
  return function(data) {
@@ -208,7 +208,7 @@ var ClientFactsRequestPlugin = /*#__PURE__*/ function() {
208
208
  /** Global facts that will be sent with every request */ _define_property(this, "globalFacts", void 0);
209
209
  /** Private facts that will be sent as-is with every request */ _define_property(this, "privateFacts", void 0);
210
210
  _define_property(this, "jwtEncoder", createJwtFactsEncoder());
211
- this.headerName = options.headerName || "ama-client-facts";
211
+ this.headerName = options.headerName || 'ama-client-facts';
212
212
  this.globalFacts = options.initialGlobalFacts;
213
213
  this.privateFacts = options.privateFacts;
214
214
  this.factsFactory = options.factsFactory;
@@ -243,7 +243,7 @@ var ClientFactsRequestPlugin = /*#__PURE__*/ function() {
243
243
  return _ts_generator(this, function(_state) {
244
244
  switch(_state.label){
245
245
  case 0:
246
- if (!(typeof _this.factsFactory === "function")) return [
246
+ if (!(typeof _this.factsFactory === 'function')) return [
247
247
  3,
248
248
  2
249
249
  ];
@@ -156,35 +156,35 @@ function _ts_generator(thisArg, body) {
156
156
  }
157
157
  }
158
158
  var defaultFacts = {
159
- foo: "one",
160
- bar: "two"
159
+ foo: 'one',
160
+ bar: 'two'
161
161
  };
162
162
  var specificFacts = {
163
- bar: "three",
164
- specific: "I am specific"
163
+ bar: 'three',
164
+ specific: 'I am specific'
165
165
  };
166
- var encryptedPrivateFacts = "GuTVpr8JxjTj1Umlmph5h5sP00c2RfIUjJIw5iYMHarSXA8sYUIuEKTUDdC5fVkcmKXi4qd3W5y/VGQcKCo0bba3JlfBGviegpGVRvug/vfH2VYTsUyAyBFdcG+CiI4dY+0/Nn48G656KxRygBkxmg==";
166
+ var encryptedPrivateFacts = 'GuTVpr8JxjTj1Umlmph5h5sP00c2RfIUjJIw5iYMHarSXA8sYUIuEKTUDdC5fVkcmKXi4qd3W5y/VGQcKCo0bba3JlfBGviegpGVRvug/vfH2VYTsUyAyBFdcG+CiI4dY+0/Nn48G656KxRygBkxmg==';
167
167
  var jwtFactsEncoder = (0, _clientfactsrequest.createJwtFactsEncoder)();
168
- var defaultHeader = "ama-client-facts";
169
- describe("Client Facts request plugin", function() {
168
+ var defaultHeader = 'ama-client-facts';
169
+ describe('Client Facts request plugin', function() {
170
170
  var options;
171
171
  var specificOptions;
172
172
  beforeEach(function() {
173
173
  options = {
174
- basePath: "dummypath",
174
+ basePath: 'dummypath',
175
175
  headers: new Headers(),
176
- method: "GET"
176
+ method: 'GET'
177
177
  };
178
178
  specificOptions = {
179
- basePath: "/order",
179
+ basePath: '/order',
180
180
  headers: new Headers(),
181
- method: "POST"
181
+ method: 'POST'
182
182
  };
183
183
  });
184
- it("Should encode the public facts as unsecured JWT", function() {
185
- expect(jwtFactsEncoder(defaultFacts)).toEqual("eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJmYWN0IiwiZm9vIjoib25lIiwiYmFyIjoidHdvIn0.");
184
+ it('Should encode the public facts as unsecured JWT', function() {
185
+ expect(jwtFactsEncoder(defaultFacts)).toEqual('eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJmYWN0IiwiZm9vIjoib25lIiwiYmFyIjoidHdvIn0.');
186
186
  });
187
- it("Should apply global facts to every requests to the default header", /*#__PURE__*/ _async_to_generator(function() {
187
+ it('Should apply global facts to every requests to the default header', /*#__PURE__*/ _async_to_generator(function() {
188
188
  var plugin, firstOptions, secondOptions;
189
189
  return _ts_generator(this, function(_state) {
190
190
  switch(_state.label){
@@ -215,14 +215,14 @@ describe("Client Facts request plugin", function() {
215
215
  }
216
216
  });
217
217
  }));
218
- it("Should allow to configure header name", /*#__PURE__*/ _async_to_generator(function() {
218
+ it('Should allow to configure header name', /*#__PURE__*/ _async_to_generator(function() {
219
219
  var plugin, newOptions;
220
220
  return _ts_generator(this, function(_state) {
221
221
  switch(_state.label){
222
222
  case 0:
223
223
  plugin = new _clientfactsrequest.ClientFactsRequestPlugin({
224
224
  initialGlobalFacts: defaultFacts,
225
- headerName: "dummy"
225
+ headerName: 'dummy'
226
226
  });
227
227
  return [
228
228
  4,
@@ -230,7 +230,7 @@ describe("Client Facts request plugin", function() {
230
230
  ];
231
231
  case 1:
232
232
  newOptions = _state.sent();
233
- expect(newOptions.headers.has("dummy")).toBeTruthy();
233
+ expect(newOptions.headers.has('dummy')).toBeTruthy();
234
234
  expect(newOptions.headers.has(defaultHeader)).toBeFalsy();
235
235
  return [
236
236
  2
@@ -238,7 +238,7 @@ describe("Client Facts request plugin", function() {
238
238
  }
239
239
  });
240
240
  }));
241
- it("Should allow to change facts via a function", /*#__PURE__*/ _async_to_generator(function() {
241
+ it('Should allow to change facts via a function', /*#__PURE__*/ _async_to_generator(function() {
242
242
  var plugin, newOptions;
243
243
  return _ts_generator(this, function(_state) {
244
244
  switch(_state.label){
@@ -247,7 +247,7 @@ describe("Client Facts request plugin", function() {
247
247
  initialGlobalFacts: defaultFacts
248
248
  });
249
249
  plugin.setGlobalFacts({
250
- foo: "bar"
250
+ foo: 'bar'
251
251
  });
252
252
  return [
253
253
  4,
@@ -257,7 +257,7 @@ describe("Client Facts request plugin", function() {
257
257
  newOptions = _state.sent();
258
258
  expect(newOptions.headers.has(defaultHeader)).toBeTruthy();
259
259
  expect(newOptions.headers.get(defaultHeader)).toEqual(jwtFactsEncoder({
260
- foo: "bar"
260
+ foo: 'bar'
261
261
  }));
262
262
  return [
263
263
  2
@@ -265,14 +265,14 @@ describe("Client Facts request plugin", function() {
265
265
  }
266
266
  });
267
267
  }));
268
- it("Should allow to return facts only for specific requests thanks to factories", /*#__PURE__*/ _async_to_generator(function() {
268
+ it('Should allow to return facts only for specific requests thanks to factories', /*#__PURE__*/ _async_to_generator(function() {
269
269
  var plugin, newOptions, newSpecificOptions;
270
270
  return _ts_generator(this, function(_state) {
271
271
  switch(_state.label){
272
272
  case 0:
273
273
  plugin = new _clientfactsrequest.ClientFactsRequestPlugin({
274
274
  factsFactory: function(request) {
275
- if (request.basePath.includes("/order") && request.method !== "GET") {
275
+ if (request.basePath.includes('/order') && request.method !== 'GET') {
276
276
  return specificFacts;
277
277
  }
278
278
  return {};
@@ -299,7 +299,7 @@ describe("Client Facts request plugin", function() {
299
299
  }
300
300
  });
301
301
  }));
302
- it("Should allow to set private facts", /*#__PURE__*/ _async_to_generator(function() {
302
+ it('Should allow to set private facts', /*#__PURE__*/ _async_to_generator(function() {
303
303
  var plugin, newOptions;
304
304
  return _ts_generator(this, function(_state) {
305
305
  switch(_state.label){
@@ -321,7 +321,7 @@ describe("Client Facts request plugin", function() {
321
321
  }
322
322
  });
323
323
  }));
324
- it("Specific facts should have priority over global facts", /*#__PURE__*/ _async_to_generator(function() {
324
+ it('Specific facts should have priority over global facts', /*#__PURE__*/ _async_to_generator(function() {
325
325
  var plugin, newSpecificOptions;
326
326
  return _ts_generator(this, function(_state) {
327
327
  switch(_state.label){
@@ -329,7 +329,7 @@ describe("Client Facts request plugin", function() {
329
329
  plugin = new _clientfactsrequest.ClientFactsRequestPlugin({
330
330
  initialGlobalFacts: defaultFacts,
331
331
  factsFactory: function(request) {
332
- if (request.basePath.includes("/order") && request.method !== "GET") {
332
+ if (request.basePath.includes('/order') && request.method !== 'GET') {
333
333
  return specificFacts;
334
334
  }
335
335
  return {};
@@ -349,14 +349,14 @@ describe("Client Facts request plugin", function() {
349
349
  }
350
350
  });
351
351
  }));
352
- it("Factories should be allowed to be asynchronous and return a Promise of facts", /*#__PURE__*/ _async_to_generator(function() {
352
+ it('Factories should be allowed to be asynchronous and return a Promise of facts', /*#__PURE__*/ _async_to_generator(function() {
353
353
  var plugin, promise, newSpecificOptions;
354
354
  return _ts_generator(this, function(_state) {
355
355
  switch(_state.label){
356
356
  case 0:
357
357
  plugin = new _clientfactsrequest.ClientFactsRequestPlugin({
358
358
  factsFactory: function(request) {
359
- if (request.basePath.includes("/order") && request.method !== "GET") {
359
+ if (request.basePath.includes('/order') && request.method !== 'GET') {
360
360
  return new Promise(function(resolve) {
361
361
  return setTimeout(function() {
362
362
  return resolve(specificFacts);
@@ -127,8 +127,8 @@ function _ts_generator(thisArg, body) {
127
127
  };
128
128
  }
129
129
  }
130
- describe("Concurrent Fetch Plugin", function() {
131
- it("should start if the limit is not reach", /*#__PURE__*/ _async_to_generator(function() {
130
+ describe('Concurrent Fetch Plugin', function() {
131
+ it('should start if the limit is not reach', /*#__PURE__*/ _async_to_generator(function() {
132
132
  var plugin, runner, canStart;
133
133
  return _ts_generator(this, function(_state) {
134
134
  switch(_state.label){
@@ -149,7 +149,7 @@ describe("Concurrent Fetch Plugin", function() {
149
149
  }
150
150
  });
151
151
  }));
152
- it("should retrieve the fetchcall in the pool", function() {
152
+ it('should retrieve the fetchcall in the pool', function() {
153
153
  var plugin = new _concurrentfetch.ConcurrentFetch(3);
154
154
  var call = new Promise(function(resolve) {
155
155
  return setTimeout(function() {
@@ -166,7 +166,7 @@ describe("Concurrent Fetch Plugin", function() {
166
166
  void plugin.load({}).transform(test);
167
167
  expect(plugin.pool[2]).toBe(test);
168
168
  });
169
- it("should start only when the pool is available", /*#__PURE__*/ _async_to_generator(function() {
169
+ it('should start only when the pool is available', /*#__PURE__*/ _async_to_generator(function() {
170
170
  var plugin, resolves, call0, call1, result, runner1, canStart1, runner2, pCanStart2;
171
171
  return _ts_generator(this, function(_state) {
172
172
  switch(_state.label){
@@ -128,14 +128,14 @@ function _ts_generator(thisArg, body) {
128
128
  };
129
129
  }
130
130
  }
131
- describe("Custom info reply plugin", function() {
132
- it("should add the content of the custom information in the reply", /*#__PURE__*/ _async_to_generator(function() {
131
+ describe('Custom info reply plugin', function() {
132
+ it('should add the content of the custom information in the reply', /*#__PURE__*/ _async_to_generator(function() {
133
133
  var customInfo, plugin, runner, newData;
134
134
  return _ts_generator(this, function(_state) {
135
135
  switch(_state.label){
136
136
  case 0:
137
137
  customInfo = {
138
- key: "value",
138
+ key: 'value',
139
139
  nested: {
140
140
  field: 10
141
141
  }
@@ -152,7 +152,7 @@ describe("Custom info reply plugin", function() {
152
152
  case 1:
153
153
  newData = _state.sent();
154
154
  expect(newData.customInfo).toEqual({
155
- key: "value",
155
+ key: 'value',
156
156
  nested: {
157
157
  field: 10
158
158
  }
@@ -163,18 +163,18 @@ describe("Custom info reply plugin", function() {
163
163
  }
164
164
  });
165
165
  }));
166
- it("should merge the contents of the two custom info", /*#__PURE__*/ _async_to_generator(function() {
166
+ it('should merge the contents of the two custom info', /*#__PURE__*/ _async_to_generator(function() {
167
167
  var customInfo1, plugin1, customInfo2, plugin2, runner1, runner2, newData, _;
168
168
  return _ts_generator(this, function(_state) {
169
169
  switch(_state.label){
170
170
  case 0:
171
171
  customInfo1 = {
172
- key0: "dummy",
173
- key1: "value"
172
+ key0: 'dummy',
173
+ key1: 'value'
174
174
  };
175
175
  plugin1 = new _custominforeply.CustomInfoReply(customInfo1);
176
176
  customInfo2 = {
177
- key1: "override",
177
+ key1: 'override',
178
178
  key2: 42
179
179
  };
180
180
  plugin2 = new _custominforeply.CustomInfoReply(customInfo2);
@@ -201,8 +201,8 @@ describe("Custom info reply plugin", function() {
201
201
  case 2:
202
202
  newData = _state.sent();
203
203
  expect(newData.customInfo).toEqual({
204
- key0: "dummy",
205
- key1: "override",
204
+ key0: 'dummy',
205
+ key1: 'override',
206
206
  key2: 42
207
207
  });
208
208
  return [
@@ -211,19 +211,19 @@ describe("Custom info reply plugin", function() {
211
211
  }
212
212
  });
213
213
  }));
214
- it("should invalidate custom info", function() {
214
+ it('should invalidate custom info', function() {
215
215
  var plugin = new _custominforeply.CustomInfoReply({});
216
216
  var data = {
217
- originalData: "OK"
217
+ originalData: 'OK'
218
218
  };
219
219
  expect(plugin.hasCustomInfo(data)).toBeFalsy();
220
220
  });
221
- it("should validate custom info", function() {
221
+ it('should validate custom info', function() {
222
222
  var plugin = new _custominforeply.CustomInfoReply({});
223
223
  var data = {
224
- originalData: "OK",
224
+ originalData: 'OK',
225
225
  customInfo: {
226
- a: "b"
226
+ a: 'b'
227
227
  }
228
228
  };
229
229
  expect(plugin.hasCustomInfo(data)).toBeTruthy();
@@ -67,8 +67,8 @@ var ExceptionReply = /*#__PURE__*/ function() {
67
67
  };
68
68
  var error;
69
69
  if (!context.response) {
70
- error = new _errors.EmptyResponseError("Fail to Fetch", undefined, errorContext);
71
- } else if (context.apiType === _api.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
70
+ error = new _errors.EmptyResponseError('Fail to Fetch', undefined, errorContext);
71
+ } else if (context.apiType === _api.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
72
72
  )) {
73
73
  error = new _errors.EmptyResponseError(context.response.statusText, res, errorContext);
74
74
  } else if (!context.response.ok) {