@ama-sdk/core 10.3.0-prerelease.9 → 11.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,11 +122,11 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { SimpleApiKeyAuthenticationRequest } from "./simple-api-key-authentication.request";
126
- import { createBase64UrlDecoder } from "../../utils/json-token";
125
+ import { SimpleApiKeyAuthenticationRequest } from './simple-api-key-authentication.request';
126
+ import { createBase64UrlDecoder } from '../../utils/json-token';
127
127
  var base64UrlDecoder = createBase64UrlDecoder();
128
128
  function getJWTPayload(jwt) {
129
- return JSON.parse(base64UrlDecoder(jwt.split(".")[1]));
129
+ return JSON.parse(base64UrlDecoder(jwt.split('.')[1]));
130
130
  }
131
131
  function returnInSequence() {
132
132
  for(var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++){
@@ -137,22 +137,22 @@ function returnInSequence() {
137
137
  return values[index++];
138
138
  };
139
139
  }
140
- describe("Api Key Request Plugin", function() {
140
+ describe('Api Key Request Plugin', function() {
141
141
  var options;
142
142
  beforeEach(function() {
143
143
  var headers = new Headers();
144
144
  options = {
145
145
  headers: headers,
146
- basePath: "http://test.com",
147
- method: "get"
146
+ basePath: 'http://test.com',
147
+ method: 'get'
148
148
  };
149
149
  });
150
- it("Static API key should be added to the default header.", /*#__PURE__*/ _async_to_generator(function() {
150
+ it('Static API key should be added to the default header.', /*#__PURE__*/ _async_to_generator(function() {
151
151
  var plugin, runner;
152
152
  return _ts_generator(this, function(_state) {
153
153
  switch(_state.label){
154
154
  case 0:
155
- plugin = new SimpleApiKeyAuthenticationRequest("key");
155
+ plugin = new SimpleApiKeyAuthenticationRequest('key');
156
156
  runner = plugin.load();
157
157
  return [
158
158
  4,
@@ -160,20 +160,20 @@ describe("Api Key Request Plugin", function() {
160
160
  ];
161
161
  case 1:
162
162
  _state.sent();
163
- expect(options.headers.get("x-api-key")).toBe("key");
163
+ expect(options.headers.get('x-api-key')).toBe('key');
164
164
  return [
165
165
  2
166
166
  ];
167
167
  }
168
168
  });
169
169
  }));
170
- it("Static API key should be added to the specified header.", /*#__PURE__*/ _async_to_generator(function() {
170
+ it('Static API key should be added to the specified header.', /*#__PURE__*/ _async_to_generator(function() {
171
171
  var plugin, runner;
172
172
  return _ts_generator(this, function(_state) {
173
173
  switch(_state.label){
174
174
  case 0:
175
- plugin = new SimpleApiKeyAuthenticationRequest("key", {
176
- apiKeyHeader: "custom-header"
175
+ plugin = new SimpleApiKeyAuthenticationRequest('key', {
176
+ apiKeyHeader: 'custom-header'
177
177
  });
178
178
  runner = plugin.load();
179
179
  return [
@@ -182,21 +182,21 @@ describe("Api Key Request Plugin", function() {
182
182
  ];
183
183
  case 1:
184
184
  _state.sent();
185
- expect(options.headers.get("custom-header")).toBe("key");
186
- expect(options.headers.get("x-api-key")).toBeNull();
185
+ expect(options.headers.get('custom-header')).toBe('key');
186
+ expect(options.headers.get('x-api-key')).toBeNull();
187
187
  return [
188
188
  2
189
189
  ];
190
190
  }
191
191
  });
192
192
  }));
193
- it("Static OID override should compute the right ama-ctx", /*#__PURE__*/ _async_to_generator(function() {
193
+ it('Static OID override should compute the right ama-ctx', /*#__PURE__*/ _async_to_generator(function() {
194
194
  var plugin, runner, amaCtx;
195
195
  return _ts_generator(this, function(_state) {
196
196
  switch(_state.label){
197
197
  case 0:
198
- plugin = new SimpleApiKeyAuthenticationRequest("key", {
199
- officeId: "TESTOID"
198
+ plugin = new SimpleApiKeyAuthenticationRequest('key', {
199
+ officeId: 'TESTOID'
200
200
  });
201
201
  runner = plugin.load();
202
202
  return [
@@ -205,10 +205,10 @@ describe("Api Key Request Plugin", function() {
205
205
  ];
206
206
  case 1:
207
207
  _state.sent();
208
- amaCtx = options.headers.get("ama-ctx");
208
+ amaCtx = options.headers.get('ama-ctx');
209
209
  expect(amaCtx).toBeDefined();
210
210
  expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
211
- oid: "TESTOID"
211
+ oid: 'TESTOID'
212
212
  }));
213
213
  return [
214
214
  2
@@ -216,13 +216,13 @@ describe("Api Key Request Plugin", function() {
216
216
  }
217
217
  });
218
218
  }));
219
- it("API key and OID as functions that return strings should result in the right headers", /*#__PURE__*/ _async_to_generator(function() {
219
+ it('API key and OID as functions that return strings should result in the right headers', /*#__PURE__*/ _async_to_generator(function() {
220
220
  var plugin, runner, amaCtx;
221
221
  return _ts_generator(this, function(_state) {
222
222
  switch(_state.label){
223
223
  case 0:
224
- plugin = new SimpleApiKeyAuthenticationRequest(returnInSequence("key", "secondKey"), {
225
- officeId: returnInSequence("TESTOID", "SECONDOID")
224
+ plugin = new SimpleApiKeyAuthenticationRequest(returnInSequence('key', 'secondKey'), {
225
+ officeId: returnInSequence('TESTOID', 'SECONDOID')
226
226
  });
227
227
  runner = plugin.load();
228
228
  return [
@@ -231,11 +231,11 @@ describe("Api Key Request Plugin", function() {
231
231
  ];
232
232
  case 1:
233
233
  _state.sent();
234
- amaCtx = options.headers.get("ama-ctx");
235
- expect(options.headers.get("x-api-key")).toBe("key");
234
+ amaCtx = options.headers.get('ama-ctx');
235
+ expect(options.headers.get('x-api-key')).toBe('key');
236
236
  expect(amaCtx).toBeDefined();
237
237
  expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
238
- oid: "TESTOID"
238
+ oid: 'TESTOID'
239
239
  }));
240
240
  return [
241
241
  4,
@@ -243,11 +243,11 @@ describe("Api Key Request Plugin", function() {
243
243
  ];
244
244
  case 2:
245
245
  _state.sent();
246
- amaCtx = options.headers.get("ama-ctx");
247
- expect(options.headers.get("x-api-key")).toBe("secondKey");
246
+ amaCtx = options.headers.get('ama-ctx');
247
+ expect(options.headers.get('x-api-key')).toBe('secondKey');
248
248
  expect(amaCtx).toBeDefined();
249
249
  expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
250
- oid: "SECONDOID"
250
+ oid: 'SECONDOID'
251
251
  }));
252
252
  return [
253
253
  2
@@ -255,13 +255,13 @@ describe("Api Key Request Plugin", function() {
255
255
  }
256
256
  });
257
257
  }));
258
- it("API key and OID as functions that return promises should result in the right headers", /*#__PURE__*/ _async_to_generator(function() {
258
+ it('API key and OID as functions that return promises should result in the right headers', /*#__PURE__*/ _async_to_generator(function() {
259
259
  var plugin, runner, amaCtx;
260
260
  return _ts_generator(this, function(_state) {
261
261
  switch(_state.label){
262
262
  case 0:
263
- plugin = new SimpleApiKeyAuthenticationRequest(returnInSequence(Promise.resolve("key"), Promise.resolve("secondKey")), {
264
- officeId: returnInSequence(Promise.resolve("TESTOID"), Promise.resolve("SECONDOID"))
263
+ plugin = new SimpleApiKeyAuthenticationRequest(returnInSequence(Promise.resolve('key'), Promise.resolve('secondKey')), {
264
+ officeId: returnInSequence(Promise.resolve('TESTOID'), Promise.resolve('SECONDOID'))
265
265
  });
266
266
  runner = plugin.load();
267
267
  return [
@@ -270,11 +270,11 @@ describe("Api Key Request Plugin", function() {
270
270
  ];
271
271
  case 1:
272
272
  _state.sent();
273
- amaCtx = options.headers.get("ama-ctx");
274
- expect(options.headers.get("x-api-key")).toBe("key");
273
+ amaCtx = options.headers.get('ama-ctx');
274
+ expect(options.headers.get('x-api-key')).toBe('key');
275
275
  expect(amaCtx).toBeDefined();
276
276
  expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
277
- oid: "TESTOID"
277
+ oid: 'TESTOID'
278
278
  }));
279
279
  return [
280
280
  4,
@@ -282,11 +282,11 @@ describe("Api Key Request Plugin", function() {
282
282
  ];
283
283
  case 2:
284
284
  _state.sent();
285
- amaCtx = options.headers.get("ama-ctx");
286
- expect(options.headers.get("x-api-key")).toBe("secondKey");
285
+ amaCtx = options.headers.get('ama-ctx');
286
+ expect(options.headers.get('x-api-key')).toBe('secondKey');
287
287
  expect(amaCtx).toBeDefined();
288
288
  expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
289
- oid: "SECONDOID"
289
+ oid: 'SECONDOID'
290
290
  }));
291
291
  return [
292
292
  2
@@ -294,12 +294,12 @@ describe("Api Key Request Plugin", function() {
294
294
  }
295
295
  });
296
296
  }));
297
- it("Setting API key and OID using the setters should result in the right headers", /*#__PURE__*/ _async_to_generator(function() {
297
+ it('Setting API key and OID using the setters should result in the right headers', /*#__PURE__*/ _async_to_generator(function() {
298
298
  var plugin, runner, amaCtx;
299
299
  return _ts_generator(this, function(_state) {
300
300
  switch(_state.label){
301
301
  case 0:
302
- plugin = new SimpleApiKeyAuthenticationRequest("key");
302
+ plugin = new SimpleApiKeyAuthenticationRequest('key');
303
303
  runner = plugin.load();
304
304
  return [
305
305
  4,
@@ -307,22 +307,22 @@ describe("Api Key Request Plugin", function() {
307
307
  ];
308
308
  case 1:
309
309
  _state.sent();
310
- amaCtx = options.headers.get("ama-ctx");
311
- expect(options.headers.get("x-api-key")).toBe("key");
310
+ amaCtx = options.headers.get('ama-ctx');
311
+ expect(options.headers.get('x-api-key')).toBe('key');
312
312
  expect(amaCtx).toBeNull();
313
- plugin.setApiKey("secondApiKey");
314
- plugin.setOfficeId("OID");
313
+ plugin.setApiKey('secondApiKey');
314
+ plugin.setOfficeId('OID');
315
315
  return [
316
316
  4,
317
317
  runner.transform(options)
318
318
  ];
319
319
  case 2:
320
320
  _state.sent();
321
- amaCtx = options.headers.get("ama-ctx");
322
- expect(options.headers.get("x-api-key")).toBe("secondApiKey");
321
+ amaCtx = options.headers.get('ama-ctx');
322
+ expect(options.headers.get('x-api-key')).toBe('secondApiKey');
323
323
  expect(amaCtx).toBeDefined();
324
324
  expect(getJWTPayload(amaCtx)).toEqual(expect.objectContaining({
325
- oid: "OID"
325
+ oid: 'OID'
326
326
  }));
327
327
  return [
328
328
  2
@@ -1 +1 @@
1
- export * from "./timeout.fetch";
1
+ export * from './timeout.fetch';
@@ -154,12 +154,12 @@ function _ts_generator(thisArg, body) {
154
154
  };
155
155
  }
156
156
  }
157
- import { ResponseTimeoutError } from "../../fwk/errors";
157
+ import { ResponseTimeoutError } from '../../fwk/errors';
158
158
  /**
159
159
  * Check if a message can be cast as an {@link ImpervaCaptchaMessage}
160
160
  * @param message
161
161
  */ function isImpervaCaptchaMessage(message) {
162
- return Object.prototype.hasOwnProperty.call(message, "impervaChallenge") && Object.prototype.hasOwnProperty.call(message.impervaChallenge, "status") && Object.prototype.hasOwnProperty.call(message.impervaChallenge, "type") && message.impervaChallenge.type === "captcha";
162
+ return Object.prototype.hasOwnProperty.call(message, 'impervaChallenge') && Object.prototype.hasOwnProperty.call(message.impervaChallenge, 'status') && Object.prototype.hasOwnProperty.call(message.impervaChallenge, 'type') && message.impervaChallenge.type === 'captcha';
163
163
  }
164
164
  /**
165
165
  * Captures Imperva captcha events and calls the event callback
@@ -174,14 +174,14 @@ import { ResponseTimeoutError } from "../../fwk/errors";
174
174
  if (originHostname !== location.hostname && ((config === null || config === void 0 ? void 0 : config.whiteListedHostNames) || []).indexOf(originHostname) === -1) {
175
175
  return;
176
176
  }
177
- var message = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
177
+ var message = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
178
178
  if (message && isImpervaCaptchaMessage(message)) {
179
- timeoutPauseCallback(message.impervaChallenge.status === "started" ? "timeoutStopped" : "timeoutStarted");
179
+ timeoutPauseCallback(message.impervaChallenge.status === 'started' ? 'timeoutStopped' : 'timeoutStarted');
180
180
  }
181
181
  };
182
- addEventListener("message", onImpervaCaptcha);
182
+ addEventListener('message', onImpervaCaptcha);
183
183
  return function() {
184
- removeEventListener("message", onImpervaCaptcha);
184
+ removeEventListener('message', onImpervaCaptcha);
185
185
  };
186
186
  };
187
187
  };
@@ -199,7 +199,7 @@ import { ResponseTimeoutError } from "../../fwk/errors";
199
199
  _define_property(this, "timerPauseState", void 0);
200
200
  this.timeoutPauseEvent = timeoutPauseEvent;
201
201
  this.timerSubscription = [];
202
- this.timerPauseState = "timeoutStarted";
202
+ this.timerPauseState = 'timeoutStarted';
203
203
  this.timeout = timeout;
204
204
  if (this.timeoutPauseEvent) {
205
205
  this.timeoutPauseEvent(function(pausedStatus) {
@@ -230,15 +230,15 @@ import { ResponseTimeoutError } from "../../fwk/errors";
230
230
  reject(new ResponseTimeoutError("in ".concat(_this.timeout, "ms")));
231
231
  (_context_controller = context.controller) === null || _context_controller === void 0 ? void 0 : _context_controller.abort();
232
232
  };
233
- timer = _this.timerPauseState === "timeoutStopped" ? undefined : setTimeout(timeoutCallback, _this.timeout);
233
+ timer = _this.timerPauseState === 'timeoutStopped' ? undefined : setTimeout(timeoutCallback, _this.timeout);
234
234
  timerCallback = function(pauseStatus) {
235
- if (timer && pauseStatus === "timeoutStopped") {
235
+ if (timer && pauseStatus === 'timeoutStopped') {
236
236
  clearTimeout(timer);
237
- (context.logger || console).log("[SDK Plugins] Timeout cancelled.");
237
+ (context.logger || console).log('[SDK Plugins] Timeout cancelled.');
238
238
  timer = undefined;
239
- } else if (!timer && pauseStatus === "timeoutStarted") {
239
+ } else if (!timer && pauseStatus === 'timeoutStarted') {
240
240
  timer = setTimeout(timeoutCallback, _this.timeout);
241
- (context.logger || console).log("[SDK Plugins] Timeout restarted.");
241
+ (context.logger || console).log('[SDK Plugins] Timeout restarted.');
242
242
  }
243
243
  };
244
244
  _this.timerSubscription.push(timerCallback);
@@ -122,10 +122,10 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { EmptyResponseError, ResponseTimeoutError } from "../../fwk/errors";
126
- import { TimeoutFetch } from "./timeout.fetch";
127
- describe("Timeout Fetch Plugin", function() {
128
- it("should reject on timeout", /*#__PURE__*/ _async_to_generator(function() {
125
+ import { EmptyResponseError, ResponseTimeoutError } from '../../fwk/errors';
126
+ import { TimeoutFetch } from './timeout.fetch';
127
+ describe('Timeout Fetch Plugin', function() {
128
+ it('should reject on timeout', /*#__PURE__*/ _async_to_generator(function() {
129
129
  var plugin, runner, call, callback;
130
130
  return _ts_generator(this, function(_state) {
131
131
  switch(_state.label){
@@ -154,14 +154,14 @@ describe("Timeout Fetch Plugin", function() {
154
154
  ];
155
155
  case 2:
156
156
  _state.sent();
157
- expect(callback).toHaveBeenCalledWith(new ResponseTimeoutError("in 100ms"));
157
+ expect(callback).toHaveBeenCalledWith(new ResponseTimeoutError('in 100ms'));
158
158
  return [
159
159
  2
160
160
  ];
161
161
  }
162
162
  });
163
163
  }));
164
- it("should not reject on fetch rejection", /*#__PURE__*/ _async_to_generator(function() {
164
+ it('should not reject on fetch rejection', /*#__PURE__*/ _async_to_generator(function() {
165
165
  var plugin, runner, call, callback;
166
166
  return _ts_generator(this, function(_state) {
167
167
  switch(_state.label){
@@ -172,7 +172,7 @@ describe("Timeout Fetch Plugin", function() {
172
172
  });
173
173
  call = new Promise(function(_resolve, reject) {
174
174
  return setTimeout(function() {
175
- return reject(new EmptyResponseError(""));
175
+ return reject(new EmptyResponseError(''));
176
176
  }, 100);
177
177
  });
178
178
  callback = jest.fn();
@@ -183,14 +183,14 @@ describe("Timeout Fetch Plugin", function() {
183
183
  ];
184
184
  case 1:
185
185
  _state.sent();
186
- expect(callback).toHaveBeenCalledWith(new EmptyResponseError(""));
186
+ expect(callback).toHaveBeenCalledWith(new EmptyResponseError(''));
187
187
  return [
188
188
  2
189
189
  ];
190
190
  }
191
191
  });
192
192
  }));
193
- it("should forward the fetch response", /*#__PURE__*/ _async_to_generator(function() {
193
+ it('should forward the fetch response', /*#__PURE__*/ _async_to_generator(function() {
194
194
  var plugin, runner, call, promise;
195
195
  return _ts_generator(this, function(_state) {
196
196
  switch(_state.label){
@@ -229,7 +229,7 @@ describe("Timeout Fetch Plugin", function() {
229
229
  }
230
230
  });
231
231
  }));
232
- it("should not reject if the timeout has been paused and reject if restarted", /*#__PURE__*/ _async_to_generator(function() {
232
+ it('should not reject if the timeout has been paused and reject if restarted', /*#__PURE__*/ _async_to_generator(function() {
233
233
  var timeoutPauseEvent, plugin, runner, call, callback;
234
234
  return _ts_generator(this, function(_state) {
235
235
  switch(_state.label){
@@ -254,28 +254,28 @@ describe("Timeout Fetch Plugin", function() {
254
254
  });
255
255
  callback = jest.fn();
256
256
  runner.transform(call).catch(callback);
257
- timeoutPauseEvent.emitEvent("timeoutStopped");
257
+ timeoutPauseEvent.emitEvent('timeoutStopped');
258
258
  return [
259
259
  4,
260
260
  jest.advanceTimersByTimeAsync(200)
261
261
  ];
262
262
  case 1:
263
263
  _state.sent();
264
- timeoutPauseEvent.emitEvent("timeoutStarted");
264
+ timeoutPauseEvent.emitEvent('timeoutStarted');
265
265
  return [
266
266
  4,
267
267
  jest.advanceTimersByTimeAsync(200)
268
268
  ];
269
269
  case 2:
270
270
  _state.sent();
271
- expect(callback).toHaveBeenCalledWith(new ResponseTimeoutError("in 100ms"));
271
+ expect(callback).toHaveBeenCalledWith(new ResponseTimeoutError('in 100ms'));
272
272
  return [
273
273
  2
274
274
  ];
275
275
  }
276
276
  });
277
277
  }));
278
- it("should take into account pause events triggered before the call", /*#__PURE__*/ _async_to_generator(function() {
278
+ it('should take into account pause events triggered before the call', /*#__PURE__*/ _async_to_generator(function() {
279
279
  var timeoutPauseEvent, plugin, runner, call, promise;
280
280
  return _ts_generator(this, function(_state) {
281
281
  switch(_state.label){
@@ -298,7 +298,7 @@ describe("Timeout Fetch Plugin", function() {
298
298
  });
299
299
  }, 500);
300
300
  });
301
- timeoutPauseEvent.emitEvent("timeoutStopped");
301
+ timeoutPauseEvent.emitEvent('timeoutStopped');
302
302
  promise = runner.transform(call);
303
303
  return [
304
304
  4,
@@ -1 +1 @@
1
- export * from "./url-rewrite.request";
1
+ export * from './url-rewrite.request';
@@ -122,25 +122,25 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { UrlRewriteRequest } from "./url-rewrite.request";
126
- describe("URL Rewrite Request Plugin", function() {
127
- var urlRewriter = jest.fn().mockReturnValue("http://ok");
125
+ import { UrlRewriteRequest } from './url-rewrite.request';
126
+ describe('URL Rewrite Request Plugin', function() {
127
+ var urlRewriter = jest.fn().mockReturnValue('http://ok');
128
128
  var defaultGetParams = {
129
- defaultTest: "ok"
129
+ defaultTest: 'ok'
130
130
  };
131
- var defaultBody = "default";
132
- var defaultUrl = "http://test.com/truc";
131
+ var defaultBody = 'default';
132
+ var defaultUrl = 'http://test.com/truc';
133
133
  var options;
134
134
  beforeEach(function() {
135
135
  options = {
136
- method: "get",
136
+ method: 'get',
137
137
  queryParams: defaultGetParams,
138
138
  headers: new Headers(),
139
139
  body: defaultBody,
140
140
  basePath: defaultUrl
141
141
  };
142
142
  });
143
- it("should call the URL rewriter", /*#__PURE__*/ _async_to_generator(function() {
143
+ it('should call the URL rewriter', /*#__PURE__*/ _async_to_generator(function() {
144
144
  var plugin, runner;
145
145
  return _ts_generator(this, function(_state) {
146
146
  switch(_state.label){
@@ -160,7 +160,7 @@ describe("URL Rewrite Request Plugin", function() {
160
160
  }
161
161
  });
162
162
  }));
163
- it("should have updated the url", /*#__PURE__*/ _async_to_generator(function() {
163
+ it('should have updated the url', /*#__PURE__*/ _async_to_generator(function() {
164
164
  var plugin, runner, result;
165
165
  return _ts_generator(this, function(_state) {
166
166
  switch(_state.label){
@@ -173,7 +173,7 @@ describe("URL Rewrite Request Plugin", function() {
173
173
  ];
174
174
  case 1:
175
175
  result = _state.sent();
176
- expect(result.basePath).toBe("http://ok");
176
+ expect(result.basePath).toBe('http://ok');
177
177
  return [
178
178
  2
179
179
  ];
@@ -1 +1 @@
1
- export * from "./wait-for.fetch";
1
+ export * from './wait-for.fetch';
@@ -174,10 +174,10 @@ function _ts_generator(thisArg, body) {
174
174
  };
175
175
  }
176
176
  }
177
- import { WaitForFetch } from "./wait-for.fetch";
178
- describe("Wait For Fetch Plugin", function() {
177
+ import { WaitForFetch } from './wait-for.fetch';
178
+ describe('Wait For Fetch Plugin', function() {
179
179
  var defaultContext = {};
180
- it("should not start if timeout", /*#__PURE__*/ _async_to_generator(function() {
180
+ it('should not start if timeout', /*#__PURE__*/ _async_to_generator(function() {
181
181
  var plugin, runner, canStart;
182
182
  return _ts_generator(this, function(_state) {
183
183
  switch(_state.label){
@@ -213,7 +213,7 @@ describe("Wait For Fetch Plugin", function() {
213
213
  }
214
214
  });
215
215
  }));
216
- it("should start if promise condition passed", /*#__PURE__*/ _async_to_generator(function() {
216
+ it('should start if promise condition passed', /*#__PURE__*/ _async_to_generator(function() {
217
217
  var plugin, runner, canStart;
218
218
  return _ts_generator(this, function(_state) {
219
219
  switch(_state.label){
@@ -237,7 +237,7 @@ describe("Wait For Fetch Plugin", function() {
237
237
  }
238
238
  });
239
239
  }));
240
- it("should start if condition passed", /*#__PURE__*/ _async_to_generator(function() {
240
+ it('should start if condition passed', /*#__PURE__*/ _async_to_generator(function() {
241
241
  var plugin, runner, canStart;
242
242
  return _ts_generator(this, function(_state) {
243
243
  switch(_state.label){
@@ -261,7 +261,7 @@ describe("Wait For Fetch Plugin", function() {
261
261
  }
262
262
  });
263
263
  }));
264
- it("should call the callback function on success", /*#__PURE__*/ _async_to_generator(function() {
264
+ it('should call the callback function on success', /*#__PURE__*/ _async_to_generator(function() {
265
265
  var callback, plugin, runner, response, fetchCall;
266
266
  return _ts_generator(this, function(_state) {
267
267
  switch(_state.label){
@@ -290,7 +290,7 @@ describe("Wait For Fetch Plugin", function() {
290
290
  }
291
291
  });
292
292
  }));
293
- it("should call the callback function with the correct data", /*#__PURE__*/ _async_to_generator(function() {
293
+ it('should call the callback function with the correct data', /*#__PURE__*/ _async_to_generator(function() {
294
294
  var callback, plugin, runner, response, fetchCall;
295
295
  return _ts_generator(this, function(_state) {
296
296
  switch(_state.label){
@@ -299,7 +299,7 @@ describe("Wait For Fetch Plugin", function() {
299
299
  plugin = new WaitForFetch(function() {
300
300
  return {
301
301
  result: true,
302
- data: "test"
302
+ data: 'test'
303
303
  };
304
304
  }, 100, callback);
305
305
  runner = plugin.load(defaultContext);
@@ -320,7 +320,7 @@ describe("Wait For Fetch Plugin", function() {
320
320
  case 2:
321
321
  _state.sent();
322
322
  expect(callback).toHaveBeenCalledWith(expect.objectContaining(_object_spread_props(_object_spread({}, defaultContext), {
323
- data: "test"
323
+ data: 'test'
324
324
  })), fetchCall, response);
325
325
  return [
326
326
  2
@@ -328,7 +328,7 @@ describe("Wait For Fetch Plugin", function() {
328
328
  }
329
329
  });
330
330
  }));
331
- it("should call the callback function on failure", /*#__PURE__*/ _async_to_generator(function() {
331
+ it('should call the callback function on failure', /*#__PURE__*/ _async_to_generator(function() {
332
332
  var callback, plugin, runner, response, fetchCall, e;
333
333
  return _ts_generator(this, function(_state) {
334
334
  switch(_state.label){
@@ -1,4 +1,4 @@
1
- export * from "./clients/index";
2
- export * from "./fwk/index";
3
- export * from "./plugins/index";
4
- export * from "./utils/index";
1
+ export * from './clients/index';
2
+ export * from './fwk/index';
3
+ export * from './plugins/index';
4
+ export * from './utils/index';