@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
@@ -109,7 +109,7 @@ function _object_spread_props(target, source) {
109
109
  return target;
110
110
  }
111
111
  function _ts_generator(thisArg, body) {
112
- var f, y, t, g, _ = {
112
+ var f, y, t, _ = {
113
113
  label: 0,
114
114
  sent: function() {
115
115
  if (t[0] & 1) throw t[1];
@@ -117,12 +117,8 @@ function _ts_generator(thisArg, body) {
117
117
  },
118
118
  trys: [],
119
119
  ops: []
120
- };
121
- return g = {
122
- next: verb(0),
123
- "throw": verb(1),
124
- "return": verb(2)
125
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
120
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
121
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
126
122
  return this;
127
123
  }), g;
128
124
  function verb(n) {
@@ -135,7 +131,7 @@ function _ts_generator(thisArg, body) {
135
131
  }
136
132
  function step(op) {
137
133
  if (f) throw new TypeError("Generator is already executing.");
138
- while(_)try {
134
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
139
135
  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;
140
136
  if (y = 0, t) op = [
141
137
  op[0] & 2,
@@ -225,7 +221,6 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
225
221
  * https://bugs.chromium.org/p/chromium/issues/detail?id=835821
226
222
  * To avoid this issue we do a fake fetch call to check whether we can activate it or not in the browser.
227
223
  */ function testKeepAlive() {
228
- var _this = this;
229
224
  return _async_to_generator(function() {
230
225
  var customHeaders, e;
231
226
  return _ts_generator(this, function(_state) {
@@ -250,14 +245,14 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
250
245
  ];
251
246
  case 2:
252
247
  _state.sent();
253
- _this.active = true;
248
+ this.active = true;
254
249
  return [
255
250
  3,
256
251
  4
257
252
  ];
258
253
  case 3:
259
254
  e = _state.sent();
260
- _this.active = false;
255
+ this.active = false;
261
256
  return [
262
257
  3,
263
258
  4
@@ -268,7 +263,7 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
268
263
  ];
269
264
  }
270
265
  });
271
- })();
266
+ }).call(this);
272
267
  }
273
268
  },
274
269
  {
@@ -33,7 +33,7 @@ function _async_to_generator(fn) {
33
33
  };
34
34
  }
35
35
  function _ts_generator(thisArg, body) {
36
- var f, y, t, g, _ = {
36
+ var f, y, t, _ = {
37
37
  label: 0,
38
38
  sent: function() {
39
39
  if (t[0] & 1) throw t[1];
@@ -41,12 +41,8 @@ function _ts_generator(thisArg, body) {
41
41
  },
42
42
  trys: [],
43
43
  ops: []
44
- };
45
- return g = {
46
- next: verb(0),
47
- "throw": verb(1),
48
- "return": verb(2)
49
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
44
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
45
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
50
46
  return this;
51
47
  }), g;
52
48
  function verb(n) {
@@ -59,7 +55,7 @@ function _ts_generator(thisArg, body) {
59
55
  }
60
56
  function step(op) {
61
57
  if (f) throw new TypeError("Generator is already executing.");
62
- while(_)try {
58
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
63
59
  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;
64
60
  if (y = 0, t) op = [
65
61
  op[0] & 2,
@@ -133,30 +129,32 @@ describe('Keepalive Request Plugin', function() {
133
129
  basePath: 'http://test.com/truc',
134
130
  method: 'get'
135
131
  };
136
- it('keepalive should be set to true', /*#__PURE__*/ _async_to_generator(function() {
137
- var plugin, runner, keepalive;
138
- return _ts_generator(this, function(_state) {
139
- switch(_state.label){
140
- case 0:
141
- plugin = new _keepaliverequest.KeepaliveRequest(true);
142
- runner = plugin.load();
143
- return [
144
- 4,
145
- runner.transform(options)
146
- ];
147
- case 1:
148
- _state.sent();
149
- return [
150
- 4,
151
- plugin.load().transform(options)
152
- ];
153
- case 2:
154
- keepalive = _state.sent().keepalive;
155
- expect(keepalive).toBe(true);
156
- return [
157
- 2
158
- ];
159
- }
160
- });
161
- }));
132
+ it('keepalive should be set to true', function() {
133
+ return _async_to_generator(function() {
134
+ var plugin, runner, keepalive;
135
+ return _ts_generator(this, function(_state) {
136
+ switch(_state.label){
137
+ case 0:
138
+ plugin = new _keepaliverequest.KeepaliveRequest(true);
139
+ runner = plugin.load();
140
+ return [
141
+ 4,
142
+ runner.transform(options)
143
+ ];
144
+ case 1:
145
+ _state.sent();
146
+ return [
147
+ 4,
148
+ plugin.load().transform(options)
149
+ ];
150
+ case 2:
151
+ keepalive = _state.sent().keepalive;
152
+ expect(keepalive).toBe(true);
153
+ return [
154
+ 2
155
+ ];
156
+ }
157
+ });
158
+ })();
159
+ });
162
160
  });
@@ -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,
@@ -183,22 +179,22 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
183
179
  {
184
180
  key: "load",
185
181
  value: function load(context) {
182
+ var _this = this;
186
183
  if (!context.apiClient.options.requestPlugins.some(function(plugin) {
187
184
  return _instanceof(plugin, _core.MockInterceptRequest);
188
185
  })) {
189
186
  throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
190
187
  }
191
- var _this = this;
192
188
  return {
193
- transform: /*#__PURE__*/ function() {
194
- var _ref = _async_to_generator(function(fetchCall) {
189
+ transform: function(fetchCall) {
190
+ return _async_to_generator(function() {
195
191
  var responsePromise, delay, _tmp, resp, operationId, mock, response;
196
192
  return _ts_generator(this, function(_state) {
197
193
  switch(_state.label){
198
194
  case 0:
199
195
  return [
200
196
  4,
201
- _this.options.adapter.initialize()
197
+ this.options.adapter.initialize()
202
198
  ];
203
199
  case 1:
204
200
  _state.sent();
@@ -209,15 +205,15 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
209
205
  responsePromise
210
206
  ];
211
207
  }
212
- if (!(typeof _this.options.delayTiming !== 'undefined')) return [
208
+ if (!(typeof this.options.delayTiming !== 'undefined')) return [
213
209
  3,
214
210
  6
215
211
  ];
216
- if (!(typeof _this.options.delayTiming === 'number')) return [
212
+ if (!(typeof this.options.delayTiming === 'number')) return [
217
213
  3,
218
214
  2
219
215
  ];
220
- _tmp = _this.options.delayTiming;
216
+ _tmp = this.options.delayTiming;
221
217
  return [
222
218
  3,
223
219
  4
@@ -225,7 +221,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
225
221
  case 2:
226
222
  return [
227
223
  4,
228
- _this.options.delayTiming(context)
224
+ this.options.delayTiming(context)
229
225
  ];
230
226
  case 3:
231
227
  _tmp = _state.sent();
@@ -247,7 +243,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
247
243
  case 6:
248
244
  operationId = context.options.headers.get(_core.CUSTOM_MOCK_OPERATION_ID_HEADER);
249
245
  try {
250
- mock = _this.options.adapter.getLatestMock(operationId);
246
+ mock = this.options.adapter.getLatestMock(operationId);
251
247
  if (!mock.getResponse) {
252
248
  return [
253
249
  2,
@@ -273,11 +269,8 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
273
269
  ];
274
270
  }
275
271
  });
276
- });
277
- return function(fetchCall) {
278
- return _ref.apply(this, arguments);
279
- };
280
- }()
272
+ }).call(_this);
273
+ }
281
274
  };
282
275
  }
283
276
  }