@ama-sdk/core 10.3.0-prerelease.66 → 10.3.0-prerelease.68

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 (166) hide show
  1. package/cjs/clients/api-angular-client.js +4 -4
  2. package/cjs/clients/api-beacon-client.js +4 -4
  3. package/cjs/clients/api-fetch-client.js +4 -4
  4. package/cjs/fwk/api.helper.spec.js +20 -20
  5. package/cjs/fwk/api.helpers.js +13 -13
  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 +4 -4
  63. package/cjs/utils/json-token.js +30 -30
  64. package/cjs/utils/json-token.spec.js +31 -31
  65. package/esm2015/clients/api-angular-client.js +8 -8
  66. package/esm2015/clients/api-beacon-client.js +5 -5
  67. package/esm2015/clients/api-fetch-client.js +8 -8
  68. package/esm2015/clients/index.js +2 -2
  69. package/esm2015/fwk/api.helper.spec.js +21 -21
  70. package/esm2015/fwk/api.helpers.js +13 -13
  71. package/esm2015/fwk/core/api-client.js +1 -1
  72. package/esm2015/fwk/core/base-api-constructor.js +1 -1
  73. package/esm2015/fwk/core/index.js +2 -2
  74. package/esm2015/fwk/date.js +9 -9
  75. package/esm2015/fwk/date.spec.js +26 -26
  76. package/esm2015/fwk/errors.js +3 -3
  77. package/esm2015/fwk/index.js +10 -10
  78. package/esm2015/fwk/mocks/alf-mock-adapter.js +6 -6
  79. package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
  80. package/esm2015/fwk/mocks/helpers.js +3 -3
  81. package/esm2015/fwk/mocks/index.js +10 -10
  82. package/esm2015/fwk/mocks/random-mock-adapter.js +1 -1
  83. package/esm2015/fwk/mocks/sequential-mock-adapter.js +1 -1
  84. package/esm2015/fwk/reviver.spec.js +20 -20
  85. package/esm2015/plugins/additional-params/additional-params-sync.request.js +3 -3
  86. package/esm2015/plugins/additional-params/additional-params.request.js +3 -3
  87. package/esm2015/plugins/additional-params/additional-params.spec.js +32 -32
  88. package/esm2015/plugins/additional-params/index.js +2 -2
  89. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  90. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +14 -14
  91. package/esm2015/plugins/api-configuration-override/index.js +1 -1
  92. package/esm2015/plugins/api-key/api-key.request.js +2 -2
  93. package/esm2015/plugins/api-key/api-key.spec.js +12 -12
  94. package/esm2015/plugins/api-key/index.js +1 -1
  95. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
  96. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +34 -34
  97. package/esm2015/plugins/bot-protection-fingerprint/index.js +1 -1
  98. package/esm2015/plugins/client-facts/client-facts.request.js +4 -4
  99. package/esm2015/plugins/client-facts/client-facts.spec.js +28 -28
  100. package/esm2015/plugins/client-facts/index.js +1 -1
  101. package/esm2015/plugins/concurrent/concurrent.spec.js +5 -5
  102. package/esm2015/plugins/concurrent/index.js +1 -1
  103. package/esm2015/plugins/core/index.js +4 -4
  104. package/esm2015/plugins/custom-info/custom-info.spec.js +17 -17
  105. package/esm2015/plugins/custom-info/index.js +1 -1
  106. package/esm2015/plugins/exception/exception.reply.js +4 -4
  107. package/esm2015/plugins/exception/exception.spec.js +18 -18
  108. package/esm2015/plugins/exception/index.js +1 -1
  109. package/esm2015/plugins/fetch-cache/fetch-cache.request.js +4 -4
  110. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +21 -21
  111. package/esm2015/plugins/fetch-cache/index.js +1 -1
  112. package/esm2015/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  113. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +9 -9
  114. package/esm2015/plugins/fetch-credentials/index.js +1 -1
  115. package/esm2015/plugins/index.js +25 -25
  116. package/esm2015/plugins/json-token/index.js +2 -2
  117. package/esm2015/plugins/json-token/json-token.reply.js +5 -5
  118. package/esm2015/plugins/json-token/json-token.request.js +4 -4
  119. package/esm2015/plugins/json-token/json-token.spec.js +27 -27
  120. package/esm2015/plugins/keepalive/index.js +1 -1
  121. package/esm2015/plugins/keepalive/keepalive.request.js +2 -2
  122. package/esm2015/plugins/keepalive/keepalive.spec.js +5 -5
  123. package/esm2015/plugins/mgw-mdw-auth/index.js +1 -1
  124. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +13 -13
  125. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +27 -27
  126. package/esm2015/plugins/mock-intercept/index.js +2 -2
  127. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -5
  128. package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  129. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +4 -4
  130. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +32 -32
  131. package/esm2015/plugins/perf-metric/index.js +1 -1
  132. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -2
  133. package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +10 -10
  134. package/esm2015/plugins/pii-tokenizer/index.js +1 -1
  135. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -12
  136. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +96 -96
  137. package/esm2015/plugins/raw-response-info/index.js +1 -1
  138. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +14 -14
  139. package/esm2015/plugins/retry/index.js +1 -1
  140. package/esm2015/plugins/retry/retry.fetch.js +1 -1
  141. package/esm2015/plugins/retry/retry.spec.js +21 -21
  142. package/esm2015/plugins/reviver/index.js +1 -1
  143. package/esm2015/plugins/reviver/reviver.spec.js +6 -6
  144. package/esm2015/plugins/session-id/index.js +1 -1
  145. package/esm2015/plugins/session-id/session-id.request.js +7 -7
  146. package/esm2015/plugins/session-id/session-id.spec.js +14 -14
  147. package/esm2015/plugins/si-token/index.js +1 -1
  148. package/esm2015/plugins/si-token/si-token.request.js +1 -1
  149. package/esm2015/plugins/si-token/si-token.spec.js +10 -10
  150. package/esm2015/plugins/simple-api-key-authentication/index.js +1 -1
  151. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +5 -5
  152. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +46 -46
  153. package/esm2015/plugins/timeout/index.js +1 -1
  154. package/esm2015/plugins/timeout/timeout.fetch.js +12 -12
  155. package/esm2015/plugins/timeout/timeout.spec.js +15 -15
  156. package/esm2015/plugins/url-rewrite/index.js +1 -1
  157. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +10 -10
  158. package/esm2015/plugins/wait-for/index.js +1 -1
  159. package/esm2015/plugins/wait-for/wait-for.spec.js +10 -10
  160. package/esm2015/public_api.js +4 -4
  161. package/esm2015/utils/crypto.js +15 -15
  162. package/esm2015/utils/generic-api.js +5 -5
  163. package/esm2015/utils/index.js +6 -6
  164. package/esm2015/utils/json-token.js +32 -32
  165. package/esm2015/utils/json-token.spec.js +32 -32
  166. package/package.json +5 -5
@@ -368,7 +368,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
368
368
  return _ts_generator(this, function(_state) {
369
369
  switch(_state.label){
370
370
  case 0:
371
- origin = options.headers.get("Origin");
371
+ origin = options.headers.get('Origin');
372
372
  _state.label = 1;
373
373
  case 1:
374
374
  _state.trys.push([
@@ -384,7 +384,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
384
384
  var metadataSignal = (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.signal;
385
385
  metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
386
386
  var subscription = _this.options.httpClient.request(options.method, url, _object_spread_props(_object_spread({}, options), {
387
- observe: "response",
387
+ observe: 'response',
388
388
  headers: headers
389
389
  })).subscribe({
390
390
  next: function(res) {
@@ -398,7 +398,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
398
398
  }
399
399
  });
400
400
  metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
401
- metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener("abort", function() {
401
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
402
402
  subscription.unsubscribe();
403
403
  reject(metadataSignal.reason);
404
404
  });
@@ -416,7 +416,7 @@ var ApiAngularClient = /*#__PURE__*/ function() {
416
416
  ];
417
417
  case 3:
418
418
  e = _state.sent();
419
- exception = new _errors.EmptyResponseError(e.message || "Fail to Fetch", undefined, {
419
+ exception = new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
420
420
  apiName: apiName,
421
421
  operationId: operationId,
422
422
  url: url,
@@ -105,8 +105,8 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
105
105
  function ApiBeaconClient(options) {
106
106
  _class_call_check(this, ApiBeaconClient);
107
107
  /** @inheritdoc */ _define_property(this, "options", void 0);
108
- if (typeof navigator === "undefined" || !navigator.sendBeacon) {
109
- throw new Error("Beacon API is not supported in this context");
108
+ if (typeof navigator === 'undefined' || !navigator.sendBeacon) {
109
+ throw new Error('Beacon API is not supported in this context');
110
110
  }
111
111
  this.options = _object_spread({}, DEFAULT_OPTIONS, options);
112
112
  }
@@ -120,7 +120,7 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
120
120
  {
121
121
  key: "getRequestOptions",
122
122
  value: /** @inheritdoc */ function getRequestOptions(options) {
123
- if (options.method.toUpperCase() !== "POST") {
123
+ if (options.method.toUpperCase() !== 'POST') {
124
124
  throw new Error("Unsupported method: ".concat(options.method, ". The beacon API only supports POST."));
125
125
  }
126
126
  var opts = _object_spread_props(_object_spread({}, options), {
@@ -198,7 +198,7 @@ var ApiBeaconClient = /*#__PURE__*/ function() {
198
198
  key: "processCall",
199
199
  value: /** @inheritdoc */ function processCall(url, options, _apiType, _apiName, _revivers, _operationId) {
200
200
  var headers = _object_spread({
201
- type: "application/json"
201
+ type: 'application/json'
202
202
  }, options.headers.entries());
203
203
  var blob = new Blob(options.body ? [
204
204
  JSON.stringify(options.body)
@@ -400,7 +400,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
400
400
  return _ts_generator(this, function(_state) {
401
401
  switch(_state.label){
402
402
  case 0:
403
- origin = options.headers.get("Origin");
403
+ origin = options.headers.get('Origin');
404
404
  _state.label = 1;
405
405
  case 1:
406
406
  _state.trys.push([
@@ -413,7 +413,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
413
413
  metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.throwIfAborted();
414
414
  controller = new AbortController();
415
415
  options.signal = controller.signal;
416
- metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener("abort", function() {
416
+ metadataSignal === null || metadataSignal === void 0 ? void 0 : metadataSignal.addEventListener('abort', function() {
417
417
  return controller.abort();
418
418
  });
419
419
  loadedPlugins = [];
@@ -491,7 +491,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
491
491
  if (_instanceof(e, _errors.CanceledCallError)) {
492
492
  exception = e;
493
493
  } else {
494
- exception = new _errors.EmptyResponseError(e.message || "Fail to Fetch", undefined, {
494
+ exception = new _errors.EmptyResponseError(e.message || 'Fail to Fetch', undefined, {
495
495
  apiName: apiName,
496
496
  operationId: operationId,
497
497
  url: url,
@@ -506,7 +506,7 @@ var ApiFetchClient = /*#__PURE__*/ function() {
506
506
  try {
507
507
  root = body ? JSON.parse(body) : undefined;
508
508
  } catch (e) {
509
- exception = new _errors.ResponseJSONParseError(e.message || "Fail to parse response body", response && response.status || 0, body, {
509
+ exception = new _errors.ResponseJSONParseError(e.message || 'Fail to parse response body', response && response.status || 0, body, {
510
510
  apiName: apiName,
511
511
  operationId: operationId,
512
512
  url: url,
@@ -3,45 +3,45 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  var _core = require("@ama-sdk/core");
6
- describe("getResponseReviver - revivers by status code", function() {
6
+ describe('getResponseReviver - revivers by status code', function() {
7
7
  var revivers = {
8
8
  202: jest.fn(),
9
9
  201: jest.fn()
10
10
  };
11
11
  beforeEach(function() {
12
- jest.spyOn(console, "error");
12
+ jest.spyOn(console, 'error');
13
13
  });
14
14
  afterEach(function() {
15
15
  jest.clearAllMocks();
16
16
  });
17
- it("should not return a reviver for a non ok response", function() {
17
+ it('should not return a reviver for a non ok response', function() {
18
18
  expect((0, _core.getResponseReviver)(revivers, {
19
19
  status: 300,
20
20
  ok: false
21
21
  })).toBe(undefined);
22
22
  });
23
- it("should return a reason but not reviver for a 204 No Content Response", function() {
23
+ it('should return a reason but not reviver for a 204 No Content Response', function() {
24
24
  expect((0, _core.getResponseReviver)(revivers, {
25
25
  status: 204,
26
26
  ok: true
27
27
  })).toBe(undefined);
28
- expect(console.error).toHaveBeenCalledWith("API status code error for unknown endpoint - 204 response is not defined in the API specification");
28
+ expect(console.error).toHaveBeenCalledWith('API status code error for unknown endpoint - 204 response is not defined in the API specification');
29
29
  });
30
- it("should return the status code's reviver", function() {
30
+ it('should return the status code\'s reviver', function() {
31
31
  expect((0, _core.getResponseReviver)(revivers, {
32
32
  status: 202,
33
33
  ok: true
34
- }, "myEndpoint")).toBe(revivers[202]);
34
+ }, 'myEndpoint')).toBe(revivers[202]);
35
35
  expect(console.error).not.toHaveBeenCalled();
36
36
  });
37
- it("should fallback on the first defined status if the status code's reviver is not defined", function() {
37
+ it('should fallback on the first defined status if the status code\'s reviver is not defined', function() {
38
38
  expect((0, _core.getResponseReviver)(revivers, {
39
39
  status: undefined,
40
40
  ok: true
41
- }, "myEndpoint")).toBe(revivers[201]);
42
- expect(console.error).toHaveBeenCalledWith("API status code error for myEndpoint endpoint - Unknown undefined code returned by the API - Fallback to 201's reviver");
41
+ }, 'myEndpoint')).toBe(revivers[201]);
42
+ expect(console.error).toHaveBeenCalledWith('API status code error for myEndpoint endpoint - Unknown undefined code returned by the API - Fallback to 201\'s reviver');
43
43
  });
44
- it("should not fallback on 204 (No Content)'s reviver", function() {
44
+ it('should not fallback on 204 (No Content)\'s reviver', function() {
45
45
  var reviversWith204 = {
46
46
  204: jest.fn(),
47
47
  206: jest.fn()
@@ -49,33 +49,33 @@ describe("getResponseReviver - revivers by status code", function() {
49
49
  var fallback = (0, _core.getResponseReviver)(reviversWith204, {
50
50
  status: 201,
51
51
  ok: true
52
- }, "myEndpoint");
52
+ }, 'myEndpoint');
53
53
  expect(fallback).toBe(reviversWith204[206]);
54
54
  expect(fallback).not.toBe(reviversWith204[204]);
55
- expect(console.error).toHaveBeenCalledWith("API status code error for myEndpoint endpoint - Unknown 201 code returned by the API - Fallback to 206's reviver");
55
+ expect(console.error).toHaveBeenCalledWith('API status code error for myEndpoint endpoint - Unknown 201 code returned by the API - Fallback to 206\'s reviver');
56
56
  });
57
- it("should not fallback if the feature is deactivated", function() {
58
- jest.spyOn(console, "log");
57
+ it('should not fallback if the feature is deactivated', function() {
58
+ jest.spyOn(console, 'log');
59
59
  expect((0, _core.getResponseReviver)(revivers, {
60
60
  status: 206,
61
61
  ok: true
62
- }, "myEndpoint", {
62
+ }, 'myEndpoint', {
63
63
  disableFallback: true,
64
64
  log: console.log
65
65
  })).toBe(undefined);
66
66
  expect(console.error).not.toHaveBeenCalled();
67
- expect(console.log).toHaveBeenCalledWith("API status code error for myEndpoint endpoint - Missing 206 from API specification - fallback is deactivated, no revive will run on this response");
67
+ expect(console.log).toHaveBeenCalledWith('API status code error for myEndpoint endpoint - Missing 206 from API specification - fallback is deactivated, no revive will run on this response');
68
68
  });
69
69
  });
70
- describe("getResponseReviver - reviver as function", function() {
70
+ describe('getResponseReviver - reviver as function', function() {
71
71
  var reviver = jest.fn();
72
- it("should not return a reviver for a non ok response", function() {
72
+ it('should not return a reviver for a non ok response', function() {
73
73
  expect((0, _core.getResponseReviver)(reviver, {
74
74
  status: 300,
75
75
  ok: false
76
76
  })).toBe(undefined);
77
77
  });
78
- it("should only return the reviver if the endpoint reviver is a function or an undefined object", function() {
78
+ it('should only return the reviver if the endpoint reviver is a function or an undefined object', function() {
79
79
  expect((0, _core.getResponseReviver)(reviver, {
80
80
  status: 200,
81
81
  ok: true
@@ -108,25 +108,25 @@ function _unsupported_iterable_to_array(o, minLen) {
108
108
  function prepareUrl(url) {
109
109
  var queryParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
110
110
  var queryPart = Object.keys(queryParameters).filter(function(name) {
111
- return typeof queryParameters[name] !== "undefined";
111
+ return typeof queryParameters[name] !== 'undefined';
112
112
  }).map(function(name) {
113
113
  return "".concat(name, "=").concat(queryParameters[name]);
114
- }).join("&");
115
- var paramsPrefix = url.indexOf("?") > -1 ? "&" : "?";
116
- return url + (!queryPart ? "" : paramsPrefix + queryPart);
114
+ }).join('&');
115
+ var paramsPrefix = url.indexOf('?') > -1 ? '&' : '?';
116
+ return url + (!queryPart ? '' : paramsPrefix + queryPart);
117
117
  }
118
118
  function extractQueryParams(data, names) {
119
119
  return names.filter(function(name) {
120
- return typeof data[name] !== "undefined" && data[name] !== null;
120
+ return typeof data[name] !== 'undefined' && data[name] !== null;
121
121
  }).reduce(function(acc, name) {
122
122
  var prop = data[name];
123
- acc[name] = typeof prop.toJSON === "function" ? prop.toJSON() : prop.toString();
123
+ acc[name] = typeof prop.toJSON === 'function' ? prop.toJSON() : prop.toString();
124
124
  return acc;
125
125
  }, {});
126
126
  }
127
127
  function filterUndefinedValues(object) {
128
128
  return !object ? {} : Object.keys(object).filter(function(objectKey) {
129
- return typeof object[objectKey] !== "undefined";
129
+ return typeof object[objectKey] !== 'undefined';
130
130
  }).reduce(function(acc, objectKey) {
131
131
  acc[objectKey] = object[objectKey];
132
132
  return acc;
@@ -134,7 +134,7 @@ function filterUndefinedValues(object) {
134
134
  }
135
135
  function processFormData(data, type) {
136
136
  var encodedData;
137
- /* eslint-disable guard-for-in */ if (type === "multipart/form-data") {
137
+ /* eslint-disable guard-for-in */ if (type === 'multipart/form-data') {
138
138
  var formData = new FormData();
139
139
  for(var i in data){
140
140
  formData.append(i, data[i]);
@@ -145,7 +145,7 @@ function processFormData(data, type) {
145
145
  for(var i1 in data){
146
146
  formData1.push("".concat(i1, "=").concat(encodeURIComponent(data[i1])));
147
147
  }
148
- encodedData = formData1.join("&");
148
+ encodedData = formData1.join('&');
149
149
  }
150
150
  /* eslint-enable guard-for-in */ return encodedData;
151
151
  }
@@ -180,12 +180,12 @@ endpoint) {
180
180
  disableFallback: false,
181
181
  log: console.error
182
182
  };
183
- var logPrefix = "API status code error for ".concat(endpoint || "unknown", " endpoint");
183
+ var logPrefix = "API status code error for ".concat(endpoint || 'unknown', " endpoint");
184
184
  var logMsg = options.log || function() {};
185
185
  if (!response || !response.ok) {
186
186
  return undefined;
187
187
  }
188
- if (typeof revivers === "function" || typeof revivers === "undefined") {
188
+ if (typeof revivers === 'function' || typeof revivers === 'undefined') {
189
189
  return revivers;
190
190
  }
191
191
  if (response.status && revivers[response.status]) {
@@ -211,7 +211,7 @@ endpoint) {
211
211
  statusCode: Number.MAX_SAFE_INTEGER,
212
212
  reviver: undefined
213
213
  });
214
- var fallbackLog = Number.MAX_SAFE_INTEGER !== fallback.statusCode ? "Fallback to ".concat(fallback.statusCode, "'s reviver") : "No fallback found";
215
- logMsg("".concat(logPrefix, " - Unknown ").concat(response.status || "undefined", " code returned by the API - ").concat(fallbackLog));
214
+ var fallbackLog = Number.MAX_SAFE_INTEGER !== fallback.statusCode ? "Fallback to ".concat(fallback.statusCode, "'s reviver") : 'No fallback found';
215
+ logMsg("".concat(logPrefix, " - Unknown ").concat(response.status || 'undefined', " code returned by the API - ").concat(fallbackLog));
216
216
  return fallback.reviver;
217
217
  }
@@ -9,5 +9,5 @@ Object.defineProperty(exports, "isApiClient", {
9
9
  }
10
10
  });
11
11
  function isApiClient(client) {
12
- return client && !!client.options && typeof client.extractQueryParams === "function" && typeof client.prepareOptions === "function" && typeof client.prepareUrl === "function" && typeof client.processFormData === "function" && typeof client.processCall === "function";
12
+ return client && !!client.options && typeof client.extractQueryParams === 'function' && typeof client.prepareOptions === 'function' && typeof client.prepareUrl === 'function' && typeof client.processFormData === 'function' && typeof client.processCall === 'function';
13
13
  }
@@ -9,5 +9,5 @@ Object.defineProperty(exports, "isConstructorObject", {
9
9
  }
10
10
  });
11
11
  function isConstructorObject(args) {
12
- return !!args && args.length === 1 && !!args[0] && typeof args[0] === "object";
12
+ return !!args && args.length === 1 && !!args[0] && typeof args[0] === 'object';
13
13
  }
package/cjs/fwk/date.js CHANGED
@@ -189,7 +189,7 @@ var _NativeDateClass = Date;
189
189
  function pad(val) {
190
190
  var digits = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
191
191
  var str = "".concat(val);
192
- return "0".repeat(Math.max(0, digits - str.length)) + str;
192
+ return '0'.repeat(Math.max(0, digits - str.length)) + str;
193
193
  }
194
194
  var CommonDate = /*#__PURE__*/ function(Date1) {
195
195
  "use strict";
@@ -201,15 +201,15 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
201
201
  }
202
202
  _class_call_check(this, CommonDate);
203
203
  if (args) {
204
- if (typeof args[0] === "string") {
205
- var idxT = args[0].lastIndexOf("T");
204
+ if (typeof args[0] === 'string') {
205
+ var idxT = args[0].lastIndexOf('T');
206
206
  // TZD = time zone designator (Z or +hh:mm or -hh:mm)
207
- var idx = args[0].lastIndexOf("Z");
207
+ var idx = args[0].lastIndexOf('Z');
208
208
  if (idx < 0) {
209
- idx = args[0].lastIndexOf("+");
209
+ idx = args[0].lastIndexOf('+');
210
210
  }
211
211
  if (idx < 0 && idxT > 0) {
212
- var relativeIdx = args[0].substring(idxT).lastIndexOf("-");
212
+ var relativeIdx = args[0].substring(idxT).lastIndexOf('-');
213
213
  idx = relativeIdx > 0 ? relativeIdx + idxT : relativeIdx;
214
214
  }
215
215
  if (idx > 0) {
@@ -217,7 +217,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
217
217
  }
218
218
  var TIME_ZONE_OFFSET = _construct(Date, _to_consumable_array(args)).getTimezoneOffset();
219
219
  if (idxT > 0) {
220
- args[0] += "".concat(TIME_ZONE_OFFSET < 0 ? "+" : "-").concat(pad(Math.floor(Math.abs(TIME_ZONE_OFFSET / 60))), ":").concat(pad(Math.abs(TIME_ZONE_OFFSET % 60)));
220
+ args[0] += "".concat(TIME_ZONE_OFFSET < 0 ? '+' : '-').concat(pad(Math.floor(Math.abs(TIME_ZONE_OFFSET / 60))), ":").concat(pad(Math.abs(TIME_ZONE_OFFSET % 60)));
221
221
  }
222
222
  } else if (_instanceof(args[0], CommonDate)) {
223
223
  args[0] = args[0];
@@ -241,7 +241,7 @@ var CommonDate = /*#__PURE__*/ function(Date1) {
241
241
  }(_wrap_native_super(Date));
242
242
  var utils;
243
243
  (function(utils) {
244
- "use strict";
244
+ 'use strict';
245
245
  var _$Date = /*#__PURE__*/ function(CommonDate) {
246
246
  _inherits(Date1, CommonDate);
247
247
  var _super = _create_super(Date1);
@@ -250,7 +250,7 @@ var utils;
250
250
  args[_key] = arguments[_key];
251
251
  }
252
252
  _class_call_check(this, Date1);
253
- if (args && typeof args[0] === "string" && args[0].lastIndexOf("T") < 0) {
253
+ if (args && typeof args[0] === 'string' && args[0].lastIndexOf('T') < 0) {
254
254
  args[0] = "".concat(args[0], "T00:00:00Z");
255
255
  } else if (_instanceof(args[0], _NativeDateClass)) {
256
256
  args[0] = "".concat(args[0].getFullYear(), "-").concat(pad(args[0].getMonth() + 1), "-").concat(pad(args[0].getDate()), "T00:00:00Z");
@@ -3,50 +3,50 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  var _date = require("./date");
6
- describe("DateTime", function() {
7
- it("should support timestamp", function() {
6
+ describe('DateTime', function() {
7
+ it('should support timestamp', function() {
8
8
  var ts = new Date().getTime();
9
9
  var dateUtils = new _date.utils.DateTime(ts);
10
10
  expect(dateUtils.getTime()).toEqual(ts);
11
11
  });
12
- it("should support DateTime Utils", function() {
12
+ it('should support DateTime Utils', function() {
13
13
  var originalDate = new _date.utils.DateTime(new Date());
14
14
  expect(new _date.utils.DateTime(originalDate)).toEqual(originalDate);
15
15
  });
16
- it("should support a copy constructor", function() {
16
+ it('should support a copy constructor', function() {
17
17
  var originalDate = new _date.utils.DateTime(new Date());
18
18
  expect(new _date.utils.DateTime(originalDate)).toEqual(originalDate);
19
19
  });
20
- it("should support json conversions", function() {
20
+ it('should support json conversions', function() {
21
21
  var originalDate = new _date.utils.DateTime(new Date());
22
22
  var jsonDate = JSON.parse(JSON.stringify(originalDate));
23
23
  expect(new _date.utils.DateTime(jsonDate)).toEqual(originalDate);
24
24
  });
25
- it("should support date without time", function() {
26
- var date1 = "1988-06-07";
25
+ it('should support date without time', function() {
26
+ var date1 = '1988-06-07';
27
27
  var dateCompare = new Date(date1);
28
28
  expect(new _date.utils.DateTime(date1)).toEqual(dateCompare);
29
29
  });
30
- it("should support datetime without timezone", function() {
31
- var date1 = "2015-03-25T12:00:00Z";
32
- var dateCompare = new Date("2015-03-25");
30
+ it('should support datetime without timezone', function() {
31
+ var date1 = '2015-03-25T12:00:00Z';
32
+ var dateCompare = new Date('2015-03-25');
33
33
  dateCompare.setHours(12);
34
34
  dateCompare.setMinutes(0);
35
35
  var dateUtils = new _date.utils.DateTime(date1);
36
36
  expect(dateUtils).toEqual(dateCompare);
37
37
  });
38
- it("should ignore timezone of datetime", function() {
39
- var date1 = "2015-03-25T12:00:00-02:00";
40
- var date2 = "2015-03-25T12:00:00+05:00";
41
- var dateCompare = new Date("2015-03-25T12:00:00Z");
38
+ it('should ignore timezone of datetime', function() {
39
+ var date1 = '2015-03-25T12:00:00-02:00';
40
+ var date2 = '2015-03-25T12:00:00+05:00';
41
+ var dateCompare = new Date('2015-03-25T12:00:00Z');
42
42
  dateCompare.setHours(12);
43
43
  dateCompare.setMinutes(0);
44
44
  expect(new _date.utils.DateTime(date1)).toEqual(dateCompare);
45
45
  expect(new _date.utils.DateTime(date2)).toEqual(dateCompare);
46
46
  });
47
- it("should handle daylight change", function() {
48
- var dateStr1 = "2017-03-23T12:00:00Z";
49
- var dateStr2 = "2017-04-01T12:00:00Z";
47
+ it('should handle daylight change', function() {
48
+ var dateStr1 = '2017-03-23T12:00:00Z';
49
+ var dateStr2 = '2017-04-01T12:00:00Z';
50
50
  var date1 = new _date.utils.DateTime(dateStr1);
51
51
  var date2 = new _date.utils.DateTime(dateStr2);
52
52
  var compareDate1 = new Date(dateStr1);
@@ -54,28 +54,28 @@ describe("DateTime", function() {
54
54
  expect(date1.getTimezoneOffset() - date2.getTimezoneOffset()).toBe(compareDate1.getTimezoneOffset() - compareDate2.getTimezoneOffset());
55
55
  });
56
56
  });
57
- describe("Date", function() {
58
- it("should support timestamp", function() {
57
+ describe('Date', function() {
58
+ it('should support timestamp', function() {
59
59
  var ts = new Date().getTime();
60
60
  var dateUtils = new _date.utils.Date(ts);
61
61
  expect(dateUtils.getTime()).toEqual(ts);
62
62
  });
63
- it("should support Date Utils", function() {
63
+ it('should support Date Utils', function() {
64
64
  var originalDate = new _date.utils.Date(new Date());
65
65
  expect(new _date.utils.Date(originalDate)).toEqual(originalDate);
66
66
  });
67
- it("should support a copy constructor", function() {
67
+ it('should support a copy constructor', function() {
68
68
  var originalDate = new _date.utils.Date(new Date());
69
69
  expect(new _date.utils.Date(originalDate)).toEqual(originalDate);
70
70
  });
71
- it("should support json conversions", function() {
71
+ it('should support json conversions', function() {
72
72
  var originalDate = new _date.utils.Date(new Date());
73
73
  var jsonDate = JSON.parse(JSON.stringify(originalDate));
74
74
  expect(new _date.utils.Date(jsonDate)).toEqual(originalDate);
75
75
  });
76
- it("should be converted to a Js DateTime", function() {
77
- var date1 = "1988-06-07";
78
- var dateCompare = new _date.utils.DateTime("1988-06-07T00:00:00Z");
76
+ it('should be converted to a Js DateTime', function() {
77
+ var date1 = '1988-06-07';
78
+ var dateCompare = new _date.utils.DateTime('1988-06-07T00:00:00Z');
79
79
  expect(new _date.utils.Date(date1)).toEqual(dateCompare);
80
80
  });
81
81
  });
package/cjs/fwk/errors.js CHANGED
@@ -167,9 +167,9 @@ var GenericError = /*#__PURE__*/ function(Error1) {
167
167
  function GenericError(message, context) {
168
168
  _class_call_check(this, GenericError);
169
169
  var httpRegexp = /^https?:\/\//;
170
- var baseUrl = (context === null || context === void 0 ? void 0 : context.url) ? context.url.replace(httpRegexp, "") : "unknown";
171
- var origin = (context === null || context === void 0 ? void 0 : context.origin) ? context.origin.replace(httpRegexp, "") : "unknown";
172
- return _super.call(this, context ? "[SDK] [apiName: ".concat(context.apiName || "unknown", "] [operationId: ").concat(context.operationId || "unknown", "] [baseUrl: ").concat(baseUrl, "] [origin: ").concat(origin, "] [errorType: SDK] ").concat(message) : "[SDK] ".concat(message));
170
+ var baseUrl = (context === null || context === void 0 ? void 0 : context.url) ? context.url.replace(httpRegexp, '') : 'unknown';
171
+ var origin = (context === null || context === void 0 ? void 0 : context.origin) ? context.origin.replace(httpRegexp, '') : 'unknown';
172
+ return _super.call(this, context ? "[SDK] [apiName: ".concat(context.apiName || 'unknown', "] [operationId: ").concat(context.operationId || 'unknown', "] [baseUrl: ").concat(baseUrl, "] [origin: ").concat(origin, "] [errorType: SDK] ").concat(message) : "[SDK] ".concat(message));
173
173
  }
174
174
  return GenericError;
175
175
  }(_wrap_native_super(Error));
@@ -220,7 +220,7 @@ function _ts_generator(thisArg, body) {
220
220
  if (match && match[1] && match[2]) {
221
221
  // the match looks like this 1ASIUAIRFAC/v2/shopping/carts/19DXNCKB931CYX3S?refresh=true
222
222
  // so we remove the SAP information at the beginning and URL parameters at the end if any
223
- var requestUrl = match[2].substring(match[2].indexOf("/"), match[2].indexOf("?") > -1 ? match[2].indexOf("?") : match[2].length);
223
+ var requestUrl = match[2].substring(match[2].indexOf('/'), match[2].indexOf('?') > -1 ? match[2].indexOf('?') : match[2].length);
224
224
  var method = match[1];
225
225
  var pathObject = (0, _helpers.getPath)(requestUrl, operationAdapter, method);
226
226
  if (pathObject) {
@@ -247,7 +247,7 @@ function _ts_generator(thisArg, body) {
247
247
  * @returns JSON data that can be either the request or the response
248
248
  */ function getData(log) {
249
249
  var match = log.match(requestResponseJsonRegexp);
250
- return match && match[1] || "";
250
+ return match && match[1] || '';
251
251
  }
252
252
  /**
253
253
  * Retrieve path from logPath and parse it to find all the calls.
@@ -327,7 +327,7 @@ function _ts_generator(thisArg, body) {
327
327
  mockMap[alfCall.operationId] = [];
328
328
  }
329
329
  mockMap[alfCall.operationId].push({
330
- mockData: alfCall.response ? JSON.parse(alfCall.response) : ""
330
+ mockData: alfCall.response ? JSON.parse(alfCall.response) : ''
331
331
  });
332
332
  return mockMap;
333
333
  }, {});
@@ -355,7 +355,7 @@ function getAlfMockAdapter(binFilePath, operationAdapter) {
355
355
  ];
356
356
  case 2:
357
357
  content = _state.sent();
358
- if (!(typeof operationAdapter === "function")) return [
358
+ if (!(typeof operationAdapter === 'function')) return [
359
359
  3,
360
360
  4
361
361
  ];
@@ -174,7 +174,7 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
174
174
  _define_property(this, "mockFactory", void 0);
175
175
  this.pathObjects = pathObjects;
176
176
  this.mocks = {};
177
- if (typeof mockMap !== "function") {
177
+ if (typeof mockMap !== 'function') {
178
178
  this.mocks = mockMap;
179
179
  } else {
180
180
  this.mockFactory = mockMap;
@@ -205,7 +205,7 @@ var BaseMockAdapter = /*#__PURE__*/ function() {
205
205
  return _ts_generator(this, function(_state) {
206
206
  switch(_state.label){
207
207
  case 0:
208
- if (!(typeof _this.pathObjects === "function")) return [
208
+ if (!(typeof _this.pathObjects === 'function')) return [
209
209
  3,
210
210
  2
211
211
  ];
@@ -27,7 +27,7 @@ function getOperationId(pathObject, method) {
27
27
  return operation.operationId || "".concat(pathObject.path, "_").concat(lcMethod);
28
28
  }
29
29
  function getPath(requestUrl, pathObjects, method) {
30
- var pathName = new URL(requestUrl, requestUrl.startsWith("/") ? "http://example.com" : undefined).pathname;
30
+ var pathName = new URL(requestUrl, requestUrl.startsWith('/') ? 'http://example.com' : undefined).pathname;
31
31
  if (!pathName) {
32
32
  throw new Error("Couldn't parse url ".concat(requestUrl));
33
33
  }
@@ -36,7 +36,7 @@ function getPath(requestUrl, pathObjects, method) {
36
36
  if (pathObject.regexp.test(pathName)) {
37
37
  newMatches.push({
38
38
  index: index,
39
- segments: pathObject.path.split("/"),
39
+ segments: pathObject.path.split('/'),
40
40
  methods: pathObject.operations.map(function(operation) {
41
41
  return operation.method;
42
42
  })
@@ -49,7 +49,7 @@ function getPath(requestUrl, pathObjects, method) {
49
49
  while(matches.length > 1){
50
50
  matches = matches.reduce(function(newMatches, match) {
51
51
  var newIndex = match.segments.findIndex(function(segment) {
52
- return segment.startsWith("{") && segment.endsWith("}");
52
+ return segment.startsWith('{') && segment.endsWith('}');
53
53
  }, lastIndex + 1);
54
54
  // Complete static match so use some value that can't be exceeded
55
55
  if (newIndex === -1) {