@uniformdev/next-app-router 20.50.2-alpha.149 → 20.50.2-alpha.167
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 +670 -515
- package/dist/cache.mjs +670 -515
- package/dist/component.js +81 -380
- package/dist/component.mjs +81 -380
- package/dist/handler.js +755 -640
- package/dist/handler.mjs +755 -640
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +775 -649
- package/dist/index.js +778 -652
- package/dist/index.mjs +775 -649
- package/dist/middleware.js +716 -599
- package/dist/middleware.mjs +716 -599
- package/package.json +19 -19
package/dist/middleware.mjs
CHANGED
|
@@ -7,6 +7,7 @@ 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;
|
|
10
11
|
var __commonJS = (cb, mod) => function __require() {
|
|
11
12
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
13
|
};
|
|
@@ -26,16 +27,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
27
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
28
|
mod
|
|
28
29
|
));
|
|
30
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
29
31
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
30
32
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
31
33
|
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);
|
|
32
34
|
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
|
+
});
|
|
33
43
|
|
|
34
44
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
35
45
|
var require_yocto_queue = __commonJS({
|
|
36
46
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
|
|
37
47
|
"use strict";
|
|
38
|
-
var
|
|
48
|
+
var Node2 = class {
|
|
39
49
|
/// value;
|
|
40
50
|
/// next;
|
|
41
51
|
constructor(value) {
|
|
@@ -43,7 +53,7 @@ var require_yocto_queue = __commonJS({
|
|
|
43
53
|
this.next = void 0;
|
|
44
54
|
}
|
|
45
55
|
};
|
|
46
|
-
var
|
|
56
|
+
var Queue2 = class {
|
|
47
57
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
48
58
|
// #_head;
|
|
49
59
|
// #_tail;
|
|
@@ -52,7 +62,7 @@ var require_yocto_queue = __commonJS({
|
|
|
52
62
|
this.clear();
|
|
53
63
|
}
|
|
54
64
|
enqueue(value) {
|
|
55
|
-
const node = new
|
|
65
|
+
const node = new Node2(value);
|
|
56
66
|
if (this._head) {
|
|
57
67
|
this._tail.next = node;
|
|
58
68
|
this._tail = node;
|
|
@@ -87,7 +97,7 @@ var require_yocto_queue = __commonJS({
|
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
};
|
|
90
|
-
module.exports =
|
|
100
|
+
module.exports = Queue2;
|
|
91
101
|
}
|
|
92
102
|
});
|
|
93
103
|
|
|
@@ -95,12 +105,12 @@ var require_yocto_queue = __commonJS({
|
|
|
95
105
|
var require_p_limit = __commonJS({
|
|
96
106
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
|
|
97
107
|
"use strict";
|
|
98
|
-
var
|
|
99
|
-
var
|
|
108
|
+
var Queue2 = require_yocto_queue();
|
|
109
|
+
var pLimit3 = (concurrency) => {
|
|
100
110
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
101
111
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
102
112
|
}
|
|
103
|
-
const queue = new
|
|
113
|
+
const queue = new Queue2();
|
|
104
114
|
let activeCount = 0;
|
|
105
115
|
const next = () => {
|
|
106
116
|
activeCount--;
|
|
@@ -145,7 +155,238 @@ var require_p_limit = __commonJS({
|
|
|
145
155
|
});
|
|
146
156
|
return generator;
|
|
147
157
|
};
|
|
148
|
-
module.exports =
|
|
158
|
+
module.exports = pLimit3;
|
|
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();
|
|
149
390
|
}
|
|
150
391
|
});
|
|
151
392
|
|
|
@@ -344,8 +585,8 @@ var __defProp2 = Object.defineProperty;
|
|
|
344
585
|
var __typeError2 = (msg) => {
|
|
345
586
|
throw TypeError(msg);
|
|
346
587
|
};
|
|
347
|
-
var
|
|
348
|
-
var
|
|
588
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
589
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
349
590
|
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
350
591
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
351
592
|
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);
|
|
@@ -356,18 +597,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
356
597
|
`${errorMessage}
|
|
357
598
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
358
599
|
);
|
|
359
|
-
this
|
|
360
|
-
this
|
|
361
|
-
this
|
|
362
|
-
this
|
|
363
|
-
this
|
|
364
|
-
this
|
|
600
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
601
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
602
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
603
|
+
__publicField2(this, "statusCode", statusCode);
|
|
604
|
+
__publicField2(this, "statusText", statusText);
|
|
605
|
+
__publicField2(this, "requestId", requestId);
|
|
365
606
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
366
607
|
}
|
|
367
608
|
};
|
|
368
609
|
var ApiClient = class _ApiClient {
|
|
369
610
|
constructor(options) {
|
|
370
|
-
|
|
611
|
+
__publicField2(this, "options");
|
|
371
612
|
var _a, _b, _c, _d, _e;
|
|
372
613
|
if (!options.apiKey && !options.bearerToken) {
|
|
373
614
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -749,391 +990,192 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
749
990
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
750
991
|
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
751
992
|
|
|
752
|
-
//
|
|
753
|
-
var
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
var __typeError3 = (msg) => {
|
|
760
|
-
throw TypeError(msg);
|
|
761
|
-
};
|
|
762
|
-
var __commonJS2 = (cb, mod) => function __require() {
|
|
763
|
-
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
993
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
994
|
+
var Node = class {
|
|
995
|
+
constructor(value) {
|
|
996
|
+
__publicField(this, "value");
|
|
997
|
+
__publicField(this, "next");
|
|
998
|
+
this.value = value;
|
|
999
|
+
}
|
|
764
1000
|
};
|
|
765
|
-
var
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
1001
|
+
var _head, _tail, _size;
|
|
1002
|
+
var Queue = class {
|
|
1003
|
+
constructor() {
|
|
1004
|
+
__privateAdd(this, _head);
|
|
1005
|
+
__privateAdd(this, _tail);
|
|
1006
|
+
__privateAdd(this, _size);
|
|
1007
|
+
this.clear();
|
|
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);
|
|
1042
|
+
}
|
|
1043
|
+
get size() {
|
|
1044
|
+
return __privateGet(this, _size);
|
|
1045
|
+
}
|
|
1046
|
+
*[Symbol.iterator]() {
|
|
1047
|
+
let current = __privateGet(this, _head);
|
|
1048
|
+
while (current) {
|
|
1049
|
+
yield current.value;
|
|
1050
|
+
current = current.next;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
*drain() {
|
|
1054
|
+
while (__privateGet(this, _head)) {
|
|
1055
|
+
yield this.dequeue();
|
|
1056
|
+
}
|
|
770
1057
|
}
|
|
771
|
-
return to;
|
|
772
1058
|
};
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
)
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
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;
|
|
840
|
-
}
|
|
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;
|
|
896
|
-
}
|
|
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
|
-
}
|
|
1059
|
+
_head = new WeakMap();
|
|
1060
|
+
_tail = new WeakMap();
|
|
1061
|
+
_size = new WeakMap();
|
|
1062
|
+
|
|
1063
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
1064
|
+
function pLimit2(concurrency) {
|
|
1065
|
+
validateConcurrency(concurrency);
|
|
1066
|
+
const queue = new Queue();
|
|
1067
|
+
let activeCount = 0;
|
|
1068
|
+
const resumeNext = () => {
|
|
1069
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
1070
|
+
queue.dequeue()();
|
|
1071
|
+
activeCount++;
|
|
920
1072
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
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
|
-
};
|
|
1030
|
-
}
|
|
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);
|
|
1047
|
-
}
|
|
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];
|
|
1057
|
-
}
|
|
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));
|
|
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();
|
|
1067
1097
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1098
|
+
})();
|
|
1099
|
+
};
|
|
1100
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
1101
|
+
enqueue(function_, resolve, arguments_);
|
|
1102
|
+
});
|
|
1103
|
+
Object.defineProperties(generator, {
|
|
1104
|
+
activeCount: {
|
|
1105
|
+
get: () => activeCount
|
|
1106
|
+
},
|
|
1107
|
+
pendingCount: {
|
|
1108
|
+
get: () => queue.size
|
|
1109
|
+
},
|
|
1110
|
+
clearQueue: {
|
|
1111
|
+
value() {
|
|
1112
|
+
queue.clear();
|
|
1083
1113
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1114
|
+
},
|
|
1115
|
+
concurrency: {
|
|
1116
|
+
get: () => concurrency,
|
|
1117
|
+
set(newConcurrency) {
|
|
1118
|
+
validateConcurrency(newConcurrency);
|
|
1119
|
+
concurrency = newConcurrency;
|
|
1120
|
+
queueMicrotask(() => {
|
|
1121
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
1122
|
+
resumeNext();
|
|
1089
1123
|
}
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
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;
|
|
1124
|
+
});
|
|
1113
1125
|
}
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
return generator;
|
|
1129
|
+
}
|
|
1130
|
+
function validateConcurrency(concurrency) {
|
|
1131
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
1132
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
1121
1133
|
}
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1137
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
1138
|
+
|
|
1139
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
1140
|
+
var objectToString = Object.prototype.toString;
|
|
1141
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
1142
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
1143
|
+
"network error",
|
|
1127
1144
|
// Chrome
|
|
1128
1145
|
"NetworkError when attempting to fetch resource.",
|
|
1129
1146
|
// Firefox
|
|
1130
1147
|
"The Internet connection appears to be offline.",
|
|
1131
|
-
// Safari
|
|
1148
|
+
// Safari 16
|
|
1132
1149
|
"Network request failed",
|
|
1133
1150
|
// `cross-fetch`
|
|
1134
|
-
"fetch failed"
|
|
1151
|
+
"fetch failed",
|
|
1152
|
+
// Undici (Node.js)
|
|
1153
|
+
"terminated",
|
|
1135
1154
|
// Undici (Node.js)
|
|
1155
|
+
" A network error occurred.",
|
|
1156
|
+
// Bun (WebKit)
|
|
1157
|
+
"Network connection lost"
|
|
1158
|
+
// Cloudflare Workers (fetch)
|
|
1136
1159
|
]);
|
|
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
|
|
1137
1179
|
var AbortError = class extends Error {
|
|
1138
1180
|
constructor(message) {
|
|
1139
1181
|
super();
|
|
@@ -1154,63 +1196,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1154
1196
|
error.retriesLeft = retriesLeft;
|
|
1155
1197
|
return error;
|
|
1156
1198
|
};
|
|
1157
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
1158
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1159
1199
|
async function pRetry(input, options) {
|
|
1160
1200
|
return new Promise((resolve, reject) => {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
retries: 10,
|
|
1165
|
-
...options
|
|
1201
|
+
var _a, _b, _c;
|
|
1202
|
+
options = { ...options };
|
|
1203
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
1166
1204
|
};
|
|
1205
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1206
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1167
1207
|
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
|
+
};
|
|
1168
1221
|
operation.attempt(async (attemptNumber) => {
|
|
1169
1222
|
try {
|
|
1170
|
-
|
|
1223
|
+
const result = await input(attemptNumber);
|
|
1224
|
+
cleanUp();
|
|
1225
|
+
resolve(result);
|
|
1171
1226
|
} catch (error) {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
} else {
|
|
1227
|
+
try {
|
|
1228
|
+
if (!(error instanceof Error)) {
|
|
1229
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1230
|
+
}
|
|
1231
|
+
if (error instanceof AbortError) {
|
|
1232
|
+
throw error.originalError;
|
|
1233
|
+
}
|
|
1234
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1235
|
+
throw error;
|
|
1236
|
+
}
|
|
1183
1237
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
reject(error2);
|
|
1188
|
-
return;
|
|
1238
|
+
if (!await options.shouldRetry(error)) {
|
|
1239
|
+
operation.stop();
|
|
1240
|
+
reject(error);
|
|
1189
1241
|
}
|
|
1242
|
+
await options.onFailedAttempt(error);
|
|
1190
1243
|
if (!operation.retry(error)) {
|
|
1191
|
-
|
|
1244
|
+
throw operation.mainError();
|
|
1192
1245
|
}
|
|
1246
|
+
} catch (finalError) {
|
|
1247
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1248
|
+
cleanUp();
|
|
1249
|
+
reject(finalError);
|
|
1193
1250
|
}
|
|
1194
1251
|
}
|
|
1195
1252
|
});
|
|
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
|
-
}
|
|
1205
1253
|
});
|
|
1206
1254
|
}
|
|
1255
|
+
|
|
1256
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1207
1257
|
var AbortError2 = class extends Error {
|
|
1208
1258
|
constructor() {
|
|
1209
1259
|
super("Throttled function aborted");
|
|
1210
1260
|
this.name = "AbortError";
|
|
1211
1261
|
}
|
|
1212
1262
|
};
|
|
1213
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1263
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1214
1264
|
if (!Number.isFinite(limit)) {
|
|
1215
1265
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1216
1266
|
}
|
|
@@ -1238,32 +1288,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1238
1288
|
const strictTicks = [];
|
|
1239
1289
|
function strictDelay() {
|
|
1240
1290
|
const now = Date.now();
|
|
1241
|
-
if (strictTicks.length
|
|
1242
|
-
strictTicks.
|
|
1243
|
-
return 0;
|
|
1291
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1292
|
+
strictTicks.length = 0;
|
|
1244
1293
|
}
|
|
1245
|
-
|
|
1246
|
-
if (now >= earliestTime) {
|
|
1294
|
+
if (strictTicks.length < limit) {
|
|
1247
1295
|
strictTicks.push(now);
|
|
1248
1296
|
return 0;
|
|
1249
1297
|
}
|
|
1250
|
-
strictTicks
|
|
1251
|
-
|
|
1298
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1299
|
+
strictTicks.shift();
|
|
1300
|
+
strictTicks.push(nextExecutionTime);
|
|
1301
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1252
1302
|
}
|
|
1253
1303
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1254
1304
|
return (function_) => {
|
|
1255
|
-
const throttled = function(...
|
|
1305
|
+
const throttled = function(...arguments_) {
|
|
1256
1306
|
if (!throttled.isEnabled) {
|
|
1257
|
-
return (async () => function_.apply(this,
|
|
1307
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1258
1308
|
}
|
|
1259
|
-
let
|
|
1309
|
+
let timeoutId;
|
|
1260
1310
|
return new Promise((resolve, reject) => {
|
|
1261
1311
|
const execute = () => {
|
|
1262
|
-
resolve(function_.apply(this,
|
|
1263
|
-
queue.delete(
|
|
1312
|
+
resolve(function_.apply(this, arguments_));
|
|
1313
|
+
queue.delete(timeoutId);
|
|
1264
1314
|
};
|
|
1265
|
-
|
|
1266
|
-
|
|
1315
|
+
const delay = getDelay();
|
|
1316
|
+
if (delay > 0) {
|
|
1317
|
+
timeoutId = setTimeout(execute, delay);
|
|
1318
|
+
queue.set(timeoutId, reject);
|
|
1319
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1320
|
+
} else {
|
|
1321
|
+
execute();
|
|
1322
|
+
}
|
|
1267
1323
|
});
|
|
1268
1324
|
};
|
|
1269
1325
|
throttled.abort = () => {
|
|
@@ -1275,16 +1331,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1275
1331
|
strictTicks.splice(0, strictTicks.length);
|
|
1276
1332
|
};
|
|
1277
1333
|
throttled.isEnabled = true;
|
|
1334
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1335
|
+
get() {
|
|
1336
|
+
return queue.size;
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1278
1339
|
return throttled;
|
|
1279
1340
|
};
|
|
1280
1341
|
}
|
|
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);
|
|
1281
1350
|
function createLimitPolicy({
|
|
1282
1351
|
throttle = { interval: 1e3, limit: 10 },
|
|
1283
|
-
retry:
|
|
1352
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1284
1353
|
limit = 10
|
|
1285
1354
|
}) {
|
|
1286
1355
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1287
|
-
const limiter = limit ? (
|
|
1356
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1288
1357
|
return function limitPolicy(func) {
|
|
1289
1358
|
let currentFunc = async () => await func();
|
|
1290
1359
|
if (throttler) {
|
|
@@ -1295,13 +1364,13 @@ function createLimitPolicy({
|
|
|
1295
1364
|
const limitFunc = currentFunc;
|
|
1296
1365
|
currentFunc = () => limiter(limitFunc);
|
|
1297
1366
|
}
|
|
1298
|
-
if (
|
|
1367
|
+
if (retry3) {
|
|
1299
1368
|
const retryFunc = currentFunc;
|
|
1300
1369
|
currentFunc = () => pRetry(retryFunc, {
|
|
1301
|
-
...
|
|
1370
|
+
...retry3,
|
|
1302
1371
|
onFailedAttempt: async (error) => {
|
|
1303
|
-
if (
|
|
1304
|
-
await
|
|
1372
|
+
if (retry3.onFailedAttempt) {
|
|
1373
|
+
await retry3.onFailedAttempt(error);
|
|
1305
1374
|
}
|
|
1306
1375
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1307
1376
|
throw error;
|
|
@@ -1312,123 +1381,151 @@ function createLimitPolicy({
|
|
|
1312
1381
|
return currentFunc();
|
|
1313
1382
|
};
|
|
1314
1383
|
}
|
|
1315
|
-
var
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
if (!options.limitPolicy) {
|
|
1320
|
-
options.limitPolicy = createLimitPolicy({});
|
|
1321
|
-
}
|
|
1322
|
-
super(options);
|
|
1323
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1324
|
-
this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1325
|
-
}
|
|
1326
|
-
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1327
|
-
async getCompositionList(params = {}) {
|
|
1328
|
-
const { projectId } = this.options;
|
|
1329
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1330
|
-
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1331
|
-
if (!resolveData) {
|
|
1332
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1333
|
-
return this.apiClient(fetchUri);
|
|
1334
|
-
}
|
|
1335
|
-
const edgeParams = {
|
|
1336
|
-
...originParams,
|
|
1337
|
-
projectId,
|
|
1338
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1339
|
-
...rewrittenFilters
|
|
1340
|
-
};
|
|
1341
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1342
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1343
|
-
}
|
|
1344
|
-
getCompositionByNodePath(options) {
|
|
1345
|
-
return this.getOneComposition(options);
|
|
1346
|
-
}
|
|
1347
|
-
getCompositionByNodeId(options) {
|
|
1348
|
-
return this.getOneComposition(options);
|
|
1349
|
-
}
|
|
1350
|
-
getCompositionBySlug(options) {
|
|
1351
|
-
return this.getOneComposition(options);
|
|
1352
|
-
}
|
|
1353
|
-
getCompositionById(options) {
|
|
1354
|
-
return this.getOneComposition(options);
|
|
1355
|
-
}
|
|
1356
|
-
getCompositionDefaults(options) {
|
|
1357
|
-
return this.getOneComposition(options);
|
|
1358
|
-
}
|
|
1359
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1360
|
-
async getCompositionHistory(options) {
|
|
1361
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1384
|
+
var ContentClientBase = class extends ApiClient {
|
|
1385
|
+
constructor(options, defaultBypassCache) {
|
|
1386
|
+
var _a, _b;
|
|
1387
|
+
super({
|
|
1362
1388
|
...options,
|
|
1363
|
-
|
|
1389
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1390
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1364
1391
|
});
|
|
1365
|
-
return this.apiClient(historyUrl);
|
|
1366
1392
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1393
|
+
};
|
|
1394
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1395
|
+
function appendCsv(out, key, values) {
|
|
1396
|
+
if (values === void 0) {
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
out[key] = values.join(",");
|
|
1400
|
+
}
|
|
1401
|
+
function projectionToQuery(spec) {
|
|
1402
|
+
const out = {};
|
|
1403
|
+
if (!spec) {
|
|
1404
|
+
return out;
|
|
1405
|
+
}
|
|
1406
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1407
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1408
|
+
if (fields) {
|
|
1409
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1410
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1411
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1412
|
+
}
|
|
1413
|
+
if (fieldTypes) {
|
|
1414
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1415
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1416
|
+
}
|
|
1417
|
+
if (slots) {
|
|
1418
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1419
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1420
|
+
if (typeof slots.depth === "number") {
|
|
1421
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1422
|
+
}
|
|
1423
|
+
if (slots.named) {
|
|
1424
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1425
|
+
for (const slotName of slotNames) {
|
|
1426
|
+
const named = slots.named[slotName];
|
|
1427
|
+
if (named && typeof named.depth === "number") {
|
|
1428
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1375
1431
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1432
|
+
}
|
|
1433
|
+
return out;
|
|
1434
|
+
}
|
|
1435
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1436
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
1437
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1438
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1439
|
+
var CANVAS_TEST_SLOT = "test";
|
|
1440
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1441
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1442
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1443
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1444
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1445
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1446
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1447
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1448
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1449
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1450
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1451
|
+
function resolveCompositionSelector(args) {
|
|
1452
|
+
if ("compositionId" in args) {
|
|
1453
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1454
|
+
return {
|
|
1455
|
+
readOptions,
|
|
1456
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1457
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1458
|
+
versionId,
|
|
1459
|
+
hasCompositionId: true,
|
|
1460
|
+
pinnedEdition: editionId !== void 0
|
|
1380
1461
|
};
|
|
1381
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1382
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1383
1462
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
}
|
|
1397
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1463
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1464
|
+
}
|
|
1465
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1466
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1467
|
+
constructor(options) {
|
|
1468
|
+
var _a;
|
|
1469
|
+
super(
|
|
1470
|
+
options,
|
|
1471
|
+
/* defaultBypassCache */
|
|
1472
|
+
false
|
|
1473
|
+
);
|
|
1474
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1475
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1398
1476
|
}
|
|
1399
|
-
/**
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
const { projectId } = this.options;
|
|
1403
|
-
await this.apiClient(fetchUri, {
|
|
1404
|
-
method: "DELETE",
|
|
1405
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1406
|
-
expectNoContent: true
|
|
1407
|
-
});
|
|
1477
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1478
|
+
coerceDiagnostics(diagnostics) {
|
|
1479
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1408
1480
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1481
|
+
};
|
|
1482
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1483
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1484
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1485
|
+
constructor(options) {
|
|
1486
|
+
super(options);
|
|
1414
1487
|
}
|
|
1415
|
-
/**
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1488
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1489
|
+
get(args) {
|
|
1490
|
+
var _a;
|
|
1491
|
+
const { diagnostics, select, ...rest } = args;
|
|
1492
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1493
|
+
const url = this.createUrl(
|
|
1494
|
+
EDGE_SINGLE_URL,
|
|
1495
|
+
{
|
|
1496
|
+
...readOptions,
|
|
1497
|
+
...projectionToQuery(select),
|
|
1498
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1499
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1500
|
+
compositionId,
|
|
1501
|
+
versionId,
|
|
1502
|
+
projectId: this.options.projectId,
|
|
1503
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1504
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1505
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1506
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1507
|
+
},
|
|
1508
|
+
this.edgeApiHost
|
|
1509
|
+
);
|
|
1510
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1423
1511
|
}
|
|
1424
|
-
/**
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1512
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1513
|
+
list(args = {}) {
|
|
1514
|
+
var _a;
|
|
1515
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1516
|
+
const url = this.createUrl(
|
|
1517
|
+
EDGE_LIST_URL,
|
|
1518
|
+
{
|
|
1519
|
+
...rest,
|
|
1520
|
+
...rewriteFiltersForApi(filters),
|
|
1521
|
+
...projectionToQuery(select),
|
|
1522
|
+
projectId: this.options.projectId,
|
|
1523
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1524
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1525
|
+
},
|
|
1526
|
+
this.edgeApiHost
|
|
1527
|
+
);
|
|
1528
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1432
1529
|
}
|
|
1433
1530
|
};
|
|
1434
1531
|
var _contentTypesUrl;
|
|
@@ -1446,15 +1543,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1446
1543
|
}
|
|
1447
1544
|
getEntries(options) {
|
|
1448
1545
|
const { projectId } = this.options;
|
|
1449
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1546
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1450
1547
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1548
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1451
1549
|
if (skipDataResolution) {
|
|
1452
|
-
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1550
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1551
|
+
...params,
|
|
1552
|
+
...rewrittenFilters,
|
|
1553
|
+
...rewrittenSelect,
|
|
1554
|
+
projectId
|
|
1555
|
+
});
|
|
1453
1556
|
return this.apiClient(url);
|
|
1454
1557
|
}
|
|
1455
1558
|
const edgeUrl = this.createUrl(
|
|
1456
1559
|
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1457
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1560
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1458
1561
|
this.edgeApiHost
|
|
1459
1562
|
);
|
|
1460
1563
|
return this.apiClient(
|
|
@@ -1531,14 +1634,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1531
1634
|
constructor(options) {
|
|
1532
1635
|
super(options);
|
|
1533
1636
|
}
|
|
1534
|
-
/** Fetches
|
|
1535
|
-
async
|
|
1637
|
+
/** Fetches a list of DataTypes for a project */
|
|
1638
|
+
async list(options) {
|
|
1536
1639
|
const { projectId } = this.options;
|
|
1537
1640
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1538
1641
|
return await this.apiClient(fetchUri);
|
|
1539
1642
|
}
|
|
1643
|
+
/** @deprecated Use {@link list} instead. */
|
|
1644
|
+
async get(options) {
|
|
1645
|
+
return this.list(options);
|
|
1646
|
+
}
|
|
1540
1647
|
/** Updates or creates (based on id) a DataType */
|
|
1541
|
-
async
|
|
1648
|
+
async save(body) {
|
|
1542
1649
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1543
1650
|
await this.apiClient(fetchUri, {
|
|
1544
1651
|
method: "PUT",
|
|
@@ -1546,6 +1653,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1546
1653
|
expectNoContent: true
|
|
1547
1654
|
});
|
|
1548
1655
|
}
|
|
1656
|
+
/** @deprecated Use {@link save} instead. */
|
|
1657
|
+
async upsert(body) {
|
|
1658
|
+
return this.save(body);
|
|
1659
|
+
}
|
|
1549
1660
|
/** Deletes a DataType */
|
|
1550
1661
|
async remove(body) {
|
|
1551
1662
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1583,22 +1694,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1583
1694
|
}
|
|
1584
1695
|
return `.${path.join(".")}`;
|
|
1585
1696
|
}
|
|
1586
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1587
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
1588
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1589
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1590
|
-
var CANVAS_TEST_SLOT = "test";
|
|
1591
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1592
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1593
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1594
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1595
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1596
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1597
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1598
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1599
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1600
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1601
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1602
1697
|
function isRootEntryReference(root) {
|
|
1603
1698
|
return root.type === "root" && isEntryData(root.node);
|
|
1604
1699
|
}
|
|
@@ -2200,20 +2295,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2200
2295
|
* When teamId is provided, returns a single team with its projects.
|
|
2201
2296
|
* When omitted, returns all accessible teams and their projects.
|
|
2202
2297
|
*/
|
|
2203
|
-
async
|
|
2298
|
+
async list(options) {
|
|
2204
2299
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
2205
2300
|
return await this.apiClient(fetchUri);
|
|
2206
2301
|
}
|
|
2302
|
+
/** @deprecated Use {@link list} instead. */
|
|
2303
|
+
async getProjects(options) {
|
|
2304
|
+
return this.list(options);
|
|
2305
|
+
}
|
|
2207
2306
|
/** Updates or creates (based on id) a Project */
|
|
2208
|
-
async
|
|
2307
|
+
async save(body) {
|
|
2209
2308
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
2210
2309
|
return await this.apiClient(fetchUri, {
|
|
2211
2310
|
method: "PUT",
|
|
2212
2311
|
body: JSON.stringify({ ...body })
|
|
2213
2312
|
});
|
|
2214
2313
|
}
|
|
2314
|
+
/** @deprecated Use {@link save} instead. */
|
|
2315
|
+
async upsert(body) {
|
|
2316
|
+
return this.save(body);
|
|
2317
|
+
}
|
|
2215
2318
|
/** Deletes a Project */
|
|
2216
|
-
async
|
|
2319
|
+
async remove(body) {
|
|
2217
2320
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
2218
2321
|
await this.apiClient(fetchUri, {
|
|
2219
2322
|
method: "DELETE",
|
|
@@ -2221,6 +2324,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2221
2324
|
expectNoContent: true
|
|
2222
2325
|
});
|
|
2223
2326
|
}
|
|
2327
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2328
|
+
async delete(body) {
|
|
2329
|
+
return this.remove(body);
|
|
2330
|
+
}
|
|
2224
2331
|
};
|
|
2225
2332
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
2226
2333
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
@@ -2236,15 +2343,27 @@ var RouteClient = class extends ApiClient {
|
|
|
2236
2343
|
super(options);
|
|
2237
2344
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
2238
2345
|
}
|
|
2239
|
-
/**
|
|
2240
|
-
|
|
2346
|
+
/**
|
|
2347
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
2348
|
+
*
|
|
2349
|
+
* An optional `select` projection applies to the resolved composition when
|
|
2350
|
+
* the route matches one; redirect / notFound responses pass through
|
|
2351
|
+
* untouched.
|
|
2352
|
+
*/
|
|
2353
|
+
async get(options) {
|
|
2241
2354
|
const { projectId } = this.options;
|
|
2242
|
-
const
|
|
2355
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2356
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2357
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2243
2358
|
return await this.apiClient(
|
|
2244
2359
|
fetchUri,
|
|
2245
2360
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
2246
2361
|
);
|
|
2247
2362
|
}
|
|
2363
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
2364
|
+
async getRoute(options) {
|
|
2365
|
+
return this.get(options);
|
|
2366
|
+
}
|
|
2248
2367
|
};
|
|
2249
2368
|
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2250
2369
|
var _a, _b;
|
|
@@ -2492,7 +2611,7 @@ function createLimiter(concurrency) {
|
|
|
2492
2611
|
});
|
|
2493
2612
|
};
|
|
2494
2613
|
}
|
|
2495
|
-
async function
|
|
2614
|
+
async function retry2(fn, options) {
|
|
2496
2615
|
let lastError;
|
|
2497
2616
|
let delay = 1e3;
|
|
2498
2617
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2532,7 +2651,7 @@ function createLimitPolicy2({
|
|
|
2532
2651
|
}
|
|
2533
2652
|
if (retryOptions) {
|
|
2534
2653
|
const retryFunc = currentFunc;
|
|
2535
|
-
currentFunc = () =>
|
|
2654
|
+
currentFunc = () => retry2(retryFunc, {
|
|
2536
2655
|
...retryOptions,
|
|
2537
2656
|
onFailedAttempt: async (error) => {
|
|
2538
2657
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2551,7 +2670,7 @@ function createLimitPolicy2({
|
|
|
2551
2670
|
// src/clients/canvas.ts
|
|
2552
2671
|
var getCanvasClient = (options) => {
|
|
2553
2672
|
const cache = resolveCanvasCache(options);
|
|
2554
|
-
return new
|
|
2673
|
+
return new CompositionDeliveryClient({
|
|
2555
2674
|
projectId: env.getProjectId(),
|
|
2556
2675
|
apiHost: env.getApiHost(),
|
|
2557
2676
|
apiKey: env.getApiKey(),
|
|
@@ -2822,14 +2941,14 @@ var DefaultDataClient = class {
|
|
|
2822
2941
|
if (oldCachedRoute) {
|
|
2823
2942
|
waitUntil(
|
|
2824
2943
|
(async () => {
|
|
2825
|
-
const result2 = await routeClient.
|
|
2944
|
+
const result2 = await routeClient.get(route);
|
|
2826
2945
|
await cacheNewRoute(result2);
|
|
2827
2946
|
})()
|
|
2828
2947
|
);
|
|
2829
2948
|
return oldCachedRoute;
|
|
2830
2949
|
}
|
|
2831
2950
|
}
|
|
2832
|
-
const result = await routeClient.
|
|
2951
|
+
const result = await routeClient.get(route);
|
|
2833
2952
|
waitUntil(
|
|
2834
2953
|
(async () => {
|
|
2835
2954
|
await Promise.all([
|
|
@@ -3155,7 +3274,7 @@ function dequal(foo, bar) {
|
|
|
3155
3274
|
return foo !== foo && bar !== bar;
|
|
3156
3275
|
}
|
|
3157
3276
|
|
|
3158
|
-
// ../../node_modules/.pnpm/js-cookie@3.0.
|
|
3277
|
+
// ../../node_modules/.pnpm/js-cookie@3.0.8/node_modules/js-cookie/dist/js.cookie.mjs
|
|
3159
3278
|
function assign(target) {
|
|
3160
3279
|
for (var i = 1; i < arguments.length; i++) {
|
|
3161
3280
|
var source = arguments[i];
|
|
@@ -3221,7 +3340,7 @@ function init(converter, defaultAttributes) {
|
|
|
3221
3340
|
if (name === found) {
|
|
3222
3341
|
break;
|
|
3223
3342
|
}
|
|
3224
|
-
} catch (
|
|
3343
|
+
} catch (_e) {
|
|
3225
3344
|
}
|
|
3226
3345
|
}
|
|
3227
3346
|
return name ? jar[name] : jar;
|
|
@@ -3276,12 +3395,12 @@ function mitt_default(n) {
|
|
|
3276
3395
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
3277
3396
|
var import_rfdc2 = __toESM(require_rfdc(), 1);
|
|
3278
3397
|
var import_rfdc3 = __toESM(require_rfdc(), 1);
|
|
3279
|
-
var
|
|
3398
|
+
var __defProp3 = Object.defineProperty;
|
|
3280
3399
|
var __typeError4 = (msg) => {
|
|
3281
3400
|
throw TypeError(msg);
|
|
3282
3401
|
};
|
|
3283
|
-
var
|
|
3284
|
-
var
|
|
3402
|
+
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3403
|
+
var __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3285
3404
|
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
3286
3405
|
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3287
3406
|
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);
|
|
@@ -3358,7 +3477,7 @@ var SignalInstance = class {
|
|
|
3358
3477
|
constructor(data, evaluator, onLogMessage) {
|
|
3359
3478
|
__privateAdd4(this, _evaluator);
|
|
3360
3479
|
__privateAdd4(this, _onLogMessage);
|
|
3361
|
-
|
|
3480
|
+
__publicField3(this, "signal");
|
|
3362
3481
|
this.signal = data;
|
|
3363
3482
|
__privateSet2(this, _evaluator, evaluator);
|
|
3364
3483
|
__privateSet2(this, _onLogMessage, onLogMessage);
|
|
@@ -3416,7 +3535,7 @@ var ManifestInstance = class {
|
|
|
3416
3535
|
onLogMessage = () => {
|
|
3417
3536
|
}
|
|
3418
3537
|
}) {
|
|
3419
|
-
|
|
3538
|
+
__publicField3(this, "data");
|
|
3420
3539
|
__privateAdd4(this, _mf);
|
|
3421
3540
|
__privateAdd4(this, _signalInstances);
|
|
3422
3541
|
__privateAdd4(this, _goalEvaluators, []);
|
|
@@ -4203,7 +4322,7 @@ var TransitionDataStore = class {
|
|
|
4203
4322
|
__privateAdd4(this, _data);
|
|
4204
4323
|
__privateAdd4(this, _initialData);
|
|
4205
4324
|
__privateAdd4(this, _mitt, mitt_default());
|
|
4206
|
-
|
|
4325
|
+
__publicField3(this, "events", {
|
|
4207
4326
|
on: __privateGet4(this, _mitt).on,
|
|
4208
4327
|
off: __privateGet4(this, _mitt).off
|
|
4209
4328
|
});
|
|
@@ -4566,10 +4685,10 @@ var _LocalStorage_instances;
|
|
|
4566
4685
|
var key_fn;
|
|
4567
4686
|
var LocalStorage = class {
|
|
4568
4687
|
constructor(partitionKey) {
|
|
4569
|
-
this
|
|
4688
|
+
__publicField3(this, "partitionKey", partitionKey);
|
|
4570
4689
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4571
|
-
|
|
4572
|
-
|
|
4690
|
+
__publicField3(this, "inMemoryFallback", {});
|
|
4691
|
+
__publicField3(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
4573
4692
|
}
|
|
4574
4693
|
get(key) {
|
|
4575
4694
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
|
@@ -4630,7 +4749,7 @@ var VisitorDataStore = class {
|
|
|
4630
4749
|
__privateAdd4(this, _persist);
|
|
4631
4750
|
__privateAdd4(this, _visitTimeout);
|
|
4632
4751
|
__privateAdd4(this, _options);
|
|
4633
|
-
|
|
4752
|
+
__publicField3(this, "events", {
|
|
4634
4753
|
on: __privateGet4(this, _mitt2).on,
|
|
4635
4754
|
off: __privateGet4(this, _mitt2).off
|
|
4636
4755
|
});
|
|
@@ -4831,7 +4950,7 @@ var calculateScores_fn;
|
|
|
4831
4950
|
var Context = class {
|
|
4832
4951
|
constructor(options) {
|
|
4833
4952
|
__privateAdd4(this, _Context_instances);
|
|
4834
|
-
|
|
4953
|
+
__publicField3(this, "manifest");
|
|
4835
4954
|
__privateAdd4(this, _personalizationSelectionAlgorithms);
|
|
4836
4955
|
__privateAdd4(this, _serverTransitionState);
|
|
4837
4956
|
__privateAdd4(this, _scores, {});
|
|
@@ -4841,11 +4960,11 @@ var Context = class {
|
|
|
4841
4960
|
__privateAdd4(this, _commands);
|
|
4842
4961
|
__privateAdd4(this, _requireConsentForPersonalization);
|
|
4843
4962
|
__privateAdd4(this, _mitt3, mitt_default());
|
|
4844
|
-
|
|
4963
|
+
__publicField3(this, "events", {
|
|
4845
4964
|
on: __privateGet4(this, _mitt3).on,
|
|
4846
4965
|
off: __privateGet4(this, _mitt3).off
|
|
4847
4966
|
});
|
|
4848
|
-
|
|
4967
|
+
__publicField3(this, "storage");
|
|
4849
4968
|
var _a, _b, _c;
|
|
4850
4969
|
const { manifest, ...storageOptions } = options;
|
|
4851
4970
|
__privateSet2(this, _state, {});
|
|
@@ -5431,7 +5550,6 @@ var retrieveRouteByPath = async ({
|
|
|
5431
5550
|
releaseId,
|
|
5432
5551
|
locale
|
|
5433
5552
|
}) => {
|
|
5434
|
-
var _a;
|
|
5435
5553
|
return await dataClient.getRoute({
|
|
5436
5554
|
source: "middleware",
|
|
5437
5555
|
searchParams,
|
|
@@ -5441,7 +5559,6 @@ var retrieveRouteByPath = async ({
|
|
|
5441
5559
|
state,
|
|
5442
5560
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
|
|
5443
5561
|
withComponentIDs: true,
|
|
5444
|
-
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5445
5562
|
releaseId,
|
|
5446
5563
|
locale,
|
|
5447
5564
|
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
@@ -5540,7 +5657,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5540
5657
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
5541
5658
|
const state = possibleStates[i];
|
|
5542
5659
|
try {
|
|
5543
|
-
composition = await canvasClient.
|
|
5660
|
+
composition = await canvasClient.get({
|
|
5544
5661
|
compositionId: id,
|
|
5545
5662
|
state,
|
|
5546
5663
|
withComponentIDs: true
|
|
@@ -5891,5 +6008,5 @@ export {
|
|
|
5891
6008
|
/*! Bundled license information:
|
|
5892
6009
|
|
|
5893
6010
|
js-cookie/dist/js.cookie.mjs:
|
|
5894
|
-
(*! js-cookie v3.0.
|
|
6011
|
+
(*! js-cookie v3.0.8 | MIT *)
|
|
5895
6012
|
*/
|