@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
@@ -146,10 +146,10 @@ function _ts_generator(thisArg, body) {
146
146
  };
147
147
  }
148
148
  }
149
- var authHeaderKey = "Authorization";
150
- var authHeaderPrefix = "Bearer ";
151
- var baseUrl = "https://domain.com";
152
- var routePath = "/v2/shopping/air-offers";
149
+ var authHeaderKey = 'Authorization';
150
+ var authHeaderPrefix = 'Bearer ';
151
+ var baseUrl = 'https://domain.com';
152
+ var routePath = '/v2/shopping/air-offers';
153
153
  var options;
154
154
  var FakeHeader = function FakeHeader() {
155
155
  "use strict";
@@ -167,26 +167,26 @@ var FakeHeader = function FakeHeader() {
167
167
  });
168
168
  };
169
169
  var jsonAuthTokenOptions = {
170
- applicationId: "6X_MG__tester@test.com__PDT",
171
- apiKey: "dummy4P1K3Y",
170
+ applicationId: '6X_MG__tester@test.com__PDT',
171
+ apiKey: 'dummy4P1K3Y',
172
172
  expIntervalInSec: 60,
173
- secret: "super-secret",
173
+ secret: 'super-secret',
174
174
  context: {
175
- oid: "NCE1A0955"
175
+ oid: 'NCE1A0955'
176
176
  }
177
177
  };
178
- describe("JSON auth token request plugin", function() {
178
+ describe('JSON auth token request plugin', function() {
179
179
  beforeEach(function() {
180
180
  options = {
181
181
  basePath: "".concat(baseUrl).concat(routePath),
182
182
  headers: new FakeHeader(),
183
- method: "GET"
183
+ method: 'GET'
184
184
  };
185
185
  });
186
186
  afterAll(function() {
187
187
  global.sessionStorage = undefined;
188
188
  });
189
- it("should add a Bearer in the header", /*#__PURE__*/ _async_to_generator(function() {
189
+ it('should add a Bearer in the header', /*#__PURE__*/ _async_to_generator(function() {
190
190
  var _result_headers_get, plugin, result;
191
191
  return _ts_generator(this, function(_state) {
192
192
  switch(_state.label){
@@ -206,7 +206,7 @@ describe("JSON auth token request plugin", function() {
206
206
  }
207
207
  });
208
208
  }));
209
- it("should check that the jws token is well formatted", /*#__PURE__*/ _async_to_generator(function() {
209
+ it('should check that the jws token is well formatted', /*#__PURE__*/ _async_to_generator(function() {
210
210
  var plugin, result, token, tokenParts;
211
211
  return _ts_generator(this, function(_state) {
212
212
  switch(_state.label){
@@ -218,8 +218,8 @@ describe("JSON auth token request plugin", function() {
218
218
  ];
219
219
  case 1:
220
220
  result = _state.sent();
221
- token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, "");
222
- tokenParts = token.split(".");
221
+ token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
222
+ tokenParts = token.split('.');
223
223
  expect(token).toBeDefined();
224
224
  expect(tokenParts.length).toEqual(3);
225
225
  return [
@@ -228,7 +228,7 @@ describe("JSON auth token request plugin", function() {
228
228
  }
229
229
  });
230
230
  }));
231
- it("should check that the header is properly set", /*#__PURE__*/ _async_to_generator(function() {
231
+ it('should check that the header is properly set', /*#__PURE__*/ _async_to_generator(function() {
232
232
  var base64URLDecoder, plugin, result, token, tokenParts, header;
233
233
  return _ts_generator(this, function(_state) {
234
234
  switch(_state.label){
@@ -241,21 +241,21 @@ describe("JSON auth token request plugin", function() {
241
241
  ];
242
242
  case 1:
243
243
  result = _state.sent();
244
- token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, "");
244
+ token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
245
245
  expect(token).toBeDefined();
246
- tokenParts = token.split(".");
246
+ tokenParts = token.split('.');
247
247
  header = JSON.parse(base64URLDecoder(tokenParts[0]));
248
248
  expect(header.alg).toBeDefined();
249
- expect(header.alg).toEqual("HS256");
249
+ expect(header.alg).toEqual('HS256');
250
250
  expect(header.typ).toBeDefined();
251
- expect(header.typ).toEqual("JWT");
251
+ expect(header.typ).toEqual('JWT');
252
252
  return [
253
253
  2
254
254
  ];
255
255
  }
256
256
  });
257
257
  }));
258
- it("should check that the payload is properly set", /*#__PURE__*/ _async_to_generator(function() {
258
+ it('should check that the payload is properly set', /*#__PURE__*/ _async_to_generator(function() {
259
259
  var base64URLDecoder, base64Decoder, plugin, result, token, tokenParts, payload, context;
260
260
  return _ts_generator(this, function(_state) {
261
261
  switch(_state.label){
@@ -269,9 +269,9 @@ describe("JSON auth token request plugin", function() {
269
269
  ];
270
270
  case 1:
271
271
  result = _state.sent();
272
- token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, "");
272
+ token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
273
273
  expect(token).toBeDefined();
274
- tokenParts = token.split(".");
274
+ tokenParts = token.split('.');
275
275
  payload = JSON.parse(base64URLDecoder(tokenParts[1]));
276
276
  expect(payload.jti).toBeDefined();
277
277
  expect(payload.iat).toBeDefined();
@@ -288,7 +288,7 @@ describe("JSON auth token request plugin", function() {
288
288
  }
289
289
  });
290
290
  }));
291
- it("should check the signature validity", /*#__PURE__*/ _async_to_generator(function() {
291
+ it('should check the signature validity', /*#__PURE__*/ _async_to_generator(function() {
292
292
  var base64URLDecoder, base64UrlEncoder, plugin, result, token, tokenParts, header, payload, signature, secretKey, _, message, signCheck;
293
293
  return _ts_generator(this, function(_state) {
294
294
  switch(_state.label){
@@ -302,8 +302,8 @@ describe("JSON auth token request plugin", function() {
302
302
  ];
303
303
  case 1:
304
304
  result = _state.sent();
305
- token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, "");
306
- tokenParts = token.split(".");
305
+ token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
306
+ tokenParts = token.split('.');
307
307
  header = JSON.parse(base64URLDecoder(tokenParts[0]));
308
308
  payload = JSON.parse(base64URLDecoder(tokenParts[1]));
309
309
  signature = tokenParts[2];
@@ -187,7 +187,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
187
187
  if (!context.apiClient.options.requestPlugins.some(function(plugin) {
188
188
  return _instanceof(plugin, _mockinterceptrequest.MockInterceptRequest);
189
189
  })) {
190
- throw new Error("MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin");
190
+ throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
191
191
  }
192
192
  var _this = this;
193
193
  return {
@@ -211,11 +211,11 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
211
211
  responsePromise
212
212
  ];
213
213
  }
214
- if (!(typeof _this.options.delayTiming !== "undefined")) return [
214
+ if (!(typeof _this.options.delayTiming !== 'undefined')) return [
215
215
  3,
216
216
  6
217
217
  ];
218
- if (!(typeof _this.options.delayTiming === "number")) return [
218
+ if (!(typeof _this.options.delayTiming === 'number')) return [
219
219
  3,
220
220
  2
221
221
  ];
@@ -16,5 +16,5 @@ _export(exports, {
16
16
  return CUSTOM_MOCK_REQUEST_HEADER;
17
17
  }
18
18
  });
19
- var CUSTOM_MOCK_OPERATION_ID_HEADER = "X-mock-operation-id";
20
- var CUSTOM_MOCK_REQUEST_HEADER = "X-mock-request";
19
+ var CUSTOM_MOCK_OPERATION_ID_HEADER = 'X-mock-operation-id';
20
+ var CUSTOM_MOCK_REQUEST_HEADER = 'X-mock-request';
@@ -241,7 +241,7 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
241
241
  ];
242
242
  }
243
243
  requestOption = _object_spread_props(_object_spread({}, data), {
244
- method: data.method || "GET"
244
+ method: data.method || 'GET'
245
245
  });
246
246
  return [
247
247
  4,
@@ -254,7 +254,7 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
254
254
  blob = new Blob([
255
255
  text
256
256
  ], {
257
- type: "application/json"
257
+ type: 'application/json'
258
258
  });
259
259
  basePath = URL.createObjectURL(blob);
260
260
  headers = data.headers || new Headers();
@@ -263,7 +263,7 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
263
263
  return [
264
264
  2,
265
265
  {
266
- method: "GET",
266
+ method: 'GET',
267
267
  basePath: basePath,
268
268
  headers: headers
269
269
  }
@@ -148,7 +148,7 @@ var testMock = {
148
148
  };
149
149
  var getMockSpy = jest.fn().mockReturnValue(testMock);
150
150
  var getLatestMockSpy = jest.fn().mockReturnValue(testMock);
151
- var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve("testOperation"));
151
+ var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve('testOperation'));
152
152
  var initializeSpy = jest.fn().mockReturnValue(Promise.resolve());
153
153
  var testMockAdapter = {
154
154
  getMock: getMockSpy,
@@ -164,13 +164,13 @@ var requestPlugins = [
164
164
  var apiClient = {
165
165
  options: {
166
166
  requestPlugins: requestPlugins,
167
- basePath: "test",
167
+ basePath: 'test',
168
168
  replyPlugins: []
169
169
  }
170
170
  };
171
- describe("Mock intercept", function() {
172
- describe("request plugin", function() {
173
- it("should do nothing if disabled is true", /*#__PURE__*/ _async_to_generator(function() {
171
+ describe('Mock intercept', function() {
172
+ describe('request plugin', function() {
173
+ it('should do nothing if disabled is true', /*#__PURE__*/ _async_to_generator(function() {
174
174
  var plugin, originalRequest, loaded;
175
175
  return _ts_generator(this, function(_state) {
176
176
  switch(_state.label){
@@ -180,11 +180,11 @@ describe("Mock intercept", function() {
180
180
  adapter: testMockAdapter
181
181
  });
182
182
  originalRequest = {
183
- method: "get",
183
+ method: 'get',
184
184
  headers: new Headers({
185
- test: "true"
185
+ test: 'true'
186
186
  }),
187
- basePath: "myurl"
187
+ basePath: 'myurl'
188
188
  };
189
189
  loaded = plugin.load();
190
190
  return [
@@ -202,7 +202,7 @@ describe("Mock intercept", function() {
202
202
  }
203
203
  });
204
204
  }));
205
- it.skip("should intercept the request", /*#__PURE__*/ _async_to_generator(function() {
205
+ it.skip('should intercept the request', /*#__PURE__*/ _async_to_generator(function() {
206
206
  var plugin, originalRequest, loaded, transformed, res;
207
207
  return _ts_generator(this, function(_state) {
208
208
  switch(_state.label){
@@ -213,10 +213,10 @@ describe("Mock intercept", function() {
213
213
  });
214
214
  originalRequest = {
215
215
  headers: new Headers({
216
- test: "true"
216
+ test: 'true'
217
217
  }),
218
- basePath: "myurl",
219
- method: "PATCH"
218
+ basePath: 'myurl',
219
+ method: 'PATCH'
220
220
  };
221
221
  loaded = plugin.load();
222
222
  transformed = loaded.transform(originalRequest);
@@ -236,8 +236,8 @@ describe("Mock intercept", function() {
236
236
  });
237
237
  }));
238
238
  });
239
- describe("fetch plugin", function() {
240
- describe("when using an initialization function", function() {
239
+ describe('fetch plugin', function() {
240
+ describe('when using an initialization function', function() {
241
241
  var plugin;
242
242
  var asyncMockAdapter;
243
243
  beforeEach(function() {
@@ -251,17 +251,17 @@ describe("Mock intercept", function() {
251
251
  adapter: asyncMockAdapter
252
252
  });
253
253
  });
254
- it("should call initialize fn", /*#__PURE__*/ _async_to_generator(function() {
254
+ it('should call initialize fn', /*#__PURE__*/ _async_to_generator(function() {
255
255
  var loadedPlugin, testData;
256
256
  return _ts_generator(this, function(_state) {
257
257
  switch(_state.label){
258
258
  case 0:
259
259
  loadedPlugin = plugin.load({
260
260
  fetchPlugins: [],
261
- url: "myurl",
261
+ url: 'myurl',
262
262
  apiClient: apiClient,
263
263
  options: {
264
- headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, "testOperation"))
264
+ headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
265
265
  }
266
266
  });
267
267
  testData = {
@@ -275,24 +275,24 @@ describe("Mock intercept", function() {
275
275
  _state.sent();
276
276
  expect(initializeSpy).toHaveBeenCalled();
277
277
  expect(getMockSpy).not.toHaveBeenCalled();
278
- expect(getLatestMockSpy).toHaveBeenCalledWith("testOperation");
278
+ expect(getLatestMockSpy).toHaveBeenCalledWith('testOperation');
279
279
  return [
280
280
  2
281
281
  ];
282
282
  }
283
283
  });
284
284
  }));
285
- it("should throw if there is no request plugin", function() {
285
+ it('should throw if there is no request plugin', function() {
286
286
  var config = {
287
287
  fetchPlugins: [],
288
- url: "myurl",
288
+ url: 'myurl',
289
289
  apiClient: {
290
290
  options: {
291
291
  requestPlugins: []
292
292
  }
293
293
  },
294
294
  options: {
295
- headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, "testOperation"))
295
+ headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
296
296
  }
297
297
  };
298
298
  expect(function() {
@@ -301,8 +301,8 @@ describe("Mock intercept", function() {
301
301
  });
302
302
  });
303
303
  });
304
- describe("with delay", function() {
305
- it("should delay the response of the specific number", /*#__PURE__*/ _async_to_generator(function() {
304
+ describe('with delay', function() {
305
+ it('should delay the response of the specific number', /*#__PURE__*/ _async_to_generator(function() {
306
306
  var plugin, loadedPlugin, callback, run;
307
307
  return _ts_generator(this, function(_state) {
308
308
  switch(_state.label){
@@ -313,10 +313,10 @@ describe("Mock intercept", function() {
313
313
  });
314
314
  loadedPlugin = plugin.load({
315
315
  fetchPlugins: [],
316
- url: "",
316
+ url: '',
317
317
  apiClient: apiClient,
318
318
  options: {
319
- headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, "testOperation"))
319
+ headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
320
320
  }
321
321
  });
322
322
  callback = jest.fn();
@@ -347,7 +347,7 @@ describe("Mock intercept", function() {
347
347
  }
348
348
  });
349
349
  }));
350
- it("should delay the response based on callback", /*#__PURE__*/ _async_to_generator(function() {
350
+ it('should delay the response based on callback', /*#__PURE__*/ _async_to_generator(function() {
351
351
  var plugin, loadedPlugin, callback, run;
352
352
  return _ts_generator(this, function(_state) {
353
353
  switch(_state.label){
@@ -360,10 +360,10 @@ describe("Mock intercept", function() {
360
360
  });
361
361
  loadedPlugin = plugin.load({
362
362
  fetchPlugins: [],
363
- url: "",
363
+ url: '',
364
364
  apiClient: apiClient,
365
365
  options: {
366
- headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, "testOperation"))
366
+ headers: new Headers(_define_property({}, _mockinterceptinterface.CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
367
367
  }
368
368
  });
369
369
  callback = jest.fn();
@@ -223,7 +223,7 @@ var PerformanceMetricPlugin = /*#__PURE__*/ function() {
223
223
  */ _define_property(this, "getTime", Date.now);
224
224
  this.onMarkComplete = options ? options.onMarkComplete : this.onMarkComplete;
225
225
  this.onMarkError = options ? options.onMarkError : this.onMarkError;
226
- if (typeof window !== "undefined" && !!window.performance && !!window.performance.now) {
226
+ if (typeof window !== 'undefined' && !!window.performance && !!window.performance.now) {
227
227
  this.getTime = function() {
228
228
  return window.performance.now();
229
229
  };
@@ -4,20 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  var _perfmetricfetch = require("./perf-metric.fetch");
6
6
  var perfPlugin;
7
- describe("PerformanceMetricPlugin", function() {
7
+ describe('PerformanceMetricPlugin', function() {
8
8
  beforeEach(function() {
9
9
  perfPlugin = new _perfmetricfetch.PerformanceMetricPlugin({});
10
10
  });
11
- it("should generate new mark ids", function() {
12
- expect(perfPlugin.openMark("", {})).not.toEqual(perfPlugin.openMark("", {}));
11
+ it('should generate new mark ids', function() {
12
+ expect(perfPlugin.openMark('', {})).not.toEqual(perfPlugin.openMark('', {}));
13
13
  });
14
- it("should include a new mark when closing", function() {
15
- var markId = perfPlugin.openMark("my-url", {});
14
+ it('should include a new mark when closing', function() {
15
+ var markId = perfPlugin.openMark('my-url', {});
16
16
  var ret = new Promise(function(resolve) {
17
17
  perfPlugin.onMarkComplete = function(mark) {
18
18
  expect(mark).toBeDefined();
19
19
  expect(mark.markId).toBe(markId);
20
- expect(mark.url).toBe("my-url");
20
+ expect(mark.url).toBe('my-url');
21
21
  expect(mark.requestOptions).toEqual({});
22
22
  expect(mark.startTime).toBeDefined();
23
23
  expect(mark.response).toEqual({});
@@ -29,13 +29,13 @@ describe("PerformanceMetricPlugin", function() {
29
29
  perfPlugin.closeMark(markId, {});
30
30
  return ret;
31
31
  });
32
- it("should include a new mark when closing with error", function() {
33
- var markId = perfPlugin.openMark("my-url", {});
32
+ it('should include a new mark when closing with error', function() {
33
+ var markId = perfPlugin.openMark('my-url', {});
34
34
  var ret = new Promise(function(resolve) {
35
35
  perfPlugin.onMarkError = function(mark) {
36
36
  expect(mark).toBeDefined();
37
37
  expect(mark.markId).toBe(markId);
38
- expect(mark.url).toBe("my-url");
38
+ expect(mark.url).toBe('my-url');
39
39
  expect(mark.requestOptions).toEqual({});
40
40
  expect(mark.startTime).toBeDefined();
41
41
  expect(mark.response).not.toBeDefined();
@@ -197,12 +197,12 @@ function createJwtPiiEncoder(applicationId) {
197
197
  var jwtPayload = function(values) {
198
198
  var timestamp = Math.floor(Date.now() / 1000);
199
199
  return {
200
- sub: "pii",
200
+ sub: 'pii',
201
201
  iat: timestamp,
202
202
  exp: timestamp + expirationDelay,
203
203
  iss: applicationId,
204
204
  // eslint-disable-next-line @typescript-eslint/naming-convention
205
- "ama-tokens": values
205
+ 'ama-tokens': values
206
206
  };
207
207
  };
208
208
  return function(values) {
@@ -215,12 +215,12 @@ function createJwePiiEncoder(applicationId) {
215
215
  var jwePayload = function(values) {
216
216
  var timestamp = Math.floor(Date.now() / 1000);
217
217
  return {
218
- sub: "pii",
218
+ sub: 'pii',
219
219
  iat: timestamp,
220
220
  exp: timestamp + expirationDelay,
221
221
  iss: applicationId,
222
222
  // eslint-disable-next-line @typescript-eslint/naming-convention
223
- "ama-tokens": values
223
+ 'ama-tokens': values
224
224
  };
225
225
  };
226
226
  return function(values) {
@@ -235,13 +235,13 @@ var PiiTokenizerRequest = /*#__PURE__*/ function() {
235
235
  /** Name of the header that will contain the response to a deeplink token challenge, if any */ _define_property(this, "challengeHeader", void 0);
236
236
  /** Token encoding function */ _define_property(this, "tokenEncoder", void 0);
237
237
  /** Boolean to specify if an error should be silent or crash the application */ _define_property(this, "silent", void 0);
238
- this.tokensHeader = options.headerName || "ama-client-facts";
239
- this.challengeHeader = options.challengeHeaderName || "ama-client-facts-challenge";
238
+ this.tokensHeader = options.headerName || 'ama-client-facts';
239
+ this.challengeHeader = options.challengeHeaderName || 'ama-client-facts-challenge';
240
240
  this.silent = options.silent || false;
241
241
  if (options.key) {
242
242
  this.tokenEncoder = createJwePiiEncoder(options.applicationId, options.expirationDelay, options.key, options.publicProperties || [
243
- "iss",
244
- "sub"
243
+ 'iss',
244
+ 'sub'
245
245
  ], options.useHeaderAsAdditionalAuthenticatedData);
246
246
  } else {
247
247
  this.tokenEncoder = createJwtPiiEncoder(options.applicationId, options.expirationDelay);
@@ -279,9 +279,9 @@ var PiiTokenizerRequest = /*#__PURE__*/ function() {
279
279
  case 2:
280
280
  e = _state.sent();
281
281
  if (_this.silent) {
282
- (logger || console).error("Couldn't encode the token");
282
+ (logger || console).error('Couldn\'t encode the token');
283
283
  } else {
284
- throw new Error("Couldn't encode the token");
284
+ throw new Error('Couldn\'t encode the token');
285
285
  }
286
286
  return [
287
287
  3,
@@ -325,7 +325,7 @@ var PiiTokenizerRequest = /*#__PURE__*/ function() {
325
325
  3,
326
326
  2
327
327
  ];
328
- ((context === null || context === void 0 ? void 0 : context.logger) || console).error("No tokenized options found. Please make sure tokenization is enabled on your ApiClient");
328
+ ((context === null || context === void 0 ? void 0 : context.logger) || console).error('No tokenized options found. Please make sure tokenization is enabled on your ApiClient');
329
329
  return [
330
330
  3,
331
331
  4