enterprise-fetch 1.0.0 → 2.0.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.
- package/dist/client/enterprise-fetch.cjs.js +1119 -1446
- package/dist/client/enterprise-fetch.cjs.min.js +3 -1
- package/dist/client/enterprise-fetch.esm.js +583 -606
- package/dist/client/enterprise-fetch.esm.min.js +1 -1
- package/dist/enterprise-fetch.cjs.js +107 -134
- package/dist/enterprise-fetch.d.ts +5 -6
- package/dist/enterprise-fetch.esm.js +107 -108
- package/dist/enterprise-fetch.esm.js.map +1 -0
- package/dist/fetch-defaults.d.ts +3 -3
- package/dist/models/AppError.d.ts +27 -27
- package/dist/models/EnterpriseFetch.d.ts +15 -15
- package/dist/models/index.d.ts +2 -2
- package/dist/util/client/is-client.d.ts +2 -2
- package/dist/util/parsejson.d.ts +3 -3
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/server/fetch.d.ts +2 -2
- package/dist/util/server/proxy-agent.d.ts +5 -5
- package/dist/util/typeguards.d.ts +2 -2
- package/package.json +47 -48
|
@@ -1,1300 +1,593 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global[
|
|
5
|
-
}(this, (function (exports
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
|
|
10
|
-
|
|
11
|
-
function _defineProperty(obj, key, value) {
|
|
12
|
-
if (key in obj) {
|
|
13
|
-
Object.defineProperty(obj, key, {
|
|
14
|
-
value: value,
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true
|
|
18
|
-
});
|
|
19
|
-
} else {
|
|
20
|
-
obj[key] = value;
|
|
21
|
-
}
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["enterprise-fetch-legacy"] = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _typeof$1(o) {
|
|
8
|
+
"@babel/helpers - typeof";
|
|
22
9
|
|
|
23
|
-
return
|
|
10
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
11
|
+
return typeof o;
|
|
12
|
+
} : function (o) {
|
|
13
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
14
|
+
}, _typeof$1(o);
|
|
24
15
|
}
|
|
25
16
|
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
17
|
+
function toPrimitive(t, r) {
|
|
18
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
19
|
+
var e = t[Symbol.toPrimitive];
|
|
20
|
+
if (void 0 !== e) {
|
|
21
|
+
var i = e.call(t, r);
|
|
22
|
+
if ("object" != _typeof$1(i)) return i;
|
|
23
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
24
|
+
}
|
|
25
|
+
return ("string" === r ? String : Number)(t);
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var _d = false;
|
|
35
|
-
var _e = undefined;
|
|
28
|
+
function toPropertyKey(t) {
|
|
29
|
+
var i = toPrimitive(t, "string");
|
|
30
|
+
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
function _defineProperty(e, r, t) {
|
|
34
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
35
|
+
value: t,
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true
|
|
39
|
+
}) : e[r] = t, e;
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
function _arrayWithHoles(r) {
|
|
43
|
+
if (Array.isArray(r)) return r;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(r, l) {
|
|
47
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
48
|
+
if (null != t) {
|
|
49
|
+
var e,
|
|
50
|
+
n,
|
|
51
|
+
i,
|
|
52
|
+
u,
|
|
53
|
+
a = [],
|
|
54
|
+
f = true,
|
|
55
|
+
o = false;
|
|
47
56
|
try {
|
|
48
|
-
if (!
|
|
57
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
58
|
+
} catch (r) {
|
|
59
|
+
o = true, n = r;
|
|
49
60
|
} finally {
|
|
50
|
-
|
|
61
|
+
try {
|
|
62
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
63
|
+
} finally {
|
|
64
|
+
if (o) throw n;
|
|
65
|
+
}
|
|
51
66
|
}
|
|
67
|
+
return a;
|
|
52
68
|
}
|
|
53
|
-
|
|
54
|
-
return _arr;
|
|
55
69
|
}
|
|
56
70
|
|
|
57
|
-
function _arrayLikeToArray(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
arr2[i] = arr[i];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return arr2;
|
|
71
|
+
function _arrayLikeToArray(r, a) {
|
|
72
|
+
(null == a || a > r.length) && (a = r.length);
|
|
73
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
74
|
+
return n;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
function _unsupportedIterableToArray(
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
77
|
+
function _unsupportedIterableToArray(r, a) {
|
|
78
|
+
if (r) {
|
|
79
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
80
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
81
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
function _nonIterableRest() {
|
|
77
86
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
87
|
}
|
|
79
88
|
|
|
80
|
-
function _slicedToArray(
|
|
81
|
-
return _arrayWithHoles(
|
|
89
|
+
function _slicedToArray(r, e) {
|
|
90
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
82
91
|
}
|
|
83
92
|
|
|
84
|
-
function _objectWithoutPropertiesLoose(
|
|
85
|
-
if (
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
91
|
-
key = sourceKeys[i];
|
|
92
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
93
|
-
target[key] = source[key];
|
|
93
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
94
|
+
if (null == r) return {};
|
|
95
|
+
var t = {};
|
|
96
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
97
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
98
|
+
t[n] = r[n];
|
|
94
99
|
}
|
|
95
|
-
|
|
96
|
-
return target;
|
|
100
|
+
return t;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
function _objectWithoutProperties(
|
|
100
|
-
if (
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
function _objectWithoutProperties(e, t) {
|
|
104
|
+
if (null == e) return {};
|
|
105
|
+
var o,
|
|
106
|
+
r,
|
|
107
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
104
108
|
if (Object.getOwnPropertySymbols) {
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
108
|
-
key = sourceSymbolKeys[i];
|
|
109
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
110
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
111
|
-
target[key] = source[key];
|
|
112
|
-
}
|
|
109
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
110
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
return target;
|
|
112
|
+
return i;
|
|
116
113
|
}
|
|
117
114
|
|
|
118
|
-
function asyncGeneratorStep(
|
|
115
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
119
116
|
try {
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
} catch (
|
|
123
|
-
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (info.done) {
|
|
128
|
-
resolve(value);
|
|
129
|
-
} else {
|
|
130
|
-
Promise.resolve(value).then(_next, _throw);
|
|
117
|
+
var i = n[a](c),
|
|
118
|
+
u = i.value;
|
|
119
|
+
} catch (n) {
|
|
120
|
+
return void e(n);
|
|
131
121
|
}
|
|
122
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
132
123
|
}
|
|
133
|
-
|
|
134
|
-
function _asyncToGenerator(fn) {
|
|
124
|
+
function _asyncToGenerator(n) {
|
|
135
125
|
return function () {
|
|
136
|
-
var
|
|
137
|
-
|
|
138
|
-
return new Promise(function (
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
126
|
+
var t = this,
|
|
127
|
+
e = arguments;
|
|
128
|
+
return new Promise(function (r, o) {
|
|
129
|
+
var a = n.apply(t, e);
|
|
130
|
+
function _next(n) {
|
|
131
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
143
132
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
133
|
+
function _throw(n) {
|
|
134
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
147
135
|
}
|
|
148
|
-
|
|
149
|
-
_next(undefined);
|
|
136
|
+
_next(void 0);
|
|
150
137
|
});
|
|
151
138
|
};
|
|
152
139
|
}
|
|
153
140
|
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
return fn(module, module.exports), module.exports;
|
|
141
|
+
function getDefaultExportFromCjs (x) {
|
|
142
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
157
143
|
}
|
|
158
144
|
|
|
159
|
-
|
|
160
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
161
|
-
*
|
|
162
|
-
* This source code is licensed under the MIT license found in the
|
|
163
|
-
* LICENSE file in the root directory of this source tree.
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
var runtime_1 = createCommonjsModule(function (module) {
|
|
167
|
-
var runtime = (function (exports) {
|
|
168
|
-
|
|
169
|
-
var Op = Object.prototype;
|
|
170
|
-
var hasOwn = Op.hasOwnProperty;
|
|
171
|
-
var undefined$1; // More compressible than void 0.
|
|
172
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
173
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
174
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
175
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
176
|
-
|
|
177
|
-
function define(obj, key, value) {
|
|
178
|
-
Object.defineProperty(obj, key, {
|
|
179
|
-
value: value,
|
|
180
|
-
enumerable: true,
|
|
181
|
-
configurable: true,
|
|
182
|
-
writable: true
|
|
183
|
-
});
|
|
184
|
-
return obj[key];
|
|
185
|
-
}
|
|
186
|
-
try {
|
|
187
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
188
|
-
define({}, "");
|
|
189
|
-
} catch (err) {
|
|
190
|
-
define = function(obj, key, value) {
|
|
191
|
-
return obj[key] = value;
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
196
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
197
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
198
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
199
|
-
var context = new Context(tryLocsList || []);
|
|
200
|
-
|
|
201
|
-
// The ._invoke method unifies the implementations of the .next,
|
|
202
|
-
// .throw, and .return methods.
|
|
203
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
204
|
-
|
|
205
|
-
return generator;
|
|
206
|
-
}
|
|
207
|
-
exports.wrap = wrap;
|
|
208
|
-
|
|
209
|
-
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
210
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
211
|
-
// have been (and was previously) designed to take a closure to be
|
|
212
|
-
// invoked without arguments, but in all the cases we care about we
|
|
213
|
-
// already have an existing method we want to call, so there's no need
|
|
214
|
-
// to create a new function object. We can even get away with assuming
|
|
215
|
-
// the method takes exactly one argument, since that happens to be true
|
|
216
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
217
|
-
// only additional allocation required is the completion record, which
|
|
218
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
219
|
-
function tryCatch(fn, obj, arg) {
|
|
220
|
-
try {
|
|
221
|
-
return { type: "normal", arg: fn.call(obj, arg) };
|
|
222
|
-
} catch (err) {
|
|
223
|
-
return { type: "throw", arg: err };
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
228
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
229
|
-
var GenStateExecuting = "executing";
|
|
230
|
-
var GenStateCompleted = "completed";
|
|
231
|
-
|
|
232
|
-
// Returning this object from the innerFn has the same effect as
|
|
233
|
-
// breaking out of the dispatch switch statement.
|
|
234
|
-
var ContinueSentinel = {};
|
|
235
|
-
|
|
236
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
237
|
-
// .constructor.prototype properties for functions that return Generator
|
|
238
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
239
|
-
// minifier not to mangle the names of these two functions.
|
|
240
|
-
function Generator() {}
|
|
241
|
-
function GeneratorFunction() {}
|
|
242
|
-
function GeneratorFunctionPrototype() {}
|
|
243
|
-
|
|
244
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
245
|
-
// don't natively support it.
|
|
246
|
-
var IteratorPrototype = {};
|
|
247
|
-
IteratorPrototype[iteratorSymbol] = function () {
|
|
248
|
-
return this;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
var getProto = Object.getPrototypeOf;
|
|
252
|
-
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
253
|
-
if (NativeIteratorPrototype &&
|
|
254
|
-
NativeIteratorPrototype !== Op &&
|
|
255
|
-
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
256
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
257
|
-
// of the polyfill.
|
|
258
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
var Gp = GeneratorFunctionPrototype.prototype =
|
|
262
|
-
Generator.prototype = Object.create(IteratorPrototype);
|
|
263
|
-
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
264
|
-
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
265
|
-
GeneratorFunction.displayName = define(
|
|
266
|
-
GeneratorFunctionPrototype,
|
|
267
|
-
toStringTagSymbol,
|
|
268
|
-
"GeneratorFunction"
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
// Helper for defining the .next, .throw, and .return methods of the
|
|
272
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
273
|
-
function defineIteratorMethods(prototype) {
|
|
274
|
-
["next", "throw", "return"].forEach(function(method) {
|
|
275
|
-
define(prototype, method, function(arg) {
|
|
276
|
-
return this._invoke(method, arg);
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
exports.isGeneratorFunction = function(genFun) {
|
|
282
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
283
|
-
return ctor
|
|
284
|
-
? ctor === GeneratorFunction ||
|
|
285
|
-
// For the native GeneratorFunction constructor, the best we can
|
|
286
|
-
// do is to check its .name property.
|
|
287
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
288
|
-
: false;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
exports.mark = function(genFun) {
|
|
292
|
-
if (Object.setPrototypeOf) {
|
|
293
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
294
|
-
} else {
|
|
295
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
296
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
297
|
-
}
|
|
298
|
-
genFun.prototype = Object.create(Gp);
|
|
299
|
-
return genFun;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
// Within the body of any async function, `await x` is transformed to
|
|
303
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
304
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
305
|
-
// meant to be awaited.
|
|
306
|
-
exports.awrap = function(arg) {
|
|
307
|
-
return { __await: arg };
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
311
|
-
function invoke(method, arg, resolve, reject) {
|
|
312
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
313
|
-
if (record.type === "throw") {
|
|
314
|
-
reject(record.arg);
|
|
315
|
-
} else {
|
|
316
|
-
var result = record.arg;
|
|
317
|
-
var value = result.value;
|
|
318
|
-
if (value &&
|
|
319
|
-
typeof value === "object" &&
|
|
320
|
-
hasOwn.call(value, "__await")) {
|
|
321
|
-
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|
322
|
-
invoke("next", value, resolve, reject);
|
|
323
|
-
}, function(err) {
|
|
324
|
-
invoke("throw", err, resolve, reject);
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
329
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
330
|
-
// the .value of the Promise<{value,done}> result for the
|
|
331
|
-
// current iteration.
|
|
332
|
-
result.value = unwrapped;
|
|
333
|
-
resolve(result);
|
|
334
|
-
}, function(error) {
|
|
335
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
336
|
-
// into the async generator function so it can be handled there.
|
|
337
|
-
return invoke("throw", error, resolve, reject);
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
var previousPromise;
|
|
343
|
-
|
|
344
|
-
function enqueue(method, arg) {
|
|
345
|
-
function callInvokeWithMethodAndArg() {
|
|
346
|
-
return new PromiseImpl(function(resolve, reject) {
|
|
347
|
-
invoke(method, arg, resolve, reject);
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return previousPromise =
|
|
352
|
-
// If enqueue has been called before, then we want to wait until
|
|
353
|
-
// all previous Promises have been resolved before calling invoke,
|
|
354
|
-
// so that results are always delivered in the correct order. If
|
|
355
|
-
// enqueue has not been called before, then it is important to
|
|
356
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
357
|
-
// so that the async generator function has the opportunity to do
|
|
358
|
-
// any necessary setup in a predictable way. This predictability
|
|
359
|
-
// is why the Promise constructor synchronously invokes its
|
|
360
|
-
// executor callback, and why async functions synchronously
|
|
361
|
-
// execute code before the first await. Since we implement simple
|
|
362
|
-
// async functions in terms of async generators, it is especially
|
|
363
|
-
// important to get this right, even though it requires care.
|
|
364
|
-
previousPromise ? previousPromise.then(
|
|
365
|
-
callInvokeWithMethodAndArg,
|
|
366
|
-
// Avoid propagating failures to Promises returned by later
|
|
367
|
-
// invocations of the iterator.
|
|
368
|
-
callInvokeWithMethodAndArg
|
|
369
|
-
) : callInvokeWithMethodAndArg();
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Define the unified helper method that is used to implement .next,
|
|
373
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
374
|
-
this._invoke = enqueue;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
378
|
-
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
379
|
-
return this;
|
|
380
|
-
};
|
|
381
|
-
exports.AsyncIterator = AsyncIterator;
|
|
382
|
-
|
|
383
|
-
// Note that simple async functions are implemented on top of
|
|
384
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
385
|
-
// the final result produced by the iterator.
|
|
386
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
387
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
388
|
-
|
|
389
|
-
var iter = new AsyncIterator(
|
|
390
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
391
|
-
PromiseImpl
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
return exports.isGeneratorFunction(outerFn)
|
|
395
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
396
|
-
: iter.next().then(function(result) {
|
|
397
|
-
return result.done ? result.value : iter.next();
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
402
|
-
var state = GenStateSuspendedStart;
|
|
403
|
-
|
|
404
|
-
return function invoke(method, arg) {
|
|
405
|
-
if (state === GenStateExecuting) {
|
|
406
|
-
throw new Error("Generator is already running");
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
if (state === GenStateCompleted) {
|
|
410
|
-
if (method === "throw") {
|
|
411
|
-
throw arg;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
415
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
416
|
-
return doneResult();
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
context.method = method;
|
|
420
|
-
context.arg = arg;
|
|
421
|
-
|
|
422
|
-
while (true) {
|
|
423
|
-
var delegate = context.delegate;
|
|
424
|
-
if (delegate) {
|
|
425
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
426
|
-
if (delegateResult) {
|
|
427
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
428
|
-
return delegateResult;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (context.method === "next") {
|
|
433
|
-
// Setting context._sent for legacy support of Babel's
|
|
434
|
-
// function.sent implementation.
|
|
435
|
-
context.sent = context._sent = context.arg;
|
|
436
|
-
|
|
437
|
-
} else if (context.method === "throw") {
|
|
438
|
-
if (state === GenStateSuspendedStart) {
|
|
439
|
-
state = GenStateCompleted;
|
|
440
|
-
throw context.arg;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
context.dispatchException(context.arg);
|
|
444
|
-
|
|
445
|
-
} else if (context.method === "return") {
|
|
446
|
-
context.abrupt("return", context.arg);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
state = GenStateExecuting;
|
|
145
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
450
146
|
|
|
451
|
-
|
|
452
|
-
if (record.type === "normal") {
|
|
453
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
454
|
-
// GenStateExecuting and loop back for another invocation.
|
|
455
|
-
state = context.done
|
|
456
|
-
? GenStateCompleted
|
|
457
|
-
: GenStateSuspendedYield;
|
|
458
|
-
|
|
459
|
-
if (record.arg === ContinueSentinel) {
|
|
460
|
-
continue;
|
|
461
|
-
}
|
|
147
|
+
var OverloadYield = {exports: {}};
|
|
462
148
|
|
|
463
|
-
|
|
464
|
-
value: record.arg,
|
|
465
|
-
done: context.done
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
} else if (record.type === "throw") {
|
|
469
|
-
state = GenStateCompleted;
|
|
470
|
-
// Dispatch the exception by looping back around to the
|
|
471
|
-
// context.dispatchException(context.arg) call above.
|
|
472
|
-
context.method = "throw";
|
|
473
|
-
context.arg = record.arg;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
480
|
-
// result, either by returning a { value, done } result from the
|
|
481
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
482
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
483
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
484
|
-
var method = delegate.iterator[context.method];
|
|
485
|
-
if (method === undefined$1) {
|
|
486
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
487
|
-
// method always terminates the yield* loop.
|
|
488
|
-
context.delegate = null;
|
|
489
|
-
|
|
490
|
-
if (context.method === "throw") {
|
|
491
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
492
|
-
if (delegate.iterator["return"]) {
|
|
493
|
-
// If the delegate iterator has a return method, give it a
|
|
494
|
-
// chance to clean up.
|
|
495
|
-
context.method = "return";
|
|
496
|
-
context.arg = undefined$1;
|
|
497
|
-
maybeInvokeDelegate(delegate, context);
|
|
498
|
-
|
|
499
|
-
if (context.method === "throw") {
|
|
500
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
501
|
-
// "return" to "throw", let that override the TypeError below.
|
|
502
|
-
return ContinueSentinel;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
context.method = "throw";
|
|
507
|
-
context.arg = new TypeError(
|
|
508
|
-
"The iterator does not provide a 'throw' method");
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
return ContinueSentinel;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
515
|
-
|
|
516
|
-
if (record.type === "throw") {
|
|
517
|
-
context.method = "throw";
|
|
518
|
-
context.arg = record.arg;
|
|
519
|
-
context.delegate = null;
|
|
520
|
-
return ContinueSentinel;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
var info = record.arg;
|
|
524
|
-
|
|
525
|
-
if (! info) {
|
|
526
|
-
context.method = "throw";
|
|
527
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
528
|
-
context.delegate = null;
|
|
529
|
-
return ContinueSentinel;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
if (info.done) {
|
|
533
|
-
// Assign the result of the finished delegate to the temporary
|
|
534
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
535
|
-
context[delegate.resultName] = info.value;
|
|
536
|
-
|
|
537
|
-
// Resume execution at the desired location (see delegateYield).
|
|
538
|
-
context.next = delegate.nextLoc;
|
|
539
|
-
|
|
540
|
-
// If context.method was "throw" but the delegate handled the
|
|
541
|
-
// exception, let the outer generator proceed normally. If
|
|
542
|
-
// context.method was "next", forget context.arg since it has been
|
|
543
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
544
|
-
// "return", allow the original .return call to continue in the
|
|
545
|
-
// outer generator.
|
|
546
|
-
if (context.method !== "return") {
|
|
547
|
-
context.method = "next";
|
|
548
|
-
context.arg = undefined$1;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
} else {
|
|
552
|
-
// Re-yield the result returned by the delegate method.
|
|
553
|
-
return info;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// The delegate iterator is finished, so forget it and continue with
|
|
557
|
-
// the outer generator.
|
|
558
|
-
context.delegate = null;
|
|
559
|
-
return ContinueSentinel;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
563
|
-
// unified ._invoke helper method.
|
|
564
|
-
defineIteratorMethods(Gp);
|
|
565
|
-
|
|
566
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
567
|
-
|
|
568
|
-
// A Generator should always return itself as the iterator object when the
|
|
569
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
570
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
571
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
572
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
573
|
-
Gp[iteratorSymbol] = function() {
|
|
574
|
-
return this;
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
Gp.toString = function() {
|
|
578
|
-
return "[object Generator]";
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
function pushTryEntry(locs) {
|
|
582
|
-
var entry = { tryLoc: locs[0] };
|
|
583
|
-
|
|
584
|
-
if (1 in locs) {
|
|
585
|
-
entry.catchLoc = locs[1];
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
if (2 in locs) {
|
|
589
|
-
entry.finallyLoc = locs[2];
|
|
590
|
-
entry.afterLoc = locs[3];
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
this.tryEntries.push(entry);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
function resetTryEntry(entry) {
|
|
597
|
-
var record = entry.completion || {};
|
|
598
|
-
record.type = "normal";
|
|
599
|
-
delete record.arg;
|
|
600
|
-
entry.completion = record;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
function Context(tryLocsList) {
|
|
604
|
-
// The root entry object (effectively a try statement without a catch
|
|
605
|
-
// or a finally block) gives us a place to store values thrown from
|
|
606
|
-
// locations where there is no enclosing try statement.
|
|
607
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
608
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
609
|
-
this.reset(true);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
exports.keys = function(object) {
|
|
613
|
-
var keys = [];
|
|
614
|
-
for (var key in object) {
|
|
615
|
-
keys.push(key);
|
|
616
|
-
}
|
|
617
|
-
keys.reverse();
|
|
618
|
-
|
|
619
|
-
// Rather than returning an object with a next method, we keep
|
|
620
|
-
// things simple and return the next function itself.
|
|
621
|
-
return function next() {
|
|
622
|
-
while (keys.length) {
|
|
623
|
-
var key = keys.pop();
|
|
624
|
-
if (key in object) {
|
|
625
|
-
next.value = key;
|
|
626
|
-
next.done = false;
|
|
627
|
-
return next;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
// To avoid creating an additional object, we just hang the .value
|
|
632
|
-
// and .done properties off the next function object itself. This
|
|
633
|
-
// also ensures that the minifier will not anonymize the function.
|
|
634
|
-
next.done = true;
|
|
635
|
-
return next;
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
function values(iterable) {
|
|
640
|
-
if (iterable) {
|
|
641
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
642
|
-
if (iteratorMethod) {
|
|
643
|
-
return iteratorMethod.call(iterable);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (typeof iterable.next === "function") {
|
|
647
|
-
return iterable;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
if (!isNaN(iterable.length)) {
|
|
651
|
-
var i = -1, next = function next() {
|
|
652
|
-
while (++i < iterable.length) {
|
|
653
|
-
if (hasOwn.call(iterable, i)) {
|
|
654
|
-
next.value = iterable[i];
|
|
655
|
-
next.done = false;
|
|
656
|
-
return next;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
next.value = undefined$1;
|
|
661
|
-
next.done = true;
|
|
662
|
-
|
|
663
|
-
return next;
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
return next.next = next;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
// Return an iterator with no values.
|
|
671
|
-
return { next: doneResult };
|
|
672
|
-
}
|
|
673
|
-
exports.values = values;
|
|
674
|
-
|
|
675
|
-
function doneResult() {
|
|
676
|
-
return { value: undefined$1, done: true };
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
Context.prototype = {
|
|
680
|
-
constructor: Context,
|
|
681
|
-
|
|
682
|
-
reset: function(skipTempReset) {
|
|
683
|
-
this.prev = 0;
|
|
684
|
-
this.next = 0;
|
|
685
|
-
// Resetting context._sent for legacy support of Babel's
|
|
686
|
-
// function.sent implementation.
|
|
687
|
-
this.sent = this._sent = undefined$1;
|
|
688
|
-
this.done = false;
|
|
689
|
-
this.delegate = null;
|
|
690
|
-
|
|
691
|
-
this.method = "next";
|
|
692
|
-
this.arg = undefined$1;
|
|
693
|
-
|
|
694
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
695
|
-
|
|
696
|
-
if (!skipTempReset) {
|
|
697
|
-
for (var name in this) {
|
|
698
|
-
// Not sure about the optimal order of these conditions:
|
|
699
|
-
if (name.charAt(0) === "t" &&
|
|
700
|
-
hasOwn.call(this, name) &&
|
|
701
|
-
!isNaN(+name.slice(1))) {
|
|
702
|
-
this[name] = undefined$1;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
},
|
|
707
|
-
|
|
708
|
-
stop: function() {
|
|
709
|
-
this.done = true;
|
|
710
|
-
|
|
711
|
-
var rootEntry = this.tryEntries[0];
|
|
712
|
-
var rootRecord = rootEntry.completion;
|
|
713
|
-
if (rootRecord.type === "throw") {
|
|
714
|
-
throw rootRecord.arg;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
return this.rval;
|
|
718
|
-
},
|
|
719
|
-
|
|
720
|
-
dispatchException: function(exception) {
|
|
721
|
-
if (this.done) {
|
|
722
|
-
throw exception;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
var context = this;
|
|
726
|
-
function handle(loc, caught) {
|
|
727
|
-
record.type = "throw";
|
|
728
|
-
record.arg = exception;
|
|
729
|
-
context.next = loc;
|
|
730
|
-
|
|
731
|
-
if (caught) {
|
|
732
|
-
// If the dispatched exception was caught by a catch block,
|
|
733
|
-
// then let that catch block handle the exception normally.
|
|
734
|
-
context.method = "next";
|
|
735
|
-
context.arg = undefined$1;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
return !! caught;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
742
|
-
var entry = this.tryEntries[i];
|
|
743
|
-
var record = entry.completion;
|
|
744
|
-
|
|
745
|
-
if (entry.tryLoc === "root") {
|
|
746
|
-
// Exception thrown outside of any try block that could handle
|
|
747
|
-
// it, so set the completion value of the entire function to
|
|
748
|
-
// throw the exception.
|
|
749
|
-
return handle("end");
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
if (entry.tryLoc <= this.prev) {
|
|
753
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
754
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
755
|
-
|
|
756
|
-
if (hasCatch && hasFinally) {
|
|
757
|
-
if (this.prev < entry.catchLoc) {
|
|
758
|
-
return handle(entry.catchLoc, true);
|
|
759
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
760
|
-
return handle(entry.finallyLoc);
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
} else if (hasCatch) {
|
|
764
|
-
if (this.prev < entry.catchLoc) {
|
|
765
|
-
return handle(entry.catchLoc, true);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
} else if (hasFinally) {
|
|
769
|
-
if (this.prev < entry.finallyLoc) {
|
|
770
|
-
return handle(entry.finallyLoc);
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
} else {
|
|
774
|
-
throw new Error("try statement without catch or finally");
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
},
|
|
779
|
-
|
|
780
|
-
abrupt: function(type, arg) {
|
|
781
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
782
|
-
var entry = this.tryEntries[i];
|
|
783
|
-
if (entry.tryLoc <= this.prev &&
|
|
784
|
-
hasOwn.call(entry, "finallyLoc") &&
|
|
785
|
-
this.prev < entry.finallyLoc) {
|
|
786
|
-
var finallyEntry = entry;
|
|
787
|
-
break;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
if (finallyEntry &&
|
|
792
|
-
(type === "break" ||
|
|
793
|
-
type === "continue") &&
|
|
794
|
-
finallyEntry.tryLoc <= arg &&
|
|
795
|
-
arg <= finallyEntry.finallyLoc) {
|
|
796
|
-
// Ignore the finally entry if control is not jumping to a
|
|
797
|
-
// location outside the try/catch block.
|
|
798
|
-
finallyEntry = null;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
802
|
-
record.type = type;
|
|
803
|
-
record.arg = arg;
|
|
804
|
-
|
|
805
|
-
if (finallyEntry) {
|
|
806
|
-
this.method = "next";
|
|
807
|
-
this.next = finallyEntry.finallyLoc;
|
|
808
|
-
return ContinueSentinel;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
return this.complete(record);
|
|
812
|
-
},
|
|
813
|
-
|
|
814
|
-
complete: function(record, afterLoc) {
|
|
815
|
-
if (record.type === "throw") {
|
|
816
|
-
throw record.arg;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
if (record.type === "break" ||
|
|
820
|
-
record.type === "continue") {
|
|
821
|
-
this.next = record.arg;
|
|
822
|
-
} else if (record.type === "return") {
|
|
823
|
-
this.rval = this.arg = record.arg;
|
|
824
|
-
this.method = "return";
|
|
825
|
-
this.next = "end";
|
|
826
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
827
|
-
this.next = afterLoc;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
return ContinueSentinel;
|
|
831
|
-
},
|
|
832
|
-
|
|
833
|
-
finish: function(finallyLoc) {
|
|
834
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
835
|
-
var entry = this.tryEntries[i];
|
|
836
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
837
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
838
|
-
resetTryEntry(entry);
|
|
839
|
-
return ContinueSentinel;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
},
|
|
843
|
-
|
|
844
|
-
"catch": function(tryLoc) {
|
|
845
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
846
|
-
var entry = this.tryEntries[i];
|
|
847
|
-
if (entry.tryLoc === tryLoc) {
|
|
848
|
-
var record = entry.completion;
|
|
849
|
-
if (record.type === "throw") {
|
|
850
|
-
var thrown = record.arg;
|
|
851
|
-
resetTryEntry(entry);
|
|
852
|
-
}
|
|
853
|
-
return thrown;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
// The context.catch method must only be called with a location
|
|
858
|
-
// argument that corresponds to a known catch block.
|
|
859
|
-
throw new Error("illegal catch attempt");
|
|
860
|
-
},
|
|
861
|
-
|
|
862
|
-
delegateYield: function(iterable, resultName, nextLoc) {
|
|
863
|
-
this.delegate = {
|
|
864
|
-
iterator: values(iterable),
|
|
865
|
-
resultName: resultName,
|
|
866
|
-
nextLoc: nextLoc
|
|
867
|
-
};
|
|
868
|
-
|
|
869
|
-
if (this.method === "next") {
|
|
870
|
-
// Deliberately forget the last sent value so that we don't
|
|
871
|
-
// accidentally pass it on to the delegate.
|
|
872
|
-
this.arg = undefined$1;
|
|
873
|
-
}
|
|
149
|
+
var hasRequiredOverloadYield;
|
|
874
150
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
}(
|
|
886
|
-
// If this script is executing as a CommonJS module, use module.exports
|
|
887
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
888
|
-
// object. Either way, the resulting object will be used to initialize
|
|
889
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
890
|
-
module.exports
|
|
891
|
-
));
|
|
892
|
-
|
|
893
|
-
try {
|
|
894
|
-
regeneratorRuntime = runtime;
|
|
895
|
-
} catch (accidentalStrictMode) {
|
|
896
|
-
// This module should not be running in strict mode, so the above
|
|
897
|
-
// assignment should always work unless something is misconfigured. Just
|
|
898
|
-
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
899
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
900
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
901
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
902
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
903
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
904
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
905
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
151
|
+
function requireOverloadYield () {
|
|
152
|
+
if (hasRequiredOverloadYield) return OverloadYield.exports;
|
|
153
|
+
hasRequiredOverloadYield = 1;
|
|
154
|
+
(function (module) {
|
|
155
|
+
function _OverloadYield(e, d) {
|
|
156
|
+
this.v = e, this.k = d;
|
|
157
|
+
}
|
|
158
|
+
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
159
|
+
} (OverloadYield));
|
|
160
|
+
return OverloadYield.exports;
|
|
906
161
|
}
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
var regenerator = runtime_1;
|
|
910
162
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
163
|
+
var regenerator$1 = {exports: {}};
|
|
164
|
+
|
|
165
|
+
var regeneratorDefine = {exports: {}};
|
|
166
|
+
|
|
167
|
+
var hasRequiredRegeneratorDefine;
|
|
168
|
+
|
|
169
|
+
function requireRegeneratorDefine () {
|
|
170
|
+
if (hasRequiredRegeneratorDefine) return regeneratorDefine.exports;
|
|
171
|
+
hasRequiredRegeneratorDefine = 1;
|
|
172
|
+
(function (module) {
|
|
173
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
174
|
+
var i = Object.defineProperty;
|
|
175
|
+
try {
|
|
176
|
+
i({}, "", {});
|
|
177
|
+
} catch (e) {
|
|
178
|
+
i = 0;
|
|
179
|
+
}
|
|
180
|
+
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
|
|
181
|
+
function o(r, n) {
|
|
182
|
+
_regeneratorDefine(e, r, function (e) {
|
|
183
|
+
return this._invoke(r, n, e);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
r ? i ? i(e, r, {
|
|
187
|
+
value: n,
|
|
188
|
+
enumerable: !t,
|
|
189
|
+
configurable: !t,
|
|
190
|
+
writable: !t
|
|
191
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
192
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
|
|
193
|
+
}
|
|
194
|
+
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
195
|
+
} (regeneratorDefine));
|
|
196
|
+
return regeneratorDefine.exports;
|
|
925
197
|
}
|
|
926
198
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
199
|
+
var hasRequiredRegenerator$1;
|
|
200
|
+
|
|
201
|
+
function requireRegenerator$1 () {
|
|
202
|
+
if (hasRequiredRegenerator$1) return regenerator$1.exports;
|
|
203
|
+
hasRequiredRegenerator$1 = 1;
|
|
204
|
+
(function (module) {
|
|
205
|
+
var regeneratorDefine = requireRegeneratorDefine();
|
|
206
|
+
function _regenerator() {
|
|
207
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
208
|
+
var e,
|
|
209
|
+
t,
|
|
210
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
211
|
+
n = r.iterator || "@@iterator",
|
|
212
|
+
o = r.toStringTag || "@@toStringTag";
|
|
213
|
+
function i(r, n, o, i) {
|
|
214
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
215
|
+
u = Object.create(c.prototype);
|
|
216
|
+
return regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
217
|
+
var i,
|
|
218
|
+
c,
|
|
219
|
+
u,
|
|
220
|
+
f = 0,
|
|
221
|
+
p = o || [],
|
|
222
|
+
y = false,
|
|
223
|
+
G = {
|
|
224
|
+
p: 0,
|
|
225
|
+
n: 0,
|
|
226
|
+
v: e,
|
|
227
|
+
a: d,
|
|
228
|
+
f: d.bind(e, 4),
|
|
229
|
+
d: function d(t, r) {
|
|
230
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
function d(r, n) {
|
|
234
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
235
|
+
var o,
|
|
236
|
+
i = p[t],
|
|
237
|
+
d = G.p,
|
|
238
|
+
l = i[2];
|
|
239
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
240
|
+
}
|
|
241
|
+
if (o || r > 1) return a;
|
|
242
|
+
throw y = true, n;
|
|
243
|
+
}
|
|
244
|
+
return function (o, p, l) {
|
|
245
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
246
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
247
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
248
|
+
try {
|
|
249
|
+
if (f = 2, i) {
|
|
250
|
+
if (c || (o = "next"), t = i[o]) {
|
|
251
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
252
|
+
if (!t.done) return t;
|
|
253
|
+
u = t.value, c < 2 && (c = 0);
|
|
254
|
+
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
255
|
+
i = e;
|
|
256
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
257
|
+
} catch (t) {
|
|
258
|
+
i = e, c = 1, u = t;
|
|
259
|
+
} finally {
|
|
260
|
+
f = 1;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
value: t,
|
|
265
|
+
done: y
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
}(r, o, i), true), u;
|
|
269
|
+
}
|
|
270
|
+
var a = {};
|
|
271
|
+
function Generator() {}
|
|
272
|
+
function GeneratorFunction() {}
|
|
273
|
+
function GeneratorFunctionPrototype() {}
|
|
274
|
+
t = Object.getPrototypeOf;
|
|
275
|
+
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
|
|
276
|
+
return this;
|
|
277
|
+
}), t),
|
|
278
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
279
|
+
function f(e) {
|
|
280
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
281
|
+
}
|
|
282
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function () {
|
|
283
|
+
return this;
|
|
284
|
+
}), regeneratorDefine(u, "toString", function () {
|
|
285
|
+
return "[object Generator]";
|
|
286
|
+
}), (module.exports = _regenerator = function _regenerator() {
|
|
287
|
+
return {
|
|
288
|
+
w: i,
|
|
289
|
+
m: f
|
|
290
|
+
};
|
|
291
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
292
|
+
}
|
|
293
|
+
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
294
|
+
} (regenerator$1));
|
|
295
|
+
return regenerator$1.exports;
|
|
937
296
|
}
|
|
938
297
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
298
|
+
var regeneratorAsync = {exports: {}};
|
|
299
|
+
|
|
300
|
+
var regeneratorAsyncGen = {exports: {}};
|
|
301
|
+
|
|
302
|
+
var regeneratorAsyncIterator = {exports: {}};
|
|
303
|
+
|
|
304
|
+
var hasRequiredRegeneratorAsyncIterator;
|
|
305
|
+
|
|
306
|
+
function requireRegeneratorAsyncIterator () {
|
|
307
|
+
if (hasRequiredRegeneratorAsyncIterator) return regeneratorAsyncIterator.exports;
|
|
308
|
+
hasRequiredRegeneratorAsyncIterator = 1;
|
|
309
|
+
(function (module) {
|
|
310
|
+
var OverloadYield = requireOverloadYield();
|
|
311
|
+
var regeneratorDefine = requireRegeneratorDefine();
|
|
312
|
+
function AsyncIterator(t, e) {
|
|
313
|
+
function n(r, o, i, f) {
|
|
314
|
+
try {
|
|
315
|
+
var c = t[r](o),
|
|
316
|
+
u = c.value;
|
|
317
|
+
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
318
|
+
n("next", t, i, f);
|
|
319
|
+
}, function (t) {
|
|
320
|
+
n("throw", t, i, f);
|
|
321
|
+
}) : e.resolve(u).then(function (t) {
|
|
322
|
+
c.value = t, i(c);
|
|
323
|
+
}, function (t) {
|
|
324
|
+
return n("throw", t, i, f);
|
|
325
|
+
});
|
|
326
|
+
} catch (t) {
|
|
327
|
+
f(t);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
var r;
|
|
331
|
+
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
332
|
+
return this;
|
|
333
|
+
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
334
|
+
function f() {
|
|
335
|
+
return new e(function (e, r) {
|
|
336
|
+
n(t, i, e, r);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
return r = r ? r.then(f, f) : f();
|
|
340
|
+
}, true);
|
|
341
|
+
}
|
|
342
|
+
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
343
|
+
} (regeneratorAsyncIterator));
|
|
344
|
+
return regeneratorAsyncIterator.exports;
|
|
968
345
|
}
|
|
969
346
|
|
|
970
|
-
var
|
|
971
|
-
|
|
972
|
-
function
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
this._attempts = 1;
|
|
985
|
-
this._operationTimeout = null;
|
|
986
|
-
this._operationTimeoutCb = null;
|
|
987
|
-
this._timeout = null;
|
|
988
|
-
this._operationStart = null;
|
|
989
|
-
|
|
990
|
-
if (this._options.forever) {
|
|
991
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
992
|
-
}
|
|
347
|
+
var hasRequiredRegeneratorAsyncGen;
|
|
348
|
+
|
|
349
|
+
function requireRegeneratorAsyncGen () {
|
|
350
|
+
if (hasRequiredRegeneratorAsyncGen) return regeneratorAsyncGen.exports;
|
|
351
|
+
hasRequiredRegeneratorAsyncGen = 1;
|
|
352
|
+
(function (module) {
|
|
353
|
+
var regenerator = requireRegenerator$1();
|
|
354
|
+
var regeneratorAsyncIterator = requireRegeneratorAsyncIterator();
|
|
355
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
356
|
+
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
|
|
357
|
+
}
|
|
358
|
+
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
359
|
+
} (regeneratorAsyncGen));
|
|
360
|
+
return regeneratorAsyncGen.exports;
|
|
993
361
|
}
|
|
994
|
-
var retry_operation = RetryOperation;
|
|
995
|
-
|
|
996
|
-
RetryOperation.prototype.reset = function() {
|
|
997
|
-
this._attempts = 1;
|
|
998
|
-
this._timeouts = this._originalTimeouts;
|
|
999
|
-
};
|
|
1000
|
-
|
|
1001
|
-
RetryOperation.prototype.stop = function() {
|
|
1002
|
-
if (this._timeout) {
|
|
1003
|
-
clearTimeout(this._timeout);
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
this._timeouts = [];
|
|
1007
|
-
this._cachedTimeouts = null;
|
|
1008
|
-
};
|
|
1009
|
-
|
|
1010
|
-
RetryOperation.prototype.retry = function(err) {
|
|
1011
|
-
if (this._timeout) {
|
|
1012
|
-
clearTimeout(this._timeout);
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
if (!err) {
|
|
1016
|
-
return false;
|
|
1017
|
-
}
|
|
1018
|
-
var currentTime = new Date().getTime();
|
|
1019
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
1020
|
-
this._errors.unshift(new Error('RetryOperation timeout occurred'));
|
|
1021
|
-
return false;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
this._errors.push(err);
|
|
1025
|
-
|
|
1026
|
-
var timeout = this._timeouts.shift();
|
|
1027
|
-
if (timeout === undefined) {
|
|
1028
|
-
if (this._cachedTimeouts) {
|
|
1029
|
-
// retry forever, only keep last error
|
|
1030
|
-
this._errors.splice(this._errors.length - 1, this._errors.length);
|
|
1031
|
-
this._timeouts = this._cachedTimeouts.slice(0);
|
|
1032
|
-
timeout = this._timeouts.shift();
|
|
1033
|
-
} else {
|
|
1034
|
-
return false;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
var self = this;
|
|
1039
|
-
var timer = setTimeout(function() {
|
|
1040
|
-
self._attempts++;
|
|
1041
|
-
|
|
1042
|
-
if (self._operationTimeoutCb) {
|
|
1043
|
-
self._timeout = setTimeout(function() {
|
|
1044
|
-
self._operationTimeoutCb(self._attempts);
|
|
1045
|
-
}, self._operationTimeout);
|
|
1046
|
-
|
|
1047
|
-
if (self._options.unref) {
|
|
1048
|
-
self._timeout.unref();
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
self._fn(self._attempts);
|
|
1053
|
-
}, timeout);
|
|
1054
|
-
|
|
1055
|
-
if (this._options.unref) {
|
|
1056
|
-
timer.unref();
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
return true;
|
|
1060
|
-
};
|
|
1061
|
-
|
|
1062
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
1063
|
-
this._fn = fn;
|
|
1064
|
-
|
|
1065
|
-
if (timeoutOps) {
|
|
1066
|
-
if (timeoutOps.timeout) {
|
|
1067
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
1068
|
-
}
|
|
1069
|
-
if (timeoutOps.cb) {
|
|
1070
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
var self = this;
|
|
1075
|
-
if (this._operationTimeoutCb) {
|
|
1076
|
-
this._timeout = setTimeout(function() {
|
|
1077
|
-
self._operationTimeoutCb();
|
|
1078
|
-
}, self._operationTimeout);
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
this._operationStart = new Date().getTime();
|
|
1082
|
-
|
|
1083
|
-
this._fn(this._attempts);
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
RetryOperation.prototype.try = function(fn) {
|
|
1087
|
-
console.log('Using RetryOperation.try() is deprecated');
|
|
1088
|
-
this.attempt(fn);
|
|
1089
|
-
};
|
|
1090
|
-
|
|
1091
|
-
RetryOperation.prototype.start = function(fn) {
|
|
1092
|
-
console.log('Using RetryOperation.start() is deprecated');
|
|
1093
|
-
this.attempt(fn);
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
1097
|
-
|
|
1098
|
-
RetryOperation.prototype.errors = function() {
|
|
1099
|
-
return this._errors;
|
|
1100
|
-
};
|
|
1101
|
-
|
|
1102
|
-
RetryOperation.prototype.attempts = function() {
|
|
1103
|
-
return this._attempts;
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
RetryOperation.prototype.mainError = function() {
|
|
1107
|
-
if (this._errors.length === 0) {
|
|
1108
|
-
return null;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
var counts = {};
|
|
1112
|
-
var mainError = null;
|
|
1113
|
-
var mainErrorCount = 0;
|
|
1114
|
-
|
|
1115
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
1116
|
-
var error = this._errors[i];
|
|
1117
|
-
var message = error.message;
|
|
1118
|
-
var count = (counts[message] || 0) + 1;
|
|
1119
|
-
|
|
1120
|
-
counts[message] = count;
|
|
1121
|
-
|
|
1122
|
-
if (count >= mainErrorCount) {
|
|
1123
|
-
mainError = error;
|
|
1124
|
-
mainErrorCount = count;
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
return mainError;
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
|
-
var retry$1 = createCommonjsModule(function (module, exports) {
|
|
1132
|
-
exports.operation = function(options) {
|
|
1133
|
-
var timeouts = exports.timeouts(options);
|
|
1134
|
-
return new retry_operation(timeouts, {
|
|
1135
|
-
forever: options && options.forever,
|
|
1136
|
-
unref: options && options.unref,
|
|
1137
|
-
maxRetryTime: options && options.maxRetryTime
|
|
1138
|
-
});
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
exports.timeouts = function(options) {
|
|
1142
|
-
if (options instanceof Array) {
|
|
1143
|
-
return [].concat(options);
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
var opts = {
|
|
1147
|
-
retries: 10,
|
|
1148
|
-
factor: 2,
|
|
1149
|
-
minTimeout: 1 * 1000,
|
|
1150
|
-
maxTimeout: Infinity,
|
|
1151
|
-
randomize: false
|
|
1152
|
-
};
|
|
1153
|
-
for (var key in options) {
|
|
1154
|
-
opts[key] = options[key];
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
1158
|
-
throw new Error('minTimeout is greater than maxTimeout');
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
var timeouts = [];
|
|
1162
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
1163
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
if (options && options.forever && !timeouts.length) {
|
|
1167
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
// sort the array numerically ascending
|
|
1171
|
-
timeouts.sort(function(a,b) {
|
|
1172
|
-
return a - b;
|
|
1173
|
-
});
|
|
1174
|
-
|
|
1175
|
-
return timeouts;
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
|
-
exports.createTimeout = function(attempt, opts) {
|
|
1179
|
-
var random = (opts.randomize)
|
|
1180
|
-
? (Math.random() + 1)
|
|
1181
|
-
: 1;
|
|
1182
|
-
|
|
1183
|
-
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
|
1184
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
1185
|
-
|
|
1186
|
-
return timeout;
|
|
1187
|
-
};
|
|
1188
|
-
|
|
1189
|
-
exports.wrap = function(obj, options, methods) {
|
|
1190
|
-
if (options instanceof Array) {
|
|
1191
|
-
methods = options;
|
|
1192
|
-
options = null;
|
|
1193
|
-
}
|
|
1194
362
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
363
|
+
var hasRequiredRegeneratorAsync;
|
|
364
|
+
|
|
365
|
+
function requireRegeneratorAsync () {
|
|
366
|
+
if (hasRequiredRegeneratorAsync) return regeneratorAsync.exports;
|
|
367
|
+
hasRequiredRegeneratorAsync = 1;
|
|
368
|
+
(function (module) {
|
|
369
|
+
var regeneratorAsyncGen = requireRegeneratorAsyncGen();
|
|
370
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
371
|
+
var a = regeneratorAsyncGen(n, e, r, t, o);
|
|
372
|
+
return a.next().then(function (n) {
|
|
373
|
+
return n.done ? n.value : a.next();
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
377
|
+
} (regeneratorAsync));
|
|
378
|
+
return regeneratorAsync.exports;
|
|
379
|
+
}
|
|
1203
380
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
381
|
+
var regeneratorKeys = {exports: {}};
|
|
382
|
+
|
|
383
|
+
var hasRequiredRegeneratorKeys;
|
|
384
|
+
|
|
385
|
+
function requireRegeneratorKeys () {
|
|
386
|
+
if (hasRequiredRegeneratorKeys) return regeneratorKeys.exports;
|
|
387
|
+
hasRequiredRegeneratorKeys = 1;
|
|
388
|
+
(function (module) {
|
|
389
|
+
function _regeneratorKeys(e) {
|
|
390
|
+
var n = Object(e),
|
|
391
|
+
r = [];
|
|
392
|
+
for (var t in n) r.unshift(t);
|
|
393
|
+
return function e() {
|
|
394
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = false, e;
|
|
395
|
+
return e.done = true, e;
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
399
|
+
} (regeneratorKeys));
|
|
400
|
+
return regeneratorKeys.exports;
|
|
401
|
+
}
|
|
1207
402
|
|
|
1208
|
-
|
|
1209
|
-
var op = exports.operation(options);
|
|
1210
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
1211
|
-
var callback = args.pop();
|
|
403
|
+
var regeneratorValues = {exports: {}};
|
|
1212
404
|
|
|
1213
|
-
|
|
1214
|
-
if (op.retry(err)) {
|
|
1215
|
-
return;
|
|
1216
|
-
}
|
|
1217
|
-
if (err) {
|
|
1218
|
-
arguments[0] = op.mainError();
|
|
1219
|
-
}
|
|
1220
|
-
callback.apply(this, arguments);
|
|
1221
|
-
});
|
|
1222
|
-
|
|
1223
|
-
op.attempt(function() {
|
|
1224
|
-
original.apply(obj, args);
|
|
1225
|
-
});
|
|
1226
|
-
}.bind(obj, original);
|
|
1227
|
-
obj[method].options = options;
|
|
1228
|
-
}
|
|
1229
|
-
};
|
|
1230
|
-
});
|
|
405
|
+
var _typeof = {exports: {}};
|
|
1231
406
|
|
|
1232
|
-
var
|
|
407
|
+
var hasRequired_typeof;
|
|
1233
408
|
|
|
1234
|
-
|
|
409
|
+
function require_typeof () {
|
|
410
|
+
if (hasRequired_typeof) return _typeof.exports;
|
|
411
|
+
hasRequired_typeof = 1;
|
|
412
|
+
(function (module) {
|
|
413
|
+
function _typeof(o) {
|
|
414
|
+
"@babel/helpers - typeof";
|
|
1235
415
|
|
|
1236
|
-
|
|
1237
|
-
|
|
416
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
417
|
+
return typeof o;
|
|
418
|
+
} : function (o) {
|
|
419
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
420
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
421
|
+
}
|
|
422
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
423
|
+
} (_typeof));
|
|
424
|
+
return _typeof.exports;
|
|
1238
425
|
}
|
|
1239
426
|
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
427
|
+
var hasRequiredRegeneratorValues;
|
|
428
|
+
|
|
429
|
+
function requireRegeneratorValues () {
|
|
430
|
+
if (hasRequiredRegeneratorValues) return regeneratorValues.exports;
|
|
431
|
+
hasRequiredRegeneratorValues = 1;
|
|
432
|
+
(function (module) {
|
|
433
|
+
var _typeof = require_typeof()["default"];
|
|
434
|
+
function _regeneratorValues(e) {
|
|
435
|
+
if (null != e) {
|
|
436
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
437
|
+
r = 0;
|
|
438
|
+
if (t) return t.call(e);
|
|
439
|
+
if ("function" == typeof e.next) return e;
|
|
440
|
+
if (!isNaN(e.length)) return {
|
|
441
|
+
next: function next() {
|
|
442
|
+
return e && r >= e.length && (e = void 0), {
|
|
443
|
+
value: e && e[r++],
|
|
444
|
+
done: !e
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
450
|
+
}
|
|
451
|
+
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
452
|
+
} (regeneratorValues));
|
|
453
|
+
return regeneratorValues.exports;
|
|
454
|
+
}
|
|
1243
455
|
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
456
|
+
var hasRequiredRegeneratorRuntime;
|
|
457
|
+
|
|
458
|
+
function requireRegeneratorRuntime () {
|
|
459
|
+
if (hasRequiredRegeneratorRuntime) return regeneratorRuntime$1.exports;
|
|
460
|
+
hasRequiredRegeneratorRuntime = 1;
|
|
461
|
+
(function (module) {
|
|
462
|
+
var OverloadYield = requireOverloadYield();
|
|
463
|
+
var regenerator = requireRegenerator$1();
|
|
464
|
+
var regeneratorAsync = requireRegeneratorAsync();
|
|
465
|
+
var regeneratorAsyncGen = requireRegeneratorAsyncGen();
|
|
466
|
+
var regeneratorAsyncIterator = requireRegeneratorAsyncIterator();
|
|
467
|
+
var regeneratorKeys = requireRegeneratorKeys();
|
|
468
|
+
var regeneratorValues = requireRegeneratorValues();
|
|
469
|
+
function _regeneratorRuntime() {
|
|
470
|
+
|
|
471
|
+
var r = regenerator(),
|
|
472
|
+
e = r.m(_regeneratorRuntime),
|
|
473
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
474
|
+
function n(r) {
|
|
475
|
+
var e = "function" == typeof r && r.constructor;
|
|
476
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
477
|
+
}
|
|
478
|
+
var o = {
|
|
479
|
+
"throw": 1,
|
|
480
|
+
"return": 2,
|
|
481
|
+
"break": 3,
|
|
482
|
+
"continue": 3
|
|
483
|
+
};
|
|
484
|
+
function a(r) {
|
|
485
|
+
var e, t;
|
|
486
|
+
return function (n) {
|
|
487
|
+
e || (e = {
|
|
488
|
+
stop: function stop() {
|
|
489
|
+
return t(n.a, 2);
|
|
490
|
+
},
|
|
491
|
+
"catch": function _catch() {
|
|
492
|
+
return n.v;
|
|
493
|
+
},
|
|
494
|
+
abrupt: function abrupt(r, e) {
|
|
495
|
+
return t(n.a, o[r], e);
|
|
496
|
+
},
|
|
497
|
+
delegateYield: function delegateYield(r, o, a) {
|
|
498
|
+
return e.resultName = o, t(n.d, regeneratorValues(r), a);
|
|
499
|
+
},
|
|
500
|
+
finish: function finish(r) {
|
|
501
|
+
return t(n.f, r);
|
|
502
|
+
}
|
|
503
|
+
}, t = function t(r, _t, o) {
|
|
504
|
+
n.p = e.prev, n.n = e.next;
|
|
505
|
+
try {
|
|
506
|
+
return r(_t, o);
|
|
507
|
+
} finally {
|
|
508
|
+
e.next = n.n;
|
|
509
|
+
}
|
|
510
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
511
|
+
try {
|
|
512
|
+
return r.call(this, e);
|
|
513
|
+
} finally {
|
|
514
|
+
n.p = e.prev, n.n = e.next;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
519
|
+
return {
|
|
520
|
+
wrap: function wrap(e, t, n, o) {
|
|
521
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
522
|
+
},
|
|
523
|
+
isGeneratorFunction: n,
|
|
524
|
+
mark: r.m,
|
|
525
|
+
awrap: function awrap(r, e) {
|
|
526
|
+
return new OverloadYield(r, e);
|
|
527
|
+
},
|
|
528
|
+
AsyncIterator: regeneratorAsyncIterator,
|
|
529
|
+
async: function async(r, e, t, o, u) {
|
|
530
|
+
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
|
|
531
|
+
},
|
|
532
|
+
keys: regeneratorKeys,
|
|
533
|
+
values: regeneratorValues
|
|
534
|
+
};
|
|
535
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
536
|
+
}
|
|
537
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
538
|
+
} (regeneratorRuntime$1));
|
|
539
|
+
return regeneratorRuntime$1.exports;
|
|
540
|
+
}
|
|
1250
541
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
reject(err);
|
|
1275
|
-
});
|
|
1276
|
-
});
|
|
1277
|
-
});
|
|
542
|
+
var regenerator;
|
|
543
|
+
var hasRequiredRegenerator;
|
|
544
|
+
|
|
545
|
+
function requireRegenerator () {
|
|
546
|
+
if (hasRequiredRegenerator) return regenerator;
|
|
547
|
+
hasRequiredRegenerator = 1;
|
|
548
|
+
// TODO(Babel 8): Remove this file.
|
|
549
|
+
|
|
550
|
+
var runtime = requireRegeneratorRuntime()();
|
|
551
|
+
regenerator = runtime;
|
|
552
|
+
|
|
553
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
554
|
+
try {
|
|
555
|
+
regeneratorRuntime = runtime;
|
|
556
|
+
} catch (accidentalStrictMode) {
|
|
557
|
+
if (typeof globalThis === "object") {
|
|
558
|
+
globalThis.regeneratorRuntime = runtime;
|
|
559
|
+
} else {
|
|
560
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return regenerator;
|
|
1278
564
|
}
|
|
1279
565
|
|
|
1280
|
-
var
|
|
566
|
+
var regeneratorExports = requireRegenerator();
|
|
567
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regeneratorExports);
|
|
568
|
+
|
|
569
|
+
var browser = {exports: {}};
|
|
1281
570
|
|
|
1282
571
|
/*globals self, window */
|
|
1283
|
-
|
|
572
|
+
var hasRequiredBrowser;
|
|
573
|
+
function requireBrowser() {
|
|
574
|
+
if (hasRequiredBrowser) return browser.exports;
|
|
575
|
+
hasRequiredBrowser = 1;
|
|
1284
576
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
undefined,
|
|
577
|
+
/*eslint-disable @mysticatea/prettier */
|
|
578
|
+
var _ref = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : /* otherwise */undefined,
|
|
1288
579
|
AbortController = _ref.AbortController,
|
|
1289
580
|
AbortSignal = _ref.AbortSignal;
|
|
1290
|
-
|
|
581
|
+
/*eslint-enable @mysticatea/prettier */
|
|
1291
582
|
|
|
583
|
+
browser.exports = AbortController;
|
|
584
|
+
browser.exports.AbortSignal = AbortSignal;
|
|
585
|
+
browser.exports["default"] = AbortController;
|
|
586
|
+
return browser.exports;
|
|
587
|
+
}
|
|
1292
588
|
|
|
1293
|
-
var
|
|
1294
|
-
var
|
|
1295
|
-
var _default = AbortController;
|
|
1296
|
-
browser.AbortSignal = AbortSignal_1;
|
|
1297
|
-
browser["default"] = _default;
|
|
589
|
+
var browserExports = requireBrowser();
|
|
590
|
+
var AbortController = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
|
1298
591
|
|
|
1299
592
|
/**
|
|
1300
593
|
* @param { Promise } promise
|
|
@@ -1312,6 +605,401 @@
|
|
|
1312
605
|
});
|
|
1313
606
|
}
|
|
1314
607
|
|
|
608
|
+
var errCode;
|
|
609
|
+
var hasRequiredErrCode;
|
|
610
|
+
function requireErrCode() {
|
|
611
|
+
if (hasRequiredErrCode) return errCode;
|
|
612
|
+
hasRequiredErrCode = 1;
|
|
613
|
+
function assign(obj, props) {
|
|
614
|
+
for (var key in props) {
|
|
615
|
+
Object.defineProperty(obj, key, {
|
|
616
|
+
value: props[key],
|
|
617
|
+
enumerable: true,
|
|
618
|
+
configurable: true
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
return obj;
|
|
622
|
+
}
|
|
623
|
+
function createError(err, code, props) {
|
|
624
|
+
if (!err || typeof err === 'string') {
|
|
625
|
+
throw new TypeError('Please pass an Error to err-code');
|
|
626
|
+
}
|
|
627
|
+
if (!props) {
|
|
628
|
+
props = {};
|
|
629
|
+
}
|
|
630
|
+
if (_typeof$1(code) === 'object') {
|
|
631
|
+
props = code;
|
|
632
|
+
code = undefined;
|
|
633
|
+
}
|
|
634
|
+
if (code != null) {
|
|
635
|
+
props.code = code;
|
|
636
|
+
}
|
|
637
|
+
try {
|
|
638
|
+
return assign(err, props);
|
|
639
|
+
} catch (_) {
|
|
640
|
+
props.message = err.message;
|
|
641
|
+
props.stack = err.stack;
|
|
642
|
+
var ErrClass = function ErrClass() {};
|
|
643
|
+
ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
|
|
644
|
+
return assign(new ErrClass(), props);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
errCode = createError;
|
|
648
|
+
return errCode;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
var retry$1 = {};
|
|
652
|
+
|
|
653
|
+
var retry_operation;
|
|
654
|
+
var hasRequiredRetry_operation;
|
|
655
|
+
|
|
656
|
+
function requireRetry_operation () {
|
|
657
|
+
if (hasRequiredRetry_operation) return retry_operation;
|
|
658
|
+
hasRequiredRetry_operation = 1;
|
|
659
|
+
function RetryOperation(timeouts, options) {
|
|
660
|
+
// Compatibility for the old (timeouts, retryForever) signature
|
|
661
|
+
if (typeof options === 'boolean') {
|
|
662
|
+
options = { forever: options };
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
666
|
+
this._timeouts = timeouts;
|
|
667
|
+
this._options = options || {};
|
|
668
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
669
|
+
this._fn = null;
|
|
670
|
+
this._errors = [];
|
|
671
|
+
this._attempts = 1;
|
|
672
|
+
this._operationTimeout = null;
|
|
673
|
+
this._operationTimeoutCb = null;
|
|
674
|
+
this._timeout = null;
|
|
675
|
+
this._operationStart = null;
|
|
676
|
+
|
|
677
|
+
if (this._options.forever) {
|
|
678
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
retry_operation = RetryOperation;
|
|
682
|
+
|
|
683
|
+
RetryOperation.prototype.reset = function() {
|
|
684
|
+
this._attempts = 1;
|
|
685
|
+
this._timeouts = this._originalTimeouts;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
RetryOperation.prototype.stop = function() {
|
|
689
|
+
if (this._timeout) {
|
|
690
|
+
clearTimeout(this._timeout);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
this._timeouts = [];
|
|
694
|
+
this._cachedTimeouts = null;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
RetryOperation.prototype.retry = function(err) {
|
|
698
|
+
if (this._timeout) {
|
|
699
|
+
clearTimeout(this._timeout);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
if (!err) {
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
var currentTime = new Date().getTime();
|
|
706
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
707
|
+
this._errors.unshift(new Error('RetryOperation timeout occurred'));
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
this._errors.push(err);
|
|
712
|
+
|
|
713
|
+
var timeout = this._timeouts.shift();
|
|
714
|
+
if (timeout === undefined) {
|
|
715
|
+
if (this._cachedTimeouts) {
|
|
716
|
+
// retry forever, only keep last error
|
|
717
|
+
this._errors.splice(this._errors.length - 1, this._errors.length);
|
|
718
|
+
this._timeouts = this._cachedTimeouts.slice(0);
|
|
719
|
+
timeout = this._timeouts.shift();
|
|
720
|
+
} else {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
var self = this;
|
|
726
|
+
var timer = setTimeout(function() {
|
|
727
|
+
self._attempts++;
|
|
728
|
+
|
|
729
|
+
if (self._operationTimeoutCb) {
|
|
730
|
+
self._timeout = setTimeout(function() {
|
|
731
|
+
self._operationTimeoutCb(self._attempts);
|
|
732
|
+
}, self._operationTimeout);
|
|
733
|
+
|
|
734
|
+
if (self._options.unref) {
|
|
735
|
+
self._timeout.unref();
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
self._fn(self._attempts);
|
|
740
|
+
}, timeout);
|
|
741
|
+
|
|
742
|
+
if (this._options.unref) {
|
|
743
|
+
timer.unref();
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
return true;
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
750
|
+
this._fn = fn;
|
|
751
|
+
|
|
752
|
+
if (timeoutOps) {
|
|
753
|
+
if (timeoutOps.timeout) {
|
|
754
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
755
|
+
}
|
|
756
|
+
if (timeoutOps.cb) {
|
|
757
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
var self = this;
|
|
762
|
+
if (this._operationTimeoutCb) {
|
|
763
|
+
this._timeout = setTimeout(function() {
|
|
764
|
+
self._operationTimeoutCb();
|
|
765
|
+
}, self._operationTimeout);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
this._operationStart = new Date().getTime();
|
|
769
|
+
|
|
770
|
+
this._fn(this._attempts);
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
RetryOperation.prototype.try = function(fn) {
|
|
774
|
+
console.log('Using RetryOperation.try() is deprecated');
|
|
775
|
+
this.attempt(fn);
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
RetryOperation.prototype.start = function(fn) {
|
|
779
|
+
console.log('Using RetryOperation.start() is deprecated');
|
|
780
|
+
this.attempt(fn);
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
784
|
+
|
|
785
|
+
RetryOperation.prototype.errors = function() {
|
|
786
|
+
return this._errors;
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
RetryOperation.prototype.attempts = function() {
|
|
790
|
+
return this._attempts;
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
RetryOperation.prototype.mainError = function() {
|
|
794
|
+
if (this._errors.length === 0) {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
var counts = {};
|
|
799
|
+
var mainError = null;
|
|
800
|
+
var mainErrorCount = 0;
|
|
801
|
+
|
|
802
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
803
|
+
var error = this._errors[i];
|
|
804
|
+
var message = error.message;
|
|
805
|
+
var count = (counts[message] || 0) + 1;
|
|
806
|
+
|
|
807
|
+
counts[message] = count;
|
|
808
|
+
|
|
809
|
+
if (count >= mainErrorCount) {
|
|
810
|
+
mainError = error;
|
|
811
|
+
mainErrorCount = count;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return mainError;
|
|
816
|
+
};
|
|
817
|
+
return retry_operation;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
var hasRequiredRetry$1;
|
|
821
|
+
|
|
822
|
+
function requireRetry$1 () {
|
|
823
|
+
if (hasRequiredRetry$1) return retry$1;
|
|
824
|
+
hasRequiredRetry$1 = 1;
|
|
825
|
+
(function (exports) {
|
|
826
|
+
var RetryOperation = requireRetry_operation();
|
|
827
|
+
|
|
828
|
+
exports.operation = function(options) {
|
|
829
|
+
var timeouts = exports.timeouts(options);
|
|
830
|
+
return new RetryOperation(timeouts, {
|
|
831
|
+
forever: options && options.forever,
|
|
832
|
+
unref: options && options.unref,
|
|
833
|
+
maxRetryTime: options && options.maxRetryTime
|
|
834
|
+
});
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
exports.timeouts = function(options) {
|
|
838
|
+
if (options instanceof Array) {
|
|
839
|
+
return [].concat(options);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
var opts = {
|
|
843
|
+
retries: 10,
|
|
844
|
+
factor: 2,
|
|
845
|
+
minTimeout: 1 * 1000,
|
|
846
|
+
maxTimeout: Infinity,
|
|
847
|
+
randomize: false
|
|
848
|
+
};
|
|
849
|
+
for (var key in options) {
|
|
850
|
+
opts[key] = options[key];
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
854
|
+
throw new Error('minTimeout is greater than maxTimeout');
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
var timeouts = [];
|
|
858
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
859
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
if (options && options.forever && !timeouts.length) {
|
|
863
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// sort the array numerically ascending
|
|
867
|
+
timeouts.sort(function(a,b) {
|
|
868
|
+
return a - b;
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
return timeouts;
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
exports.createTimeout = function(attempt, opts) {
|
|
875
|
+
var random = (opts.randomize)
|
|
876
|
+
? (Math.random() + 1)
|
|
877
|
+
: 1;
|
|
878
|
+
|
|
879
|
+
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
|
880
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
881
|
+
|
|
882
|
+
return timeout;
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
exports.wrap = function(obj, options, methods) {
|
|
886
|
+
if (options instanceof Array) {
|
|
887
|
+
methods = options;
|
|
888
|
+
options = null;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
if (!methods) {
|
|
892
|
+
methods = [];
|
|
893
|
+
for (var key in obj) {
|
|
894
|
+
if (typeof obj[key] === 'function') {
|
|
895
|
+
methods.push(key);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
for (var i = 0; i < methods.length; i++) {
|
|
901
|
+
var method = methods[i];
|
|
902
|
+
var original = obj[method];
|
|
903
|
+
|
|
904
|
+
obj[method] = function retryWrapper(original) {
|
|
905
|
+
var op = exports.operation(options);
|
|
906
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
907
|
+
var callback = args.pop();
|
|
908
|
+
|
|
909
|
+
args.push(function(err) {
|
|
910
|
+
if (op.retry(err)) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
if (err) {
|
|
914
|
+
arguments[0] = op.mainError();
|
|
915
|
+
}
|
|
916
|
+
callback.apply(this, arguments);
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
op.attempt(function() {
|
|
920
|
+
original.apply(obj, args);
|
|
921
|
+
});
|
|
922
|
+
}.bind(obj, original);
|
|
923
|
+
obj[method].options = options;
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
} (retry$1));
|
|
927
|
+
return retry$1;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
var retry;
|
|
931
|
+
var hasRequiredRetry;
|
|
932
|
+
|
|
933
|
+
function requireRetry () {
|
|
934
|
+
if (hasRequiredRetry) return retry;
|
|
935
|
+
hasRequiredRetry = 1;
|
|
936
|
+
retry = requireRetry$1();
|
|
937
|
+
return retry;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
var promiseRetry_1;
|
|
941
|
+
var hasRequiredPromiseRetry;
|
|
942
|
+
|
|
943
|
+
function requirePromiseRetry () {
|
|
944
|
+
if (hasRequiredPromiseRetry) return promiseRetry_1;
|
|
945
|
+
hasRequiredPromiseRetry = 1;
|
|
946
|
+
|
|
947
|
+
var errcode = requireErrCode();
|
|
948
|
+
var retry = requireRetry();
|
|
949
|
+
|
|
950
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
951
|
+
|
|
952
|
+
function isRetryError(err) {
|
|
953
|
+
return err && err.code === 'EPROMISERETRY' && hasOwn.call(err, 'retried');
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function promiseRetry(fn, options) {
|
|
957
|
+
var temp;
|
|
958
|
+
var operation;
|
|
959
|
+
|
|
960
|
+
if (typeof fn === 'object' && typeof options === 'function') {
|
|
961
|
+
// Swap options and fn when using alternate signature (options, fn)
|
|
962
|
+
temp = options;
|
|
963
|
+
options = fn;
|
|
964
|
+
fn = temp;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
operation = retry.operation(options);
|
|
968
|
+
|
|
969
|
+
return new Promise(function (resolve, reject) {
|
|
970
|
+
operation.attempt(function (number) {
|
|
971
|
+
Promise.resolve()
|
|
972
|
+
.then(function () {
|
|
973
|
+
return fn(function (err) {
|
|
974
|
+
if (isRetryError(err)) {
|
|
975
|
+
err = err.retried;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
throw errcode(new Error('Retrying'), 'EPROMISERETRY', { retried: err });
|
|
979
|
+
}, number);
|
|
980
|
+
})
|
|
981
|
+
.then(resolve, function (err) {
|
|
982
|
+
if (isRetryError(err)) {
|
|
983
|
+
err = err.retried;
|
|
984
|
+
|
|
985
|
+
if (operation.retry(err || new Error())) {
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
reject(err);
|
|
991
|
+
});
|
|
992
|
+
});
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
promiseRetry_1 = promiseRetry;
|
|
997
|
+
return promiseRetry_1;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
var promiseRetryExports = requirePromiseRetry();
|
|
1001
|
+
var promiseRetry = /*@__PURE__*/getDefaultExportFromCjs(promiseRetryExports);
|
|
1002
|
+
|
|
1315
1003
|
var fetchDefaults = {
|
|
1316
1004
|
// The timeout to apply to requests that do not supply a timeout option
|
|
1317
1005
|
timeout: 60 * 1000,
|
|
@@ -1324,91 +1012,111 @@
|
|
|
1324
1012
|
// Do retry function to examine failures and apply custom retry logic
|
|
1325
1013
|
// return true to retry the fetch call
|
|
1326
1014
|
doRetry: function () {
|
|
1327
|
-
var _doRetry = _asyncToGenerator(
|
|
1015
|
+
var _doRetry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(attempt, res, _ref) {
|
|
1328
1016
|
var url, options, _options$retry, retry, counter;
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
return _context.abrupt("return", true);
|
|
1353
|
-
|
|
1354
|
-
case 7:
|
|
1355
|
-
return _context.abrupt("return", false);
|
|
1356
|
-
|
|
1357
|
-
case 8:
|
|
1358
|
-
case "end":
|
|
1359
|
-
return _context.stop();
|
|
1360
|
-
}
|
|
1017
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
1018
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1019
|
+
case 0:
|
|
1020
|
+
url = _ref.url, options = _ref.options;
|
|
1021
|
+
// Get the retry policy from options or fetchDefaults
|
|
1022
|
+
_options$retry = options.retry, retry = _options$retry === void 0 ? fetchDefaults.retry : _options$retry;
|
|
1023
|
+
if (!(attempt <= retry.retries)) {
|
|
1024
|
+
_context.next = 1;
|
|
1025
|
+
break;
|
|
1026
|
+
}
|
|
1027
|
+
counter = "".concat(attempt, "/").concat(retry.retries); // Retry request on any network error,
|
|
1028
|
+
// or 4xx or 5xx status codes. No retry on 404
|
|
1029
|
+
if (!(!res.status || res.status >= 400 && res.status !== 404)) {
|
|
1030
|
+
_context.next = 1;
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
if ('message' in res) console.warn("[fetch] Attempt ".concat(counter, " ").concat(res.name, ": ").concat(res.message, " ").concat(url));else console.warn("[fetch] Attempt ".concat(counter, " ").concat(res.status, ": ").concat(res.statusText, " ").concat(url));
|
|
1034
|
+
return _context.abrupt("return", true);
|
|
1035
|
+
case 1:
|
|
1036
|
+
return _context.abrupt("return", false);
|
|
1037
|
+
case 2:
|
|
1038
|
+
case "end":
|
|
1039
|
+
return _context.stop();
|
|
1361
1040
|
}
|
|
1362
1041
|
}, _callee);
|
|
1363
1042
|
}));
|
|
1364
|
-
|
|
1365
1043
|
function doRetry(_x, _x2, _x3) {
|
|
1366
1044
|
return _doRetry.apply(this, arguments);
|
|
1367
1045
|
}
|
|
1368
|
-
|
|
1369
1046
|
return doRetry;
|
|
1370
1047
|
}()
|
|
1371
1048
|
};
|
|
1372
1049
|
|
|
1050
|
+
var isClient = function isClient() {
|
|
1051
|
+
return typeof window !== 'undefined';
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
var resolveFetch = /*#__PURE__*/function () {
|
|
1055
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
1056
|
+
var nodeFetch;
|
|
1057
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
1058
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1059
|
+
case 0:
|
|
1060
|
+
if (!isClient()) {
|
|
1061
|
+
_context.next = 1;
|
|
1062
|
+
break;
|
|
1063
|
+
}
|
|
1064
|
+
return _context.abrupt("return", window.fetch);
|
|
1065
|
+
case 1:
|
|
1066
|
+
if (!(typeof globalThis.fetch === 'function')) {
|
|
1067
|
+
_context.next = 2;
|
|
1068
|
+
break;
|
|
1069
|
+
}
|
|
1070
|
+
return _context.abrupt("return", globalThis.fetch);
|
|
1071
|
+
case 2:
|
|
1072
|
+
_context.next = 3;
|
|
1073
|
+
return ('node-fetch');
|
|
1074
|
+
case 3:
|
|
1075
|
+
nodeFetch = _context.sent;
|
|
1076
|
+
return _context.abrupt("return", nodeFetch["default"]);
|
|
1077
|
+
case 4:
|
|
1078
|
+
case "end":
|
|
1079
|
+
return _context.stop();
|
|
1080
|
+
}
|
|
1081
|
+
}, _callee);
|
|
1082
|
+
}));
|
|
1083
|
+
return function resolveFetch() {
|
|
1084
|
+
return _ref.apply(this, arguments);
|
|
1085
|
+
};
|
|
1086
|
+
}();
|
|
1087
|
+
|
|
1373
1088
|
// Setting http_proxy in env will inject a proxy agent header and disable certificate verification
|
|
1374
1089
|
var proxyAgent = /*#__PURE__*/function () {
|
|
1375
|
-
var _ref = _asyncToGenerator(
|
|
1090
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
1376
1091
|
var proxyUri, _yield$import, HttpsProxyAgent;
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
return _context.abrupt("return", {});
|
|
1403
|
-
|
|
1404
|
-
case 9:
|
|
1405
|
-
case "end":
|
|
1406
|
-
return _context.stop();
|
|
1407
|
-
}
|
|
1092
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
1093
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1094
|
+
case 0:
|
|
1095
|
+
proxyUri = !isClient() && typeof process !== 'undefined' && process.env.http_proxy || false;
|
|
1096
|
+
if (!proxyUri) {
|
|
1097
|
+
_context.next = 2;
|
|
1098
|
+
break;
|
|
1099
|
+
}
|
|
1100
|
+
// console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
|
|
1101
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
1102
|
+
// NOTE: This uses the HttpsProxyAgent class from https-proxy-agent v7.x
|
|
1103
|
+
// Will break in v8+ where only a default factory function is exported
|
|
1104
|
+
_context.next = 1;
|
|
1105
|
+
return ('https-proxy-agent');
|
|
1106
|
+
case 1:
|
|
1107
|
+
_yield$import = _context.sent;
|
|
1108
|
+
HttpsProxyAgent = _yield$import.HttpsProxyAgent;
|
|
1109
|
+
return _context.abrupt("return", {
|
|
1110
|
+
agent: new HttpsProxyAgent(proxyUri)
|
|
1111
|
+
});
|
|
1112
|
+
case 2:
|
|
1113
|
+
return _context.abrupt("return", {});
|
|
1114
|
+
case 3:
|
|
1115
|
+
case "end":
|
|
1116
|
+
return _context.stop();
|
|
1408
1117
|
}
|
|
1409
1118
|
}, _callee);
|
|
1410
1119
|
}));
|
|
1411
|
-
|
|
1412
1120
|
return function proxyAgent() {
|
|
1413
1121
|
return _ref.apply(this, arguments);
|
|
1414
1122
|
};
|
|
@@ -1418,181 +1126,146 @@
|
|
|
1418
1126
|
return typeof func === 'function';
|
|
1419
1127
|
};
|
|
1420
1128
|
|
|
1421
|
-
var
|
|
1422
|
-
|
|
1423
|
-
};
|
|
1424
|
-
|
|
1425
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
1426
|
-
|
|
1427
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1428
|
-
var thisFetch = isClient() ? window.fetch : fetch__default['default'];
|
|
1429
|
-
|
|
1129
|
+
var _excluded = ["retry", "timeout", "doRetry"];
|
|
1130
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1131
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1430
1132
|
var fetchWithDefaults = function fetchWithDefaults() {
|
|
1431
1133
|
var fetchDefaults$1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fetchDefaults;
|
|
1432
|
-
|
|
1433
1134
|
// Fetch function using hoisted defaults wrapped in a promise
|
|
1434
1135
|
// retry function adhering to a default or supplied policy calling
|
|
1435
1136
|
// a doRetry function on each failure that requires a boolean return
|
|
1436
1137
|
var enterpriseFetch = /*#__PURE__*/function () {
|
|
1437
|
-
var _ref = _asyncToGenerator(
|
|
1138
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
|
|
1438
1139
|
var init,
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
_yield$to = _context.sent;
|
|
1487
|
-
_yield$to2 = _slicedToArray(_yield$to, 2);
|
|
1488
|
-
error = _yield$to2[0];
|
|
1489
|
-
response = _yield$to2[1];
|
|
1490
|
-
|
|
1491
|
-
if (!error) {
|
|
1492
|
-
_context.next = 33;
|
|
1493
|
-
break;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
_context.t12 = isFunc(doRetry);
|
|
1497
|
-
|
|
1498
|
-
if (!_context.t12) {
|
|
1499
|
-
_context.next = 30;
|
|
1500
|
-
break;
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
_context.next = 29;
|
|
1504
|
-
return doRetry(attempt, error, {
|
|
1505
|
-
url: url,
|
|
1506
|
-
options: init
|
|
1507
|
-
});
|
|
1508
|
-
|
|
1509
|
-
case 29:
|
|
1510
|
-
_context.t12 = _context.sent;
|
|
1511
|
-
|
|
1512
|
-
case 30:
|
|
1513
|
-
if (!_context.t12) {
|
|
1514
|
-
_context.next = 32;
|
|
1515
|
-
break;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
retry(error);
|
|
1519
|
-
|
|
1520
|
-
case 32:
|
|
1521
|
-
throw error;
|
|
1522
|
-
|
|
1523
|
-
case 33:
|
|
1524
|
-
if (response.ok) {
|
|
1525
|
-
_context.next = 42;
|
|
1526
|
-
break;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
_context.t13 = isFunc(doRetry);
|
|
1530
|
-
|
|
1531
|
-
if (!_context.t13) {
|
|
1532
|
-
_context.next = 39;
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
_context.next = 38;
|
|
1537
|
-
return doRetry(attempt, response, {
|
|
1538
|
-
url: url,
|
|
1539
|
-
options: init
|
|
1540
|
-
});
|
|
1541
|
-
|
|
1542
|
-
case 38:
|
|
1543
|
-
_context.t13 = _context.sent;
|
|
1544
|
-
|
|
1545
|
-
case 39:
|
|
1546
|
-
if (!_context.t13) {
|
|
1547
|
-
_context.next = 41;
|
|
1548
|
-
break;
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
retry(response);
|
|
1552
|
-
|
|
1553
|
-
case 41:
|
|
1554
|
-
return _context.abrupt("return", response);
|
|
1555
|
-
|
|
1556
|
-
case 42:
|
|
1557
|
-
return _context.abrupt("return", response);
|
|
1558
|
-
|
|
1559
|
-
case 43:
|
|
1560
|
-
case "end":
|
|
1561
|
-
return _context.stop();
|
|
1140
|
+
thisFetch,
|
|
1141
|
+
fetchResponse,
|
|
1142
|
+
_args2 = arguments;
|
|
1143
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
1144
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1145
|
+
case 0:
|
|
1146
|
+
init = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
1147
|
+
_context2.next = 1;
|
|
1148
|
+
return resolveFetch();
|
|
1149
|
+
case 1:
|
|
1150
|
+
thisFetch = _context2.sent;
|
|
1151
|
+
_context2.next = 2;
|
|
1152
|
+
return promiseRetry(/*#__PURE__*/function () {
|
|
1153
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(retry, attempt) {
|
|
1154
|
+
var _init$retry, _init$timeout, rtimeout, _init$doRetry, doRetry, options, timeoutMs, controller, timeoutId, _yield$to, _yield$to2, error, response, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8;
|
|
1155
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
1156
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1157
|
+
case 0:
|
|
1158
|
+
_init$retry = init.retry, _init$retry === void 0 ? fetchDefaults$1.retry : _init$retry, _init$timeout = init.timeout, rtimeout = _init$timeout === void 0 ? fetchDefaults$1.timeout : _init$timeout, _init$doRetry = init.doRetry, doRetry = _init$doRetry === void 0 ? fetchDefaults$1.doRetry || fetchDefaults.doRetry : _init$doRetry, options = _objectWithoutProperties(init, _excluded);
|
|
1159
|
+
timeoutMs = rtimeout || fetchDefaults$1.timeout || 60 * 1000; // Abort signal pattern
|
|
1160
|
+
// Since v15.4.0 Node.js comes with AbortController out of the box
|
|
1161
|
+
controller = new AbortController();
|
|
1162
|
+
timeoutId = setTimeout(function () {
|
|
1163
|
+
controller.abort();
|
|
1164
|
+
}, timeoutMs); // Try fetching, wait for error or response
|
|
1165
|
+
_t = to;
|
|
1166
|
+
_t2 = thisFetch;
|
|
1167
|
+
_t3 = url;
|
|
1168
|
+
_t4 = _objectSpread;
|
|
1169
|
+
_t5 = _objectSpread;
|
|
1170
|
+
_t6 = _objectSpread({}, options);
|
|
1171
|
+
_context.next = 1;
|
|
1172
|
+
return proxyAgent();
|
|
1173
|
+
case 1:
|
|
1174
|
+
_context.next = 2;
|
|
1175
|
+
return _t(_t2(_t3, _t4(_t5(_t6, _context.sent), {}, {
|
|
1176
|
+
// The signal will recieve abort() after timeout elapsed
|
|
1177
|
+
signal: controller.signal
|
|
1178
|
+
})));
|
|
1179
|
+
case 2:
|
|
1180
|
+
_yield$to = _context.sent;
|
|
1181
|
+
_yield$to2 = _slicedToArray(_yield$to, 2);
|
|
1182
|
+
error = _yield$to2[0];
|
|
1183
|
+
response = _yield$to2[1];
|
|
1184
|
+
if (!error) {
|
|
1185
|
+
_context.next = 6;
|
|
1186
|
+
break;
|
|
1562
1187
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1188
|
+
clearTimeout(timeoutId);
|
|
1189
|
+
_t7 = isFunc(doRetry);
|
|
1190
|
+
if (!_t7) {
|
|
1191
|
+
_context.next = 4;
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
_context.next = 3;
|
|
1195
|
+
return doRetry(attempt, error, {
|
|
1196
|
+
url: url.toString(),
|
|
1197
|
+
options: init
|
|
1198
|
+
});
|
|
1199
|
+
case 3:
|
|
1200
|
+
_t7 = _context.sent;
|
|
1201
|
+
case 4:
|
|
1202
|
+
if (!_t7) {
|
|
1203
|
+
_context.next = 5;
|
|
1204
|
+
break;
|
|
1205
|
+
}
|
|
1206
|
+
retry(error);
|
|
1207
|
+
case 5:
|
|
1208
|
+
throw error;
|
|
1209
|
+
case 6:
|
|
1210
|
+
if (response.ok) {
|
|
1211
|
+
_context.next = 10;
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
clearTimeout(timeoutId);
|
|
1215
|
+
_t8 = isFunc(doRetry);
|
|
1216
|
+
if (!_t8) {
|
|
1217
|
+
_context.next = 8;
|
|
1218
|
+
break;
|
|
1219
|
+
}
|
|
1220
|
+
_context.next = 7;
|
|
1221
|
+
return doRetry(attempt, response, {
|
|
1222
|
+
url: url.toString(),
|
|
1223
|
+
options: init
|
|
1224
|
+
});
|
|
1225
|
+
case 7:
|
|
1226
|
+
_t8 = _context.sent;
|
|
1227
|
+
case 8:
|
|
1228
|
+
if (!_t8) {
|
|
1229
|
+
_context.next = 9;
|
|
1230
|
+
break;
|
|
1231
|
+
}
|
|
1232
|
+
retry(response);
|
|
1233
|
+
case 9:
|
|
1234
|
+
return _context.abrupt("return", response);
|
|
1235
|
+
case 10:
|
|
1236
|
+
clearTimeout(timeoutId);
|
|
1237
|
+
return _context.abrupt("return", response);
|
|
1238
|
+
case 11:
|
|
1239
|
+
case "end":
|
|
1240
|
+
return _context.stop();
|
|
1241
|
+
}
|
|
1242
|
+
}, _callee);
|
|
1243
|
+
}));
|
|
1244
|
+
return function (_x2, _x3) {
|
|
1245
|
+
return _ref2.apply(this, arguments);
|
|
1246
|
+
};
|
|
1247
|
+
}(), init.retry || fetchDefaults$1.retry);
|
|
1248
|
+
case 2:
|
|
1249
|
+
fetchResponse = _context2.sent;
|
|
1250
|
+
return _context2.abrupt("return", fetchResponse);
|
|
1251
|
+
case 3:
|
|
1252
|
+
case "end":
|
|
1253
|
+
return _context2.stop();
|
|
1580
1254
|
}
|
|
1581
1255
|
}, _callee2);
|
|
1582
1256
|
}));
|
|
1583
|
-
|
|
1584
1257
|
return function enterpriseFetch(_x) {
|
|
1585
1258
|
return _ref.apply(this, arguments);
|
|
1586
1259
|
};
|
|
1587
1260
|
}();
|
|
1588
|
-
|
|
1589
1261
|
return enterpriseFetch;
|
|
1590
1262
|
};
|
|
1591
|
-
var
|
|
1263
|
+
var fetch = fetchWithDefaults(fetchDefaults);
|
|
1592
1264
|
|
|
1593
|
-
exports.default =
|
|
1265
|
+
exports.default = fetch;
|
|
1266
|
+
exports.fetch = fetch;
|
|
1594
1267
|
exports.fetchWithDefaults = fetchWithDefaults;
|
|
1595
1268
|
|
|
1596
1269
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1597
1270
|
|
|
1598
|
-
}))
|
|
1271
|
+
}));
|