@ama-sdk/core 12.1.8 → 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
@@ -28,7 +28,7 @@ function _async_to_generator(fn) {
28
28
  };
29
29
  }
30
30
  function _ts_generator(thisArg, body) {
31
- var f, y, t, g, _ = {
31
+ var f, y, t, _ = {
32
32
  label: 0,
33
33
  sent: function() {
34
34
  if (t[0] & 1) throw t[1];
@@ -36,12 +36,8 @@ function _ts_generator(thisArg, body) {
36
36
  },
37
37
  trys: [],
38
38
  ops: []
39
- };
40
- return g = {
41
- next: verb(0),
42
- "throw": verb(1),
43
- "return": verb(2)
44
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
39
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
40
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
41
  return this;
46
42
  }), g;
47
43
  function verb(n) {
@@ -54,7 +50,7 @@ function _ts_generator(thisArg, body) {
54
50
  }
55
51
  function step(op) {
56
52
  if (f) throw new TypeError("Generator is already executing.");
57
- while(_)try {
53
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
58
54
  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;
59
55
  if (y = 0, t) op = [
60
56
  op[0] & 2,
@@ -126,65 +122,69 @@ import { ApiTypes } from '../../fwk/api';
126
122
  import { RawResponseInfoReply } from './raw-response-info.reply';
127
123
  describe('Raw response info Reply plugin', function() {
128
124
  var reviver = jest.fn();
129
- it('should add response object', /*#__PURE__*/ _async_to_generator(function() {
130
- var plugin, runner, data, newData;
131
- return _ts_generator(this, function(_state) {
132
- switch(_state.label){
133
- case 0:
134
- plugin = new RawResponseInfoReply();
135
- runner = plugin.load({
136
- reviver: reviver,
137
- apiType: ApiTypes.DEFAULT,
138
- response: {
139
- headers: new Headers(),
140
- test: 'OK'
141
- }
142
- });
143
- data = {};
144
- return [
145
- 4,
146
- runner.transform(data)
147
- ];
148
- case 1:
149
- newData = _state.sent();
150
- expect(newData.responseInfo).toBeDefined();
151
- expect(newData.responseInfo.test).toBe('OK');
152
- return [
153
- 2
154
- ];
155
- }
156
- });
157
- }));
158
- it('should keep original data', /*#__PURE__*/ _async_to_generator(function() {
159
- var plugin, runner, data, newData;
160
- return _ts_generator(this, function(_state) {
161
- switch(_state.label){
162
- case 0:
163
- plugin = new RawResponseInfoReply();
164
- runner = plugin.load({
165
- reviver: reviver,
166
- apiType: ApiTypes.DEFAULT,
167
- response: {
168
- headers: new Headers(),
169
- test: 'OK'
170
- }
171
- });
172
- data = {
173
- originalData: 'OK'
174
- };
175
- return [
176
- 4,
177
- runner.transform(data)
178
- ];
179
- case 1:
180
- newData = _state.sent();
181
- expect(newData.originalData).toBe('OK');
182
- return [
183
- 2
184
- ];
185
- }
186
- });
187
- }));
125
+ it('should add response object', function() {
126
+ return _async_to_generator(function() {
127
+ var plugin, runner, data, newData;
128
+ return _ts_generator(this, function(_state) {
129
+ switch(_state.label){
130
+ case 0:
131
+ plugin = new RawResponseInfoReply();
132
+ runner = plugin.load({
133
+ reviver: reviver,
134
+ apiType: ApiTypes.DEFAULT,
135
+ response: {
136
+ headers: new Headers(),
137
+ test: 'OK'
138
+ }
139
+ });
140
+ data = {};
141
+ return [
142
+ 4,
143
+ runner.transform(data)
144
+ ];
145
+ case 1:
146
+ newData = _state.sent();
147
+ expect(newData.responseInfo).toBeDefined();
148
+ expect(newData.responseInfo.test).toBe('OK');
149
+ return [
150
+ 2
151
+ ];
152
+ }
153
+ });
154
+ })();
155
+ });
156
+ it('should keep original data', function() {
157
+ return _async_to_generator(function() {
158
+ var plugin, runner, data, newData;
159
+ return _ts_generator(this, function(_state) {
160
+ switch(_state.label){
161
+ case 0:
162
+ plugin = new RawResponseInfoReply();
163
+ runner = plugin.load({
164
+ reviver: reviver,
165
+ apiType: ApiTypes.DEFAULT,
166
+ response: {
167
+ headers: new Headers(),
168
+ test: 'OK'
169
+ }
170
+ });
171
+ data = {
172
+ originalData: 'OK'
173
+ };
174
+ return [
175
+ 4,
176
+ runner.transform(data)
177
+ ];
178
+ case 1:
179
+ newData = _state.sent();
180
+ expect(newData.originalData).toBe('OK');
181
+ return [
182
+ 2
183
+ ];
184
+ }
185
+ });
186
+ })();
187
+ });
188
188
  it('should invalidate response info', function() {
189
189
  var data = {
190
190
  originalData: 'OK'
@@ -67,7 +67,7 @@ function _instanceof(left, right) {
67
67
  }
68
68
  }
69
69
  function _ts_generator(thisArg, body) {
70
- var f, y, t, g, _ = {
70
+ var f, y, t, _ = {
71
71
  label: 0,
72
72
  sent: function() {
73
73
  if (t[0] & 1) throw t[1];
@@ -75,12 +75,8 @@ function _ts_generator(thisArg, body) {
75
75
  },
76
76
  trys: [],
77
77
  ops: []
78
- };
79
- return g = {
80
- next: verb(0),
81
- "throw": verb(1),
82
- "return": verb(2)
83
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
78
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
79
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
84
80
  return this;
85
81
  }), g;
86
82
  function verb(n) {
@@ -93,7 +89,7 @@ function _ts_generator(thisArg, body) {
93
89
  }
94
90
  function step(op) {
95
91
  if (f) throw new TypeError("Generator is already executing.");
96
- while(_)try {
92
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
97
93
  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;
98
94
  if (y = 0, t) op = [
99
95
  op[0] & 2,
@@ -215,7 +211,6 @@ import { CanceledCallError } from '../../fwk/errors';
215
211
  {
216
212
  key: "delay",
217
213
  value: function delay(countDown) {
218
- var _this = this;
219
214
  return _async_to_generator(function() {
220
215
  var time;
221
216
  return _ts_generator(this, function(_state) {
@@ -223,7 +218,7 @@ import { CanceledCallError } from '../../fwk/errors';
223
218
  case 0:
224
219
  return [
225
220
  4,
226
- _this.sleepBetweenRetry(countDown)
221
+ this.sleepBetweenRetry(countDown)
227
222
  ];
228
223
  case 1:
229
224
  time = _state.sent();
@@ -235,40 +230,39 @@ import { CanceledCallError } from '../../fwk/errors';
235
230
  ];
236
231
  }
237
232
  });
238
- })();
233
+ }).call(this);
239
234
  }
240
235
  },
241
236
  {
242
237
  key: "waitAndRetry",
243
238
  value: function waitAndRetry(context, countDown) {
244
- var _this = this;
245
239
  return _async_to_generator(function() {
246
240
  return _ts_generator(this, function(_state) {
247
241
  switch(_state.label){
248
242
  case 0:
249
243
  return [
250
244
  4,
251
- _this.delay(countDown)
245
+ this.delay(countDown)
252
246
  ];
253
247
  case 1:
254
248
  _state.sent();
255
249
  return [
256
250
  2,
257
- _this.retry(context)
251
+ this.retry(context)
258
252
  ];
259
253
  }
260
254
  });
261
- })();
255
+ }).call(this);
262
256
  }
263
257
  },
264
258
  {
265
259
  key: "load",
266
260
  value: /** @inheritDoc */ function load(context) {
267
- var countDown = this.numberOfRetry;
268
261
  var _this = this;
262
+ var countDown = this.numberOfRetry;
269
263
  return {
270
- transform: /*#__PURE__*/ function() {
271
- var _ref = _async_to_generator(function(fetchCall) {
264
+ transform: function(fetchCall) {
265
+ return _async_to_generator(function() {
272
266
  var result, conditionResult, e, conditionResult1;
273
267
  return _ts_generator(this, function(_state) {
274
268
  switch(_state.label){
@@ -291,7 +285,7 @@ import { CanceledCallError } from '../../fwk/errors';
291
285
  ];
292
286
  return [
293
287
  4,
294
- _this.condition(context, result.clone())
288
+ this.condition(context, result.clone())
295
289
  ];
296
290
  case 2:
297
291
  conditionResult = _state.sent();
@@ -299,7 +293,7 @@ import { CanceledCallError } from '../../fwk/errors';
299
293
  countDown--;
300
294
  return [
301
295
  2,
302
- _this.waitAndRetry(context, countDown)
296
+ this.waitAndRetry(context, countDown)
303
297
  ];
304
298
  }
305
299
  _state.label = 3;
@@ -316,7 +310,7 @@ import { CanceledCallError } from '../../fwk/errors';
316
310
  ];
317
311
  return [
318
312
  4,
319
- _this.condition(context, undefined, _instanceof(e, Error) ? e : new Error(e.toString()))
313
+ this.condition(context, undefined, _instanceof(e, Error) ? e : new Error(e.toString()))
320
314
  ];
321
315
  case 5:
322
316
  conditionResult1 = _state.sent();
@@ -324,7 +318,7 @@ import { CanceledCallError } from '../../fwk/errors';
324
318
  countDown--;
325
319
  return [
326
320
  2,
327
- _this.waitAndRetry(context, countDown)
321
+ this.waitAndRetry(context, countDown)
328
322
  ];
329
323
  }
330
324
  _state.label = 6;
@@ -336,11 +330,8 @@ import { CanceledCallError } from '../../fwk/errors';
336
330
  ];
337
331
  }
338
332
  });
339
- });
340
- return function(fetchCall) {
341
- return _ref.apply(this, arguments);
342
- };
343
- }()
333
+ }).call(_this);
334
+ }
344
335
  };
345
336
  }
346
337
  }