@uniformdev/next-app-router 20.70.1-alpha.10 → 20.70.1-alpha.6
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/cache.js +494 -570
- package/dist/cache.mjs +494 -570
- package/dist/component.js +366 -0
- package/dist/component.mjs +366 -0
- package/dist/handler.js +507 -583
- package/dist/handler.mjs +507 -583
- package/dist/index.esm.js +538 -607
- package/dist/index.js +548 -617
- package/dist/index.mjs +538 -607
- package/dist/middleware.js +471 -524
- package/dist/middleware.mjs +471 -524
- package/package.json +8 -8
package/dist/middleware.js
CHANGED
|
@@ -8,7 +8,6 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
8
8
|
var __typeError = (msg) => {
|
|
9
9
|
throw TypeError(msg);
|
|
10
10
|
};
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
11
|
var __commonJS = (cb, mod) => function __require() {
|
|
13
12
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
13
|
};
|
|
@@ -33,25 +32,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
32
|
mod
|
|
34
33
|
));
|
|
35
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
35
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
38
36
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
39
37
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
40
38
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
41
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
42
|
-
set _(value) {
|
|
43
|
-
__privateSet(obj, member, value, setter);
|
|
44
|
-
},
|
|
45
|
-
get _() {
|
|
46
|
-
return __privateGet(obj, member, getter);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
39
|
|
|
50
40
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
51
41
|
var require_yocto_queue = __commonJS({
|
|
52
42
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
53
43
|
"use strict";
|
|
54
|
-
var
|
|
44
|
+
var Node = class {
|
|
55
45
|
/// value;
|
|
56
46
|
/// next;
|
|
57
47
|
constructor(value) {
|
|
@@ -59,7 +49,7 @@ var require_yocto_queue = __commonJS({
|
|
|
59
49
|
this.next = void 0;
|
|
60
50
|
}
|
|
61
51
|
};
|
|
62
|
-
var
|
|
52
|
+
var Queue = class {
|
|
63
53
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
64
54
|
// #_head;
|
|
65
55
|
// #_tail;
|
|
@@ -68,7 +58,7 @@ var require_yocto_queue = __commonJS({
|
|
|
68
58
|
this.clear();
|
|
69
59
|
}
|
|
70
60
|
enqueue(value) {
|
|
71
|
-
const node = new
|
|
61
|
+
const node = new Node(value);
|
|
72
62
|
if (this._head) {
|
|
73
63
|
this._tail.next = node;
|
|
74
64
|
this._tail = node;
|
|
@@ -103,7 +93,7 @@ var require_yocto_queue = __commonJS({
|
|
|
103
93
|
}
|
|
104
94
|
}
|
|
105
95
|
};
|
|
106
|
-
module2.exports =
|
|
96
|
+
module2.exports = Queue;
|
|
107
97
|
}
|
|
108
98
|
});
|
|
109
99
|
|
|
@@ -111,12 +101,12 @@ var require_yocto_queue = __commonJS({
|
|
|
111
101
|
var require_p_limit = __commonJS({
|
|
112
102
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
113
103
|
"use strict";
|
|
114
|
-
var
|
|
115
|
-
var
|
|
104
|
+
var Queue = require_yocto_queue();
|
|
105
|
+
var pLimit2 = (concurrency) => {
|
|
116
106
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
117
107
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
118
108
|
}
|
|
119
|
-
const queue = new
|
|
109
|
+
const queue = new Queue();
|
|
120
110
|
let activeCount = 0;
|
|
121
111
|
const next = () => {
|
|
122
112
|
activeCount--;
|
|
@@ -161,238 +151,7 @@ var require_p_limit = __commonJS({
|
|
|
161
151
|
});
|
|
162
152
|
return generator;
|
|
163
153
|
};
|
|
164
|
-
module2.exports =
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
169
|
-
var require_retry_operation = __commonJS({
|
|
170
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
171
|
-
"use strict";
|
|
172
|
-
function RetryOperation(timeouts, options) {
|
|
173
|
-
if (typeof options === "boolean") {
|
|
174
|
-
options = { forever: options };
|
|
175
|
-
}
|
|
176
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
177
|
-
this._timeouts = timeouts;
|
|
178
|
-
this._options = options || {};
|
|
179
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
180
|
-
this._fn = null;
|
|
181
|
-
this._errors = [];
|
|
182
|
-
this._attempts = 1;
|
|
183
|
-
this._operationTimeout = null;
|
|
184
|
-
this._operationTimeoutCb = null;
|
|
185
|
-
this._timeout = null;
|
|
186
|
-
this._operationStart = null;
|
|
187
|
-
this._timer = null;
|
|
188
|
-
if (this._options.forever) {
|
|
189
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
module2.exports = RetryOperation;
|
|
193
|
-
RetryOperation.prototype.reset = function() {
|
|
194
|
-
this._attempts = 1;
|
|
195
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
196
|
-
};
|
|
197
|
-
RetryOperation.prototype.stop = function() {
|
|
198
|
-
if (this._timeout) {
|
|
199
|
-
clearTimeout(this._timeout);
|
|
200
|
-
}
|
|
201
|
-
if (this._timer) {
|
|
202
|
-
clearTimeout(this._timer);
|
|
203
|
-
}
|
|
204
|
-
this._timeouts = [];
|
|
205
|
-
this._cachedTimeouts = null;
|
|
206
|
-
};
|
|
207
|
-
RetryOperation.prototype.retry = function(err) {
|
|
208
|
-
if (this._timeout) {
|
|
209
|
-
clearTimeout(this._timeout);
|
|
210
|
-
}
|
|
211
|
-
if (!err) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
215
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
216
|
-
this._errors.push(err);
|
|
217
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
this._errors.push(err);
|
|
221
|
-
var timeout = this._timeouts.shift();
|
|
222
|
-
if (timeout === void 0) {
|
|
223
|
-
if (this._cachedTimeouts) {
|
|
224
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
225
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
226
|
-
} else {
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
var self = this;
|
|
231
|
-
this._timer = setTimeout(function() {
|
|
232
|
-
self._attempts++;
|
|
233
|
-
if (self._operationTimeoutCb) {
|
|
234
|
-
self._timeout = setTimeout(function() {
|
|
235
|
-
self._operationTimeoutCb(self._attempts);
|
|
236
|
-
}, self._operationTimeout);
|
|
237
|
-
if (self._options.unref) {
|
|
238
|
-
self._timeout.unref();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
self._fn(self._attempts);
|
|
242
|
-
}, timeout);
|
|
243
|
-
if (this._options.unref) {
|
|
244
|
-
this._timer.unref();
|
|
245
|
-
}
|
|
246
|
-
return true;
|
|
247
|
-
};
|
|
248
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
249
|
-
this._fn = fn;
|
|
250
|
-
if (timeoutOps) {
|
|
251
|
-
if (timeoutOps.timeout) {
|
|
252
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
253
|
-
}
|
|
254
|
-
if (timeoutOps.cb) {
|
|
255
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
var self = this;
|
|
259
|
-
if (this._operationTimeoutCb) {
|
|
260
|
-
this._timeout = setTimeout(function() {
|
|
261
|
-
self._operationTimeoutCb();
|
|
262
|
-
}, self._operationTimeout);
|
|
263
|
-
}
|
|
264
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
265
|
-
this._fn(this._attempts);
|
|
266
|
-
};
|
|
267
|
-
RetryOperation.prototype.try = function(fn) {
|
|
268
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
269
|
-
this.attempt(fn);
|
|
270
|
-
};
|
|
271
|
-
RetryOperation.prototype.start = function(fn) {
|
|
272
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
273
|
-
this.attempt(fn);
|
|
274
|
-
};
|
|
275
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
276
|
-
RetryOperation.prototype.errors = function() {
|
|
277
|
-
return this._errors;
|
|
278
|
-
};
|
|
279
|
-
RetryOperation.prototype.attempts = function() {
|
|
280
|
-
return this._attempts;
|
|
281
|
-
};
|
|
282
|
-
RetryOperation.prototype.mainError = function() {
|
|
283
|
-
if (this._errors.length === 0) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
var counts = {};
|
|
287
|
-
var mainError = null;
|
|
288
|
-
var mainErrorCount = 0;
|
|
289
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
290
|
-
var error = this._errors[i];
|
|
291
|
-
var message = error.message;
|
|
292
|
-
var count = (counts[message] || 0) + 1;
|
|
293
|
-
counts[message] = count;
|
|
294
|
-
if (count >= mainErrorCount) {
|
|
295
|
-
mainError = error;
|
|
296
|
-
mainErrorCount = count;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return mainError;
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
305
|
-
var require_retry = __commonJS({
|
|
306
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
307
|
-
"use strict";
|
|
308
|
-
var RetryOperation = require_retry_operation();
|
|
309
|
-
exports2.operation = function(options) {
|
|
310
|
-
var timeouts = exports2.timeouts(options);
|
|
311
|
-
return new RetryOperation(timeouts, {
|
|
312
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
313
|
-
unref: options && options.unref,
|
|
314
|
-
maxRetryTime: options && options.maxRetryTime
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
exports2.timeouts = function(options) {
|
|
318
|
-
if (options instanceof Array) {
|
|
319
|
-
return [].concat(options);
|
|
320
|
-
}
|
|
321
|
-
var opts = {
|
|
322
|
-
retries: 10,
|
|
323
|
-
factor: 2,
|
|
324
|
-
minTimeout: 1 * 1e3,
|
|
325
|
-
maxTimeout: Infinity,
|
|
326
|
-
randomize: false
|
|
327
|
-
};
|
|
328
|
-
for (var key in options) {
|
|
329
|
-
opts[key] = options[key];
|
|
330
|
-
}
|
|
331
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
332
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
333
|
-
}
|
|
334
|
-
var timeouts = [];
|
|
335
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
336
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
337
|
-
}
|
|
338
|
-
if (options && options.forever && !timeouts.length) {
|
|
339
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
340
|
-
}
|
|
341
|
-
timeouts.sort(function(a, b) {
|
|
342
|
-
return a - b;
|
|
343
|
-
});
|
|
344
|
-
return timeouts;
|
|
345
|
-
};
|
|
346
|
-
exports2.createTimeout = function(attempt, opts) {
|
|
347
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
348
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
349
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
350
|
-
return timeout;
|
|
351
|
-
};
|
|
352
|
-
exports2.wrap = function(obj, options, methods) {
|
|
353
|
-
if (options instanceof Array) {
|
|
354
|
-
methods = options;
|
|
355
|
-
options = null;
|
|
356
|
-
}
|
|
357
|
-
if (!methods) {
|
|
358
|
-
methods = [];
|
|
359
|
-
for (var key in obj) {
|
|
360
|
-
if (typeof obj[key] === "function") {
|
|
361
|
-
methods.push(key);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
for (var i = 0; i < methods.length; i++) {
|
|
366
|
-
var method = methods[i];
|
|
367
|
-
var original = obj[method];
|
|
368
|
-
obj[method] = function retryWrapper(original2) {
|
|
369
|
-
var op = exports2.operation(options);
|
|
370
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
371
|
-
var callback = args.pop();
|
|
372
|
-
args.push(function(err) {
|
|
373
|
-
if (op.retry(err)) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
if (err) {
|
|
377
|
-
arguments[0] = op.mainError();
|
|
378
|
-
}
|
|
379
|
-
callback.apply(this, arguments);
|
|
380
|
-
});
|
|
381
|
-
op.attempt(function() {
|
|
382
|
-
original2.apply(obj, args);
|
|
383
|
-
});
|
|
384
|
-
}.bind(obj, original);
|
|
385
|
-
obj[method].options = options;
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
392
|
-
var require_retry2 = __commonJS({
|
|
393
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
394
|
-
"use strict";
|
|
395
|
-
module2.exports = require_retry();
|
|
154
|
+
module2.exports = pLimit2;
|
|
396
155
|
}
|
|
397
156
|
});
|
|
398
157
|
|
|
@@ -600,8 +359,8 @@ var __defProp2 = Object.defineProperty;
|
|
|
600
359
|
var __typeError2 = (msg) => {
|
|
601
360
|
throw TypeError(msg);
|
|
602
361
|
};
|
|
603
|
-
var
|
|
604
|
-
var
|
|
362
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
363
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
605
364
|
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
606
365
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
607
366
|
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
@@ -612,18 +371,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
612
371
|
`${errorMessage}
|
|
613
372
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
614
373
|
);
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
374
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
375
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
376
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
377
|
+
__publicField(this, "statusCode", statusCode);
|
|
378
|
+
__publicField(this, "statusText", statusText);
|
|
379
|
+
__publicField(this, "requestId", requestId);
|
|
621
380
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
622
381
|
}
|
|
623
382
|
};
|
|
624
383
|
var ApiClient = class _ApiClient {
|
|
625
384
|
constructor(options) {
|
|
626
|
-
|
|
385
|
+
__publicField(this, "options");
|
|
627
386
|
var _a, _b, _c, _d, _e;
|
|
628
387
|
if (!options.apiKey && !options.bearerToken) {
|
|
629
388
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -1005,192 +764,391 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
1005
764
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
1006
765
|
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
1007
766
|
|
|
1008
|
-
//
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
767
|
+
// ../canvas/dist/index.mjs
|
|
768
|
+
var __create2 = Object.create;
|
|
769
|
+
var __defProp3 = Object.defineProperty;
|
|
770
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
771
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
772
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
773
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
774
|
+
var __typeError3 = (msg) => {
|
|
775
|
+
throw TypeError(msg);
|
|
1015
776
|
};
|
|
1016
|
-
var
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
enqueue(value) {
|
|
1025
|
-
const node = new Node(value);
|
|
1026
|
-
if (__privateGet(this, _head)) {
|
|
1027
|
-
__privateGet(this, _tail).next = node;
|
|
1028
|
-
__privateSet(this, _tail, node);
|
|
1029
|
-
} else {
|
|
1030
|
-
__privateSet(this, _head, node);
|
|
1031
|
-
__privateSet(this, _tail, node);
|
|
1032
|
-
}
|
|
1033
|
-
__privateWrapper(this, _size)._++;
|
|
1034
|
-
}
|
|
1035
|
-
dequeue() {
|
|
1036
|
-
const current = __privateGet(this, _head);
|
|
1037
|
-
if (!current) {
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
1041
|
-
__privateWrapper(this, _size)._--;
|
|
1042
|
-
if (!__privateGet(this, _head)) {
|
|
1043
|
-
__privateSet(this, _tail, void 0);
|
|
1044
|
-
}
|
|
1045
|
-
return current.value;
|
|
1046
|
-
}
|
|
1047
|
-
peek() {
|
|
1048
|
-
if (!__privateGet(this, _head)) {
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
|
-
return __privateGet(this, _head).value;
|
|
1052
|
-
}
|
|
1053
|
-
clear() {
|
|
1054
|
-
__privateSet(this, _head, void 0);
|
|
1055
|
-
__privateSet(this, _tail, void 0);
|
|
1056
|
-
__privateSet(this, _size, 0);
|
|
777
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
778
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
779
|
+
};
|
|
780
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
781
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
782
|
+
for (let key of __getOwnPropNames2(from))
|
|
783
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
784
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1057
785
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
786
|
+
return to;
|
|
787
|
+
};
|
|
788
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
789
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
790
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
791
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
792
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
793
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
794
|
+
mod
|
|
795
|
+
));
|
|
796
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
797
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
798
|
+
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
799
|
+
var require_yocto_queue2 = __commonJS2({
|
|
800
|
+
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
801
|
+
"use strict";
|
|
802
|
+
var Node = class {
|
|
803
|
+
/// value;
|
|
804
|
+
/// next;
|
|
805
|
+
constructor(value) {
|
|
806
|
+
this.value = value;
|
|
807
|
+
this.next = void 0;
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
var Queue = class {
|
|
811
|
+
// TODO: Use private class fields when targeting Node.js 12.
|
|
812
|
+
// #_head;
|
|
813
|
+
// #_tail;
|
|
814
|
+
// #_size;
|
|
815
|
+
constructor() {
|
|
816
|
+
this.clear();
|
|
817
|
+
}
|
|
818
|
+
enqueue(value) {
|
|
819
|
+
const node = new Node(value);
|
|
820
|
+
if (this._head) {
|
|
821
|
+
this._tail.next = node;
|
|
822
|
+
this._tail = node;
|
|
823
|
+
} else {
|
|
824
|
+
this._head = node;
|
|
825
|
+
this._tail = node;
|
|
826
|
+
}
|
|
827
|
+
this._size++;
|
|
828
|
+
}
|
|
829
|
+
dequeue() {
|
|
830
|
+
const current = this._head;
|
|
831
|
+
if (!current) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
this._head = this._head.next;
|
|
835
|
+
this._size--;
|
|
836
|
+
return current.value;
|
|
837
|
+
}
|
|
838
|
+
clear() {
|
|
839
|
+
this._head = void 0;
|
|
840
|
+
this._tail = void 0;
|
|
841
|
+
this._size = 0;
|
|
842
|
+
}
|
|
843
|
+
get size() {
|
|
844
|
+
return this._size;
|
|
845
|
+
}
|
|
846
|
+
*[Symbol.iterator]() {
|
|
847
|
+
let current = this._head;
|
|
848
|
+
while (current) {
|
|
849
|
+
yield current.value;
|
|
850
|
+
current = current.next;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
module2.exports = Queue;
|
|
1060
855
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
856
|
+
});
|
|
857
|
+
var require_p_limit2 = __commonJS2({
|
|
858
|
+
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
859
|
+
"use strict";
|
|
860
|
+
var Queue = require_yocto_queue2();
|
|
861
|
+
var pLimit2 = (concurrency) => {
|
|
862
|
+
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
863
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
864
|
+
}
|
|
865
|
+
const queue = new Queue();
|
|
866
|
+
let activeCount = 0;
|
|
867
|
+
const next = () => {
|
|
868
|
+
activeCount--;
|
|
869
|
+
if (queue.size > 0) {
|
|
870
|
+
queue.dequeue()();
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
const run = async (fn, resolve, ...args) => {
|
|
874
|
+
activeCount++;
|
|
875
|
+
const result = (async () => fn(...args))();
|
|
876
|
+
resolve(result);
|
|
877
|
+
try {
|
|
878
|
+
await result;
|
|
879
|
+
} catch (e) {
|
|
880
|
+
}
|
|
881
|
+
next();
|
|
882
|
+
};
|
|
883
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
884
|
+
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
885
|
+
(async () => {
|
|
886
|
+
await Promise.resolve();
|
|
887
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
888
|
+
queue.dequeue()();
|
|
889
|
+
}
|
|
890
|
+
})();
|
|
891
|
+
};
|
|
892
|
+
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
893
|
+
enqueue(fn, resolve, ...args);
|
|
894
|
+
});
|
|
895
|
+
Object.defineProperties(generator, {
|
|
896
|
+
activeCount: {
|
|
897
|
+
get: () => activeCount
|
|
898
|
+
},
|
|
899
|
+
pendingCount: {
|
|
900
|
+
get: () => queue.size
|
|
901
|
+
},
|
|
902
|
+
clearQueue: {
|
|
903
|
+
value: () => {
|
|
904
|
+
queue.clear();
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
return generator;
|
|
909
|
+
};
|
|
910
|
+
module2.exports = pLimit2;
|
|
1067
911
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
912
|
+
});
|
|
913
|
+
var require_retry_operation = __commonJS2({
|
|
914
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
915
|
+
"use strict";
|
|
916
|
+
function RetryOperation(timeouts, options) {
|
|
917
|
+
if (typeof options === "boolean") {
|
|
918
|
+
options = { forever: options };
|
|
919
|
+
}
|
|
920
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
921
|
+
this._timeouts = timeouts;
|
|
922
|
+
this._options = options || {};
|
|
923
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
924
|
+
this._fn = null;
|
|
925
|
+
this._errors = [];
|
|
926
|
+
this._attempts = 1;
|
|
927
|
+
this._operationTimeout = null;
|
|
928
|
+
this._operationTimeoutCb = null;
|
|
929
|
+
this._timeout = null;
|
|
930
|
+
this._operationStart = null;
|
|
931
|
+
this._timer = null;
|
|
932
|
+
if (this._options.forever) {
|
|
933
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
934
|
+
}
|
|
1071
935
|
}
|
|
936
|
+
module2.exports = RetryOperation;
|
|
937
|
+
RetryOperation.prototype.reset = function() {
|
|
938
|
+
this._attempts = 1;
|
|
939
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
940
|
+
};
|
|
941
|
+
RetryOperation.prototype.stop = function() {
|
|
942
|
+
if (this._timeout) {
|
|
943
|
+
clearTimeout(this._timeout);
|
|
944
|
+
}
|
|
945
|
+
if (this._timer) {
|
|
946
|
+
clearTimeout(this._timer);
|
|
947
|
+
}
|
|
948
|
+
this._timeouts = [];
|
|
949
|
+
this._cachedTimeouts = null;
|
|
950
|
+
};
|
|
951
|
+
RetryOperation.prototype.retry = function(err) {
|
|
952
|
+
if (this._timeout) {
|
|
953
|
+
clearTimeout(this._timeout);
|
|
954
|
+
}
|
|
955
|
+
if (!err) {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
959
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
960
|
+
this._errors.push(err);
|
|
961
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
962
|
+
return false;
|
|
963
|
+
}
|
|
964
|
+
this._errors.push(err);
|
|
965
|
+
var timeout = this._timeouts.shift();
|
|
966
|
+
if (timeout === void 0) {
|
|
967
|
+
if (this._cachedTimeouts) {
|
|
968
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
969
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
970
|
+
} else {
|
|
971
|
+
return false;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
var self = this;
|
|
975
|
+
this._timer = setTimeout(function() {
|
|
976
|
+
self._attempts++;
|
|
977
|
+
if (self._operationTimeoutCb) {
|
|
978
|
+
self._timeout = setTimeout(function() {
|
|
979
|
+
self._operationTimeoutCb(self._attempts);
|
|
980
|
+
}, self._operationTimeout);
|
|
981
|
+
if (self._options.unref) {
|
|
982
|
+
self._timeout.unref();
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
self._fn(self._attempts);
|
|
986
|
+
}, timeout);
|
|
987
|
+
if (this._options.unref) {
|
|
988
|
+
this._timer.unref();
|
|
989
|
+
}
|
|
990
|
+
return true;
|
|
991
|
+
};
|
|
992
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
993
|
+
this._fn = fn;
|
|
994
|
+
if (timeoutOps) {
|
|
995
|
+
if (timeoutOps.timeout) {
|
|
996
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
997
|
+
}
|
|
998
|
+
if (timeoutOps.cb) {
|
|
999
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
var self = this;
|
|
1003
|
+
if (this._operationTimeoutCb) {
|
|
1004
|
+
this._timeout = setTimeout(function() {
|
|
1005
|
+
self._operationTimeoutCb();
|
|
1006
|
+
}, self._operationTimeout);
|
|
1007
|
+
}
|
|
1008
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
1009
|
+
this._fn(this._attempts);
|
|
1010
|
+
};
|
|
1011
|
+
RetryOperation.prototype.try = function(fn) {
|
|
1012
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
1013
|
+
this.attempt(fn);
|
|
1014
|
+
};
|
|
1015
|
+
RetryOperation.prototype.start = function(fn) {
|
|
1016
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
1017
|
+
this.attempt(fn);
|
|
1018
|
+
};
|
|
1019
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
1020
|
+
RetryOperation.prototype.errors = function() {
|
|
1021
|
+
return this._errors;
|
|
1022
|
+
};
|
|
1023
|
+
RetryOperation.prototype.attempts = function() {
|
|
1024
|
+
return this._attempts;
|
|
1025
|
+
};
|
|
1026
|
+
RetryOperation.prototype.mainError = function() {
|
|
1027
|
+
if (this._errors.length === 0) {
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1030
|
+
var counts = {};
|
|
1031
|
+
var mainError = null;
|
|
1032
|
+
var mainErrorCount = 0;
|
|
1033
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
1034
|
+
var error = this._errors[i];
|
|
1035
|
+
var message = error.message;
|
|
1036
|
+
var count = (counts[message] || 0) + 1;
|
|
1037
|
+
counts[message] = count;
|
|
1038
|
+
if (count >= mainErrorCount) {
|
|
1039
|
+
mainError = error;
|
|
1040
|
+
mainErrorCount = count;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
return mainError;
|
|
1044
|
+
};
|
|
1072
1045
|
}
|
|
1073
|
-
};
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
const next = () => {
|
|
1090
|
-
activeCount--;
|
|
1091
|
-
resumeNext();
|
|
1092
|
-
};
|
|
1093
|
-
const run = async (function_, resolve, arguments_) => {
|
|
1094
|
-
const result = (async () => function_(...arguments_))();
|
|
1095
|
-
resolve(result);
|
|
1096
|
-
try {
|
|
1097
|
-
await result;
|
|
1098
|
-
} catch (e) {
|
|
1099
|
-
}
|
|
1100
|
-
next();
|
|
1101
|
-
};
|
|
1102
|
-
const enqueue = (function_, resolve, arguments_) => {
|
|
1103
|
-
new Promise((internalResolve) => {
|
|
1104
|
-
queue.enqueue(internalResolve);
|
|
1105
|
-
}).then(
|
|
1106
|
-
run.bind(void 0, function_, resolve, arguments_)
|
|
1107
|
-
);
|
|
1108
|
-
(async () => {
|
|
1109
|
-
await Promise.resolve();
|
|
1110
|
-
if (activeCount < concurrency) {
|
|
1111
|
-
resumeNext();
|
|
1046
|
+
});
|
|
1047
|
+
var require_retry = __commonJS2({
|
|
1048
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
1049
|
+
"use strict";
|
|
1050
|
+
var RetryOperation = require_retry_operation();
|
|
1051
|
+
exports2.operation = function(options) {
|
|
1052
|
+
var timeouts = exports2.timeouts(options);
|
|
1053
|
+
return new RetryOperation(timeouts, {
|
|
1054
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
1055
|
+
unref: options && options.unref,
|
|
1056
|
+
maxRetryTime: options && options.maxRetryTime
|
|
1057
|
+
});
|
|
1058
|
+
};
|
|
1059
|
+
exports2.timeouts = function(options) {
|
|
1060
|
+
if (options instanceof Array) {
|
|
1061
|
+
return [].concat(options);
|
|
1112
1062
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
pendingCount: {
|
|
1123
|
-
get: () => queue.size
|
|
1124
|
-
},
|
|
1125
|
-
clearQueue: {
|
|
1126
|
-
value() {
|
|
1127
|
-
queue.clear();
|
|
1063
|
+
var opts = {
|
|
1064
|
+
retries: 10,
|
|
1065
|
+
factor: 2,
|
|
1066
|
+
minTimeout: 1 * 1e3,
|
|
1067
|
+
maxTimeout: Infinity,
|
|
1068
|
+
randomize: false
|
|
1069
|
+
};
|
|
1070
|
+
for (var key in options) {
|
|
1071
|
+
opts[key] = options[key];
|
|
1128
1072
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1073
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
1074
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
1075
|
+
}
|
|
1076
|
+
var timeouts = [];
|
|
1077
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
1078
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
1079
|
+
}
|
|
1080
|
+
if (options && options.forever && !timeouts.length) {
|
|
1081
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
1082
|
+
}
|
|
1083
|
+
timeouts.sort(function(a, b) {
|
|
1084
|
+
return a - b;
|
|
1085
|
+
});
|
|
1086
|
+
return timeouts;
|
|
1087
|
+
};
|
|
1088
|
+
exports2.createTimeout = function(attempt, opts) {
|
|
1089
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
1090
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
1091
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
1092
|
+
return timeout;
|
|
1093
|
+
};
|
|
1094
|
+
exports2.wrap = function(obj, options, methods) {
|
|
1095
|
+
if (options instanceof Array) {
|
|
1096
|
+
methods = options;
|
|
1097
|
+
options = null;
|
|
1098
|
+
}
|
|
1099
|
+
if (!methods) {
|
|
1100
|
+
methods = [];
|
|
1101
|
+
for (var key in obj) {
|
|
1102
|
+
if (typeof obj[key] === "function") {
|
|
1103
|
+
methods.push(key);
|
|
1138
1104
|
}
|
|
1139
|
-
}
|
|
1105
|
+
}
|
|
1140
1106
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1107
|
+
for (var i = 0; i < methods.length; i++) {
|
|
1108
|
+
var method = methods[i];
|
|
1109
|
+
var original = obj[method];
|
|
1110
|
+
obj[method] = function retryWrapper(original2) {
|
|
1111
|
+
var op = exports2.operation(options);
|
|
1112
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
1113
|
+
var callback = args.pop();
|
|
1114
|
+
args.push(function(err) {
|
|
1115
|
+
if (op.retry(err)) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
if (err) {
|
|
1119
|
+
arguments[0] = op.mainError();
|
|
1120
|
+
}
|
|
1121
|
+
callback.apply(this, arguments);
|
|
1122
|
+
});
|
|
1123
|
+
op.attempt(function() {
|
|
1124
|
+
original2.apply(obj, args);
|
|
1125
|
+
});
|
|
1126
|
+
}.bind(obj, original);
|
|
1127
|
+
obj[method].options = options;
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1148
1130
|
}
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
var
|
|
1157
|
-
var
|
|
1158
|
-
|
|
1131
|
+
});
|
|
1132
|
+
var require_retry2 = __commonJS2({
|
|
1133
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
1134
|
+
"use strict";
|
|
1135
|
+
module2.exports = require_retry();
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
1139
|
+
var import_retry = __toESM2(require_retry2(), 1);
|
|
1140
|
+
var networkErrorMsgs = /* @__PURE__ */ new Set([
|
|
1141
|
+
"Failed to fetch",
|
|
1159
1142
|
// Chrome
|
|
1160
1143
|
"NetworkError when attempting to fetch resource.",
|
|
1161
1144
|
// Firefox
|
|
1162
1145
|
"The Internet connection appears to be offline.",
|
|
1163
|
-
// Safari
|
|
1146
|
+
// Safari
|
|
1164
1147
|
"Network request failed",
|
|
1165
1148
|
// `cross-fetch`
|
|
1166
|
-
"fetch failed"
|
|
1167
|
-
// Undici (Node.js)
|
|
1168
|
-
"terminated",
|
|
1149
|
+
"fetch failed"
|
|
1169
1150
|
// Undici (Node.js)
|
|
1170
|
-
" A network error occurred.",
|
|
1171
|
-
// Bun (WebKit)
|
|
1172
|
-
"Network connection lost"
|
|
1173
|
-
// Cloudflare Workers (fetch)
|
|
1174
1151
|
]);
|
|
1175
|
-
function isNetworkError(error) {
|
|
1176
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1177
|
-
if (!isValid) {
|
|
1178
|
-
return false;
|
|
1179
|
-
}
|
|
1180
|
-
const { message, stack } = error;
|
|
1181
|
-
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1182
|
-
return stack === void 0 || "__sentry_captured__" in error;
|
|
1183
|
-
}
|
|
1184
|
-
if (message.startsWith("error sending request for url")) {
|
|
1185
|
-
return true;
|
|
1186
|
-
}
|
|
1187
|
-
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1188
|
-
return true;
|
|
1189
|
-
}
|
|
1190
|
-
return errorMessages.has(message);
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1194
1152
|
var AbortError = class extends Error {
|
|
1195
1153
|
constructor(message) {
|
|
1196
1154
|
super();
|
|
@@ -1211,71 +1169,63 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1211
1169
|
error.retriesLeft = retriesLeft;
|
|
1212
1170
|
return error;
|
|
1213
1171
|
};
|
|
1172
|
+
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
1173
|
+
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1214
1174
|
async function pRetry(input, options) {
|
|
1215
1175
|
return new Promise((resolve, reject) => {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1176
|
+
options = {
|
|
1177
|
+
onFailedAttempt() {
|
|
1178
|
+
},
|
|
1179
|
+
retries: 10,
|
|
1180
|
+
...options
|
|
1219
1181
|
};
|
|
1220
|
-
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1221
|
-
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1222
1182
|
const operation = import_retry.default.operation(options);
|
|
1223
|
-
const abortHandler = () => {
|
|
1224
|
-
var _a2;
|
|
1225
|
-
operation.stop();
|
|
1226
|
-
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1227
|
-
};
|
|
1228
|
-
if (options.signal && !options.signal.aborted) {
|
|
1229
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1230
|
-
}
|
|
1231
|
-
const cleanUp = () => {
|
|
1232
|
-
var _a2;
|
|
1233
|
-
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1234
|
-
operation.stop();
|
|
1235
|
-
};
|
|
1236
1183
|
operation.attempt(async (attemptNumber) => {
|
|
1237
1184
|
try {
|
|
1238
|
-
|
|
1239
|
-
cleanUp();
|
|
1240
|
-
resolve(result);
|
|
1185
|
+
resolve(await input(attemptNumber));
|
|
1241
1186
|
} catch (error) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1187
|
+
if (!(error instanceof Error)) {
|
|
1188
|
+
reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
if (error instanceof AbortError) {
|
|
1192
|
+
operation.stop();
|
|
1193
|
+
reject(error.originalError);
|
|
1194
|
+
} else if (error instanceof TypeError && !isNetworkError(error.message)) {
|
|
1195
|
+
operation.stop();
|
|
1196
|
+
reject(error);
|
|
1197
|
+
} else {
|
|
1252
1198
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1199
|
+
try {
|
|
1200
|
+
await options.onFailedAttempt(error);
|
|
1201
|
+
} catch (error2) {
|
|
1202
|
+
reject(error2);
|
|
1203
|
+
return;
|
|
1256
1204
|
}
|
|
1257
|
-
await options.onFailedAttempt(error);
|
|
1258
1205
|
if (!operation.retry(error)) {
|
|
1259
|
-
|
|
1206
|
+
reject(operation.mainError());
|
|
1260
1207
|
}
|
|
1261
|
-
} catch (finalError) {
|
|
1262
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1263
|
-
cleanUp();
|
|
1264
|
-
reject(finalError);
|
|
1265
1208
|
}
|
|
1266
1209
|
}
|
|
1267
1210
|
});
|
|
1211
|
+
if (options.signal && !options.signal.aborted) {
|
|
1212
|
+
options.signal.addEventListener("abort", () => {
|
|
1213
|
+
operation.stop();
|
|
1214
|
+
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1215
|
+
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1216
|
+
}, {
|
|
1217
|
+
once: true
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1268
1220
|
});
|
|
1269
1221
|
}
|
|
1270
|
-
|
|
1271
|
-
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1272
1222
|
var AbortError2 = class extends Error {
|
|
1273
1223
|
constructor() {
|
|
1274
1224
|
super("Throttled function aborted");
|
|
1275
1225
|
this.name = "AbortError";
|
|
1276
1226
|
}
|
|
1277
1227
|
};
|
|
1278
|
-
function pThrottle({ limit, interval, strict
|
|
1228
|
+
function pThrottle({ limit, interval, strict }) {
|
|
1279
1229
|
if (!Number.isFinite(limit)) {
|
|
1280
1230
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1281
1231
|
}
|
|
@@ -1303,38 +1253,32 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1303
1253
|
const strictTicks = [];
|
|
1304
1254
|
function strictDelay() {
|
|
1305
1255
|
const now = Date.now();
|
|
1306
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1307
|
-
strictTicks.length = 0;
|
|
1308
|
-
}
|
|
1309
1256
|
if (strictTicks.length < limit) {
|
|
1310
1257
|
strictTicks.push(now);
|
|
1311
1258
|
return 0;
|
|
1312
1259
|
}
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1260
|
+
const earliestTime = strictTicks.shift() + interval;
|
|
1261
|
+
if (now >= earliestTime) {
|
|
1262
|
+
strictTicks.push(now);
|
|
1263
|
+
return 0;
|
|
1264
|
+
}
|
|
1265
|
+
strictTicks.push(earliestTime);
|
|
1266
|
+
return earliestTime - now;
|
|
1317
1267
|
}
|
|
1318
1268
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1319
1269
|
return (function_) => {
|
|
1320
|
-
const throttled = function(...
|
|
1270
|
+
const throttled = function(...args) {
|
|
1321
1271
|
if (!throttled.isEnabled) {
|
|
1322
|
-
return (async () => function_.apply(this,
|
|
1272
|
+
return (async () => function_.apply(this, args))();
|
|
1323
1273
|
}
|
|
1324
|
-
let
|
|
1274
|
+
let timeout;
|
|
1325
1275
|
return new Promise((resolve, reject) => {
|
|
1326
1276
|
const execute = () => {
|
|
1327
|
-
resolve(function_.apply(this,
|
|
1328
|
-
queue.delete(
|
|
1277
|
+
resolve(function_.apply(this, args));
|
|
1278
|
+
queue.delete(timeout);
|
|
1329
1279
|
};
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
timeoutId = setTimeout(execute, delay);
|
|
1333
|
-
queue.set(timeoutId, reject);
|
|
1334
|
-
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1335
|
-
} else {
|
|
1336
|
-
execute();
|
|
1337
|
-
}
|
|
1280
|
+
timeout = setTimeout(execute, getDelay());
|
|
1281
|
+
queue.set(timeout, reject);
|
|
1338
1282
|
});
|
|
1339
1283
|
};
|
|
1340
1284
|
throttled.abort = () => {
|
|
@@ -1346,29 +1290,16 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1346
1290
|
strictTicks.splice(0, strictTicks.length);
|
|
1347
1291
|
};
|
|
1348
1292
|
throttled.isEnabled = true;
|
|
1349
|
-
Object.defineProperty(throttled, "queueSize", {
|
|
1350
|
-
get() {
|
|
1351
|
-
return queue.size;
|
|
1352
|
-
}
|
|
1353
|
-
});
|
|
1354
1293
|
return throttled;
|
|
1355
1294
|
};
|
|
1356
1295
|
}
|
|
1357
|
-
|
|
1358
|
-
// ../canvas/dist/index.mjs
|
|
1359
|
-
var __typeError3 = (msg) => {
|
|
1360
|
-
throw TypeError(msg);
|
|
1361
|
-
};
|
|
1362
|
-
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1363
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1364
|
-
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1365
1296
|
function createLimitPolicy({
|
|
1366
1297
|
throttle = { interval: 1e3, limit: 10 },
|
|
1367
|
-
retry:
|
|
1298
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
1368
1299
|
limit = 10
|
|
1369
1300
|
}) {
|
|
1370
1301
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1371
|
-
const limiter = limit ?
|
|
1302
|
+
const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
|
|
1372
1303
|
return function limitPolicy(func) {
|
|
1373
1304
|
let currentFunc = async () => await func();
|
|
1374
1305
|
if (throttler) {
|
|
@@ -1379,13 +1310,13 @@ function createLimitPolicy({
|
|
|
1379
1310
|
const limitFunc = currentFunc;
|
|
1380
1311
|
currentFunc = () => limiter(limitFunc);
|
|
1381
1312
|
}
|
|
1382
|
-
if (
|
|
1313
|
+
if (retry2) {
|
|
1383
1314
|
const retryFunc = currentFunc;
|
|
1384
1315
|
currentFunc = () => pRetry(retryFunc, {
|
|
1385
|
-
...
|
|
1316
|
+
...retry2,
|
|
1386
1317
|
onFailedAttempt: async (error) => {
|
|
1387
|
-
if (
|
|
1388
|
-
await
|
|
1318
|
+
if (retry2.onFailedAttempt) {
|
|
1319
|
+
await retry2.onFailedAttempt(error);
|
|
1389
1320
|
}
|
|
1390
1321
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1391
1322
|
throw error;
|
|
@@ -2574,7 +2505,7 @@ function createLimiter(concurrency) {
|
|
|
2574
2505
|
});
|
|
2575
2506
|
};
|
|
2576
2507
|
}
|
|
2577
|
-
async function
|
|
2508
|
+
async function retry(fn, options) {
|
|
2578
2509
|
let lastError;
|
|
2579
2510
|
let delay = 1e3;
|
|
2580
2511
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2614,7 +2545,7 @@ function createLimitPolicy2({
|
|
|
2614
2545
|
}
|
|
2615
2546
|
if (retryOptions) {
|
|
2616
2547
|
const retryFunc = currentFunc;
|
|
2617
|
-
currentFunc = () =>
|
|
2548
|
+
currentFunc = () => retry(retryFunc, {
|
|
2618
2549
|
...retryOptions,
|
|
2619
2550
|
onFailedAttempt: async (error) => {
|
|
2620
2551
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2724,6 +2655,10 @@ var getDisableSwrMiddlewareCache = () => {
|
|
|
2724
2655
|
return false;
|
|
2725
2656
|
};
|
|
2726
2657
|
|
|
2658
|
+
// src/config/routeCode.ts
|
|
2659
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2660
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2661
|
+
|
|
2727
2662
|
// src/data/client.ts
|
|
2728
2663
|
var import_functions = require("@vercel/functions");
|
|
2729
2664
|
|
|
@@ -3353,12 +3288,12 @@ function mitt_default(n) {
|
|
|
3353
3288
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
3354
3289
|
var import_rfdc2 = __toESM(require_rfdc(), 1);
|
|
3355
3290
|
var import_rfdc3 = __toESM(require_rfdc(), 1);
|
|
3356
|
-
var
|
|
3291
|
+
var __defProp4 = Object.defineProperty;
|
|
3357
3292
|
var __typeError4 = (msg) => {
|
|
3358
3293
|
throw TypeError(msg);
|
|
3359
3294
|
};
|
|
3360
|
-
var
|
|
3361
|
-
var
|
|
3295
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3296
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3362
3297
|
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
3363
3298
|
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3364
3299
|
var __privateAdd4 = (obj, member, value) => member.has(obj) ? __typeError4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
@@ -3435,7 +3370,7 @@ var SignalInstance = class {
|
|
|
3435
3370
|
constructor(data, evaluator, onLogMessage) {
|
|
3436
3371
|
__privateAdd4(this, _evaluator);
|
|
3437
3372
|
__privateAdd4(this, _onLogMessage);
|
|
3438
|
-
|
|
3373
|
+
__publicField2(this, "signal");
|
|
3439
3374
|
this.signal = data;
|
|
3440
3375
|
__privateSet2(this, _evaluator, evaluator);
|
|
3441
3376
|
__privateSet2(this, _onLogMessage, onLogMessage);
|
|
@@ -3493,7 +3428,7 @@ var ManifestInstance = class {
|
|
|
3493
3428
|
onLogMessage = () => {
|
|
3494
3429
|
}
|
|
3495
3430
|
}) {
|
|
3496
|
-
|
|
3431
|
+
__publicField2(this, "data");
|
|
3497
3432
|
__privateAdd4(this, _mf);
|
|
3498
3433
|
__privateAdd4(this, _signalInstances);
|
|
3499
3434
|
__privateAdd4(this, _goalEvaluators, []);
|
|
@@ -4280,7 +4215,7 @@ var TransitionDataStore = class {
|
|
|
4280
4215
|
__privateAdd4(this, _data);
|
|
4281
4216
|
__privateAdd4(this, _initialData);
|
|
4282
4217
|
__privateAdd4(this, _mitt, mitt_default());
|
|
4283
|
-
|
|
4218
|
+
__publicField2(this, "events", {
|
|
4284
4219
|
on: __privateGet4(this, _mitt).on,
|
|
4285
4220
|
off: __privateGet4(this, _mitt).off
|
|
4286
4221
|
});
|
|
@@ -4643,10 +4578,10 @@ var _LocalStorage_instances;
|
|
|
4643
4578
|
var key_fn;
|
|
4644
4579
|
var LocalStorage = class {
|
|
4645
4580
|
constructor(partitionKey) {
|
|
4646
|
-
|
|
4581
|
+
__publicField2(this, "partitionKey", partitionKey);
|
|
4647
4582
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4648
|
-
|
|
4649
|
-
|
|
4583
|
+
__publicField2(this, "inMemoryFallback", {});
|
|
4584
|
+
__publicField2(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
4650
4585
|
}
|
|
4651
4586
|
get(key) {
|
|
4652
4587
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
|
@@ -4707,7 +4642,7 @@ var VisitorDataStore = class {
|
|
|
4707
4642
|
__privateAdd4(this, _persist);
|
|
4708
4643
|
__privateAdd4(this, _visitTimeout);
|
|
4709
4644
|
__privateAdd4(this, _options);
|
|
4710
|
-
|
|
4645
|
+
__publicField2(this, "events", {
|
|
4711
4646
|
on: __privateGet4(this, _mitt2).on,
|
|
4712
4647
|
off: __privateGet4(this, _mitt2).off
|
|
4713
4648
|
});
|
|
@@ -4908,7 +4843,7 @@ var calculateScores_fn;
|
|
|
4908
4843
|
var Context = class {
|
|
4909
4844
|
constructor(options) {
|
|
4910
4845
|
__privateAdd4(this, _Context_instances);
|
|
4911
|
-
|
|
4846
|
+
__publicField2(this, "manifest");
|
|
4912
4847
|
__privateAdd4(this, _personalizationSelectionAlgorithms);
|
|
4913
4848
|
__privateAdd4(this, _serverTransitionState);
|
|
4914
4849
|
__privateAdd4(this, _scores, {});
|
|
@@ -4918,11 +4853,11 @@ var Context = class {
|
|
|
4918
4853
|
__privateAdd4(this, _commands);
|
|
4919
4854
|
__privateAdd4(this, _requireConsentForPersonalization);
|
|
4920
4855
|
__privateAdd4(this, _mitt3, mitt_default());
|
|
4921
|
-
|
|
4856
|
+
__publicField2(this, "events", {
|
|
4922
4857
|
on: __privateGet4(this, _mitt3).on,
|
|
4923
4858
|
off: __privateGet4(this, _mitt3).off
|
|
4924
4859
|
});
|
|
4925
|
-
|
|
4860
|
+
__publicField2(this, "storage");
|
|
4926
4861
|
var _a, _b, _c;
|
|
4927
4862
|
const { manifest, ...storageOptions } = options;
|
|
4928
4863
|
__privateSet2(this, _state, {});
|
|
@@ -5812,8 +5747,14 @@ var handleRouteRequest = async ({
|
|
|
5812
5747
|
allComponentIds
|
|
5813
5748
|
});
|
|
5814
5749
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5750
|
+
let usedDraftStableSegment = false;
|
|
5815
5751
|
if (!pathToRewriteTo) {
|
|
5816
|
-
|
|
5752
|
+
if (draftModeEnabled) {
|
|
5753
|
+
pathToRewriteTo = `/uniform/${UNIFORM_DRAFT_SEGMENT}`;
|
|
5754
|
+
usedDraftStableSegment = true;
|
|
5755
|
+
} else {
|
|
5756
|
+
pathToRewriteTo = `/uniform/${code}`;
|
|
5757
|
+
}
|
|
5817
5758
|
}
|
|
5818
5759
|
const headers = new Headers();
|
|
5819
5760
|
if (serializedQuirkCookie) {
|
|
@@ -5822,8 +5763,14 @@ var handleRouteRequest = async ({
|
|
|
5822
5763
|
`${import_next_app_router_shared6.UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME}=${serializedQuirkCookie}; Path=/; SameSite=Lax; Max-Age=10`
|
|
5823
5764
|
);
|
|
5824
5765
|
}
|
|
5766
|
+
let requestHeaders;
|
|
5767
|
+
if (usedDraftStableSegment) {
|
|
5768
|
+
requestHeaders = new Headers(request.headers);
|
|
5769
|
+
requestHeaders.set(UNIFORM_DRAFT_CODE_HEADER, code);
|
|
5770
|
+
}
|
|
5825
5771
|
return import_server.NextResponse.rewrite(new URL(pathToRewriteTo, request.nextUrl.origin), {
|
|
5826
|
-
headers
|
|
5772
|
+
headers,
|
|
5773
|
+
...requestHeaders ? { request: { headers: requestHeaders } } : {}
|
|
5827
5774
|
});
|
|
5828
5775
|
};
|
|
5829
5776
|
var isPrefetchRequest = (request) => {
|