@uniformdev/next-app-router 20.63.1-alpha.12 → 20.63.1-alpha.17
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 +547 -567
- package/dist/cache.mjs +547 -567
- package/dist/component.js +416 -3
- package/dist/component.mjs +416 -3
- package/dist/handler.js +567 -582
- package/dist/handler.mjs +567 -582
- package/dist/index.esm.js +570 -583
- package/dist/index.js +570 -583
- package/dist/index.mjs +570 -583
- package/dist/middleware.js +516 -522
- package/dist/middleware.mjs +516 -522
- 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);
|
|
@@ -623,7 +382,7 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
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,185 +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
|
-
|
|
1159
|
-
// Chrome
|
|
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([
|
|
1160
1141
|
"Failed to fetch",
|
|
1161
1142
|
// Chrome
|
|
1162
1143
|
"NetworkError when attempting to fetch resource.",
|
|
1163
1144
|
// Firefox
|
|
1164
1145
|
"The Internet connection appears to be offline.",
|
|
1165
|
-
// Safari
|
|
1166
|
-
"Load failed",
|
|
1167
|
-
// Safari 17+
|
|
1146
|
+
// Safari
|
|
1168
1147
|
"Network request failed",
|
|
1169
1148
|
// `cross-fetch`
|
|
1170
|
-
"fetch failed"
|
|
1171
|
-
// Undici (Node.js)
|
|
1172
|
-
"terminated"
|
|
1149
|
+
"fetch failed"
|
|
1173
1150
|
// Undici (Node.js)
|
|
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
|
-
if (error.message === "Load failed") {
|
|
1181
|
-
return error.stack === void 0;
|
|
1182
|
-
}
|
|
1183
|
-
return errorMessages.has(error.message);
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1187
1152
|
var AbortError = class extends Error {
|
|
1188
1153
|
constructor(message) {
|
|
1189
1154
|
super();
|
|
@@ -1204,68 +1169,63 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1204
1169
|
error.retriesLeft = retriesLeft;
|
|
1205
1170
|
return error;
|
|
1206
1171
|
};
|
|
1172
|
+
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
1173
|
+
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1207
1174
|
async function pRetry(input, options) {
|
|
1208
1175
|
return new Promise((resolve, reject) => {
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1176
|
+
options = {
|
|
1177
|
+
onFailedAttempt() {
|
|
1178
|
+
},
|
|
1179
|
+
retries: 10,
|
|
1180
|
+
...options
|
|
1212
1181
|
};
|
|
1213
|
-
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1214
|
-
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1215
1182
|
const operation = import_retry.default.operation(options);
|
|
1216
|
-
const abortHandler = () => {
|
|
1217
|
-
var _a2;
|
|
1218
|
-
operation.stop();
|
|
1219
|
-
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1220
|
-
};
|
|
1221
|
-
if (options.signal && !options.signal.aborted) {
|
|
1222
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1223
|
-
}
|
|
1224
|
-
const cleanUp = () => {
|
|
1225
|
-
var _a2;
|
|
1226
|
-
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1227
|
-
operation.stop();
|
|
1228
|
-
};
|
|
1229
1183
|
operation.attempt(async (attemptNumber) => {
|
|
1230
1184
|
try {
|
|
1231
|
-
|
|
1232
|
-
cleanUp();
|
|
1233
|
-
resolve(result);
|
|
1185
|
+
resolve(await input(attemptNumber));
|
|
1234
1186
|
} catch (error) {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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 {
|
|
1245
1198
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1199
|
+
try {
|
|
1200
|
+
await options.onFailedAttempt(error);
|
|
1201
|
+
} catch (error2) {
|
|
1202
|
+
reject(error2);
|
|
1203
|
+
return;
|
|
1249
1204
|
}
|
|
1250
|
-
await options.onFailedAttempt(error);
|
|
1251
1205
|
if (!operation.retry(error)) {
|
|
1252
|
-
|
|
1206
|
+
reject(operation.mainError());
|
|
1253
1207
|
}
|
|
1254
|
-
} catch (finalError) {
|
|
1255
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1256
|
-
cleanUp();
|
|
1257
|
-
reject(finalError);
|
|
1258
1208
|
}
|
|
1259
1209
|
}
|
|
1260
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
|
+
}
|
|
1261
1220
|
});
|
|
1262
1221
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1222
|
+
var AbortError2 = class extends Error {
|
|
1223
|
+
constructor() {
|
|
1224
|
+
super("Throttled function aborted");
|
|
1225
|
+
this.name = "AbortError";
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
function pThrottle({ limit, interval, strict }) {
|
|
1269
1229
|
if (!Number.isFinite(limit)) {
|
|
1270
1230
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1271
1231
|
}
|
|
@@ -1293,75 +1253,53 @@ function pThrottle({ limit, interval, strict, signal, onDelay }) {
|
|
|
1293
1253
|
const strictTicks = [];
|
|
1294
1254
|
function strictDelay() {
|
|
1295
1255
|
const now = Date.now();
|
|
1296
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1297
|
-
strictTicks.length = 0;
|
|
1298
|
-
}
|
|
1299
1256
|
if (strictTicks.length < limit) {
|
|
1300
1257
|
strictTicks.push(now);
|
|
1301
1258
|
return 0;
|
|
1302
1259
|
}
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
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;
|
|
1307
1267
|
}
|
|
1308
1268
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1309
1269
|
return (function_) => {
|
|
1310
|
-
const throttled = function(...
|
|
1270
|
+
const throttled = function(...args) {
|
|
1311
1271
|
if (!throttled.isEnabled) {
|
|
1312
|
-
return (async () => function_.apply(this,
|
|
1272
|
+
return (async () => function_.apply(this, args))();
|
|
1313
1273
|
}
|
|
1314
|
-
let
|
|
1274
|
+
let timeout;
|
|
1315
1275
|
return new Promise((resolve, reject) => {
|
|
1316
1276
|
const execute = () => {
|
|
1317
|
-
resolve(function_.apply(this,
|
|
1318
|
-
queue.delete(
|
|
1277
|
+
resolve(function_.apply(this, args));
|
|
1278
|
+
queue.delete(timeout);
|
|
1319
1279
|
};
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
timeoutId = setTimeout(execute, delay);
|
|
1323
|
-
queue.set(timeoutId, reject);
|
|
1324
|
-
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1325
|
-
} else {
|
|
1326
|
-
execute();
|
|
1327
|
-
}
|
|
1280
|
+
timeout = setTimeout(execute, getDelay());
|
|
1281
|
+
queue.set(timeout, reject);
|
|
1328
1282
|
});
|
|
1329
1283
|
};
|
|
1330
|
-
|
|
1284
|
+
throttled.abort = () => {
|
|
1331
1285
|
for (const timeout of queue.keys()) {
|
|
1332
1286
|
clearTimeout(timeout);
|
|
1333
|
-
queue.get(timeout)(
|
|
1287
|
+
queue.get(timeout)(new AbortError2());
|
|
1334
1288
|
}
|
|
1335
1289
|
queue.clear();
|
|
1336
1290
|
strictTicks.splice(0, strictTicks.length);
|
|
1337
1291
|
};
|
|
1338
|
-
registry.register(throttled, { signal, aborted });
|
|
1339
|
-
signal == null ? void 0 : signal.throwIfAborted();
|
|
1340
|
-
signal == null ? void 0 : signal.addEventListener("abort", aborted, { once: true });
|
|
1341
1292
|
throttled.isEnabled = true;
|
|
1342
|
-
Object.defineProperty(throttled, "queueSize", {
|
|
1343
|
-
get() {
|
|
1344
|
-
return queue.size;
|
|
1345
|
-
}
|
|
1346
|
-
});
|
|
1347
1293
|
return throttled;
|
|
1348
1294
|
};
|
|
1349
1295
|
}
|
|
1350
|
-
|
|
1351
|
-
// ../canvas/dist/index.mjs
|
|
1352
|
-
var __typeError3 = (msg) => {
|
|
1353
|
-
throw TypeError(msg);
|
|
1354
|
-
};
|
|
1355
|
-
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1356
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1357
|
-
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);
|
|
1358
1296
|
function createLimitPolicy({
|
|
1359
1297
|
throttle = { interval: 1e3, limit: 10 },
|
|
1360
|
-
retry:
|
|
1298
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
1361
1299
|
limit = 10
|
|
1362
1300
|
}) {
|
|
1363
1301
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1364
|
-
const limiter = limit ?
|
|
1302
|
+
const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
|
|
1365
1303
|
return function limitPolicy(func) {
|
|
1366
1304
|
let currentFunc = async () => await func();
|
|
1367
1305
|
if (throttler) {
|
|
@@ -1372,13 +1310,13 @@ function createLimitPolicy({
|
|
|
1372
1310
|
const limitFunc = currentFunc;
|
|
1373
1311
|
currentFunc = () => limiter(limitFunc);
|
|
1374
1312
|
}
|
|
1375
|
-
if (
|
|
1313
|
+
if (retry2) {
|
|
1376
1314
|
const retryFunc = currentFunc;
|
|
1377
1315
|
currentFunc = () => pRetry(retryFunc, {
|
|
1378
|
-
...
|
|
1316
|
+
...retry2,
|
|
1379
1317
|
onFailedAttempt: async (error) => {
|
|
1380
|
-
if (
|
|
1381
|
-
await
|
|
1318
|
+
if (retry2.onFailedAttempt) {
|
|
1319
|
+
await retry2.onFailedAttempt(error);
|
|
1382
1320
|
}
|
|
1383
1321
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1384
1322
|
throw error;
|
|
@@ -1389,6 +1327,47 @@ function createLimitPolicy({
|
|
|
1389
1327
|
return currentFunc();
|
|
1390
1328
|
};
|
|
1391
1329
|
}
|
|
1330
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1331
|
+
function appendCsv(out, key, values) {
|
|
1332
|
+
if (values === void 0) {
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
out[key] = values.join(",");
|
|
1336
|
+
}
|
|
1337
|
+
function projectionToQuery(spec) {
|
|
1338
|
+
const out = {};
|
|
1339
|
+
if (!spec) {
|
|
1340
|
+
return out;
|
|
1341
|
+
}
|
|
1342
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1343
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1344
|
+
if (fields) {
|
|
1345
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1346
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1347
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1348
|
+
}
|
|
1349
|
+
if (fieldTypes) {
|
|
1350
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1351
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1352
|
+
}
|
|
1353
|
+
if (slots) {
|
|
1354
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1355
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1356
|
+
if (typeof slots.depth === "number") {
|
|
1357
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1358
|
+
}
|
|
1359
|
+
if (slots.named) {
|
|
1360
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1361
|
+
for (const slotName of slotNames) {
|
|
1362
|
+
const named = slots.named[slotName];
|
|
1363
|
+
if (named && typeof named.depth === "number") {
|
|
1364
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return out;
|
|
1370
|
+
}
|
|
1392
1371
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1393
1372
|
var CanvasClient = class extends ApiClient {
|
|
1394
1373
|
constructor(options) {
|
|
@@ -1403,17 +1382,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1403
1382
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1404
1383
|
async getCompositionList(params = {}) {
|
|
1405
1384
|
const { projectId } = this.options;
|
|
1406
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1385
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1407
1386
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1387
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1408
1388
|
if (!resolveData) {
|
|
1409
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1389
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1390
|
+
...originParams,
|
|
1391
|
+
projectId,
|
|
1392
|
+
...rewrittenFilters,
|
|
1393
|
+
...rewrittenSelect
|
|
1394
|
+
});
|
|
1410
1395
|
return this.apiClient(fetchUri);
|
|
1411
1396
|
}
|
|
1412
1397
|
const edgeParams = {
|
|
1413
1398
|
...originParams,
|
|
1414
1399
|
projectId,
|
|
1415
1400
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1416
|
-
...rewrittenFilters
|
|
1401
|
+
...rewrittenFilters,
|
|
1402
|
+
...rewrittenSelect
|
|
1417
1403
|
};
|
|
1418
1404
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1419
1405
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1523,15 +1509,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1523
1509
|
}
|
|
1524
1510
|
getEntries(options) {
|
|
1525
1511
|
const { projectId } = this.options;
|
|
1526
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1512
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1527
1513
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1514
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1528
1515
|
if (skipDataResolution) {
|
|
1529
|
-
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1516
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1517
|
+
...params,
|
|
1518
|
+
...rewrittenFilters,
|
|
1519
|
+
...rewrittenSelect,
|
|
1520
|
+
projectId
|
|
1521
|
+
});
|
|
1530
1522
|
return this.apiClient(url);
|
|
1531
1523
|
}
|
|
1532
1524
|
const edgeUrl = this.createUrl(
|
|
1533
1525
|
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1534
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1526
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1535
1527
|
this.edgeApiHost
|
|
1536
1528
|
);
|
|
1537
1529
|
return this.apiClient(
|
|
@@ -2316,7 +2308,9 @@ var RouteClient = class extends ApiClient {
|
|
|
2316
2308
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
2317
2309
|
async getRoute(options) {
|
|
2318
2310
|
const { projectId } = this.options;
|
|
2319
|
-
const
|
|
2311
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2312
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2313
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2320
2314
|
return await this.apiClient(
|
|
2321
2315
|
fetchUri,
|
|
2322
2316
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
@@ -2567,7 +2561,7 @@ function createLimiter(concurrency) {
|
|
|
2567
2561
|
});
|
|
2568
2562
|
};
|
|
2569
2563
|
}
|
|
2570
|
-
async function
|
|
2564
|
+
async function retry(fn, options) {
|
|
2571
2565
|
let lastError;
|
|
2572
2566
|
let delay = 1e3;
|
|
2573
2567
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2607,7 +2601,7 @@ function createLimitPolicy2({
|
|
|
2607
2601
|
}
|
|
2608
2602
|
if (retryOptions) {
|
|
2609
2603
|
const retryFunc = currentFunc;
|
|
2610
|
-
currentFunc = () =>
|
|
2604
|
+
currentFunc = () => retry(retryFunc, {
|
|
2611
2605
|
...retryOptions,
|
|
2612
2606
|
onFailedAttempt: async (error) => {
|
|
2613
2607
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -3345,12 +3339,12 @@ function mitt_default(n) {
|
|
|
3345
3339
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
3346
3340
|
var import_rfdc2 = __toESM(require_rfdc(), 1);
|
|
3347
3341
|
var import_rfdc3 = __toESM(require_rfdc(), 1);
|
|
3348
|
-
var
|
|
3342
|
+
var __defProp4 = Object.defineProperty;
|
|
3349
3343
|
var __typeError4 = (msg) => {
|
|
3350
3344
|
throw TypeError(msg);
|
|
3351
3345
|
};
|
|
3352
|
-
var
|
|
3353
|
-
var
|
|
3346
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3347
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3354
3348
|
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
3355
3349
|
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3356
3350
|
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 +3421,7 @@ var SignalInstance = class {
|
|
|
3427
3421
|
constructor(data, evaluator, onLogMessage) {
|
|
3428
3422
|
__privateAdd4(this, _evaluator);
|
|
3429
3423
|
__privateAdd4(this, _onLogMessage);
|
|
3430
|
-
|
|
3424
|
+
__publicField2(this, "signal");
|
|
3431
3425
|
this.signal = data;
|
|
3432
3426
|
__privateSet2(this, _evaluator, evaluator);
|
|
3433
3427
|
__privateSet2(this, _onLogMessage, onLogMessage);
|
|
@@ -3485,7 +3479,7 @@ var ManifestInstance = class {
|
|
|
3485
3479
|
onLogMessage = () => {
|
|
3486
3480
|
}
|
|
3487
3481
|
}) {
|
|
3488
|
-
|
|
3482
|
+
__publicField2(this, "data");
|
|
3489
3483
|
__privateAdd4(this, _mf);
|
|
3490
3484
|
__privateAdd4(this, _signalInstances);
|
|
3491
3485
|
__privateAdd4(this, _goalEvaluators, []);
|
|
@@ -4272,7 +4266,7 @@ var TransitionDataStore = class {
|
|
|
4272
4266
|
__privateAdd4(this, _data);
|
|
4273
4267
|
__privateAdd4(this, _initialData);
|
|
4274
4268
|
__privateAdd4(this, _mitt, mitt_default());
|
|
4275
|
-
|
|
4269
|
+
__publicField2(this, "events", {
|
|
4276
4270
|
on: __privateGet4(this, _mitt).on,
|
|
4277
4271
|
off: __privateGet4(this, _mitt).off
|
|
4278
4272
|
});
|
|
@@ -4637,8 +4631,8 @@ var LocalStorage = class {
|
|
|
4637
4631
|
constructor(partitionKey) {
|
|
4638
4632
|
this.partitionKey = partitionKey;
|
|
4639
4633
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4640
|
-
|
|
4641
|
-
|
|
4634
|
+
__publicField2(this, "inMemoryFallback", {});
|
|
4635
|
+
__publicField2(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
4642
4636
|
}
|
|
4643
4637
|
get(key) {
|
|
4644
4638
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
|
@@ -4699,7 +4693,7 @@ var VisitorDataStore = class {
|
|
|
4699
4693
|
__privateAdd4(this, _persist);
|
|
4700
4694
|
__privateAdd4(this, _visitTimeout);
|
|
4701
4695
|
__privateAdd4(this, _options);
|
|
4702
|
-
|
|
4696
|
+
__publicField2(this, "events", {
|
|
4703
4697
|
on: __privateGet4(this, _mitt2).on,
|
|
4704
4698
|
off: __privateGet4(this, _mitt2).off
|
|
4705
4699
|
});
|
|
@@ -4900,7 +4894,7 @@ var calculateScores_fn;
|
|
|
4900
4894
|
var Context = class {
|
|
4901
4895
|
constructor(options) {
|
|
4902
4896
|
__privateAdd4(this, _Context_instances);
|
|
4903
|
-
|
|
4897
|
+
__publicField2(this, "manifest");
|
|
4904
4898
|
__privateAdd4(this, _personalizationSelectionAlgorithms);
|
|
4905
4899
|
__privateAdd4(this, _serverTransitionState);
|
|
4906
4900
|
__privateAdd4(this, _scores, {});
|
|
@@ -4910,11 +4904,11 @@ var Context = class {
|
|
|
4910
4904
|
__privateAdd4(this, _commands);
|
|
4911
4905
|
__privateAdd4(this, _requireConsentForPersonalization);
|
|
4912
4906
|
__privateAdd4(this, _mitt3, mitt_default());
|
|
4913
|
-
|
|
4907
|
+
__publicField2(this, "events", {
|
|
4914
4908
|
on: __privateGet4(this, _mitt3).on,
|
|
4915
4909
|
off: __privateGet4(this, _mitt3).off
|
|
4916
4910
|
});
|
|
4917
|
-
|
|
4911
|
+
__publicField2(this, "storage");
|
|
4918
4912
|
var _a, _b, _c;
|
|
4919
4913
|
const { manifest, ...storageOptions } = options;
|
|
4920
4914
|
__privateSet2(this, _state, {});
|