@ama-sdk/client-fetch 12.3.0-prerelease.70 → 12.3.0-prerelease.72
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.
- package/cjs/api-fetch-client.js +12 -13
- package/cjs/plugins/abort/abort.spec.js +79 -73
- package/cjs/plugins/concurrent/concurrent.fetch.js +8 -12
- package/cjs/plugins/concurrent/concurrent.spec.js +95 -91
- package/cjs/plugins/keepalive/keepalive.request.js +3 -4
- package/cjs/plugins/keepalive/keepalive.spec.js +28 -26
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +11 -14
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +243 -231
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +7 -10
- package/cjs/plugins/retry/retry.fetch.js +14 -19
- package/cjs/plugins/retry/retry.spec.js +229 -217
- package/cjs/plugins/timeout/timeout.fetch.js +9 -11
- package/cjs/plugins/timeout/timeout.spec.js +207 -197
- package/cjs/plugins/wait-for/wait-for.fetch.js +15 -21
- package/cjs/plugins/wait-for/wait-for.spec.js +207 -195
- package/esm2015/api-fetch-client.js +12 -13
- package/esm2015/plugins/abort/abort.spec.js +79 -73
- package/esm2015/plugins/concurrent/concurrent.fetch.js +8 -12
- package/esm2015/plugins/concurrent/concurrent.spec.js +95 -91
- package/esm2015/plugins/keepalive/keepalive.request.js +3 -4
- package/esm2015/plugins/keepalive/keepalive.spec.js +28 -26
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +11 -14
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +243 -231
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +7 -10
- package/esm2015/plugins/retry/retry.fetch.js +14 -19
- package/esm2015/plugins/retry/retry.spec.js +229 -217
- package/esm2015/plugins/timeout/timeout.fetch.js +9 -11
- package/esm2015/plugins/timeout/timeout.spec.js +207 -197
- package/esm2015/plugins/wait-for/wait-for.fetch.js +15 -21
- package/esm2015/plugins/wait-for/wait-for.spec.js +207 -195
- package/package.json +8 -8
|
@@ -210,7 +210,6 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
210
210
|
{
|
|
211
211
|
key: "delay",
|
|
212
212
|
value: function delay(countDown) {
|
|
213
|
-
var _this = this;
|
|
214
213
|
return _async_to_generator(function() {
|
|
215
214
|
var time;
|
|
216
215
|
return _ts_generator(this, function(_state) {
|
|
@@ -218,7 +217,7 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
218
217
|
case 0:
|
|
219
218
|
return [
|
|
220
219
|
4,
|
|
221
|
-
|
|
220
|
+
this.sleepBetweenRetry(countDown)
|
|
222
221
|
];
|
|
223
222
|
case 1:
|
|
224
223
|
time = _state.sent();
|
|
@@ -230,40 +229,39 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
230
229
|
];
|
|
231
230
|
}
|
|
232
231
|
});
|
|
233
|
-
})();
|
|
232
|
+
}).call(this);
|
|
234
233
|
}
|
|
235
234
|
},
|
|
236
235
|
{
|
|
237
236
|
key: "waitAndRetry",
|
|
238
237
|
value: function waitAndRetry(context, countDown) {
|
|
239
|
-
var _this = this;
|
|
240
238
|
return _async_to_generator(function() {
|
|
241
239
|
return _ts_generator(this, function(_state) {
|
|
242
240
|
switch(_state.label){
|
|
243
241
|
case 0:
|
|
244
242
|
return [
|
|
245
243
|
4,
|
|
246
|
-
|
|
244
|
+
this.delay(countDown)
|
|
247
245
|
];
|
|
248
246
|
case 1:
|
|
249
247
|
_state.sent();
|
|
250
248
|
return [
|
|
251
249
|
2,
|
|
252
|
-
|
|
250
|
+
this.retry(context)
|
|
253
251
|
];
|
|
254
252
|
}
|
|
255
253
|
});
|
|
256
|
-
})();
|
|
254
|
+
}).call(this);
|
|
257
255
|
}
|
|
258
256
|
},
|
|
259
257
|
{
|
|
260
258
|
key: "load",
|
|
261
259
|
value: /** @inheritDoc */ function load(context) {
|
|
262
|
-
var countDown = this.numberOfRetry;
|
|
263
260
|
var _this = this;
|
|
261
|
+
var countDown = this.numberOfRetry;
|
|
264
262
|
return {
|
|
265
|
-
transform:
|
|
266
|
-
|
|
263
|
+
transform: function(fetchCall) {
|
|
264
|
+
return _async_to_generator(function() {
|
|
267
265
|
var result, conditionResult, e, conditionResult1;
|
|
268
266
|
return _ts_generator(this, function(_state) {
|
|
269
267
|
switch(_state.label){
|
|
@@ -286,7 +284,7 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
286
284
|
];
|
|
287
285
|
return [
|
|
288
286
|
4,
|
|
289
|
-
|
|
287
|
+
this.condition(context, result.clone())
|
|
290
288
|
];
|
|
291
289
|
case 2:
|
|
292
290
|
conditionResult = _state.sent();
|
|
@@ -294,7 +292,7 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
294
292
|
countDown--;
|
|
295
293
|
return [
|
|
296
294
|
2,
|
|
297
|
-
|
|
295
|
+
this.waitAndRetry(context, countDown)
|
|
298
296
|
];
|
|
299
297
|
}
|
|
300
298
|
_state.label = 3;
|
|
@@ -311,7 +309,7 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
311
309
|
];
|
|
312
310
|
return [
|
|
313
311
|
4,
|
|
314
|
-
|
|
312
|
+
this.condition(context, undefined, e)
|
|
315
313
|
];
|
|
316
314
|
case 5:
|
|
317
315
|
conditionResult1 = _state.sent();
|
|
@@ -319,7 +317,7 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
319
317
|
countDown--;
|
|
320
318
|
return [
|
|
321
319
|
2,
|
|
322
|
-
|
|
320
|
+
this.waitAndRetry(context, countDown)
|
|
323
321
|
];
|
|
324
322
|
}
|
|
325
323
|
_state.label = 6;
|
|
@@ -331,11 +329,8 @@ import { CanceledCallError } from '@ama-sdk/core';
|
|
|
331
329
|
];
|
|
332
330
|
}
|
|
333
331
|
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
return _ref.apply(this, arguments);
|
|
337
|
-
};
|
|
338
|
-
}()
|
|
332
|
+
}).call(_this);
|
|
333
|
+
}
|
|
339
334
|
};
|
|
340
335
|
}
|
|
341
336
|
}
|
|
@@ -120,221 +120,233 @@ function _ts_generator(thisArg, body) {
|
|
|
120
120
|
}
|
|
121
121
|
import { RetryFetch } from './retry.fetch';
|
|
122
122
|
describe('Retry Fetch Plugin', function() {
|
|
123
|
-
it('should not retry on success',
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
res
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
jest.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
123
|
+
it('should not retry on success', function() {
|
|
124
|
+
return _async_to_generator(function() {
|
|
125
|
+
var condition, plugin, runner, call, res, ret;
|
|
126
|
+
return _ts_generator(this, function(_state) {
|
|
127
|
+
switch(_state.label){
|
|
128
|
+
case 0:
|
|
129
|
+
condition = jest.fn().mockReturnValue(true);
|
|
130
|
+
plugin = new RetryFetch(1, condition);
|
|
131
|
+
runner = plugin.load({
|
|
132
|
+
url: 'http://www.test.com',
|
|
133
|
+
fetchPlugins: []
|
|
134
|
+
});
|
|
135
|
+
call = Promise.resolve({
|
|
136
|
+
text: 'test',
|
|
137
|
+
ok: true
|
|
138
|
+
});
|
|
139
|
+
res = runner.transform(call);
|
|
140
|
+
expect(condition).not.toHaveBeenCalled();
|
|
141
|
+
return [
|
|
142
|
+
4,
|
|
143
|
+
res
|
|
144
|
+
];
|
|
145
|
+
case 1:
|
|
146
|
+
ret = _state.sent();
|
|
147
|
+
expect(ret).toEqual({
|
|
148
|
+
text: 'test',
|
|
149
|
+
ok: true
|
|
150
|
+
});
|
|
151
|
+
return [
|
|
152
|
+
2
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
})();
|
|
157
|
+
});
|
|
158
|
+
it('should not retry if refused by the condition', function() {
|
|
159
|
+
return _async_to_generator(function() {
|
|
160
|
+
var conditionFalsy, plugin, runner, call, res;
|
|
161
|
+
return _ts_generator(this, function(_state) {
|
|
162
|
+
switch(_state.label){
|
|
163
|
+
case 0:
|
|
164
|
+
conditionFalsy = jest.fn().mockReturnValue(false);
|
|
165
|
+
plugin = new RetryFetch(3, conditionFalsy);
|
|
166
|
+
runner = plugin.load({
|
|
167
|
+
url: 'http://www.test.com',
|
|
168
|
+
fetchPlugins: []
|
|
169
|
+
});
|
|
170
|
+
call = Promise.resolve({
|
|
171
|
+
text: 'test',
|
|
172
|
+
ok: false,
|
|
173
|
+
clone: function() {
|
|
174
|
+
return {};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
res = runner.transform(call);
|
|
178
|
+
return [
|
|
179
|
+
4,
|
|
180
|
+
res
|
|
181
|
+
];
|
|
182
|
+
case 1:
|
|
183
|
+
_state.sent();
|
|
184
|
+
expect(conditionFalsy).toHaveBeenCalledTimes(1);
|
|
185
|
+
return [
|
|
186
|
+
2
|
|
187
|
+
];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
})();
|
|
191
|
+
});
|
|
192
|
+
it('should retry on fetch rejection', function() {
|
|
193
|
+
return _async_to_generator(function() {
|
|
194
|
+
var condition, plugin, runners, runner, call, callback;
|
|
195
|
+
return _ts_generator(this, function(_state) {
|
|
196
|
+
switch(_state.label){
|
|
197
|
+
case 0:
|
|
198
|
+
condition = jest.fn().mockReturnValue(true);
|
|
199
|
+
plugin = new RetryFetch(2, condition);
|
|
200
|
+
runners = [];
|
|
201
|
+
runner = plugin.load({
|
|
202
|
+
url: 'not an url',
|
|
203
|
+
fetchPlugins: runners
|
|
204
|
+
});
|
|
205
|
+
runners.push(runner);
|
|
206
|
+
call = Promise.reject(new Error(JSON.stringify({
|
|
207
|
+
text: 'test',
|
|
208
|
+
ok: true
|
|
209
|
+
})));
|
|
210
|
+
callback = jest.fn();
|
|
211
|
+
runner.transform(call).catch(callback);
|
|
212
|
+
return [
|
|
213
|
+
4,
|
|
214
|
+
jest.runAllTimersAsync()
|
|
215
|
+
];
|
|
216
|
+
case 1:
|
|
217
|
+
_state.sent();
|
|
218
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
219
|
+
expect(condition).toHaveBeenCalledTimes(2);
|
|
220
|
+
return [
|
|
221
|
+
2
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
})();
|
|
226
|
+
});
|
|
227
|
+
it('should retry on fetch rejection with wait', function() {
|
|
228
|
+
return _async_to_generator(function() {
|
|
229
|
+
var condition, delay, plugin, runners, runner, call, callback;
|
|
230
|
+
return _ts_generator(this, function(_state) {
|
|
231
|
+
switch(_state.label){
|
|
232
|
+
case 0:
|
|
233
|
+
condition = jest.fn().mockReturnValue(true);
|
|
234
|
+
delay = 500;
|
|
235
|
+
plugin = new RetryFetch(2, condition, function() {
|
|
236
|
+
return delay;
|
|
237
|
+
});
|
|
238
|
+
runners = [];
|
|
239
|
+
runner = plugin.load({
|
|
240
|
+
url: 'not an url',
|
|
241
|
+
fetchPlugins: runners
|
|
242
|
+
});
|
|
243
|
+
runners.push(runner);
|
|
244
|
+
call = Promise.reject(new Error(JSON.stringify({
|
|
245
|
+
text: 'test',
|
|
246
|
+
ok: true
|
|
247
|
+
})));
|
|
248
|
+
callback = jest.fn();
|
|
249
|
+
runner.transform(call).catch(callback);
|
|
250
|
+
return [
|
|
251
|
+
4,
|
|
252
|
+
jest.advanceTimersByTimeAsync(delay)
|
|
253
|
+
];
|
|
254
|
+
case 1:
|
|
255
|
+
_state.sent();
|
|
256
|
+
expect(callback).not.toHaveBeenCalled();
|
|
257
|
+
return [
|
|
258
|
+
4,
|
|
259
|
+
jest.advanceTimersByTimeAsync(delay)
|
|
260
|
+
];
|
|
261
|
+
case 2:
|
|
262
|
+
_state.sent();
|
|
263
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
264
|
+
expect(condition).toHaveBeenCalledTimes(2);
|
|
265
|
+
return [
|
|
266
|
+
2
|
|
267
|
+
];
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
})();
|
|
271
|
+
});
|
|
272
|
+
it('should retry on not ok call', function() {
|
|
273
|
+
return _async_to_generator(function() {
|
|
274
|
+
var condition, plugin, runners, runner, call, callback;
|
|
275
|
+
return _ts_generator(this, function(_state) {
|
|
276
|
+
switch(_state.label){
|
|
277
|
+
case 0:
|
|
278
|
+
condition = jest.fn().mockReturnValue(true);
|
|
279
|
+
plugin = new RetryFetch(3, condition);
|
|
280
|
+
runners = [];
|
|
281
|
+
runner = plugin.load({
|
|
282
|
+
url: 'not an url',
|
|
283
|
+
fetchPlugins: runners
|
|
284
|
+
});
|
|
285
|
+
runners.push(runner);
|
|
286
|
+
call = Promise.resolve({
|
|
287
|
+
text: 'test',
|
|
288
|
+
ok: false
|
|
289
|
+
});
|
|
290
|
+
callback = jest.fn();
|
|
291
|
+
runner.transform(call).catch(callback);
|
|
292
|
+
return [
|
|
293
|
+
4,
|
|
294
|
+
jest.runAllTimersAsync()
|
|
295
|
+
];
|
|
296
|
+
case 1:
|
|
297
|
+
_state.sent();
|
|
298
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
299
|
+
expect(condition).toHaveBeenCalledTimes(3);
|
|
300
|
+
return [
|
|
301
|
+
2
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
})();
|
|
306
|
+
});
|
|
307
|
+
it('should retry on not ok call with wait', function() {
|
|
308
|
+
return _async_to_generator(function() {
|
|
309
|
+
var condition, delay, plugin, runners, runner, call, callback;
|
|
310
|
+
return _ts_generator(this, function(_state) {
|
|
311
|
+
switch(_state.label){
|
|
312
|
+
case 0:
|
|
313
|
+
condition = jest.fn().mockReturnValue(true);
|
|
314
|
+
delay = 500;
|
|
315
|
+
plugin = new RetryFetch(3, condition, function() {
|
|
316
|
+
return delay;
|
|
317
|
+
});
|
|
318
|
+
runners = [];
|
|
319
|
+
runner = plugin.load({
|
|
320
|
+
url: 'not an url',
|
|
321
|
+
fetchPlugins: runners
|
|
322
|
+
});
|
|
323
|
+
runners.push(runner);
|
|
324
|
+
call = Promise.resolve({
|
|
325
|
+
text: 'test',
|
|
326
|
+
ok: false
|
|
327
|
+
});
|
|
328
|
+
callback = jest.fn();
|
|
329
|
+
runner.transform(call).catch(callback);
|
|
330
|
+
return [
|
|
331
|
+
4,
|
|
332
|
+
jest.advanceTimersByTimeAsync(2 * delay)
|
|
333
|
+
];
|
|
334
|
+
case 1:
|
|
335
|
+
_state.sent();
|
|
336
|
+
expect(callback).not.toHaveBeenCalled();
|
|
337
|
+
return [
|
|
338
|
+
4,
|
|
339
|
+
jest.advanceTimersByTimeAsync(delay)
|
|
340
|
+
];
|
|
341
|
+
case 2:
|
|
342
|
+
_state.sent();
|
|
343
|
+
expect(callback).toHaveBeenCalledWith(expect.objectContaining({}));
|
|
344
|
+
expect(condition).toHaveBeenCalledTimes(3);
|
|
345
|
+
return [
|
|
346
|
+
2
|
|
347
|
+
];
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
})();
|
|
351
|
+
});
|
|
340
352
|
});
|
|
@@ -231,18 +231,19 @@ import { ResponseTimeoutError } from '@ama-sdk/core';
|
|
|
231
231
|
return {
|
|
232
232
|
transform: function(fetchCall) {
|
|
233
233
|
return(// eslint-disable-next-line no-async-promise-executor -- all await are handled with a try-catch block
|
|
234
|
-
new Promise(
|
|
235
|
-
|
|
236
|
-
var timeoutCallback, timer, timerCallback, response, ex;
|
|
234
|
+
new Promise(function(resolve, reject) {
|
|
235
|
+
return _async_to_generator(function() {
|
|
236
|
+
var _this, timeoutCallback, timer, timerCallback, response, ex;
|
|
237
237
|
return _ts_generator(this, function(_state) {
|
|
238
238
|
switch(_state.label){
|
|
239
239
|
case 0:
|
|
240
|
+
_this = this;
|
|
240
241
|
timeoutCallback = function() {
|
|
241
242
|
reject(new ResponseTimeoutError("in ".concat(_this.timeout, "ms")));
|
|
242
243
|
// Fetch abort controller is now supported by all modern browser and node 15+. It should always be defined
|
|
243
244
|
context.controller.abort();
|
|
244
245
|
};
|
|
245
|
-
timer =
|
|
246
|
+
timer = this.timerPauseState === 'timeoutStopped' ? undefined : setTimeout(timeoutCallback, this.timeout);
|
|
246
247
|
timerCallback = function(pauseStatus) {
|
|
247
248
|
if (timer && pauseStatus === 'timeoutStopped') {
|
|
248
249
|
clearTimeout(timer);
|
|
@@ -253,7 +254,7 @@ import { ResponseTimeoutError } from '@ama-sdk/core';
|
|
|
253
254
|
(context.logger || console).log('[SDK Plugins] Timeout restarted.');
|
|
254
255
|
}
|
|
255
256
|
};
|
|
256
|
-
|
|
257
|
+
this.timerSubscription.push(timerCallback);
|
|
257
258
|
_state.label = 1;
|
|
258
259
|
case 1:
|
|
259
260
|
_state.trys.push([
|
|
@@ -286,7 +287,7 @@ import { ResponseTimeoutError } from '@ama-sdk/core';
|
|
|
286
287
|
if (timer) {
|
|
287
288
|
clearTimeout(timer);
|
|
288
289
|
}
|
|
289
|
-
|
|
290
|
+
this.timerSubscription = this.timerSubscription.filter(function(callback) {
|
|
290
291
|
return timerCallback !== callback;
|
|
291
292
|
});
|
|
292
293
|
return [
|
|
@@ -298,11 +299,8 @@ import { ResponseTimeoutError } from '@ama-sdk/core';
|
|
|
298
299
|
];
|
|
299
300
|
}
|
|
300
301
|
});
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
return _ref.apply(this, arguments);
|
|
304
|
-
};
|
|
305
|
-
}()));
|
|
302
|
+
}).call(_this);
|
|
303
|
+
}));
|
|
306
304
|
}
|
|
307
305
|
};
|
|
308
306
|
}
|