@ama-sdk/core 12.1.10 → 12.1.11

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 (111) hide show
  1. package/cjs/clients/api-angular-client.js +13 -18
  2. package/cjs/clients/api-fetch-client.js +16 -21
  3. package/cjs/fwk/api.helpers.js +11 -11
  4. package/cjs/fwk/date.js +5 -5
  5. package/cjs/fwk/errors.js +7 -7
  6. package/cjs/fwk/mocks/alf-mock-adapter.js +58 -60
  7. package/cjs/fwk/mocks/base-mock-adapter.js +15 -19
  8. package/cjs/fwk/mocks/helpers.js +3 -3
  9. package/cjs/fwk/param-serialization.js +6 -6
  10. package/cjs/fwk/reviver.js +4 -4
  11. package/cjs/plugins/abort/abort.spec.js +83 -81
  12. package/cjs/plugins/additional-params/additional-params.request.js +18 -25
  13. package/cjs/plugins/additional-params/additional-params.spec.js +194 -186
  14. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
  15. package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
  16. package/cjs/plugins/api-key/api-key.request.js +12 -19
  17. package/cjs/plugins/api-key/api-key.spec.js +50 -50
  18. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +25 -36
  19. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
  20. package/cjs/plugins/client-facts/client-facts.request.js +18 -25
  21. package/cjs/plugins/client-facts/client-facts.spec.js +218 -208
  22. package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
  23. package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
  24. package/cjs/plugins/custom-info/custom-info.spec.js +90 -90
  25. package/cjs/plugins/fetch-cache/fetch-cache.spec.js +100 -98
  26. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
  27. package/cjs/plugins/json-token/json-token.spec.js +109 -107
  28. package/cjs/plugins/keepalive/keepalive.request.js +7 -12
  29. package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
  30. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +11 -23
  31. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
  32. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
  33. package/cjs/plugins/mock-intercept/mock-intercept.angular.js +94 -100
  34. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  35. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +3 -3
  36. package/cjs/plugins/mock-intercept/mock-intercept.request.js +12 -19
  37. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +245 -237
  38. package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
  39. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +19 -27
  40. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
  41. package/cjs/plugins/raw-response-info/raw-response-info.spec.js +67 -67
  42. package/cjs/plugins/retry/retry.fetch.js +18 -27
  43. package/cjs/plugins/retry/retry.spec.js +233 -225
  44. package/cjs/plugins/reviver/reviver.spec.js +88 -86
  45. package/cjs/plugins/session-id/session-id.spec.js +98 -94
  46. package/cjs/plugins/si-token/si-token.spec.js +27 -29
  47. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
  48. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
  49. package/cjs/plugins/timeout/timeout.fetch.js +16 -22
  50. package/cjs/plugins/timeout/timeout.spec.js +211 -205
  51. package/cjs/plugins/url-rewrite/url-rewrite.request.js +9 -16
  52. package/cjs/plugins/url-rewrite/url-rewrite.spec.js +48 -48
  53. package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
  54. package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
  55. package/cjs/utils/crypto.js +15 -27
  56. package/cjs/utils/generic-api.js +9 -14
  57. package/cjs/utils/json-token.js +19 -26
  58. package/cjs/utils/json-token.spec.js +495 -497
  59. package/cjs/utils/mime-types.js +3 -3
  60. package/esm2015/clients/api-angular-client.js +13 -18
  61. package/esm2015/clients/api-fetch-client.js +16 -21
  62. package/esm2015/fwk/mocks/alf-mock-adapter.js +58 -60
  63. package/esm2015/fwk/mocks/base-mock-adapter.js +15 -19
  64. package/esm2015/plugins/abort/abort.spec.js +83 -81
  65. package/esm2015/plugins/additional-params/additional-params.request.js +15 -22
  66. package/esm2015/plugins/additional-params/additional-params.spec.js +194 -186
  67. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +10 -17
  68. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +83 -81
  69. package/esm2015/plugins/api-key/api-key.request.js +12 -19
  70. package/esm2015/plugins/api-key/api-key.spec.js +50 -50
  71. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +21 -32
  72. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +343 -327
  73. package/esm2015/plugins/client-facts/client-facts.request.js +15 -22
  74. package/esm2015/plugins/client-facts/client-facts.spec.js +218 -208
  75. package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
  76. package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
  77. package/esm2015/plugins/custom-info/custom-info.spec.js +90 -90
  78. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +100 -98
  79. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +60 -60
  80. package/esm2015/plugins/json-token/json-token.spec.js +109 -107
  81. package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
  82. package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
  83. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.helpers.js +8 -20
  84. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +18 -28
  85. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +212 -204
  86. package/esm2015/plugins/mock-intercept/mock-intercept.angular.js +94 -100
  87. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  88. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +12 -19
  89. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +245 -237
  90. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
  91. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +15 -23
  92. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +404 -386
  93. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +67 -67
  94. package/esm2015/plugins/retry/retry.fetch.js +18 -27
  95. package/esm2015/plugins/retry/retry.spec.js +233 -225
  96. package/esm2015/plugins/reviver/reviver.spec.js +88 -86
  97. package/esm2015/plugins/session-id/session-id.spec.js +98 -94
  98. package/esm2015/plugins/si-token/si-token.spec.js +27 -29
  99. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +17 -24
  100. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +199 -191
  101. package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
  102. package/esm2015/plugins/timeout/timeout.spec.js +211 -205
  103. package/esm2015/plugins/url-rewrite/url-rewrite.request.js +9 -16
  104. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +48 -48
  105. package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
  106. package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
  107. package/esm2015/utils/crypto.js +8 -20
  108. package/esm2015/utils/generic-api.js +9 -14
  109. package/esm2015/utils/json-token.js +10 -17
  110. package/esm2015/utils/json-token.spec.js +495 -497
  111. package/package.json +6 -6
@@ -34,7 +34,7 @@ function _async_to_generator(fn) {
34
34
  };
35
35
  }
36
36
  function _ts_generator(thisArg, body) {
37
- var f, y, t, g, _ = {
37
+ var f, y, t, _ = {
38
38
  label: 0,
39
39
  sent: function() {
40
40
  if (t[0] & 1) throw t[1];
@@ -42,12 +42,8 @@ function _ts_generator(thisArg, body) {
42
42
  },
43
43
  trys: [],
44
44
  ops: []
45
- };
46
- return g = {
47
- next: verb(0),
48
- "throw": verb(1),
49
- "return": verb(2)
50
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
51
47
  return this;
52
48
  }), g;
53
49
  function verb(n) {
@@ -60,7 +56,7 @@ function _ts_generator(thisArg, body) {
60
56
  }
61
57
  function step(op) {
62
58
  if (f) throw new TypeError("Generator is already executing.");
63
- while(_)try {
59
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
64
60
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
65
61
  if (y = 0, t) op = [
66
62
  op[0] & 2,
@@ -130,65 +126,69 @@ function _ts_generator(thisArg, body) {
130
126
  }
131
127
  describe('Raw response info Reply plugin', function() {
132
128
  var reviver = jest.fn();
133
- it('should add response object', /*#__PURE__*/ _async_to_generator(function() {
134
- var plugin, runner, data, newData;
135
- return _ts_generator(this, function(_state) {
136
- switch(_state.label){
137
- case 0:
138
- plugin = new _rawresponseinforeply.RawResponseInfoReply();
139
- runner = plugin.load({
140
- reviver: reviver,
141
- apiType: _api.ApiTypes.DEFAULT,
142
- response: {
143
- headers: new Headers(),
144
- test: 'OK'
145
- }
146
- });
147
- data = {};
148
- return [
149
- 4,
150
- runner.transform(data)
151
- ];
152
- case 1:
153
- newData = _state.sent();
154
- expect(newData.responseInfo).toBeDefined();
155
- expect(newData.responseInfo.test).toBe('OK');
156
- return [
157
- 2
158
- ];
159
- }
160
- });
161
- }));
162
- it('should keep original data', /*#__PURE__*/ _async_to_generator(function() {
163
- var plugin, runner, data, newData;
164
- return _ts_generator(this, function(_state) {
165
- switch(_state.label){
166
- case 0:
167
- plugin = new _rawresponseinforeply.RawResponseInfoReply();
168
- runner = plugin.load({
169
- reviver: reviver,
170
- apiType: _api.ApiTypes.DEFAULT,
171
- response: {
172
- headers: new Headers(),
173
- test: 'OK'
174
- }
175
- });
176
- data = {
177
- originalData: 'OK'
178
- };
179
- return [
180
- 4,
181
- runner.transform(data)
182
- ];
183
- case 1:
184
- newData = _state.sent();
185
- expect(newData.originalData).toBe('OK');
186
- return [
187
- 2
188
- ];
189
- }
190
- });
191
- }));
129
+ it('should add response object', function() {
130
+ return _async_to_generator(function() {
131
+ var plugin, runner, data, newData;
132
+ return _ts_generator(this, function(_state) {
133
+ switch(_state.label){
134
+ case 0:
135
+ plugin = new _rawresponseinforeply.RawResponseInfoReply();
136
+ runner = plugin.load({
137
+ reviver: reviver,
138
+ apiType: _api.ApiTypes.DEFAULT,
139
+ response: {
140
+ headers: new Headers(),
141
+ test: 'OK'
142
+ }
143
+ });
144
+ data = {};
145
+ return [
146
+ 4,
147
+ runner.transform(data)
148
+ ];
149
+ case 1:
150
+ newData = _state.sent();
151
+ expect(newData.responseInfo).toBeDefined();
152
+ expect(newData.responseInfo.test).toBe('OK');
153
+ return [
154
+ 2
155
+ ];
156
+ }
157
+ });
158
+ })();
159
+ });
160
+ it('should keep original data', function() {
161
+ return _async_to_generator(function() {
162
+ var plugin, runner, data, newData;
163
+ return _ts_generator(this, function(_state) {
164
+ switch(_state.label){
165
+ case 0:
166
+ plugin = new _rawresponseinforeply.RawResponseInfoReply();
167
+ runner = plugin.load({
168
+ reviver: reviver,
169
+ apiType: _api.ApiTypes.DEFAULT,
170
+ response: {
171
+ headers: new Headers(),
172
+ test: 'OK'
173
+ }
174
+ });
175
+ data = {
176
+ originalData: 'OK'
177
+ };
178
+ return [
179
+ 4,
180
+ runner.transform(data)
181
+ ];
182
+ case 1:
183
+ newData = _state.sent();
184
+ expect(newData.originalData).toBe('OK');
185
+ return [
186
+ 2
187
+ ];
188
+ }
189
+ });
190
+ })();
191
+ });
192
192
  it('should invalidate response info', function() {
193
193
  var data = {
194
194
  originalData: 'OK'
@@ -78,7 +78,7 @@ function _instanceof(left, right) {
78
78
  }
79
79
  }
80
80
  function _ts_generator(thisArg, body) {
81
- var f, y, t, g, _ = {
81
+ var f, y, t, _ = {
82
82
  label: 0,
83
83
  sent: function() {
84
84
  if (t[0] & 1) throw t[1];
@@ -86,12 +86,8 @@ function _ts_generator(thisArg, body) {
86
86
  },
87
87
  trys: [],
88
88
  ops: []
89
- };
90
- return g = {
91
- next: verb(0),
92
- "throw": verb(1),
93
- "return": verb(2)
94
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
89
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
90
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
95
91
  return this;
96
92
  }), g;
97
93
  function verb(n) {
@@ -104,7 +100,7 @@ function _ts_generator(thisArg, body) {
104
100
  }
105
101
  function step(op) {
106
102
  if (f) throw new TypeError("Generator is already executing.");
107
- while(_)try {
103
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
108
104
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
109
105
  if (y = 0, t) op = [
110
106
  op[0] & 2,
@@ -222,7 +218,6 @@ var RetryFetch = /*#__PURE__*/ function() {
222
218
  {
223
219
  key: "delay",
224
220
  value: function delay(countDown) {
225
- var _this = this;
226
221
  return _async_to_generator(function() {
227
222
  var time;
228
223
  return _ts_generator(this, function(_state) {
@@ -230,7 +225,7 @@ var RetryFetch = /*#__PURE__*/ function() {
230
225
  case 0:
231
226
  return [
232
227
  4,
233
- _this.sleepBetweenRetry(countDown)
228
+ this.sleepBetweenRetry(countDown)
234
229
  ];
235
230
  case 1:
236
231
  time = _state.sent();
@@ -242,40 +237,39 @@ var RetryFetch = /*#__PURE__*/ function() {
242
237
  ];
243
238
  }
244
239
  });
245
- })();
240
+ }).call(this);
246
241
  }
247
242
  },
248
243
  {
249
244
  key: "waitAndRetry",
250
245
  value: function waitAndRetry(context, countDown) {
251
- var _this = this;
252
246
  return _async_to_generator(function() {
253
247
  return _ts_generator(this, function(_state) {
254
248
  switch(_state.label){
255
249
  case 0:
256
250
  return [
257
251
  4,
258
- _this.delay(countDown)
252
+ this.delay(countDown)
259
253
  ];
260
254
  case 1:
261
255
  _state.sent();
262
256
  return [
263
257
  2,
264
- _this.retry(context)
258
+ this.retry(context)
265
259
  ];
266
260
  }
267
261
  });
268
- })();
262
+ }).call(this);
269
263
  }
270
264
  },
271
265
  {
272
266
  key: "load",
273
267
  value: /** @inheritDoc */ function load(context) {
274
- var countDown = this.numberOfRetry;
275
268
  var _this = this;
269
+ var countDown = this.numberOfRetry;
276
270
  return {
277
- transform: /*#__PURE__*/ function() {
278
- var _ref = _async_to_generator(function(fetchCall) {
271
+ transform: function(fetchCall) {
272
+ return _async_to_generator(function() {
279
273
  var result, conditionResult, e, conditionResult1;
280
274
  return _ts_generator(this, function(_state) {
281
275
  switch(_state.label){
@@ -298,7 +292,7 @@ var RetryFetch = /*#__PURE__*/ function() {
298
292
  ];
299
293
  return [
300
294
  4,
301
- _this.condition(context, result.clone())
295
+ this.condition(context, result.clone())
302
296
  ];
303
297
  case 2:
304
298
  conditionResult = _state.sent();
@@ -306,7 +300,7 @@ var RetryFetch = /*#__PURE__*/ function() {
306
300
  countDown--;
307
301
  return [
308
302
  2,
309
- _this.waitAndRetry(context, countDown)
303
+ this.waitAndRetry(context, countDown)
310
304
  ];
311
305
  }
312
306
  _state.label = 3;
@@ -323,7 +317,7 @@ var RetryFetch = /*#__PURE__*/ function() {
323
317
  ];
324
318
  return [
325
319
  4,
326
- _this.condition(context, undefined, _instanceof(e, Error) ? e : new Error(e.toString()))
320
+ this.condition(context, undefined, _instanceof(e, Error) ? e : new Error(e.toString()))
327
321
  ];
328
322
  case 5:
329
323
  conditionResult1 = _state.sent();
@@ -331,7 +325,7 @@ var RetryFetch = /*#__PURE__*/ function() {
331
325
  countDown--;
332
326
  return [
333
327
  2,
334
- _this.waitAndRetry(context, countDown)
328
+ this.waitAndRetry(context, countDown)
335
329
  ];
336
330
  }
337
331
  _state.label = 6;
@@ -343,11 +337,8 @@ var RetryFetch = /*#__PURE__*/ function() {
343
337
  ];
344
338
  }
345
339
  });
346
- });
347
- return function(fetchCall) {
348
- return _ref.apply(this, arguments);
349
- };
350
- }()
340
+ }).call(_this);
341
+ }
351
342
  };
352
343
  }
353
344
  }