@vixoniccom/module-packager 2.10.2-test.7 → 2.10.2

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.
@@ -1,433 +0,0 @@
1
- (global["webpackChunk_vixoniccom_module_packager"] = global["webpackChunk_vixoniccom_module_packager"] || []).push([[371],{
2
-
3
- /***/ 61386:
4
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5
-
6
- var RetryOperation = __webpack_require__(83884);
7
-
8
- exports.operation = function(options) {
9
- var timeouts = exports.timeouts(options);
10
- return new RetryOperation(timeouts, {
11
- forever: options && (options.forever || options.retries === Infinity),
12
- unref: options && options.unref,
13
- maxRetryTime: options && options.maxRetryTime
14
- });
15
- };
16
-
17
- exports.timeouts = function(options) {
18
- if (options instanceof Array) {
19
- return [].concat(options);
20
- }
21
-
22
- var opts = {
23
- retries: 10,
24
- factor: 2,
25
- minTimeout: 1 * 1000,
26
- maxTimeout: Infinity,
27
- randomize: false
28
- };
29
- for (var key in options) {
30
- opts[key] = options[key];
31
- }
32
-
33
- if (opts.minTimeout > opts.maxTimeout) {
34
- throw new Error('minTimeout is greater than maxTimeout');
35
- }
36
-
37
- var timeouts = [];
38
- for (var i = 0; i < opts.retries; i++) {
39
- timeouts.push(this.createTimeout(i, opts));
40
- }
41
-
42
- if (options && options.forever && !timeouts.length) {
43
- timeouts.push(this.createTimeout(i, opts));
44
- }
45
-
46
- // sort the array numerically ascending
47
- timeouts.sort(function(a,b) {
48
- return a - b;
49
- });
50
-
51
- return timeouts;
52
- };
53
-
54
- exports.createTimeout = function(attempt, opts) {
55
- var random = (opts.randomize)
56
- ? (Math.random() + 1)
57
- : 1;
58
-
59
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
60
- timeout = Math.min(timeout, opts.maxTimeout);
61
-
62
- return timeout;
63
- };
64
-
65
- exports.wrap = function(obj, options, methods) {
66
- if (options instanceof Array) {
67
- methods = options;
68
- options = null;
69
- }
70
-
71
- if (!methods) {
72
- methods = [];
73
- for (var key in obj) {
74
- if (typeof obj[key] === 'function') {
75
- methods.push(key);
76
- }
77
- }
78
- }
79
-
80
- for (var i = 0; i < methods.length; i++) {
81
- var method = methods[i];
82
- var original = obj[method];
83
-
84
- obj[method] = function retryWrapper(original) {
85
- var op = exports.operation(options);
86
- var args = Array.prototype.slice.call(arguments, 1);
87
- var callback = args.pop();
88
-
89
- args.push(function(err) {
90
- if (op.retry(err)) {
91
- return;
92
- }
93
- if (err) {
94
- arguments[0] = op.mainError();
95
- }
96
- callback.apply(this, arguments);
97
- });
98
-
99
- op.attempt(function() {
100
- original.apply(obj, args);
101
- });
102
- }.bind(obj, original);
103
- obj[method].options = options;
104
- }
105
- };
106
-
107
-
108
- /***/ }),
109
-
110
- /***/ 69364:
111
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
112
-
113
- module.exports = __webpack_require__(61386);
114
-
115
- /***/ }),
116
-
117
- /***/ 82371:
118
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
119
-
120
- "use strict";
121
- // ESM COMPAT FLAG
122
- __webpack_require__.r(__webpack_exports__);
123
-
124
- // EXPORTS
125
- __webpack_require__.d(__webpack_exports__, {
126
- AbortError: () => (/* binding */ AbortError),
127
- "default": () => (/* binding */ pRetry)
128
- });
129
-
130
- // EXTERNAL MODULE: ../../node_modules/retry/index.js
131
- var retry = __webpack_require__(69364);
132
- ;// ../../node_modules/is-network-error/index.js
133
- const objectToString = Object.prototype.toString;
134
-
135
- const isError = value => objectToString.call(value) === '[object Error]';
136
-
137
- const errorMessages = new Set([
138
- 'network error', // Chrome
139
- 'Failed to fetch', // Chrome
140
- 'NetworkError when attempting to fetch resource.', // Firefox
141
- 'The Internet connection appears to be offline.', // Safari 16
142
- 'Load failed', // Safari 17+
143
- 'Network request failed', // `cross-fetch`
144
- 'fetch failed', // Undici (Node.js)
145
- 'terminated', // Undici (Node.js)
146
- ]);
147
-
148
- function isNetworkError(error) {
149
- const isValid = error
150
- && isError(error)
151
- && error.name === 'TypeError'
152
- && typeof error.message === 'string';
153
-
154
- if (!isValid) {
155
- return false;
156
- }
157
-
158
- // We do an extra check for Safari 17+ as it has a very generic error message.
159
- // Network errors in Safari have no stack.
160
- if (error.message === 'Load failed') {
161
- return error.stack === undefined;
162
- }
163
-
164
- return errorMessages.has(error.message);
165
- }
166
-
167
- ;// ../../node_modules/p-retry/index.js
168
-
169
-
170
-
171
- class AbortError extends Error {
172
- constructor(message) {
173
- super();
174
-
175
- if (message instanceof Error) {
176
- this.originalError = message;
177
- ({message} = message);
178
- } else {
179
- this.originalError = new Error(message);
180
- this.originalError.stack = this.stack;
181
- }
182
-
183
- this.name = 'AbortError';
184
- this.message = message;
185
- }
186
- }
187
-
188
- const decorateErrorWithCounts = (error, attemptNumber, options) => {
189
- // Minus 1 from attemptNumber because the first attempt does not count as a retry
190
- const retriesLeft = options.retries - (attemptNumber - 1);
191
-
192
- error.attemptNumber = attemptNumber;
193
- error.retriesLeft = retriesLeft;
194
- return error;
195
- };
196
-
197
- async function pRetry(input, options) {
198
- return new Promise((resolve, reject) => {
199
- options = {...options};
200
- options.onFailedAttempt ??= () => {};
201
- options.shouldRetry ??= () => true;
202
- options.retries ??= 10;
203
-
204
- const operation = retry.operation(options);
205
-
206
- const abortHandler = () => {
207
- operation.stop();
208
- reject(options.signal?.reason);
209
- };
210
-
211
- if (options.signal && !options.signal.aborted) {
212
- options.signal.addEventListener('abort', abortHandler, {once: true});
213
- }
214
-
215
- const cleanUp = () => {
216
- options.signal?.removeEventListener('abort', abortHandler);
217
- operation.stop();
218
- };
219
-
220
- operation.attempt(async attemptNumber => {
221
- try {
222
- const result = await input(attemptNumber);
223
- cleanUp();
224
- resolve(result);
225
- } catch (error) {
226
- try {
227
- if (!(error instanceof Error)) {
228
- throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
229
- }
230
-
231
- if (error instanceof AbortError) {
232
- throw error.originalError;
233
- }
234
-
235
- if (error instanceof TypeError && !isNetworkError(error)) {
236
- throw error;
237
- }
238
-
239
- decorateErrorWithCounts(error, attemptNumber, options);
240
-
241
- if (!(await options.shouldRetry(error))) {
242
- operation.stop();
243
- reject(error);
244
- }
245
-
246
- await options.onFailedAttempt(error);
247
-
248
- if (!operation.retry(error)) {
249
- throw operation.mainError();
250
- }
251
- } catch (finalError) {
252
- decorateErrorWithCounts(finalError, attemptNumber, options);
253
- cleanUp();
254
- reject(finalError);
255
- }
256
- }
257
- });
258
- });
259
- }
260
-
261
-
262
- /***/ }),
263
-
264
- /***/ 83884:
265
- /***/ ((module) => {
266
-
267
- function RetryOperation(timeouts, options) {
268
- // Compatibility for the old (timeouts, retryForever) signature
269
- if (typeof options === 'boolean') {
270
- options = { forever: options };
271
- }
272
-
273
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
274
- this._timeouts = timeouts;
275
- this._options = options || {};
276
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
277
- this._fn = null;
278
- this._errors = [];
279
- this._attempts = 1;
280
- this._operationTimeout = null;
281
- this._operationTimeoutCb = null;
282
- this._timeout = null;
283
- this._operationStart = null;
284
- this._timer = null;
285
-
286
- if (this._options.forever) {
287
- this._cachedTimeouts = this._timeouts.slice(0);
288
- }
289
- }
290
- module.exports = RetryOperation;
291
-
292
- RetryOperation.prototype.reset = function() {
293
- this._attempts = 1;
294
- this._timeouts = this._originalTimeouts.slice(0);
295
- }
296
-
297
- RetryOperation.prototype.stop = function() {
298
- if (this._timeout) {
299
- clearTimeout(this._timeout);
300
- }
301
- if (this._timer) {
302
- clearTimeout(this._timer);
303
- }
304
-
305
- this._timeouts = [];
306
- this._cachedTimeouts = null;
307
- };
308
-
309
- RetryOperation.prototype.retry = function(err) {
310
- if (this._timeout) {
311
- clearTimeout(this._timeout);
312
- }
313
-
314
- if (!err) {
315
- return false;
316
- }
317
- var currentTime = new Date().getTime();
318
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
319
- this._errors.push(err);
320
- this._errors.unshift(new Error('RetryOperation timeout occurred'));
321
- return false;
322
- }
323
-
324
- this._errors.push(err);
325
-
326
- var timeout = this._timeouts.shift();
327
- if (timeout === undefined) {
328
- if (this._cachedTimeouts) {
329
- // retry forever, only keep last error
330
- this._errors.splice(0, this._errors.length - 1);
331
- timeout = this._cachedTimeouts.slice(-1);
332
- } else {
333
- return false;
334
- }
335
- }
336
-
337
- var self = this;
338
- this._timer = setTimeout(function() {
339
- self._attempts++;
340
-
341
- if (self._operationTimeoutCb) {
342
- self._timeout = setTimeout(function() {
343
- self._operationTimeoutCb(self._attempts);
344
- }, self._operationTimeout);
345
-
346
- if (self._options.unref) {
347
- self._timeout.unref();
348
- }
349
- }
350
-
351
- self._fn(self._attempts);
352
- }, timeout);
353
-
354
- if (this._options.unref) {
355
- this._timer.unref();
356
- }
357
-
358
- return true;
359
- };
360
-
361
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
362
- this._fn = fn;
363
-
364
- if (timeoutOps) {
365
- if (timeoutOps.timeout) {
366
- this._operationTimeout = timeoutOps.timeout;
367
- }
368
- if (timeoutOps.cb) {
369
- this._operationTimeoutCb = timeoutOps.cb;
370
- }
371
- }
372
-
373
- var self = this;
374
- if (this._operationTimeoutCb) {
375
- this._timeout = setTimeout(function() {
376
- self._operationTimeoutCb();
377
- }, self._operationTimeout);
378
- }
379
-
380
- this._operationStart = new Date().getTime();
381
-
382
- this._fn(this._attempts);
383
- };
384
-
385
- RetryOperation.prototype.try = function(fn) {
386
- console.log('Using RetryOperation.try() is deprecated');
387
- this.attempt(fn);
388
- };
389
-
390
- RetryOperation.prototype.start = function(fn) {
391
- console.log('Using RetryOperation.start() is deprecated');
392
- this.attempt(fn);
393
- };
394
-
395
- RetryOperation.prototype.start = RetryOperation.prototype.try;
396
-
397
- RetryOperation.prototype.errors = function() {
398
- return this._errors;
399
- };
400
-
401
- RetryOperation.prototype.attempts = function() {
402
- return this._attempts;
403
- };
404
-
405
- RetryOperation.prototype.mainError = function() {
406
- if (this._errors.length === 0) {
407
- return null;
408
- }
409
-
410
- var counts = {};
411
- var mainError = null;
412
- var mainErrorCount = 0;
413
-
414
- for (var i = 0; i < this._errors.length; i++) {
415
- var error = this._errors[i];
416
- var message = error.message;
417
- var count = (counts[message] || 0) + 1;
418
-
419
- counts[message] = count;
420
-
421
- if (count >= mainErrorCount) {
422
- mainError = error;
423
- mainErrorCount = count;
424
- }
425
- }
426
-
427
- return mainError;
428
- };
429
-
430
-
431
- /***/ })
432
-
433
- }]);