@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.mjs
CHANGED
|
@@ -7,7 +7,6 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __typeError = (msg) => {
|
|
8
8
|
throw TypeError(msg);
|
|
9
9
|
};
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
10
|
var __commonJS = (cb, mod) => function __require() {
|
|
12
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
12
|
};
|
|
@@ -27,25 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
26
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
27
|
mod
|
|
29
28
|
));
|
|
30
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
29
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
32
30
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
33
31
|
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);
|
|
34
32
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
35
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
36
|
-
set _(value) {
|
|
37
|
-
__privateSet(obj, member, value, setter);
|
|
38
|
-
},
|
|
39
|
-
get _() {
|
|
40
|
-
return __privateGet(obj, member, getter);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
33
|
|
|
44
34
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
45
35
|
var require_yocto_queue = __commonJS({
|
|
46
36
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
|
|
47
37
|
"use strict";
|
|
48
|
-
var
|
|
38
|
+
var Node = class {
|
|
49
39
|
/// value;
|
|
50
40
|
/// next;
|
|
51
41
|
constructor(value) {
|
|
@@ -53,7 +43,7 @@ var require_yocto_queue = __commonJS({
|
|
|
53
43
|
this.next = void 0;
|
|
54
44
|
}
|
|
55
45
|
};
|
|
56
|
-
var
|
|
46
|
+
var Queue = class {
|
|
57
47
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
58
48
|
// #_head;
|
|
59
49
|
// #_tail;
|
|
@@ -62,7 +52,7 @@ var require_yocto_queue = __commonJS({
|
|
|
62
52
|
this.clear();
|
|
63
53
|
}
|
|
64
54
|
enqueue(value) {
|
|
65
|
-
const node = new
|
|
55
|
+
const node = new Node(value);
|
|
66
56
|
if (this._head) {
|
|
67
57
|
this._tail.next = node;
|
|
68
58
|
this._tail = node;
|
|
@@ -97,7 +87,7 @@ var require_yocto_queue = __commonJS({
|
|
|
97
87
|
}
|
|
98
88
|
}
|
|
99
89
|
};
|
|
100
|
-
module.exports =
|
|
90
|
+
module.exports = Queue;
|
|
101
91
|
}
|
|
102
92
|
});
|
|
103
93
|
|
|
@@ -105,12 +95,12 @@ var require_yocto_queue = __commonJS({
|
|
|
105
95
|
var require_p_limit = __commonJS({
|
|
106
96
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
|
|
107
97
|
"use strict";
|
|
108
|
-
var
|
|
109
|
-
var
|
|
98
|
+
var Queue = require_yocto_queue();
|
|
99
|
+
var pLimit2 = (concurrency) => {
|
|
110
100
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
111
101
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
112
102
|
}
|
|
113
|
-
const queue = new
|
|
103
|
+
const queue = new Queue();
|
|
114
104
|
let activeCount = 0;
|
|
115
105
|
const next = () => {
|
|
116
106
|
activeCount--;
|
|
@@ -155,238 +145,7 @@ var require_p_limit = __commonJS({
|
|
|
155
145
|
});
|
|
156
146
|
return generator;
|
|
157
147
|
};
|
|
158
|
-
module.exports =
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
163
|
-
var require_retry_operation = __commonJS({
|
|
164
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
165
|
-
"use strict";
|
|
166
|
-
function RetryOperation(timeouts, options) {
|
|
167
|
-
if (typeof options === "boolean") {
|
|
168
|
-
options = { forever: options };
|
|
169
|
-
}
|
|
170
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
171
|
-
this._timeouts = timeouts;
|
|
172
|
-
this._options = options || {};
|
|
173
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
174
|
-
this._fn = null;
|
|
175
|
-
this._errors = [];
|
|
176
|
-
this._attempts = 1;
|
|
177
|
-
this._operationTimeout = null;
|
|
178
|
-
this._operationTimeoutCb = null;
|
|
179
|
-
this._timeout = null;
|
|
180
|
-
this._operationStart = null;
|
|
181
|
-
this._timer = null;
|
|
182
|
-
if (this._options.forever) {
|
|
183
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
module.exports = RetryOperation;
|
|
187
|
-
RetryOperation.prototype.reset = function() {
|
|
188
|
-
this._attempts = 1;
|
|
189
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
190
|
-
};
|
|
191
|
-
RetryOperation.prototype.stop = function() {
|
|
192
|
-
if (this._timeout) {
|
|
193
|
-
clearTimeout(this._timeout);
|
|
194
|
-
}
|
|
195
|
-
if (this._timer) {
|
|
196
|
-
clearTimeout(this._timer);
|
|
197
|
-
}
|
|
198
|
-
this._timeouts = [];
|
|
199
|
-
this._cachedTimeouts = null;
|
|
200
|
-
};
|
|
201
|
-
RetryOperation.prototype.retry = function(err) {
|
|
202
|
-
if (this._timeout) {
|
|
203
|
-
clearTimeout(this._timeout);
|
|
204
|
-
}
|
|
205
|
-
if (!err) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
209
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
210
|
-
this._errors.push(err);
|
|
211
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
this._errors.push(err);
|
|
215
|
-
var timeout = this._timeouts.shift();
|
|
216
|
-
if (timeout === void 0) {
|
|
217
|
-
if (this._cachedTimeouts) {
|
|
218
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
219
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
220
|
-
} else {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
var self = this;
|
|
225
|
-
this._timer = setTimeout(function() {
|
|
226
|
-
self._attempts++;
|
|
227
|
-
if (self._operationTimeoutCb) {
|
|
228
|
-
self._timeout = setTimeout(function() {
|
|
229
|
-
self._operationTimeoutCb(self._attempts);
|
|
230
|
-
}, self._operationTimeout);
|
|
231
|
-
if (self._options.unref) {
|
|
232
|
-
self._timeout.unref();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
self._fn(self._attempts);
|
|
236
|
-
}, timeout);
|
|
237
|
-
if (this._options.unref) {
|
|
238
|
-
this._timer.unref();
|
|
239
|
-
}
|
|
240
|
-
return true;
|
|
241
|
-
};
|
|
242
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
243
|
-
this._fn = fn;
|
|
244
|
-
if (timeoutOps) {
|
|
245
|
-
if (timeoutOps.timeout) {
|
|
246
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
247
|
-
}
|
|
248
|
-
if (timeoutOps.cb) {
|
|
249
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
var self = this;
|
|
253
|
-
if (this._operationTimeoutCb) {
|
|
254
|
-
this._timeout = setTimeout(function() {
|
|
255
|
-
self._operationTimeoutCb();
|
|
256
|
-
}, self._operationTimeout);
|
|
257
|
-
}
|
|
258
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
259
|
-
this._fn(this._attempts);
|
|
260
|
-
};
|
|
261
|
-
RetryOperation.prototype.try = function(fn) {
|
|
262
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
263
|
-
this.attempt(fn);
|
|
264
|
-
};
|
|
265
|
-
RetryOperation.prototype.start = function(fn) {
|
|
266
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
267
|
-
this.attempt(fn);
|
|
268
|
-
};
|
|
269
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
270
|
-
RetryOperation.prototype.errors = function() {
|
|
271
|
-
return this._errors;
|
|
272
|
-
};
|
|
273
|
-
RetryOperation.prototype.attempts = function() {
|
|
274
|
-
return this._attempts;
|
|
275
|
-
};
|
|
276
|
-
RetryOperation.prototype.mainError = function() {
|
|
277
|
-
if (this._errors.length === 0) {
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
var counts = {};
|
|
281
|
-
var mainError = null;
|
|
282
|
-
var mainErrorCount = 0;
|
|
283
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
284
|
-
var error = this._errors[i];
|
|
285
|
-
var message = error.message;
|
|
286
|
-
var count = (counts[message] || 0) + 1;
|
|
287
|
-
counts[message] = count;
|
|
288
|
-
if (count >= mainErrorCount) {
|
|
289
|
-
mainError = error;
|
|
290
|
-
mainErrorCount = count;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return mainError;
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
299
|
-
var require_retry = __commonJS({
|
|
300
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
301
|
-
"use strict";
|
|
302
|
-
var RetryOperation = require_retry_operation();
|
|
303
|
-
exports.operation = function(options) {
|
|
304
|
-
var timeouts = exports.timeouts(options);
|
|
305
|
-
return new RetryOperation(timeouts, {
|
|
306
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
307
|
-
unref: options && options.unref,
|
|
308
|
-
maxRetryTime: options && options.maxRetryTime
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
|
-
exports.timeouts = function(options) {
|
|
312
|
-
if (options instanceof Array) {
|
|
313
|
-
return [].concat(options);
|
|
314
|
-
}
|
|
315
|
-
var opts = {
|
|
316
|
-
retries: 10,
|
|
317
|
-
factor: 2,
|
|
318
|
-
minTimeout: 1 * 1e3,
|
|
319
|
-
maxTimeout: Infinity,
|
|
320
|
-
randomize: false
|
|
321
|
-
};
|
|
322
|
-
for (var key in options) {
|
|
323
|
-
opts[key] = options[key];
|
|
324
|
-
}
|
|
325
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
326
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
327
|
-
}
|
|
328
|
-
var timeouts = [];
|
|
329
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
330
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
331
|
-
}
|
|
332
|
-
if (options && options.forever && !timeouts.length) {
|
|
333
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
334
|
-
}
|
|
335
|
-
timeouts.sort(function(a, b) {
|
|
336
|
-
return a - b;
|
|
337
|
-
});
|
|
338
|
-
return timeouts;
|
|
339
|
-
};
|
|
340
|
-
exports.createTimeout = function(attempt, opts) {
|
|
341
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
342
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
343
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
344
|
-
return timeout;
|
|
345
|
-
};
|
|
346
|
-
exports.wrap = function(obj, options, methods) {
|
|
347
|
-
if (options instanceof Array) {
|
|
348
|
-
methods = options;
|
|
349
|
-
options = null;
|
|
350
|
-
}
|
|
351
|
-
if (!methods) {
|
|
352
|
-
methods = [];
|
|
353
|
-
for (var key in obj) {
|
|
354
|
-
if (typeof obj[key] === "function") {
|
|
355
|
-
methods.push(key);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
for (var i = 0; i < methods.length; i++) {
|
|
360
|
-
var method = methods[i];
|
|
361
|
-
var original = obj[method];
|
|
362
|
-
obj[method] = function retryWrapper(original2) {
|
|
363
|
-
var op = exports.operation(options);
|
|
364
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
365
|
-
var callback = args.pop();
|
|
366
|
-
args.push(function(err) {
|
|
367
|
-
if (op.retry(err)) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
if (err) {
|
|
371
|
-
arguments[0] = op.mainError();
|
|
372
|
-
}
|
|
373
|
-
callback.apply(this, arguments);
|
|
374
|
-
});
|
|
375
|
-
op.attempt(function() {
|
|
376
|
-
original2.apply(obj, args);
|
|
377
|
-
});
|
|
378
|
-
}.bind(obj, original);
|
|
379
|
-
obj[method].options = options;
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
386
|
-
var require_retry2 = __commonJS({
|
|
387
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
|
|
388
|
-
"use strict";
|
|
389
|
-
module.exports = require_retry();
|
|
148
|
+
module.exports = pLimit2;
|
|
390
149
|
}
|
|
391
150
|
});
|
|
392
151
|
|
|
@@ -585,8 +344,8 @@ var __defProp2 = Object.defineProperty;
|
|
|
585
344
|
var __typeError2 = (msg) => {
|
|
586
345
|
throw TypeError(msg);
|
|
587
346
|
};
|
|
588
|
-
var
|
|
589
|
-
var
|
|
347
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
348
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
590
349
|
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
591
350
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
592
351
|
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);
|
|
@@ -597,18 +356,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
597
356
|
`${errorMessage}
|
|
598
357
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
599
358
|
);
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
359
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
360
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
361
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
362
|
+
__publicField(this, "statusCode", statusCode);
|
|
363
|
+
__publicField(this, "statusText", statusText);
|
|
364
|
+
__publicField(this, "requestId", requestId);
|
|
606
365
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
607
366
|
}
|
|
608
367
|
};
|
|
609
368
|
var ApiClient = class _ApiClient {
|
|
610
369
|
constructor(options) {
|
|
611
|
-
|
|
370
|
+
__publicField(this, "options");
|
|
612
371
|
var _a, _b, _c, _d, _e;
|
|
613
372
|
if (!options.apiKey && !options.bearerToken) {
|
|
614
373
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -990,192 +749,391 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
990
749
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
991
750
|
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
992
751
|
|
|
993
|
-
//
|
|
994
|
-
var
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
752
|
+
// ../canvas/dist/index.mjs
|
|
753
|
+
var __create2 = Object.create;
|
|
754
|
+
var __defProp3 = Object.defineProperty;
|
|
755
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
756
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
757
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
758
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
759
|
+
var __typeError3 = (msg) => {
|
|
760
|
+
throw TypeError(msg);
|
|
1000
761
|
};
|
|
1001
|
-
var
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
enqueue(value) {
|
|
1010
|
-
const node = new Node(value);
|
|
1011
|
-
if (__privateGet(this, _head)) {
|
|
1012
|
-
__privateGet(this, _tail).next = node;
|
|
1013
|
-
__privateSet(this, _tail, node);
|
|
1014
|
-
} else {
|
|
1015
|
-
__privateSet(this, _head, node);
|
|
1016
|
-
__privateSet(this, _tail, node);
|
|
1017
|
-
}
|
|
1018
|
-
__privateWrapper(this, _size)._++;
|
|
1019
|
-
}
|
|
1020
|
-
dequeue() {
|
|
1021
|
-
const current = __privateGet(this, _head);
|
|
1022
|
-
if (!current) {
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
1026
|
-
__privateWrapper(this, _size)._--;
|
|
1027
|
-
if (!__privateGet(this, _head)) {
|
|
1028
|
-
__privateSet(this, _tail, void 0);
|
|
1029
|
-
}
|
|
1030
|
-
return current.value;
|
|
1031
|
-
}
|
|
1032
|
-
peek() {
|
|
1033
|
-
if (!__privateGet(this, _head)) {
|
|
1034
|
-
return;
|
|
1035
|
-
}
|
|
1036
|
-
return __privateGet(this, _head).value;
|
|
1037
|
-
}
|
|
1038
|
-
clear() {
|
|
1039
|
-
__privateSet(this, _head, void 0);
|
|
1040
|
-
__privateSet(this, _tail, void 0);
|
|
1041
|
-
__privateSet(this, _size, 0);
|
|
762
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
763
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
764
|
+
};
|
|
765
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
766
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
767
|
+
for (let key of __getOwnPropNames2(from))
|
|
768
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
769
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1042
770
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
771
|
+
return to;
|
|
772
|
+
};
|
|
773
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
774
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
775
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
776
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
777
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
778
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
779
|
+
mod
|
|
780
|
+
));
|
|
781
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
782
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
783
|
+
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);
|
|
784
|
+
var require_yocto_queue2 = __commonJS2({
|
|
785
|
+
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
|
|
786
|
+
"use strict";
|
|
787
|
+
var Node = class {
|
|
788
|
+
/// value;
|
|
789
|
+
/// next;
|
|
790
|
+
constructor(value) {
|
|
791
|
+
this.value = value;
|
|
792
|
+
this.next = void 0;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
var Queue = class {
|
|
796
|
+
// TODO: Use private class fields when targeting Node.js 12.
|
|
797
|
+
// #_head;
|
|
798
|
+
// #_tail;
|
|
799
|
+
// #_size;
|
|
800
|
+
constructor() {
|
|
801
|
+
this.clear();
|
|
802
|
+
}
|
|
803
|
+
enqueue(value) {
|
|
804
|
+
const node = new Node(value);
|
|
805
|
+
if (this._head) {
|
|
806
|
+
this._tail.next = node;
|
|
807
|
+
this._tail = node;
|
|
808
|
+
} else {
|
|
809
|
+
this._head = node;
|
|
810
|
+
this._tail = node;
|
|
811
|
+
}
|
|
812
|
+
this._size++;
|
|
813
|
+
}
|
|
814
|
+
dequeue() {
|
|
815
|
+
const current = this._head;
|
|
816
|
+
if (!current) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
this._head = this._head.next;
|
|
820
|
+
this._size--;
|
|
821
|
+
return current.value;
|
|
822
|
+
}
|
|
823
|
+
clear() {
|
|
824
|
+
this._head = void 0;
|
|
825
|
+
this._tail = void 0;
|
|
826
|
+
this._size = 0;
|
|
827
|
+
}
|
|
828
|
+
get size() {
|
|
829
|
+
return this._size;
|
|
830
|
+
}
|
|
831
|
+
*[Symbol.iterator]() {
|
|
832
|
+
let current = this._head;
|
|
833
|
+
while (current) {
|
|
834
|
+
yield current.value;
|
|
835
|
+
current = current.next;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
module.exports = Queue;
|
|
1045
840
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
841
|
+
});
|
|
842
|
+
var require_p_limit2 = __commonJS2({
|
|
843
|
+
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
|
|
844
|
+
"use strict";
|
|
845
|
+
var Queue = require_yocto_queue2();
|
|
846
|
+
var pLimit2 = (concurrency) => {
|
|
847
|
+
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
848
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
849
|
+
}
|
|
850
|
+
const queue = new Queue();
|
|
851
|
+
let activeCount = 0;
|
|
852
|
+
const next = () => {
|
|
853
|
+
activeCount--;
|
|
854
|
+
if (queue.size > 0) {
|
|
855
|
+
queue.dequeue()();
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
const run = async (fn, resolve, ...args) => {
|
|
859
|
+
activeCount++;
|
|
860
|
+
const result = (async () => fn(...args))();
|
|
861
|
+
resolve(result);
|
|
862
|
+
try {
|
|
863
|
+
await result;
|
|
864
|
+
} catch (e) {
|
|
865
|
+
}
|
|
866
|
+
next();
|
|
867
|
+
};
|
|
868
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
869
|
+
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
870
|
+
(async () => {
|
|
871
|
+
await Promise.resolve();
|
|
872
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
873
|
+
queue.dequeue()();
|
|
874
|
+
}
|
|
875
|
+
})();
|
|
876
|
+
};
|
|
877
|
+
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
878
|
+
enqueue(fn, resolve, ...args);
|
|
879
|
+
});
|
|
880
|
+
Object.defineProperties(generator, {
|
|
881
|
+
activeCount: {
|
|
882
|
+
get: () => activeCount
|
|
883
|
+
},
|
|
884
|
+
pendingCount: {
|
|
885
|
+
get: () => queue.size
|
|
886
|
+
},
|
|
887
|
+
clearQueue: {
|
|
888
|
+
value: () => {
|
|
889
|
+
queue.clear();
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
return generator;
|
|
894
|
+
};
|
|
895
|
+
module.exports = pLimit2;
|
|
1052
896
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
897
|
+
});
|
|
898
|
+
var require_retry_operation = __commonJS2({
|
|
899
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
900
|
+
"use strict";
|
|
901
|
+
function RetryOperation(timeouts, options) {
|
|
902
|
+
if (typeof options === "boolean") {
|
|
903
|
+
options = { forever: options };
|
|
904
|
+
}
|
|
905
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
906
|
+
this._timeouts = timeouts;
|
|
907
|
+
this._options = options || {};
|
|
908
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
909
|
+
this._fn = null;
|
|
910
|
+
this._errors = [];
|
|
911
|
+
this._attempts = 1;
|
|
912
|
+
this._operationTimeout = null;
|
|
913
|
+
this._operationTimeoutCb = null;
|
|
914
|
+
this._timeout = null;
|
|
915
|
+
this._operationStart = null;
|
|
916
|
+
this._timer = null;
|
|
917
|
+
if (this._options.forever) {
|
|
918
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
919
|
+
}
|
|
1056
920
|
}
|
|
921
|
+
module.exports = RetryOperation;
|
|
922
|
+
RetryOperation.prototype.reset = function() {
|
|
923
|
+
this._attempts = 1;
|
|
924
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
925
|
+
};
|
|
926
|
+
RetryOperation.prototype.stop = function() {
|
|
927
|
+
if (this._timeout) {
|
|
928
|
+
clearTimeout(this._timeout);
|
|
929
|
+
}
|
|
930
|
+
if (this._timer) {
|
|
931
|
+
clearTimeout(this._timer);
|
|
932
|
+
}
|
|
933
|
+
this._timeouts = [];
|
|
934
|
+
this._cachedTimeouts = null;
|
|
935
|
+
};
|
|
936
|
+
RetryOperation.prototype.retry = function(err) {
|
|
937
|
+
if (this._timeout) {
|
|
938
|
+
clearTimeout(this._timeout);
|
|
939
|
+
}
|
|
940
|
+
if (!err) {
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
944
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
945
|
+
this._errors.push(err);
|
|
946
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
this._errors.push(err);
|
|
950
|
+
var timeout = this._timeouts.shift();
|
|
951
|
+
if (timeout === void 0) {
|
|
952
|
+
if (this._cachedTimeouts) {
|
|
953
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
954
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
955
|
+
} else {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
var self = this;
|
|
960
|
+
this._timer = setTimeout(function() {
|
|
961
|
+
self._attempts++;
|
|
962
|
+
if (self._operationTimeoutCb) {
|
|
963
|
+
self._timeout = setTimeout(function() {
|
|
964
|
+
self._operationTimeoutCb(self._attempts);
|
|
965
|
+
}, self._operationTimeout);
|
|
966
|
+
if (self._options.unref) {
|
|
967
|
+
self._timeout.unref();
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
self._fn(self._attempts);
|
|
971
|
+
}, timeout);
|
|
972
|
+
if (this._options.unref) {
|
|
973
|
+
this._timer.unref();
|
|
974
|
+
}
|
|
975
|
+
return true;
|
|
976
|
+
};
|
|
977
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
978
|
+
this._fn = fn;
|
|
979
|
+
if (timeoutOps) {
|
|
980
|
+
if (timeoutOps.timeout) {
|
|
981
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
982
|
+
}
|
|
983
|
+
if (timeoutOps.cb) {
|
|
984
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
var self = this;
|
|
988
|
+
if (this._operationTimeoutCb) {
|
|
989
|
+
this._timeout = setTimeout(function() {
|
|
990
|
+
self._operationTimeoutCb();
|
|
991
|
+
}, self._operationTimeout);
|
|
992
|
+
}
|
|
993
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
994
|
+
this._fn(this._attempts);
|
|
995
|
+
};
|
|
996
|
+
RetryOperation.prototype.try = function(fn) {
|
|
997
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
998
|
+
this.attempt(fn);
|
|
999
|
+
};
|
|
1000
|
+
RetryOperation.prototype.start = function(fn) {
|
|
1001
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
1002
|
+
this.attempt(fn);
|
|
1003
|
+
};
|
|
1004
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
1005
|
+
RetryOperation.prototype.errors = function() {
|
|
1006
|
+
return this._errors;
|
|
1007
|
+
};
|
|
1008
|
+
RetryOperation.prototype.attempts = function() {
|
|
1009
|
+
return this._attempts;
|
|
1010
|
+
};
|
|
1011
|
+
RetryOperation.prototype.mainError = function() {
|
|
1012
|
+
if (this._errors.length === 0) {
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
var counts = {};
|
|
1016
|
+
var mainError = null;
|
|
1017
|
+
var mainErrorCount = 0;
|
|
1018
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
1019
|
+
var error = this._errors[i];
|
|
1020
|
+
var message = error.message;
|
|
1021
|
+
var count = (counts[message] || 0) + 1;
|
|
1022
|
+
counts[message] = count;
|
|
1023
|
+
if (count >= mainErrorCount) {
|
|
1024
|
+
mainError = error;
|
|
1025
|
+
mainErrorCount = count;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
return mainError;
|
|
1029
|
+
};
|
|
1057
1030
|
}
|
|
1058
|
-
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
const next = () => {
|
|
1075
|
-
activeCount--;
|
|
1076
|
-
resumeNext();
|
|
1077
|
-
};
|
|
1078
|
-
const run = async (function_, resolve, arguments_) => {
|
|
1079
|
-
const result = (async () => function_(...arguments_))();
|
|
1080
|
-
resolve(result);
|
|
1081
|
-
try {
|
|
1082
|
-
await result;
|
|
1083
|
-
} catch (e) {
|
|
1084
|
-
}
|
|
1085
|
-
next();
|
|
1086
|
-
};
|
|
1087
|
-
const enqueue = (function_, resolve, arguments_) => {
|
|
1088
|
-
new Promise((internalResolve) => {
|
|
1089
|
-
queue.enqueue(internalResolve);
|
|
1090
|
-
}).then(
|
|
1091
|
-
run.bind(void 0, function_, resolve, arguments_)
|
|
1092
|
-
);
|
|
1093
|
-
(async () => {
|
|
1094
|
-
await Promise.resolve();
|
|
1095
|
-
if (activeCount < concurrency) {
|
|
1096
|
-
resumeNext();
|
|
1031
|
+
});
|
|
1032
|
+
var require_retry = __commonJS2({
|
|
1033
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
1034
|
+
"use strict";
|
|
1035
|
+
var RetryOperation = require_retry_operation();
|
|
1036
|
+
exports.operation = function(options) {
|
|
1037
|
+
var timeouts = exports.timeouts(options);
|
|
1038
|
+
return new RetryOperation(timeouts, {
|
|
1039
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
1040
|
+
unref: options && options.unref,
|
|
1041
|
+
maxRetryTime: options && options.maxRetryTime
|
|
1042
|
+
});
|
|
1043
|
+
};
|
|
1044
|
+
exports.timeouts = function(options) {
|
|
1045
|
+
if (options instanceof Array) {
|
|
1046
|
+
return [].concat(options);
|
|
1097
1047
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
pendingCount: {
|
|
1108
|
-
get: () => queue.size
|
|
1109
|
-
},
|
|
1110
|
-
clearQueue: {
|
|
1111
|
-
value() {
|
|
1112
|
-
queue.clear();
|
|
1048
|
+
var opts = {
|
|
1049
|
+
retries: 10,
|
|
1050
|
+
factor: 2,
|
|
1051
|
+
minTimeout: 1 * 1e3,
|
|
1052
|
+
maxTimeout: Infinity,
|
|
1053
|
+
randomize: false
|
|
1054
|
+
};
|
|
1055
|
+
for (var key in options) {
|
|
1056
|
+
opts[key] = options[key];
|
|
1113
1057
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1058
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
1059
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
1060
|
+
}
|
|
1061
|
+
var timeouts = [];
|
|
1062
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
1063
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
1064
|
+
}
|
|
1065
|
+
if (options && options.forever && !timeouts.length) {
|
|
1066
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
1067
|
+
}
|
|
1068
|
+
timeouts.sort(function(a, b) {
|
|
1069
|
+
return a - b;
|
|
1070
|
+
});
|
|
1071
|
+
return timeouts;
|
|
1072
|
+
};
|
|
1073
|
+
exports.createTimeout = function(attempt, opts) {
|
|
1074
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
1075
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
1076
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
1077
|
+
return timeout;
|
|
1078
|
+
};
|
|
1079
|
+
exports.wrap = function(obj, options, methods) {
|
|
1080
|
+
if (options instanceof Array) {
|
|
1081
|
+
methods = options;
|
|
1082
|
+
options = null;
|
|
1083
|
+
}
|
|
1084
|
+
if (!methods) {
|
|
1085
|
+
methods = [];
|
|
1086
|
+
for (var key in obj) {
|
|
1087
|
+
if (typeof obj[key] === "function") {
|
|
1088
|
+
methods.push(key);
|
|
1123
1089
|
}
|
|
1124
|
-
}
|
|
1090
|
+
}
|
|
1125
1091
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1092
|
+
for (var i = 0; i < methods.length; i++) {
|
|
1093
|
+
var method = methods[i];
|
|
1094
|
+
var original = obj[method];
|
|
1095
|
+
obj[method] = function retryWrapper(original2) {
|
|
1096
|
+
var op = exports.operation(options);
|
|
1097
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
1098
|
+
var callback = args.pop();
|
|
1099
|
+
args.push(function(err) {
|
|
1100
|
+
if (op.retry(err)) {
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
if (err) {
|
|
1104
|
+
arguments[0] = op.mainError();
|
|
1105
|
+
}
|
|
1106
|
+
callback.apply(this, arguments);
|
|
1107
|
+
});
|
|
1108
|
+
op.attempt(function() {
|
|
1109
|
+
original2.apply(obj, args);
|
|
1110
|
+
});
|
|
1111
|
+
}.bind(obj, original);
|
|
1112
|
+
obj[method].options = options;
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1133
1115
|
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
var
|
|
1142
|
-
var
|
|
1143
|
-
|
|
1116
|
+
});
|
|
1117
|
+
var require_retry2 = __commonJS2({
|
|
1118
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
|
|
1119
|
+
"use strict";
|
|
1120
|
+
module.exports = require_retry();
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
1124
|
+
var import_retry = __toESM2(require_retry2(), 1);
|
|
1125
|
+
var networkErrorMsgs = /* @__PURE__ */ new Set([
|
|
1126
|
+
"Failed to fetch",
|
|
1144
1127
|
// Chrome
|
|
1145
1128
|
"NetworkError when attempting to fetch resource.",
|
|
1146
1129
|
// Firefox
|
|
1147
1130
|
"The Internet connection appears to be offline.",
|
|
1148
|
-
// Safari
|
|
1131
|
+
// Safari
|
|
1149
1132
|
"Network request failed",
|
|
1150
1133
|
// `cross-fetch`
|
|
1151
|
-
"fetch failed"
|
|
1152
|
-
// Undici (Node.js)
|
|
1153
|
-
"terminated",
|
|
1134
|
+
"fetch failed"
|
|
1154
1135
|
// Undici (Node.js)
|
|
1155
|
-
" A network error occurred.",
|
|
1156
|
-
// Bun (WebKit)
|
|
1157
|
-
"Network connection lost"
|
|
1158
|
-
// Cloudflare Workers (fetch)
|
|
1159
1136
|
]);
|
|
1160
|
-
function isNetworkError(error) {
|
|
1161
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1162
|
-
if (!isValid) {
|
|
1163
|
-
return false;
|
|
1164
|
-
}
|
|
1165
|
-
const { message, stack } = error;
|
|
1166
|
-
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1167
|
-
return stack === void 0 || "__sentry_captured__" in error;
|
|
1168
|
-
}
|
|
1169
|
-
if (message.startsWith("error sending request for url")) {
|
|
1170
|
-
return true;
|
|
1171
|
-
}
|
|
1172
|
-
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1173
|
-
return true;
|
|
1174
|
-
}
|
|
1175
|
-
return errorMessages.has(message);
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1179
1137
|
var AbortError = class extends Error {
|
|
1180
1138
|
constructor(message) {
|
|
1181
1139
|
super();
|
|
@@ -1196,71 +1154,63 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1196
1154
|
error.retriesLeft = retriesLeft;
|
|
1197
1155
|
return error;
|
|
1198
1156
|
};
|
|
1157
|
+
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
1158
|
+
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1199
1159
|
async function pRetry(input, options) {
|
|
1200
1160
|
return new Promise((resolve, reject) => {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1161
|
+
options = {
|
|
1162
|
+
onFailedAttempt() {
|
|
1163
|
+
},
|
|
1164
|
+
retries: 10,
|
|
1165
|
+
...options
|
|
1204
1166
|
};
|
|
1205
|
-
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1206
|
-
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1207
1167
|
const operation = import_retry.default.operation(options);
|
|
1208
|
-
const abortHandler = () => {
|
|
1209
|
-
var _a2;
|
|
1210
|
-
operation.stop();
|
|
1211
|
-
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1212
|
-
};
|
|
1213
|
-
if (options.signal && !options.signal.aborted) {
|
|
1214
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1215
|
-
}
|
|
1216
|
-
const cleanUp = () => {
|
|
1217
|
-
var _a2;
|
|
1218
|
-
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1219
|
-
operation.stop();
|
|
1220
|
-
};
|
|
1221
1168
|
operation.attempt(async (attemptNumber) => {
|
|
1222
1169
|
try {
|
|
1223
|
-
|
|
1224
|
-
cleanUp();
|
|
1225
|
-
resolve(result);
|
|
1170
|
+
resolve(await input(attemptNumber));
|
|
1226
1171
|
} catch (error) {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1172
|
+
if (!(error instanceof Error)) {
|
|
1173
|
+
reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (error instanceof AbortError) {
|
|
1177
|
+
operation.stop();
|
|
1178
|
+
reject(error.originalError);
|
|
1179
|
+
} else if (error instanceof TypeError && !isNetworkError(error.message)) {
|
|
1180
|
+
operation.stop();
|
|
1181
|
+
reject(error);
|
|
1182
|
+
} else {
|
|
1237
1183
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1184
|
+
try {
|
|
1185
|
+
await options.onFailedAttempt(error);
|
|
1186
|
+
} catch (error2) {
|
|
1187
|
+
reject(error2);
|
|
1188
|
+
return;
|
|
1241
1189
|
}
|
|
1242
|
-
await options.onFailedAttempt(error);
|
|
1243
1190
|
if (!operation.retry(error)) {
|
|
1244
|
-
|
|
1191
|
+
reject(operation.mainError());
|
|
1245
1192
|
}
|
|
1246
|
-
} catch (finalError) {
|
|
1247
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1248
|
-
cleanUp();
|
|
1249
|
-
reject(finalError);
|
|
1250
1193
|
}
|
|
1251
1194
|
}
|
|
1252
1195
|
});
|
|
1196
|
+
if (options.signal && !options.signal.aborted) {
|
|
1197
|
+
options.signal.addEventListener("abort", () => {
|
|
1198
|
+
operation.stop();
|
|
1199
|
+
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1200
|
+
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1201
|
+
}, {
|
|
1202
|
+
once: true
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1253
1205
|
});
|
|
1254
1206
|
}
|
|
1255
|
-
|
|
1256
|
-
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1257
1207
|
var AbortError2 = class extends Error {
|
|
1258
1208
|
constructor() {
|
|
1259
1209
|
super("Throttled function aborted");
|
|
1260
1210
|
this.name = "AbortError";
|
|
1261
1211
|
}
|
|
1262
1212
|
};
|
|
1263
|
-
function pThrottle({ limit, interval, strict
|
|
1213
|
+
function pThrottle({ limit, interval, strict }) {
|
|
1264
1214
|
if (!Number.isFinite(limit)) {
|
|
1265
1215
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1266
1216
|
}
|
|
@@ -1288,38 +1238,32 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1288
1238
|
const strictTicks = [];
|
|
1289
1239
|
function strictDelay() {
|
|
1290
1240
|
const now = Date.now();
|
|
1291
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1292
|
-
strictTicks.length = 0;
|
|
1293
|
-
}
|
|
1294
1241
|
if (strictTicks.length < limit) {
|
|
1295
1242
|
strictTicks.push(now);
|
|
1296
1243
|
return 0;
|
|
1297
1244
|
}
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1245
|
+
const earliestTime = strictTicks.shift() + interval;
|
|
1246
|
+
if (now >= earliestTime) {
|
|
1247
|
+
strictTicks.push(now);
|
|
1248
|
+
return 0;
|
|
1249
|
+
}
|
|
1250
|
+
strictTicks.push(earliestTime);
|
|
1251
|
+
return earliestTime - now;
|
|
1302
1252
|
}
|
|
1303
1253
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1304
1254
|
return (function_) => {
|
|
1305
|
-
const throttled = function(...
|
|
1255
|
+
const throttled = function(...args) {
|
|
1306
1256
|
if (!throttled.isEnabled) {
|
|
1307
|
-
return (async () => function_.apply(this,
|
|
1257
|
+
return (async () => function_.apply(this, args))();
|
|
1308
1258
|
}
|
|
1309
|
-
let
|
|
1259
|
+
let timeout;
|
|
1310
1260
|
return new Promise((resolve, reject) => {
|
|
1311
1261
|
const execute = () => {
|
|
1312
|
-
resolve(function_.apply(this,
|
|
1313
|
-
queue.delete(
|
|
1262
|
+
resolve(function_.apply(this, args));
|
|
1263
|
+
queue.delete(timeout);
|
|
1314
1264
|
};
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
timeoutId = setTimeout(execute, delay);
|
|
1318
|
-
queue.set(timeoutId, reject);
|
|
1319
|
-
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1320
|
-
} else {
|
|
1321
|
-
execute();
|
|
1322
|
-
}
|
|
1265
|
+
timeout = setTimeout(execute, getDelay());
|
|
1266
|
+
queue.set(timeout, reject);
|
|
1323
1267
|
});
|
|
1324
1268
|
};
|
|
1325
1269
|
throttled.abort = () => {
|
|
@@ -1331,29 +1275,16 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1331
1275
|
strictTicks.splice(0, strictTicks.length);
|
|
1332
1276
|
};
|
|
1333
1277
|
throttled.isEnabled = true;
|
|
1334
|
-
Object.defineProperty(throttled, "queueSize", {
|
|
1335
|
-
get() {
|
|
1336
|
-
return queue.size;
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1339
1278
|
return throttled;
|
|
1340
1279
|
};
|
|
1341
1280
|
}
|
|
1342
|
-
|
|
1343
|
-
// ../canvas/dist/index.mjs
|
|
1344
|
-
var __typeError3 = (msg) => {
|
|
1345
|
-
throw TypeError(msg);
|
|
1346
|
-
};
|
|
1347
|
-
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1348
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1349
|
-
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);
|
|
1350
1281
|
function createLimitPolicy({
|
|
1351
1282
|
throttle = { interval: 1e3, limit: 10 },
|
|
1352
|
-
retry:
|
|
1283
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
1353
1284
|
limit = 10
|
|
1354
1285
|
}) {
|
|
1355
1286
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1356
|
-
const limiter = limit ?
|
|
1287
|
+
const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
|
|
1357
1288
|
return function limitPolicy(func) {
|
|
1358
1289
|
let currentFunc = async () => await func();
|
|
1359
1290
|
if (throttler) {
|
|
@@ -1364,13 +1295,13 @@ function createLimitPolicy({
|
|
|
1364
1295
|
const limitFunc = currentFunc;
|
|
1365
1296
|
currentFunc = () => limiter(limitFunc);
|
|
1366
1297
|
}
|
|
1367
|
-
if (
|
|
1298
|
+
if (retry2) {
|
|
1368
1299
|
const retryFunc = currentFunc;
|
|
1369
1300
|
currentFunc = () => pRetry(retryFunc, {
|
|
1370
|
-
...
|
|
1301
|
+
...retry2,
|
|
1371
1302
|
onFailedAttempt: async (error) => {
|
|
1372
|
-
if (
|
|
1373
|
-
await
|
|
1303
|
+
if (retry2.onFailedAttempt) {
|
|
1304
|
+
await retry2.onFailedAttempt(error);
|
|
1374
1305
|
}
|
|
1375
1306
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1376
1307
|
throw error;
|
|
@@ -2561,7 +2492,7 @@ function createLimiter(concurrency) {
|
|
|
2561
2492
|
});
|
|
2562
2493
|
};
|
|
2563
2494
|
}
|
|
2564
|
-
async function
|
|
2495
|
+
async function retry(fn, options) {
|
|
2565
2496
|
let lastError;
|
|
2566
2497
|
let delay = 1e3;
|
|
2567
2498
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2601,7 +2532,7 @@ function createLimitPolicy2({
|
|
|
2601
2532
|
}
|
|
2602
2533
|
if (retryOptions) {
|
|
2603
2534
|
const retryFunc = currentFunc;
|
|
2604
|
-
currentFunc = () =>
|
|
2535
|
+
currentFunc = () => retry(retryFunc, {
|
|
2605
2536
|
...retryOptions,
|
|
2606
2537
|
onFailedAttempt: async (error) => {
|
|
2607
2538
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2711,6 +2642,10 @@ var getDisableSwrMiddlewareCache = () => {
|
|
|
2711
2642
|
return false;
|
|
2712
2643
|
};
|
|
2713
2644
|
|
|
2645
|
+
// src/config/routeCode.ts
|
|
2646
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2647
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2648
|
+
|
|
2714
2649
|
// src/data/client.ts
|
|
2715
2650
|
import { getCache, waitUntil } from "@vercel/functions";
|
|
2716
2651
|
|
|
@@ -3345,12 +3280,12 @@ function mitt_default(n) {
|
|
|
3345
3280
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
3346
3281
|
var import_rfdc2 = __toESM(require_rfdc(), 1);
|
|
3347
3282
|
var import_rfdc3 = __toESM(require_rfdc(), 1);
|
|
3348
|
-
var
|
|
3283
|
+
var __defProp4 = Object.defineProperty;
|
|
3349
3284
|
var __typeError4 = (msg) => {
|
|
3350
3285
|
throw TypeError(msg);
|
|
3351
3286
|
};
|
|
3352
|
-
var
|
|
3353
|
-
var
|
|
3287
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3288
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3354
3289
|
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
3355
3290
|
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3356
3291
|
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);
|
|
@@ -3427,7 +3362,7 @@ var SignalInstance = class {
|
|
|
3427
3362
|
constructor(data, evaluator, onLogMessage) {
|
|
3428
3363
|
__privateAdd4(this, _evaluator);
|
|
3429
3364
|
__privateAdd4(this, _onLogMessage);
|
|
3430
|
-
|
|
3365
|
+
__publicField2(this, "signal");
|
|
3431
3366
|
this.signal = data;
|
|
3432
3367
|
__privateSet2(this, _evaluator, evaluator);
|
|
3433
3368
|
__privateSet2(this, _onLogMessage, onLogMessage);
|
|
@@ -3485,7 +3420,7 @@ var ManifestInstance = class {
|
|
|
3485
3420
|
onLogMessage = () => {
|
|
3486
3421
|
}
|
|
3487
3422
|
}) {
|
|
3488
|
-
|
|
3423
|
+
__publicField2(this, "data");
|
|
3489
3424
|
__privateAdd4(this, _mf);
|
|
3490
3425
|
__privateAdd4(this, _signalInstances);
|
|
3491
3426
|
__privateAdd4(this, _goalEvaluators, []);
|
|
@@ -4272,7 +4207,7 @@ var TransitionDataStore = class {
|
|
|
4272
4207
|
__privateAdd4(this, _data);
|
|
4273
4208
|
__privateAdd4(this, _initialData);
|
|
4274
4209
|
__privateAdd4(this, _mitt, mitt_default());
|
|
4275
|
-
|
|
4210
|
+
__publicField2(this, "events", {
|
|
4276
4211
|
on: __privateGet4(this, _mitt).on,
|
|
4277
4212
|
off: __privateGet4(this, _mitt).off
|
|
4278
4213
|
});
|
|
@@ -4635,10 +4570,10 @@ var _LocalStorage_instances;
|
|
|
4635
4570
|
var key_fn;
|
|
4636
4571
|
var LocalStorage = class {
|
|
4637
4572
|
constructor(partitionKey) {
|
|
4638
|
-
|
|
4573
|
+
__publicField2(this, "partitionKey", partitionKey);
|
|
4639
4574
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4640
|
-
|
|
4641
|
-
|
|
4575
|
+
__publicField2(this, "inMemoryFallback", {});
|
|
4576
|
+
__publicField2(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
4642
4577
|
}
|
|
4643
4578
|
get(key) {
|
|
4644
4579
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
|
@@ -4699,7 +4634,7 @@ var VisitorDataStore = class {
|
|
|
4699
4634
|
__privateAdd4(this, _persist);
|
|
4700
4635
|
__privateAdd4(this, _visitTimeout);
|
|
4701
4636
|
__privateAdd4(this, _options);
|
|
4702
|
-
|
|
4637
|
+
__publicField2(this, "events", {
|
|
4703
4638
|
on: __privateGet4(this, _mitt2).on,
|
|
4704
4639
|
off: __privateGet4(this, _mitt2).off
|
|
4705
4640
|
});
|
|
@@ -4900,7 +4835,7 @@ var calculateScores_fn;
|
|
|
4900
4835
|
var Context = class {
|
|
4901
4836
|
constructor(options) {
|
|
4902
4837
|
__privateAdd4(this, _Context_instances);
|
|
4903
|
-
|
|
4838
|
+
__publicField2(this, "manifest");
|
|
4904
4839
|
__privateAdd4(this, _personalizationSelectionAlgorithms);
|
|
4905
4840
|
__privateAdd4(this, _serverTransitionState);
|
|
4906
4841
|
__privateAdd4(this, _scores, {});
|
|
@@ -4910,11 +4845,11 @@ var Context = class {
|
|
|
4910
4845
|
__privateAdd4(this, _commands);
|
|
4911
4846
|
__privateAdd4(this, _requireConsentForPersonalization);
|
|
4912
4847
|
__privateAdd4(this, _mitt3, mitt_default());
|
|
4913
|
-
|
|
4848
|
+
__publicField2(this, "events", {
|
|
4914
4849
|
on: __privateGet4(this, _mitt3).on,
|
|
4915
4850
|
off: __privateGet4(this, _mitt3).off
|
|
4916
4851
|
});
|
|
4917
|
-
|
|
4852
|
+
__publicField2(this, "storage");
|
|
4918
4853
|
var _a, _b, _c;
|
|
4919
4854
|
const { manifest, ...storageOptions } = options;
|
|
4920
4855
|
__privateSet2(this, _state, {});
|
|
@@ -5804,8 +5739,14 @@ var handleRouteRequest = async ({
|
|
|
5804
5739
|
allComponentIds
|
|
5805
5740
|
});
|
|
5806
5741
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5742
|
+
let usedDraftStableSegment = false;
|
|
5807
5743
|
if (!pathToRewriteTo) {
|
|
5808
|
-
|
|
5744
|
+
if (draftModeEnabled) {
|
|
5745
|
+
pathToRewriteTo = `/uniform/${UNIFORM_DRAFT_SEGMENT}`;
|
|
5746
|
+
usedDraftStableSegment = true;
|
|
5747
|
+
} else {
|
|
5748
|
+
pathToRewriteTo = `/uniform/${code}`;
|
|
5749
|
+
}
|
|
5809
5750
|
}
|
|
5810
5751
|
const headers = new Headers();
|
|
5811
5752
|
if (serializedQuirkCookie) {
|
|
@@ -5814,8 +5755,14 @@ var handleRouteRequest = async ({
|
|
|
5814
5755
|
`${UNIFORM_MIDDLEWARE_QUIRK_COOKIE_NAME}=${serializedQuirkCookie}; Path=/; SameSite=Lax; Max-Age=10`
|
|
5815
5756
|
);
|
|
5816
5757
|
}
|
|
5758
|
+
let requestHeaders;
|
|
5759
|
+
if (usedDraftStableSegment) {
|
|
5760
|
+
requestHeaders = new Headers(request.headers);
|
|
5761
|
+
requestHeaders.set(UNIFORM_DRAFT_CODE_HEADER, code);
|
|
5762
|
+
}
|
|
5817
5763
|
return NextResponse.rewrite(new URL(pathToRewriteTo, request.nextUrl.origin), {
|
|
5818
|
-
headers
|
|
5764
|
+
headers,
|
|
5765
|
+
...requestHeaders ? { request: { headers: requestHeaders } } : {}
|
|
5819
5766
|
});
|
|
5820
5767
|
};
|
|
5821
5768
|
var isPrefetchRequest = (request) => {
|