@ama-sdk/client-fetch 12.3.0-prerelease.9 → 12.4.0-prerelease.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 (37) hide show
  1. package/cjs/api-fetch-client.js +18 -22
  2. package/cjs/plugins/abort/abort.spec.js +83 -81
  3. package/cjs/plugins/concurrent/concurrent.fetch.js +12 -20
  4. package/cjs/plugins/concurrent/concurrent.spec.js +99 -99
  5. package/cjs/plugins/keepalive/keepalive.request.js +7 -12
  6. package/cjs/plugins/keepalive/keepalive.spec.js +32 -34
  7. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  8. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +247 -239
  9. package/cjs/plugins/perf-metric/perf-metric.fetch.js +11 -18
  10. package/cjs/plugins/retry/retry.fetch.js +18 -27
  11. package/cjs/plugins/retry/retry.spec.js +233 -225
  12. package/cjs/plugins/timeout/timeout.fetch.js +13 -19
  13. package/cjs/plugins/timeout/timeout.spec.js +211 -205
  14. package/cjs/plugins/wait-for/wait-for.fetch.js +19 -29
  15. package/cjs/plugins/wait-for/wait-for.spec.js +211 -203
  16. package/esm2015/api-fetch-client.js +18 -22
  17. package/esm2015/plugins/abort/abort.spec.js +83 -81
  18. package/esm2015/plugins/concurrent/concurrent.fetch.js +12 -20
  19. package/esm2015/plugins/concurrent/concurrent.spec.js +99 -99
  20. package/esm2015/plugins/keepalive/keepalive.request.js +7 -12
  21. package/esm2015/plugins/keepalive/keepalive.spec.js +32 -34
  22. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +15 -22
  23. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +247 -239
  24. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +11 -18
  25. package/esm2015/plugins/retry/retry.fetch.js +18 -27
  26. package/esm2015/plugins/retry/retry.spec.js +233 -225
  27. package/esm2015/plugins/timeout/timeout.fetch.js +13 -19
  28. package/esm2015/plugins/timeout/timeout.spec.js +211 -205
  29. package/esm2015/plugins/wait-for/wait-for.fetch.js +19 -29
  30. package/esm2015/plugins/wait-for/wait-for.spec.js +211 -203
  31. package/package.json +15 -15
  32. package/schematics/ng-add/index.d.ts.map +1 -1
  33. package/schematics/ng-add/index.js +11 -21
  34. package/src/api-fetch-client.d.ts +1 -1
  35. package/src/api-fetch-client.d.ts.map +1 -1
  36. package/src/api-fetch-client.js +2 -1
  37. package/src/api-fetch-client.js.map +1 -1
@@ -99,7 +99,7 @@ function _object_spread_props(target, source) {
99
99
  return target;
100
100
  }
101
101
  function _ts_generator(thisArg, body) {
102
- var f, y, t, g, _ = {
102
+ var f, y, t, _ = {
103
103
  label: 0,
104
104
  sent: function() {
105
105
  if (t[0] & 1) throw t[1];
@@ -107,12 +107,8 @@ function _ts_generator(thisArg, body) {
107
107
  },
108
108
  trys: [],
109
109
  ops: []
110
- };
111
- return g = {
112
- next: verb(0),
113
- "throw": verb(1),
114
- "return": verb(2)
115
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
110
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
111
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
116
112
  return this;
117
113
  }), g;
118
114
  function verb(n) {
@@ -125,7 +121,7 @@ function _ts_generator(thisArg, body) {
125
121
  }
126
122
  function step(op) {
127
123
  if (f) throw new TypeError("Generator is already executing.");
128
- while(_)try {
124
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
129
125
  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;
130
126
  if (y = 0, t) op = [
131
127
  op[0] & 2,
@@ -217,7 +213,6 @@ function _ts_generator(thisArg, body) {
217
213
  * https://bugs.chromium.org/p/chromium/issues/detail?id=835821
218
214
  * To avoid this issue we do a fake fetch call to check whether we can activate it or not in the browser.
219
215
  */ function testKeepAlive() {
220
- var _this = this;
221
216
  return _async_to_generator(function() {
222
217
  var customHeaders, e;
223
218
  return _ts_generator(this, function(_state) {
@@ -242,14 +237,14 @@ function _ts_generator(thisArg, body) {
242
237
  ];
243
238
  case 2:
244
239
  _state.sent();
245
- _this.active = true;
240
+ this.active = true;
246
241
  return [
247
242
  3,
248
243
  4
249
244
  ];
250
245
  case 3:
251
246
  e = _state.sent();
252
- _this.active = false;
247
+ this.active = false;
253
248
  return [
254
249
  3,
255
250
  4
@@ -260,7 +255,7 @@ function _ts_generator(thisArg, body) {
260
255
  ];
261
256
  }
262
257
  });
263
- })();
258
+ }).call(this);
264
259
  }
265
260
  },
266
261
  {
@@ -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,
@@ -129,30 +125,32 @@ describe('Keepalive Request Plugin', function() {
129
125
  basePath: 'http://test.com/truc',
130
126
  method: 'get'
131
127
  };
132
- it('keepalive should be set to true', /*#__PURE__*/ _async_to_generator(function() {
133
- var plugin, runner, keepalive;
134
- return _ts_generator(this, function(_state) {
135
- switch(_state.label){
136
- case 0:
137
- plugin = new KeepaliveRequest(true);
138
- runner = plugin.load();
139
- return [
140
- 4,
141
- runner.transform(options)
142
- ];
143
- case 1:
144
- _state.sent();
145
- return [
146
- 4,
147
- plugin.load().transform(options)
148
- ];
149
- case 2:
150
- keepalive = _state.sent().keepalive;
151
- expect(keepalive).toBe(true);
152
- return [
153
- 2
154
- ];
155
- }
156
- });
157
- }));
128
+ it('keepalive should be set to true', function() {
129
+ return _async_to_generator(function() {
130
+ var plugin, runner, keepalive;
131
+ return _ts_generator(this, function(_state) {
132
+ switch(_state.label){
133
+ case 0:
134
+ plugin = new KeepaliveRequest(true);
135
+ runner = plugin.load();
136
+ return [
137
+ 4,
138
+ runner.transform(options)
139
+ ];
140
+ case 1:
141
+ _state.sent();
142
+ return [
143
+ 4,
144
+ plugin.load().transform(options)
145
+ ];
146
+ case 2:
147
+ keepalive = _state.sent().keepalive;
148
+ expect(keepalive).toBe(true);
149
+ return [
150
+ 2
151
+ ];
152
+ }
153
+ });
154
+ })();
155
+ });
158
156
  });
@@ -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,
@@ -178,22 +174,22 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, MockInterceptRequest } from '@ama-sdk/
178
174
  {
179
175
  key: "load",
180
176
  value: function load(context) {
177
+ var _this = this;
181
178
  if (!context.apiClient.options.requestPlugins.some(function(plugin) {
182
179
  return _instanceof(plugin, MockInterceptRequest);
183
180
  })) {
184
181
  throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
185
182
  }
186
- var _this = this;
187
183
  return {
188
- transform: /*#__PURE__*/ function() {
189
- var _ref = _async_to_generator(function(fetchCall) {
184
+ transform: function(fetchCall) {
185
+ return _async_to_generator(function() {
190
186
  var responsePromise, delay, _tmp, resp, operationId, mock, response;
191
187
  return _ts_generator(this, function(_state) {
192
188
  switch(_state.label){
193
189
  case 0:
194
190
  return [
195
191
  4,
196
- _this.options.adapter.initialize()
192
+ this.options.adapter.initialize()
197
193
  ];
198
194
  case 1:
199
195
  _state.sent();
@@ -204,15 +200,15 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, MockInterceptRequest } from '@ama-sdk/
204
200
  responsePromise
205
201
  ];
206
202
  }
207
- if (!(typeof _this.options.delayTiming !== 'undefined')) return [
203
+ if (!(typeof this.options.delayTiming !== 'undefined')) return [
208
204
  3,
209
205
  6
210
206
  ];
211
- if (!(typeof _this.options.delayTiming === 'number')) return [
207
+ if (!(typeof this.options.delayTiming === 'number')) return [
212
208
  3,
213
209
  2
214
210
  ];
215
- _tmp = _this.options.delayTiming;
211
+ _tmp = this.options.delayTiming;
216
212
  return [
217
213
  3,
218
214
  4
@@ -220,7 +216,7 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, MockInterceptRequest } from '@ama-sdk/
220
216
  case 2:
221
217
  return [
222
218
  4,
223
- _this.options.delayTiming(context)
219
+ this.options.delayTiming(context)
224
220
  ];
225
221
  case 3:
226
222
  _tmp = _state.sent();
@@ -242,7 +238,7 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, MockInterceptRequest } from '@ama-sdk/
242
238
  case 6:
243
239
  operationId = context.options.headers.get(CUSTOM_MOCK_OPERATION_ID_HEADER);
244
240
  try {
245
- mock = _this.options.adapter.getLatestMock(operationId);
241
+ mock = this.options.adapter.getLatestMock(operationId);
246
242
  if (!mock.getResponse) {
247
243
  return [
248
244
  2,
@@ -268,11 +264,8 @@ import { CUSTOM_MOCK_OPERATION_ID_HEADER, MockInterceptRequest } from '@ama-sdk/
268
264
  ];
269
265
  }
270
266
  });
271
- });
272
- return function(fetchCall) {
273
- return _ref.apply(this, arguments);
274
- };
275
- }()
267
+ }).call(_this);
268
+ }
276
269
  };
277
270
  }
278
271
  }