@uniformdev/next-app-router 20.50.2-alpha.146 → 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.js
CHANGED
|
@@ -8,6 +8,7 @@ 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;
|
|
11
12
|
var __commonJS = (cb, mod) => function __require() {
|
|
12
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
14
|
};
|
|
@@ -32,16 +33,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
33
|
mod
|
|
33
34
|
));
|
|
34
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
35
37
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
36
38
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
37
39
|
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);
|
|
38
40
|
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
|
+
});
|
|
39
49
|
|
|
40
50
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
41
51
|
var require_yocto_queue = __commonJS({
|
|
42
52
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
43
53
|
"use strict";
|
|
44
|
-
var
|
|
54
|
+
var Node2 = class {
|
|
45
55
|
/// value;
|
|
46
56
|
/// next;
|
|
47
57
|
constructor(value) {
|
|
@@ -49,7 +59,7 @@ var require_yocto_queue = __commonJS({
|
|
|
49
59
|
this.next = void 0;
|
|
50
60
|
}
|
|
51
61
|
};
|
|
52
|
-
var
|
|
62
|
+
var Queue2 = class {
|
|
53
63
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
54
64
|
// #_head;
|
|
55
65
|
// #_tail;
|
|
@@ -58,7 +68,7 @@ var require_yocto_queue = __commonJS({
|
|
|
58
68
|
this.clear();
|
|
59
69
|
}
|
|
60
70
|
enqueue(value) {
|
|
61
|
-
const node = new
|
|
71
|
+
const node = new Node2(value);
|
|
62
72
|
if (this._head) {
|
|
63
73
|
this._tail.next = node;
|
|
64
74
|
this._tail = node;
|
|
@@ -93,7 +103,7 @@ var require_yocto_queue = __commonJS({
|
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
};
|
|
96
|
-
module2.exports =
|
|
106
|
+
module2.exports = Queue2;
|
|
97
107
|
}
|
|
98
108
|
});
|
|
99
109
|
|
|
@@ -101,12 +111,12 @@ var require_yocto_queue = __commonJS({
|
|
|
101
111
|
var require_p_limit = __commonJS({
|
|
102
112
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
103
113
|
"use strict";
|
|
104
|
-
var
|
|
105
|
-
var
|
|
114
|
+
var Queue2 = require_yocto_queue();
|
|
115
|
+
var pLimit3 = (concurrency) => {
|
|
106
116
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
107
117
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
108
118
|
}
|
|
109
|
-
const queue = new
|
|
119
|
+
const queue = new Queue2();
|
|
110
120
|
let activeCount = 0;
|
|
111
121
|
const next = () => {
|
|
112
122
|
activeCount--;
|
|
@@ -151,7 +161,238 @@ var require_p_limit = __commonJS({
|
|
|
151
161
|
});
|
|
152
162
|
return generator;
|
|
153
163
|
};
|
|
154
|
-
module2.exports =
|
|
164
|
+
module2.exports = pLimit3;
|
|
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();
|
|
155
396
|
}
|
|
156
397
|
});
|
|
157
398
|
|
|
@@ -359,8 +600,8 @@ var __defProp2 = Object.defineProperty;
|
|
|
359
600
|
var __typeError2 = (msg) => {
|
|
360
601
|
throw TypeError(msg);
|
|
361
602
|
};
|
|
362
|
-
var
|
|
363
|
-
var
|
|
603
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
604
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
364
605
|
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
365
606
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
366
607
|
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);
|
|
@@ -371,18 +612,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
371
612
|
`${errorMessage}
|
|
372
613
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
373
614
|
);
|
|
374
|
-
this
|
|
375
|
-
this
|
|
376
|
-
this
|
|
377
|
-
this
|
|
378
|
-
this
|
|
379
|
-
this
|
|
615
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
616
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
617
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
618
|
+
__publicField2(this, "statusCode", statusCode);
|
|
619
|
+
__publicField2(this, "statusText", statusText);
|
|
620
|
+
__publicField2(this, "requestId", requestId);
|
|
380
621
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
381
622
|
}
|
|
382
623
|
};
|
|
383
624
|
var ApiClient = class _ApiClient {
|
|
384
625
|
constructor(options) {
|
|
385
|
-
|
|
626
|
+
__publicField2(this, "options");
|
|
386
627
|
var _a, _b, _c, _d, _e;
|
|
387
628
|
if (!options.apiKey && !options.bearerToken) {
|
|
388
629
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -764,391 +1005,192 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
764
1005
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
765
1006
|
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
766
1007
|
|
|
767
|
-
//
|
|
768
|
-
var
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
var __typeError3 = (msg) => {
|
|
775
|
-
throw TypeError(msg);
|
|
776
|
-
};
|
|
777
|
-
var __commonJS2 = (cb, mod) => function __require() {
|
|
778
|
-
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
1008
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
1009
|
+
var Node = class {
|
|
1010
|
+
constructor(value) {
|
|
1011
|
+
__publicField(this, "value");
|
|
1012
|
+
__publicField(this, "next");
|
|
1013
|
+
this.value = value;
|
|
1014
|
+
}
|
|
779
1015
|
};
|
|
780
|
-
var
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1016
|
+
var _head, _tail, _size;
|
|
1017
|
+
var Queue = class {
|
|
1018
|
+
constructor() {
|
|
1019
|
+
__privateAdd(this, _head);
|
|
1020
|
+
__privateAdd(this, _tail);
|
|
1021
|
+
__privateAdd(this, _size);
|
|
1022
|
+
this.clear();
|
|
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);
|
|
1057
|
+
}
|
|
1058
|
+
get size() {
|
|
1059
|
+
return __privateGet(this, _size);
|
|
1060
|
+
}
|
|
1061
|
+
*[Symbol.iterator]() {
|
|
1062
|
+
let current = __privateGet(this, _head);
|
|
1063
|
+
while (current) {
|
|
1064
|
+
yield current.value;
|
|
1065
|
+
current = current.next;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
*drain() {
|
|
1069
|
+
while (__privateGet(this, _head)) {
|
|
1070
|
+
yield this.dequeue();
|
|
1071
|
+
}
|
|
785
1072
|
}
|
|
786
|
-
return to;
|
|
787
1073
|
};
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
)
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
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;
|
|
855
|
-
}
|
|
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;
|
|
911
|
-
}
|
|
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
|
-
}
|
|
1074
|
+
_head = new WeakMap();
|
|
1075
|
+
_tail = new WeakMap();
|
|
1076
|
+
_size = new WeakMap();
|
|
1077
|
+
|
|
1078
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
1079
|
+
function pLimit2(concurrency) {
|
|
1080
|
+
validateConcurrency(concurrency);
|
|
1081
|
+
const queue = new Queue();
|
|
1082
|
+
let activeCount = 0;
|
|
1083
|
+
const resumeNext = () => {
|
|
1084
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
1085
|
+
queue.dequeue()();
|
|
1086
|
+
activeCount++;
|
|
935
1087
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
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
|
-
};
|
|
1045
|
-
}
|
|
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);
|
|
1062
|
-
}
|
|
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];
|
|
1072
|
-
}
|
|
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));
|
|
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();
|
|
1082
1112
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1113
|
+
})();
|
|
1114
|
+
};
|
|
1115
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
1116
|
+
enqueue(function_, resolve, arguments_);
|
|
1117
|
+
});
|
|
1118
|
+
Object.defineProperties(generator, {
|
|
1119
|
+
activeCount: {
|
|
1120
|
+
get: () => activeCount
|
|
1121
|
+
},
|
|
1122
|
+
pendingCount: {
|
|
1123
|
+
get: () => queue.size
|
|
1124
|
+
},
|
|
1125
|
+
clearQueue: {
|
|
1126
|
+
value() {
|
|
1127
|
+
queue.clear();
|
|
1098
1128
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1129
|
+
},
|
|
1130
|
+
concurrency: {
|
|
1131
|
+
get: () => concurrency,
|
|
1132
|
+
set(newConcurrency) {
|
|
1133
|
+
validateConcurrency(newConcurrency);
|
|
1134
|
+
concurrency = newConcurrency;
|
|
1135
|
+
queueMicrotask(() => {
|
|
1136
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
1137
|
+
resumeNext();
|
|
1104
1138
|
}
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
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;
|
|
1139
|
+
});
|
|
1128
1140
|
}
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
return generator;
|
|
1144
|
+
}
|
|
1145
|
+
function validateConcurrency(concurrency) {
|
|
1146
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
1147
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
1136
1148
|
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
var
|
|
1141
|
-
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1152
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
1153
|
+
|
|
1154
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
1155
|
+
var objectToString = Object.prototype.toString;
|
|
1156
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
1157
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
1158
|
+
"network error",
|
|
1142
1159
|
// Chrome
|
|
1143
1160
|
"NetworkError when attempting to fetch resource.",
|
|
1144
1161
|
// Firefox
|
|
1145
1162
|
"The Internet connection appears to be offline.",
|
|
1146
|
-
// Safari
|
|
1163
|
+
// Safari 16
|
|
1147
1164
|
"Network request failed",
|
|
1148
1165
|
// `cross-fetch`
|
|
1149
|
-
"fetch failed"
|
|
1166
|
+
"fetch failed",
|
|
1167
|
+
// Undici (Node.js)
|
|
1168
|
+
"terminated",
|
|
1150
1169
|
// Undici (Node.js)
|
|
1170
|
+
" A network error occurred.",
|
|
1171
|
+
// Bun (WebKit)
|
|
1172
|
+
"Network connection lost"
|
|
1173
|
+
// Cloudflare Workers (fetch)
|
|
1151
1174
|
]);
|
|
1175
|
+
function isNetworkError(error) {
|
|
1176
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1177
|
+
if (!isValid) {
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
const { message, stack } = error;
|
|
1181
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1182
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
1183
|
+
}
|
|
1184
|
+
if (message.startsWith("error sending request for url")) {
|
|
1185
|
+
return true;
|
|
1186
|
+
}
|
|
1187
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1188
|
+
return true;
|
|
1189
|
+
}
|
|
1190
|
+
return errorMessages.has(message);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1152
1194
|
var AbortError = class extends Error {
|
|
1153
1195
|
constructor(message) {
|
|
1154
1196
|
super();
|
|
@@ -1169,63 +1211,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1169
1211
|
error.retriesLeft = retriesLeft;
|
|
1170
1212
|
return error;
|
|
1171
1213
|
};
|
|
1172
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
1173
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1174
1214
|
async function pRetry(input, options) {
|
|
1175
1215
|
return new Promise((resolve, reject) => {
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
retries: 10,
|
|
1180
|
-
...options
|
|
1216
|
+
var _a, _b, _c;
|
|
1217
|
+
options = { ...options };
|
|
1218
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
1181
1219
|
};
|
|
1220
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1221
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1182
1222
|
const operation = import_retry.default.operation(options);
|
|
1223
|
+
const abortHandler = () => {
|
|
1224
|
+
var _a2;
|
|
1225
|
+
operation.stop();
|
|
1226
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1227
|
+
};
|
|
1228
|
+
if (options.signal && !options.signal.aborted) {
|
|
1229
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1230
|
+
}
|
|
1231
|
+
const cleanUp = () => {
|
|
1232
|
+
var _a2;
|
|
1233
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1234
|
+
operation.stop();
|
|
1235
|
+
};
|
|
1183
1236
|
operation.attempt(async (attemptNumber) => {
|
|
1184
1237
|
try {
|
|
1185
|
-
|
|
1238
|
+
const result = await input(attemptNumber);
|
|
1239
|
+
cleanUp();
|
|
1240
|
+
resolve(result);
|
|
1186
1241
|
} catch (error) {
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
} else {
|
|
1242
|
+
try {
|
|
1243
|
+
if (!(error instanceof Error)) {
|
|
1244
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1245
|
+
}
|
|
1246
|
+
if (error instanceof AbortError) {
|
|
1247
|
+
throw error.originalError;
|
|
1248
|
+
}
|
|
1249
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1250
|
+
throw error;
|
|
1251
|
+
}
|
|
1198
1252
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
reject(error2);
|
|
1203
|
-
return;
|
|
1253
|
+
if (!await options.shouldRetry(error)) {
|
|
1254
|
+
operation.stop();
|
|
1255
|
+
reject(error);
|
|
1204
1256
|
}
|
|
1257
|
+
await options.onFailedAttempt(error);
|
|
1205
1258
|
if (!operation.retry(error)) {
|
|
1206
|
-
|
|
1259
|
+
throw operation.mainError();
|
|
1207
1260
|
}
|
|
1261
|
+
} catch (finalError) {
|
|
1262
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1263
|
+
cleanUp();
|
|
1264
|
+
reject(finalError);
|
|
1208
1265
|
}
|
|
1209
1266
|
}
|
|
1210
1267
|
});
|
|
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
|
-
}
|
|
1220
1268
|
});
|
|
1221
1269
|
}
|
|
1270
|
+
|
|
1271
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1222
1272
|
var AbortError2 = class extends Error {
|
|
1223
1273
|
constructor() {
|
|
1224
1274
|
super("Throttled function aborted");
|
|
1225
1275
|
this.name = "AbortError";
|
|
1226
1276
|
}
|
|
1227
1277
|
};
|
|
1228
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1278
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1229
1279
|
if (!Number.isFinite(limit)) {
|
|
1230
1280
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1231
1281
|
}
|
|
@@ -1253,32 +1303,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1253
1303
|
const strictTicks = [];
|
|
1254
1304
|
function strictDelay() {
|
|
1255
1305
|
const now = Date.now();
|
|
1256
|
-
if (strictTicks.length
|
|
1257
|
-
strictTicks.
|
|
1258
|
-
return 0;
|
|
1306
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1307
|
+
strictTicks.length = 0;
|
|
1259
1308
|
}
|
|
1260
|
-
|
|
1261
|
-
if (now >= earliestTime) {
|
|
1309
|
+
if (strictTicks.length < limit) {
|
|
1262
1310
|
strictTicks.push(now);
|
|
1263
1311
|
return 0;
|
|
1264
1312
|
}
|
|
1265
|
-
strictTicks
|
|
1266
|
-
|
|
1313
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1314
|
+
strictTicks.shift();
|
|
1315
|
+
strictTicks.push(nextExecutionTime);
|
|
1316
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1267
1317
|
}
|
|
1268
1318
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1269
1319
|
return (function_) => {
|
|
1270
|
-
const throttled = function(...
|
|
1320
|
+
const throttled = function(...arguments_) {
|
|
1271
1321
|
if (!throttled.isEnabled) {
|
|
1272
|
-
return (async () => function_.apply(this,
|
|
1322
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1273
1323
|
}
|
|
1274
|
-
let
|
|
1324
|
+
let timeoutId;
|
|
1275
1325
|
return new Promise((resolve, reject) => {
|
|
1276
1326
|
const execute = () => {
|
|
1277
|
-
resolve(function_.apply(this,
|
|
1278
|
-
queue.delete(
|
|
1327
|
+
resolve(function_.apply(this, arguments_));
|
|
1328
|
+
queue.delete(timeoutId);
|
|
1279
1329
|
};
|
|
1280
|
-
|
|
1281
|
-
|
|
1330
|
+
const delay = getDelay();
|
|
1331
|
+
if (delay > 0) {
|
|
1332
|
+
timeoutId = setTimeout(execute, delay);
|
|
1333
|
+
queue.set(timeoutId, reject);
|
|
1334
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1335
|
+
} else {
|
|
1336
|
+
execute();
|
|
1337
|
+
}
|
|
1282
1338
|
});
|
|
1283
1339
|
};
|
|
1284
1340
|
throttled.abort = () => {
|
|
@@ -1290,16 +1346,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1290
1346
|
strictTicks.splice(0, strictTicks.length);
|
|
1291
1347
|
};
|
|
1292
1348
|
throttled.isEnabled = true;
|
|
1349
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1350
|
+
get() {
|
|
1351
|
+
return queue.size;
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1293
1354
|
return throttled;
|
|
1294
1355
|
};
|
|
1295
1356
|
}
|
|
1357
|
+
|
|
1358
|
+
// ../canvas/dist/index.mjs
|
|
1359
|
+
var __typeError3 = (msg) => {
|
|
1360
|
+
throw TypeError(msg);
|
|
1361
|
+
};
|
|
1362
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1363
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1364
|
+
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1296
1365
|
function createLimitPolicy({
|
|
1297
1366
|
throttle = { interval: 1e3, limit: 10 },
|
|
1298
|
-
retry:
|
|
1367
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1299
1368
|
limit = 10
|
|
1300
1369
|
}) {
|
|
1301
1370
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1302
|
-
const limiter = limit ? (
|
|
1371
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1303
1372
|
return function limitPolicy(func) {
|
|
1304
1373
|
let currentFunc = async () => await func();
|
|
1305
1374
|
if (throttler) {
|
|
@@ -1310,13 +1379,13 @@ function createLimitPolicy({
|
|
|
1310
1379
|
const limitFunc = currentFunc;
|
|
1311
1380
|
currentFunc = () => limiter(limitFunc);
|
|
1312
1381
|
}
|
|
1313
|
-
if (
|
|
1382
|
+
if (retry3) {
|
|
1314
1383
|
const retryFunc = currentFunc;
|
|
1315
1384
|
currentFunc = () => pRetry(retryFunc, {
|
|
1316
|
-
...
|
|
1385
|
+
...retry3,
|
|
1317
1386
|
onFailedAttempt: async (error) => {
|
|
1318
|
-
if (
|
|
1319
|
-
await
|
|
1387
|
+
if (retry3.onFailedAttempt) {
|
|
1388
|
+
await retry3.onFailedAttempt(error);
|
|
1320
1389
|
}
|
|
1321
1390
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1322
1391
|
throw error;
|
|
@@ -1327,123 +1396,151 @@ function createLimitPolicy({
|
|
|
1327
1396
|
return currentFunc();
|
|
1328
1397
|
};
|
|
1329
1398
|
}
|
|
1330
|
-
var
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
if (!options.limitPolicy) {
|
|
1335
|
-
options.limitPolicy = createLimitPolicy({});
|
|
1336
|
-
}
|
|
1337
|
-
super(options);
|
|
1338
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1339
|
-
this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1340
|
-
}
|
|
1341
|
-
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1342
|
-
async getCompositionList(params = {}) {
|
|
1343
|
-
const { projectId } = this.options;
|
|
1344
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1345
|
-
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1346
|
-
if (!resolveData) {
|
|
1347
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1348
|
-
return this.apiClient(fetchUri);
|
|
1349
|
-
}
|
|
1350
|
-
const edgeParams = {
|
|
1351
|
-
...originParams,
|
|
1352
|
-
projectId,
|
|
1353
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1354
|
-
...rewrittenFilters
|
|
1355
|
-
};
|
|
1356
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1357
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1358
|
-
}
|
|
1359
|
-
getCompositionByNodePath(options) {
|
|
1360
|
-
return this.getOneComposition(options);
|
|
1361
|
-
}
|
|
1362
|
-
getCompositionByNodeId(options) {
|
|
1363
|
-
return this.getOneComposition(options);
|
|
1364
|
-
}
|
|
1365
|
-
getCompositionBySlug(options) {
|
|
1366
|
-
return this.getOneComposition(options);
|
|
1367
|
-
}
|
|
1368
|
-
getCompositionById(options) {
|
|
1369
|
-
return this.getOneComposition(options);
|
|
1370
|
-
}
|
|
1371
|
-
getCompositionDefaults(options) {
|
|
1372
|
-
return this.getOneComposition(options);
|
|
1373
|
-
}
|
|
1374
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1375
|
-
async getCompositionHistory(options) {
|
|
1376
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1399
|
+
var ContentClientBase = class extends ApiClient {
|
|
1400
|
+
constructor(options, defaultBypassCache) {
|
|
1401
|
+
var _a, _b;
|
|
1402
|
+
super({
|
|
1377
1403
|
...options,
|
|
1378
|
-
|
|
1404
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1405
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1379
1406
|
});
|
|
1380
|
-
return this.apiClient(historyUrl);
|
|
1381
1407
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1408
|
+
};
|
|
1409
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1410
|
+
function appendCsv(out, key, values) {
|
|
1411
|
+
if (values === void 0) {
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
out[key] = values.join(",");
|
|
1415
|
+
}
|
|
1416
|
+
function projectionToQuery(spec) {
|
|
1417
|
+
const out = {};
|
|
1418
|
+
if (!spec) {
|
|
1419
|
+
return out;
|
|
1420
|
+
}
|
|
1421
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1422
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1423
|
+
if (fields) {
|
|
1424
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1425
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1426
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1427
|
+
}
|
|
1428
|
+
if (fieldTypes) {
|
|
1429
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1430
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1431
|
+
}
|
|
1432
|
+
if (slots) {
|
|
1433
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1434
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1435
|
+
if (typeof slots.depth === "number") {
|
|
1436
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1437
|
+
}
|
|
1438
|
+
if (slots.named) {
|
|
1439
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1440
|
+
for (const slotName of slotNames) {
|
|
1441
|
+
const named = slots.named[slotName];
|
|
1442
|
+
if (named && typeof named.depth === "number") {
|
|
1443
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1390
1446
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1447
|
+
}
|
|
1448
|
+
return out;
|
|
1449
|
+
}
|
|
1450
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1451
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
1452
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1453
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1454
|
+
var CANVAS_TEST_SLOT = "test";
|
|
1455
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1456
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1457
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1458
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1459
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1460
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1461
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1462
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1463
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1464
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1465
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1466
|
+
function resolveCompositionSelector(args) {
|
|
1467
|
+
if ("compositionId" in args) {
|
|
1468
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1469
|
+
return {
|
|
1470
|
+
readOptions,
|
|
1471
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1472
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1473
|
+
versionId,
|
|
1474
|
+
hasCompositionId: true,
|
|
1475
|
+
pinnedEdition: editionId !== void 0
|
|
1395
1476
|
};
|
|
1396
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1397
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1398
1477
|
}
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
}
|
|
1412
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1478
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1479
|
+
}
|
|
1480
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1481
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1482
|
+
constructor(options) {
|
|
1483
|
+
var _a;
|
|
1484
|
+
super(
|
|
1485
|
+
options,
|
|
1486
|
+
/* defaultBypassCache */
|
|
1487
|
+
false
|
|
1488
|
+
);
|
|
1489
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1490
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1413
1491
|
}
|
|
1414
|
-
/**
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
const { projectId } = this.options;
|
|
1418
|
-
await this.apiClient(fetchUri, {
|
|
1419
|
-
method: "DELETE",
|
|
1420
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1421
|
-
expectNoContent: true
|
|
1422
|
-
});
|
|
1492
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1493
|
+
coerceDiagnostics(diagnostics) {
|
|
1494
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1423
1495
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1496
|
+
};
|
|
1497
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1498
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1499
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1500
|
+
constructor(options) {
|
|
1501
|
+
super(options);
|
|
1429
1502
|
}
|
|
1430
|
-
/**
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1503
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1504
|
+
get(args) {
|
|
1505
|
+
var _a;
|
|
1506
|
+
const { diagnostics, select, ...rest } = args;
|
|
1507
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1508
|
+
const url = this.createUrl(
|
|
1509
|
+
EDGE_SINGLE_URL,
|
|
1510
|
+
{
|
|
1511
|
+
...readOptions,
|
|
1512
|
+
...projectionToQuery(select),
|
|
1513
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1514
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1515
|
+
compositionId,
|
|
1516
|
+
versionId,
|
|
1517
|
+
projectId: this.options.projectId,
|
|
1518
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1519
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1520
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1521
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1522
|
+
},
|
|
1523
|
+
this.edgeApiHost
|
|
1524
|
+
);
|
|
1525
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1438
1526
|
}
|
|
1439
|
-
/**
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1527
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1528
|
+
list(args = {}) {
|
|
1529
|
+
var _a;
|
|
1530
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1531
|
+
const url = this.createUrl(
|
|
1532
|
+
EDGE_LIST_URL,
|
|
1533
|
+
{
|
|
1534
|
+
...rest,
|
|
1535
|
+
...rewriteFiltersForApi(filters),
|
|
1536
|
+
...projectionToQuery(select),
|
|
1537
|
+
projectId: this.options.projectId,
|
|
1538
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1539
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1540
|
+
},
|
|
1541
|
+
this.edgeApiHost
|
|
1542
|
+
);
|
|
1543
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1447
1544
|
}
|
|
1448
1545
|
};
|
|
1449
1546
|
var _contentTypesUrl;
|
|
@@ -1461,15 +1558,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1461
1558
|
}
|
|
1462
1559
|
getEntries(options) {
|
|
1463
1560
|
const { projectId } = this.options;
|
|
1464
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1561
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1465
1562
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1563
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1466
1564
|
if (skipDataResolution) {
|
|
1467
|
-
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1565
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1566
|
+
...params,
|
|
1567
|
+
...rewrittenFilters,
|
|
1568
|
+
...rewrittenSelect,
|
|
1569
|
+
projectId
|
|
1570
|
+
});
|
|
1468
1571
|
return this.apiClient(url);
|
|
1469
1572
|
}
|
|
1470
1573
|
const edgeUrl = this.createUrl(
|
|
1471
1574
|
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1472
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1575
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1473
1576
|
this.edgeApiHost
|
|
1474
1577
|
);
|
|
1475
1578
|
return this.apiClient(
|
|
@@ -1546,14 +1649,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1546
1649
|
constructor(options) {
|
|
1547
1650
|
super(options);
|
|
1548
1651
|
}
|
|
1549
|
-
/** Fetches
|
|
1550
|
-
async
|
|
1652
|
+
/** Fetches a list of DataTypes for a project */
|
|
1653
|
+
async list(options) {
|
|
1551
1654
|
const { projectId } = this.options;
|
|
1552
1655
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1553
1656
|
return await this.apiClient(fetchUri);
|
|
1554
1657
|
}
|
|
1658
|
+
/** @deprecated Use {@link list} instead. */
|
|
1659
|
+
async get(options) {
|
|
1660
|
+
return this.list(options);
|
|
1661
|
+
}
|
|
1555
1662
|
/** Updates or creates (based on id) a DataType */
|
|
1556
|
-
async
|
|
1663
|
+
async save(body) {
|
|
1557
1664
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1558
1665
|
await this.apiClient(fetchUri, {
|
|
1559
1666
|
method: "PUT",
|
|
@@ -1561,6 +1668,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1561
1668
|
expectNoContent: true
|
|
1562
1669
|
});
|
|
1563
1670
|
}
|
|
1671
|
+
/** @deprecated Use {@link save} instead. */
|
|
1672
|
+
async upsert(body) {
|
|
1673
|
+
return this.save(body);
|
|
1674
|
+
}
|
|
1564
1675
|
/** Deletes a DataType */
|
|
1565
1676
|
async remove(body) {
|
|
1566
1677
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1598,22 +1709,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1598
1709
|
}
|
|
1599
1710
|
return `.${path.join(".")}`;
|
|
1600
1711
|
}
|
|
1601
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1602
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
1603
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1604
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1605
|
-
var CANVAS_TEST_SLOT = "test";
|
|
1606
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1607
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1608
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1609
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1610
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1611
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1612
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1613
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1614
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1615
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1616
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1617
1712
|
function isRootEntryReference(root) {
|
|
1618
1713
|
return root.type === "root" && isEntryData(root.node);
|
|
1619
1714
|
}
|
|
@@ -2215,20 +2310,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2215
2310
|
* When teamId is provided, returns a single team with its projects.
|
|
2216
2311
|
* When omitted, returns all accessible teams and their projects.
|
|
2217
2312
|
*/
|
|
2218
|
-
async
|
|
2313
|
+
async list(options) {
|
|
2219
2314
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
2220
2315
|
return await this.apiClient(fetchUri);
|
|
2221
2316
|
}
|
|
2317
|
+
/** @deprecated Use {@link list} instead. */
|
|
2318
|
+
async getProjects(options) {
|
|
2319
|
+
return this.list(options);
|
|
2320
|
+
}
|
|
2222
2321
|
/** Updates or creates (based on id) a Project */
|
|
2223
|
-
async
|
|
2322
|
+
async save(body) {
|
|
2224
2323
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
2225
2324
|
return await this.apiClient(fetchUri, {
|
|
2226
2325
|
method: "PUT",
|
|
2227
2326
|
body: JSON.stringify({ ...body })
|
|
2228
2327
|
});
|
|
2229
2328
|
}
|
|
2329
|
+
/** @deprecated Use {@link save} instead. */
|
|
2330
|
+
async upsert(body) {
|
|
2331
|
+
return this.save(body);
|
|
2332
|
+
}
|
|
2230
2333
|
/** Deletes a Project */
|
|
2231
|
-
async
|
|
2334
|
+
async remove(body) {
|
|
2232
2335
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
2233
2336
|
await this.apiClient(fetchUri, {
|
|
2234
2337
|
method: "DELETE",
|
|
@@ -2236,6 +2339,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2236
2339
|
expectNoContent: true
|
|
2237
2340
|
});
|
|
2238
2341
|
}
|
|
2342
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2343
|
+
async delete(body) {
|
|
2344
|
+
return this.remove(body);
|
|
2345
|
+
}
|
|
2239
2346
|
};
|
|
2240
2347
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
2241
2348
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
@@ -2251,15 +2358,27 @@ var RouteClient = class extends ApiClient {
|
|
|
2251
2358
|
super(options);
|
|
2252
2359
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
2253
2360
|
}
|
|
2254
|
-
/**
|
|
2255
|
-
|
|
2361
|
+
/**
|
|
2362
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
2363
|
+
*
|
|
2364
|
+
* An optional `select` projection applies to the resolved composition when
|
|
2365
|
+
* the route matches one; redirect / notFound responses pass through
|
|
2366
|
+
* untouched.
|
|
2367
|
+
*/
|
|
2368
|
+
async get(options) {
|
|
2256
2369
|
const { projectId } = this.options;
|
|
2257
|
-
const
|
|
2370
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2371
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2372
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2258
2373
|
return await this.apiClient(
|
|
2259
2374
|
fetchUri,
|
|
2260
2375
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
2261
2376
|
);
|
|
2262
2377
|
}
|
|
2378
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
2379
|
+
async getRoute(options) {
|
|
2380
|
+
return this.get(options);
|
|
2381
|
+
}
|
|
2263
2382
|
};
|
|
2264
2383
|
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2265
2384
|
var _a, _b;
|
|
@@ -2505,7 +2624,7 @@ function createLimiter(concurrency) {
|
|
|
2505
2624
|
});
|
|
2506
2625
|
};
|
|
2507
2626
|
}
|
|
2508
|
-
async function
|
|
2627
|
+
async function retry2(fn, options) {
|
|
2509
2628
|
let lastError;
|
|
2510
2629
|
let delay = 1e3;
|
|
2511
2630
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2545,7 +2664,7 @@ function createLimitPolicy2({
|
|
|
2545
2664
|
}
|
|
2546
2665
|
if (retryOptions) {
|
|
2547
2666
|
const retryFunc = currentFunc;
|
|
2548
|
-
currentFunc = () =>
|
|
2667
|
+
currentFunc = () => retry2(retryFunc, {
|
|
2549
2668
|
...retryOptions,
|
|
2550
2669
|
onFailedAttempt: async (error) => {
|
|
2551
2670
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2564,7 +2683,7 @@ function createLimitPolicy2({
|
|
|
2564
2683
|
// src/clients/canvas.ts
|
|
2565
2684
|
var getCanvasClient = (options) => {
|
|
2566
2685
|
const cache = resolveCanvasCache(options);
|
|
2567
|
-
return new
|
|
2686
|
+
return new CompositionDeliveryClient({
|
|
2568
2687
|
projectId: env.getProjectId(),
|
|
2569
2688
|
apiHost: env.getApiHost(),
|
|
2570
2689
|
apiKey: env.getApiKey(),
|
|
@@ -2835,14 +2954,14 @@ var DefaultDataClient = class {
|
|
|
2835
2954
|
if (oldCachedRoute) {
|
|
2836
2955
|
(0, import_functions.waitUntil)(
|
|
2837
2956
|
(async () => {
|
|
2838
|
-
const result2 = await routeClient.
|
|
2957
|
+
const result2 = await routeClient.get(route);
|
|
2839
2958
|
await cacheNewRoute(result2);
|
|
2840
2959
|
})()
|
|
2841
2960
|
);
|
|
2842
2961
|
return oldCachedRoute;
|
|
2843
2962
|
}
|
|
2844
2963
|
}
|
|
2845
|
-
const result = await routeClient.
|
|
2964
|
+
const result = await routeClient.get(route);
|
|
2846
2965
|
(0, import_functions.waitUntil)(
|
|
2847
2966
|
(async () => {
|
|
2848
2967
|
await Promise.all([
|
|
@@ -3163,7 +3282,7 @@ function dequal(foo, bar) {
|
|
|
3163
3282
|
return foo !== foo && bar !== bar;
|
|
3164
3283
|
}
|
|
3165
3284
|
|
|
3166
|
-
// ../../node_modules/.pnpm/js-cookie@3.0.
|
|
3285
|
+
// ../../node_modules/.pnpm/js-cookie@3.0.8/node_modules/js-cookie/dist/js.cookie.mjs
|
|
3167
3286
|
function assign(target) {
|
|
3168
3287
|
for (var i = 1; i < arguments.length; i++) {
|
|
3169
3288
|
var source = arguments[i];
|
|
@@ -3229,7 +3348,7 @@ function init(converter, defaultAttributes) {
|
|
|
3229
3348
|
if (name === found) {
|
|
3230
3349
|
break;
|
|
3231
3350
|
}
|
|
3232
|
-
} catch (
|
|
3351
|
+
} catch (_e) {
|
|
3233
3352
|
}
|
|
3234
3353
|
}
|
|
3235
3354
|
return name ? jar[name] : jar;
|
|
@@ -3284,12 +3403,12 @@ function mitt_default(n) {
|
|
|
3284
3403
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
3285
3404
|
var import_rfdc2 = __toESM(require_rfdc(), 1);
|
|
3286
3405
|
var import_rfdc3 = __toESM(require_rfdc(), 1);
|
|
3287
|
-
var
|
|
3406
|
+
var __defProp3 = Object.defineProperty;
|
|
3288
3407
|
var __typeError4 = (msg) => {
|
|
3289
3408
|
throw TypeError(msg);
|
|
3290
3409
|
};
|
|
3291
|
-
var
|
|
3292
|
-
var
|
|
3410
|
+
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3411
|
+
var __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3293
3412
|
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
3294
3413
|
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3295
3414
|
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);
|
|
@@ -3366,7 +3485,7 @@ var SignalInstance = class {
|
|
|
3366
3485
|
constructor(data, evaluator, onLogMessage) {
|
|
3367
3486
|
__privateAdd4(this, _evaluator);
|
|
3368
3487
|
__privateAdd4(this, _onLogMessage);
|
|
3369
|
-
|
|
3488
|
+
__publicField3(this, "signal");
|
|
3370
3489
|
this.signal = data;
|
|
3371
3490
|
__privateSet2(this, _evaluator, evaluator);
|
|
3372
3491
|
__privateSet2(this, _onLogMessage, onLogMessage);
|
|
@@ -3424,7 +3543,7 @@ var ManifestInstance = class {
|
|
|
3424
3543
|
onLogMessage = () => {
|
|
3425
3544
|
}
|
|
3426
3545
|
}) {
|
|
3427
|
-
|
|
3546
|
+
__publicField3(this, "data");
|
|
3428
3547
|
__privateAdd4(this, _mf);
|
|
3429
3548
|
__privateAdd4(this, _signalInstances);
|
|
3430
3549
|
__privateAdd4(this, _goalEvaluators, []);
|
|
@@ -4211,7 +4330,7 @@ var TransitionDataStore = class {
|
|
|
4211
4330
|
__privateAdd4(this, _data);
|
|
4212
4331
|
__privateAdd4(this, _initialData);
|
|
4213
4332
|
__privateAdd4(this, _mitt, mitt_default());
|
|
4214
|
-
|
|
4333
|
+
__publicField3(this, "events", {
|
|
4215
4334
|
on: __privateGet4(this, _mitt).on,
|
|
4216
4335
|
off: __privateGet4(this, _mitt).off
|
|
4217
4336
|
});
|
|
@@ -4574,10 +4693,10 @@ var _LocalStorage_instances;
|
|
|
4574
4693
|
var key_fn;
|
|
4575
4694
|
var LocalStorage = class {
|
|
4576
4695
|
constructor(partitionKey) {
|
|
4577
|
-
this
|
|
4696
|
+
__publicField3(this, "partitionKey", partitionKey);
|
|
4578
4697
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4579
|
-
|
|
4580
|
-
|
|
4698
|
+
__publicField3(this, "inMemoryFallback", {});
|
|
4699
|
+
__publicField3(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
4581
4700
|
}
|
|
4582
4701
|
get(key) {
|
|
4583
4702
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
|
@@ -4638,7 +4757,7 @@ var VisitorDataStore = class {
|
|
|
4638
4757
|
__privateAdd4(this, _persist);
|
|
4639
4758
|
__privateAdd4(this, _visitTimeout);
|
|
4640
4759
|
__privateAdd4(this, _options);
|
|
4641
|
-
|
|
4760
|
+
__publicField3(this, "events", {
|
|
4642
4761
|
on: __privateGet4(this, _mitt2).on,
|
|
4643
4762
|
off: __privateGet4(this, _mitt2).off
|
|
4644
4763
|
});
|
|
@@ -4839,7 +4958,7 @@ var calculateScores_fn;
|
|
|
4839
4958
|
var Context = class {
|
|
4840
4959
|
constructor(options) {
|
|
4841
4960
|
__privateAdd4(this, _Context_instances);
|
|
4842
|
-
|
|
4961
|
+
__publicField3(this, "manifest");
|
|
4843
4962
|
__privateAdd4(this, _personalizationSelectionAlgorithms);
|
|
4844
4963
|
__privateAdd4(this, _serverTransitionState);
|
|
4845
4964
|
__privateAdd4(this, _scores, {});
|
|
@@ -4849,11 +4968,11 @@ var Context = class {
|
|
|
4849
4968
|
__privateAdd4(this, _commands);
|
|
4850
4969
|
__privateAdd4(this, _requireConsentForPersonalization);
|
|
4851
4970
|
__privateAdd4(this, _mitt3, mitt_default());
|
|
4852
|
-
|
|
4971
|
+
__publicField3(this, "events", {
|
|
4853
4972
|
on: __privateGet4(this, _mitt3).on,
|
|
4854
4973
|
off: __privateGet4(this, _mitt3).off
|
|
4855
4974
|
});
|
|
4856
|
-
|
|
4975
|
+
__publicField3(this, "storage");
|
|
4857
4976
|
var _a, _b, _c;
|
|
4858
4977
|
const { manifest, ...storageOptions } = options;
|
|
4859
4978
|
__privateSet2(this, _state, {});
|
|
@@ -5439,7 +5558,6 @@ var retrieveRouteByPath = async ({
|
|
|
5439
5558
|
releaseId,
|
|
5440
5559
|
locale
|
|
5441
5560
|
}) => {
|
|
5442
|
-
var _a;
|
|
5443
5561
|
return await dataClient.getRoute({
|
|
5444
5562
|
source: "middleware",
|
|
5445
5563
|
searchParams,
|
|
@@ -5449,7 +5567,6 @@ var retrieveRouteByPath = async ({
|
|
|
5449
5567
|
state,
|
|
5450
5568
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
|
|
5451
5569
|
withComponentIDs: true,
|
|
5452
|
-
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5453
5570
|
releaseId,
|
|
5454
5571
|
locale,
|
|
5455
5572
|
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
@@ -5548,7 +5665,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5548
5665
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
5549
5666
|
const state = possibleStates[i];
|
|
5550
5667
|
try {
|
|
5551
|
-
composition = await canvasClient.
|
|
5668
|
+
composition = await canvasClient.get({
|
|
5552
5669
|
compositionId: id,
|
|
5553
5670
|
state,
|
|
5554
5671
|
withComponentIDs: true
|
|
@@ -5900,5 +6017,5 @@ var determinePreviewMode = ({
|
|
|
5900
6017
|
/*! Bundled license information:
|
|
5901
6018
|
|
|
5902
6019
|
js-cookie/dist/js.cookie.mjs:
|
|
5903
|
-
(*! js-cookie v3.0.
|
|
6020
|
+
(*! js-cookie v3.0.8 | MIT *)
|
|
5904
6021
|
*/
|