@uniformdev/next-app-router 20.49.2 → 20.49.3-alpha.47
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/{UniformComposition-d7_93l3F.d.ts → UniformComposition-BWxMuY7i.d.ts} +2 -2
- package/dist/{UniformComposition-hhRIBHmn.d.mts → UniformComposition-Bo6UsTDC.d.mts} +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +768 -582
- package/dist/cache.mjs +768 -582
- package/dist/{client-BCGVjYM-.d.mts → client-DRMp2gpi.d.mts} +2 -1
- package/dist/{client-BCGVjYM-.d.ts → client-DRMp2gpi.d.ts} +2 -1
- package/dist/compat.d.mts +3 -3
- package/dist/compat.d.ts +3 -3
- package/dist/component.js +100 -387
- package/dist/component.mjs +101 -388
- package/dist/handler.js +797 -587
- package/dist/handler.mjs +797 -587
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +838 -596
- package/dist/index.js +845 -603
- package/dist/index.mjs +838 -596
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +790 -569
- package/dist/middleware.mjs +790 -569
- package/dist/{resolveRouteFromCode-DgTsfMK8.d.ts → resolveRouteFromCode-Bhz8EJBu.d.ts} +1 -1
- package/dist/{resolveRouteFromCode-CKaYNXte.d.mts → resolveRouteFromCode-C0dkUV2T.d.mts} +1 -1
- package/package.json +22 -21
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,30 +600,37 @@ 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);
|
|
367
608
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
609
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
368
610
|
var ApiClientError = class _ApiClientError extends Error {
|
|
369
611
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
370
612
|
super(
|
|
371
613
|
`${errorMessage}
|
|
372
614
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
373
615
|
);
|
|
374
|
-
this
|
|
375
|
-
this
|
|
376
|
-
this
|
|
377
|
-
this
|
|
378
|
-
this
|
|
379
|
-
this
|
|
616
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
617
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
618
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
619
|
+
__publicField2(this, "statusCode", statusCode);
|
|
620
|
+
__publicField2(this, "statusText", statusText);
|
|
621
|
+
__publicField2(this, "requestId", requestId);
|
|
380
622
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
381
623
|
}
|
|
382
624
|
};
|
|
625
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
626
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
627
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
628
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
629
|
+
}
|
|
630
|
+
};
|
|
383
631
|
var ApiClient = class _ApiClient {
|
|
384
632
|
constructor(options) {
|
|
385
|
-
|
|
633
|
+
__publicField2(this, "options");
|
|
386
634
|
var _a, _b, _c, _d, _e;
|
|
387
635
|
if (!options.apiKey && !options.bearerToken) {
|
|
388
636
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -413,7 +661,7 @@ var ApiClient = class _ApiClient {
|
|
|
413
661
|
}
|
|
414
662
|
async apiClientWithResponse(fetchUri, options) {
|
|
415
663
|
return this.options.limitPolicy(async () => {
|
|
416
|
-
var _a;
|
|
664
|
+
var _a, _b;
|
|
417
665
|
const coreHeaders = this.options.apiKey ? {
|
|
418
666
|
"x-api-key": this.options.apiKey
|
|
419
667
|
} : {
|
|
@@ -449,9 +697,19 @@ var ApiClient = class _ApiClient {
|
|
|
449
697
|
} catch (e) {
|
|
450
698
|
message = `General error`;
|
|
451
699
|
}
|
|
700
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
701
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
702
|
+
message,
|
|
703
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
704
|
+
fetchUri.toString(),
|
|
705
|
+
apiResponse.status,
|
|
706
|
+
apiResponse.statusText,
|
|
707
|
+
_ApiClient.getRequestId(apiResponse)
|
|
708
|
+
);
|
|
709
|
+
}
|
|
452
710
|
throw new ApiClientError(
|
|
453
711
|
message,
|
|
454
|
-
(
|
|
712
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
455
713
|
fetchUri.toString(),
|
|
456
714
|
apiResponse.status,
|
|
457
715
|
apiResponse.statusText,
|
|
@@ -525,11 +783,25 @@ async function handleRateLimits(callApi) {
|
|
|
525
783
|
}
|
|
526
784
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
527
785
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
528
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
786
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
529
787
|
backoffRetriesLeft -= 1;
|
|
530
788
|
}
|
|
531
789
|
return response;
|
|
532
790
|
}
|
|
791
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
792
|
+
function rewriteFiltersForApi(filters) {
|
|
793
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
794
|
+
(acc, [key, value]) => {
|
|
795
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
796
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
797
|
+
return {
|
|
798
|
+
...acc,
|
|
799
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
800
|
+
};
|
|
801
|
+
},
|
|
802
|
+
{}
|
|
803
|
+
);
|
|
804
|
+
}
|
|
533
805
|
var _url;
|
|
534
806
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
535
807
|
constructor(options) {
|
|
@@ -743,398 +1015,199 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
743
1015
|
await this.apiClient(fetchUri, {
|
|
744
1016
|
method: "DELETE",
|
|
745
1017
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
746
|
-
expectNoContent: true
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
_url7 = /* @__PURE__ */ new WeakMap();
|
|
751
|
-
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
752
|
-
|
|
753
|
-
//
|
|
754
|
-
var
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
)
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
dequeue()
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
const run = async (fn, resolve, ...args) => {
|
|
860
|
-
activeCount++;
|
|
861
|
-
const result = (async () => fn(...args))();
|
|
862
|
-
resolve(result);
|
|
863
|
-
try {
|
|
864
|
-
await result;
|
|
865
|
-
} catch (e) {
|
|
866
|
-
}
|
|
867
|
-
next();
|
|
868
|
-
};
|
|
869
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
870
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
871
|
-
(async () => {
|
|
872
|
-
await Promise.resolve();
|
|
873
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
874
|
-
queue.dequeue()();
|
|
875
|
-
}
|
|
876
|
-
})();
|
|
877
|
-
};
|
|
878
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
879
|
-
enqueue(fn, resolve, ...args);
|
|
880
|
-
});
|
|
881
|
-
Object.defineProperties(generator, {
|
|
882
|
-
activeCount: {
|
|
883
|
-
get: () => activeCount
|
|
884
|
-
},
|
|
885
|
-
pendingCount: {
|
|
886
|
-
get: () => queue.size
|
|
887
|
-
},
|
|
888
|
-
clearQueue: {
|
|
889
|
-
value: () => {
|
|
890
|
-
queue.clear();
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
return generator;
|
|
895
|
-
};
|
|
896
|
-
module2.exports = pLimit2;
|
|
897
|
-
}
|
|
898
|
-
});
|
|
899
|
-
var require_retry_operation = __commonJS2({
|
|
900
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
901
|
-
"use strict";
|
|
902
|
-
function RetryOperation(timeouts, options) {
|
|
903
|
-
if (typeof options === "boolean") {
|
|
904
|
-
options = { forever: options };
|
|
905
|
-
}
|
|
906
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
907
|
-
this._timeouts = timeouts;
|
|
908
|
-
this._options = options || {};
|
|
909
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
910
|
-
this._fn = null;
|
|
911
|
-
this._errors = [];
|
|
912
|
-
this._attempts = 1;
|
|
913
|
-
this._operationTimeout = null;
|
|
914
|
-
this._operationTimeoutCb = null;
|
|
915
|
-
this._timeout = null;
|
|
916
|
-
this._operationStart = null;
|
|
917
|
-
this._timer = null;
|
|
918
|
-
if (this._options.forever) {
|
|
919
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
module2.exports = RetryOperation;
|
|
923
|
-
RetryOperation.prototype.reset = function() {
|
|
924
|
-
this._attempts = 1;
|
|
925
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
926
|
-
};
|
|
927
|
-
RetryOperation.prototype.stop = function() {
|
|
928
|
-
if (this._timeout) {
|
|
929
|
-
clearTimeout(this._timeout);
|
|
930
|
-
}
|
|
931
|
-
if (this._timer) {
|
|
932
|
-
clearTimeout(this._timer);
|
|
933
|
-
}
|
|
934
|
-
this._timeouts = [];
|
|
935
|
-
this._cachedTimeouts = null;
|
|
936
|
-
};
|
|
937
|
-
RetryOperation.prototype.retry = function(err) {
|
|
938
|
-
if (this._timeout) {
|
|
939
|
-
clearTimeout(this._timeout);
|
|
940
|
-
}
|
|
941
|
-
if (!err) {
|
|
942
|
-
return false;
|
|
943
|
-
}
|
|
944
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
945
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
946
|
-
this._errors.push(err);
|
|
947
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
948
|
-
return false;
|
|
949
|
-
}
|
|
950
|
-
this._errors.push(err);
|
|
951
|
-
var timeout = this._timeouts.shift();
|
|
952
|
-
if (timeout === void 0) {
|
|
953
|
-
if (this._cachedTimeouts) {
|
|
954
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
955
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
956
|
-
} else {
|
|
957
|
-
return false;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
var self = this;
|
|
961
|
-
this._timer = setTimeout(function() {
|
|
962
|
-
self._attempts++;
|
|
963
|
-
if (self._operationTimeoutCb) {
|
|
964
|
-
self._timeout = setTimeout(function() {
|
|
965
|
-
self._operationTimeoutCb(self._attempts);
|
|
966
|
-
}, self._operationTimeout);
|
|
967
|
-
if (self._options.unref) {
|
|
968
|
-
self._timeout.unref();
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
self._fn(self._attempts);
|
|
972
|
-
}, timeout);
|
|
973
|
-
if (this._options.unref) {
|
|
974
|
-
this._timer.unref();
|
|
975
|
-
}
|
|
976
|
-
return true;
|
|
977
|
-
};
|
|
978
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
979
|
-
this._fn = fn;
|
|
980
|
-
if (timeoutOps) {
|
|
981
|
-
if (timeoutOps.timeout) {
|
|
982
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
983
|
-
}
|
|
984
|
-
if (timeoutOps.cb) {
|
|
985
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
var self = this;
|
|
989
|
-
if (this._operationTimeoutCb) {
|
|
990
|
-
this._timeout = setTimeout(function() {
|
|
991
|
-
self._operationTimeoutCb();
|
|
992
|
-
}, self._operationTimeout);
|
|
993
|
-
}
|
|
994
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
995
|
-
this._fn(this._attempts);
|
|
996
|
-
};
|
|
997
|
-
RetryOperation.prototype.try = function(fn) {
|
|
998
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
999
|
-
this.attempt(fn);
|
|
1000
|
-
};
|
|
1001
|
-
RetryOperation.prototype.start = function(fn) {
|
|
1002
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
1003
|
-
this.attempt(fn);
|
|
1004
|
-
};
|
|
1005
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
1006
|
-
RetryOperation.prototype.errors = function() {
|
|
1007
|
-
return this._errors;
|
|
1008
|
-
};
|
|
1009
|
-
RetryOperation.prototype.attempts = function() {
|
|
1010
|
-
return this._attempts;
|
|
1011
|
-
};
|
|
1012
|
-
RetryOperation.prototype.mainError = function() {
|
|
1013
|
-
if (this._errors.length === 0) {
|
|
1014
|
-
return null;
|
|
1015
|
-
}
|
|
1016
|
-
var counts = {};
|
|
1017
|
-
var mainError = null;
|
|
1018
|
-
var mainErrorCount = 0;
|
|
1019
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
1020
|
-
var error = this._errors[i];
|
|
1021
|
-
var message = error.message;
|
|
1022
|
-
var count = (counts[message] || 0) + 1;
|
|
1023
|
-
counts[message] = count;
|
|
1024
|
-
if (count >= mainErrorCount) {
|
|
1025
|
-
mainError = error;
|
|
1026
|
-
mainErrorCount = count;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
return mainError;
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
});
|
|
1033
|
-
var require_retry = __commonJS2({
|
|
1034
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
1035
|
-
"use strict";
|
|
1036
|
-
var RetryOperation = require_retry_operation();
|
|
1037
|
-
exports2.operation = function(options) {
|
|
1038
|
-
var timeouts = exports2.timeouts(options);
|
|
1039
|
-
return new RetryOperation(timeouts, {
|
|
1040
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
1041
|
-
unref: options && options.unref,
|
|
1042
|
-
maxRetryTime: options && options.maxRetryTime
|
|
1043
|
-
});
|
|
1044
|
-
};
|
|
1045
|
-
exports2.timeouts = function(options) {
|
|
1046
|
-
if (options instanceof Array) {
|
|
1047
|
-
return [].concat(options);
|
|
1048
|
-
}
|
|
1049
|
-
var opts = {
|
|
1050
|
-
retries: 10,
|
|
1051
|
-
factor: 2,
|
|
1052
|
-
minTimeout: 1 * 1e3,
|
|
1053
|
-
maxTimeout: Infinity,
|
|
1054
|
-
randomize: false
|
|
1055
|
-
};
|
|
1056
|
-
for (var key in options) {
|
|
1057
|
-
opts[key] = options[key];
|
|
1058
|
-
}
|
|
1059
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
1060
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
1061
|
-
}
|
|
1062
|
-
var timeouts = [];
|
|
1063
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
1064
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
1065
|
-
}
|
|
1066
|
-
if (options && options.forever && !timeouts.length) {
|
|
1067
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
1018
|
+
expectNoContent: true
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
_url7 = /* @__PURE__ */ new WeakMap();
|
|
1023
|
+
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
1024
|
+
|
|
1025
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
1026
|
+
var Node = class {
|
|
1027
|
+
constructor(value) {
|
|
1028
|
+
__publicField(this, "value");
|
|
1029
|
+
__publicField(this, "next");
|
|
1030
|
+
this.value = value;
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
var _head, _tail, _size;
|
|
1034
|
+
var Queue = class {
|
|
1035
|
+
constructor() {
|
|
1036
|
+
__privateAdd(this, _head);
|
|
1037
|
+
__privateAdd(this, _tail);
|
|
1038
|
+
__privateAdd(this, _size);
|
|
1039
|
+
this.clear();
|
|
1040
|
+
}
|
|
1041
|
+
enqueue(value) {
|
|
1042
|
+
const node = new Node(value);
|
|
1043
|
+
if (__privateGet(this, _head)) {
|
|
1044
|
+
__privateGet(this, _tail).next = node;
|
|
1045
|
+
__privateSet(this, _tail, node);
|
|
1046
|
+
} else {
|
|
1047
|
+
__privateSet(this, _head, node);
|
|
1048
|
+
__privateSet(this, _tail, node);
|
|
1049
|
+
}
|
|
1050
|
+
__privateWrapper(this, _size)._++;
|
|
1051
|
+
}
|
|
1052
|
+
dequeue() {
|
|
1053
|
+
const current = __privateGet(this, _head);
|
|
1054
|
+
if (!current) {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
1058
|
+
__privateWrapper(this, _size)._--;
|
|
1059
|
+
if (!__privateGet(this, _head)) {
|
|
1060
|
+
__privateSet(this, _tail, void 0);
|
|
1061
|
+
}
|
|
1062
|
+
return current.value;
|
|
1063
|
+
}
|
|
1064
|
+
peek() {
|
|
1065
|
+
if (!__privateGet(this, _head)) {
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
return __privateGet(this, _head).value;
|
|
1069
|
+
}
|
|
1070
|
+
clear() {
|
|
1071
|
+
__privateSet(this, _head, void 0);
|
|
1072
|
+
__privateSet(this, _tail, void 0);
|
|
1073
|
+
__privateSet(this, _size, 0);
|
|
1074
|
+
}
|
|
1075
|
+
get size() {
|
|
1076
|
+
return __privateGet(this, _size);
|
|
1077
|
+
}
|
|
1078
|
+
*[Symbol.iterator]() {
|
|
1079
|
+
let current = __privateGet(this, _head);
|
|
1080
|
+
while (current) {
|
|
1081
|
+
yield current.value;
|
|
1082
|
+
current = current.next;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
*drain() {
|
|
1086
|
+
while (__privateGet(this, _head)) {
|
|
1087
|
+
yield this.dequeue();
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
_head = new WeakMap();
|
|
1092
|
+
_tail = new WeakMap();
|
|
1093
|
+
_size = new WeakMap();
|
|
1094
|
+
|
|
1095
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
1096
|
+
function pLimit2(concurrency) {
|
|
1097
|
+
validateConcurrency(concurrency);
|
|
1098
|
+
const queue = new Queue();
|
|
1099
|
+
let activeCount = 0;
|
|
1100
|
+
const resumeNext = () => {
|
|
1101
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
1102
|
+
queue.dequeue()();
|
|
1103
|
+
activeCount++;
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
const next = () => {
|
|
1107
|
+
activeCount--;
|
|
1108
|
+
resumeNext();
|
|
1109
|
+
};
|
|
1110
|
+
const run = async (function_, resolve, arguments_) => {
|
|
1111
|
+
const result = (async () => function_(...arguments_))();
|
|
1112
|
+
resolve(result);
|
|
1113
|
+
try {
|
|
1114
|
+
await result;
|
|
1115
|
+
} catch (e) {
|
|
1116
|
+
}
|
|
1117
|
+
next();
|
|
1118
|
+
};
|
|
1119
|
+
const enqueue = (function_, resolve, arguments_) => {
|
|
1120
|
+
new Promise((internalResolve) => {
|
|
1121
|
+
queue.enqueue(internalResolve);
|
|
1122
|
+
}).then(
|
|
1123
|
+
run.bind(void 0, function_, resolve, arguments_)
|
|
1124
|
+
);
|
|
1125
|
+
(async () => {
|
|
1126
|
+
await Promise.resolve();
|
|
1127
|
+
if (activeCount < concurrency) {
|
|
1128
|
+
resumeNext();
|
|
1068
1129
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1130
|
+
})();
|
|
1131
|
+
};
|
|
1132
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
1133
|
+
enqueue(function_, resolve, arguments_);
|
|
1134
|
+
});
|
|
1135
|
+
Object.defineProperties(generator, {
|
|
1136
|
+
activeCount: {
|
|
1137
|
+
get: () => activeCount
|
|
1138
|
+
},
|
|
1139
|
+
pendingCount: {
|
|
1140
|
+
get: () => queue.size
|
|
1141
|
+
},
|
|
1142
|
+
clearQueue: {
|
|
1143
|
+
value() {
|
|
1144
|
+
queue.clear();
|
|
1084
1145
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1146
|
+
},
|
|
1147
|
+
concurrency: {
|
|
1148
|
+
get: () => concurrency,
|
|
1149
|
+
set(newConcurrency) {
|
|
1150
|
+
validateConcurrency(newConcurrency);
|
|
1151
|
+
concurrency = newConcurrency;
|
|
1152
|
+
queueMicrotask(() => {
|
|
1153
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
1154
|
+
resumeNext();
|
|
1090
1155
|
}
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
for (var i = 0; i < methods.length; i++) {
|
|
1094
|
-
var method = methods[i];
|
|
1095
|
-
var original = obj[method];
|
|
1096
|
-
obj[method] = function retryWrapper(original2) {
|
|
1097
|
-
var op = exports2.operation(options);
|
|
1098
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
1099
|
-
var callback = args.pop();
|
|
1100
|
-
args.push(function(err) {
|
|
1101
|
-
if (op.retry(err)) {
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
if (err) {
|
|
1105
|
-
arguments[0] = op.mainError();
|
|
1106
|
-
}
|
|
1107
|
-
callback.apply(this, arguments);
|
|
1108
|
-
});
|
|
1109
|
-
op.attempt(function() {
|
|
1110
|
-
original2.apply(obj, args);
|
|
1111
|
-
});
|
|
1112
|
-
}.bind(obj, original);
|
|
1113
|
-
obj[method].options = options;
|
|
1156
|
+
});
|
|
1114
1157
|
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1160
|
+
return generator;
|
|
1161
|
+
}
|
|
1162
|
+
function validateConcurrency(concurrency) {
|
|
1163
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
1164
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
1122
1165
|
}
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
var
|
|
1127
|
-
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1169
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
1170
|
+
|
|
1171
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
1172
|
+
var objectToString = Object.prototype.toString;
|
|
1173
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
1174
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
1175
|
+
"network error",
|
|
1128
1176
|
// Chrome
|
|
1129
1177
|
"NetworkError when attempting to fetch resource.",
|
|
1130
1178
|
// Firefox
|
|
1131
1179
|
"The Internet connection appears to be offline.",
|
|
1132
|
-
// Safari
|
|
1180
|
+
// Safari 16
|
|
1133
1181
|
"Network request failed",
|
|
1134
1182
|
// `cross-fetch`
|
|
1135
|
-
"fetch failed"
|
|
1183
|
+
"fetch failed",
|
|
1136
1184
|
// Undici (Node.js)
|
|
1185
|
+
"terminated",
|
|
1186
|
+
// Undici (Node.js)
|
|
1187
|
+
" A network error occurred.",
|
|
1188
|
+
// Bun (WebKit)
|
|
1189
|
+
"Network connection lost"
|
|
1190
|
+
// Cloudflare Workers (fetch)
|
|
1137
1191
|
]);
|
|
1192
|
+
function isNetworkError(error) {
|
|
1193
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1194
|
+
if (!isValid) {
|
|
1195
|
+
return false;
|
|
1196
|
+
}
|
|
1197
|
+
const { message, stack } = error;
|
|
1198
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1199
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
1200
|
+
}
|
|
1201
|
+
if (message.startsWith("error sending request for url")) {
|
|
1202
|
+
return true;
|
|
1203
|
+
}
|
|
1204
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1205
|
+
return true;
|
|
1206
|
+
}
|
|
1207
|
+
return errorMessages.has(message);
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1138
1211
|
var AbortError = class extends Error {
|
|
1139
1212
|
constructor(message) {
|
|
1140
1213
|
super();
|
|
@@ -1155,63 +1228,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1155
1228
|
error.retriesLeft = retriesLeft;
|
|
1156
1229
|
return error;
|
|
1157
1230
|
};
|
|
1158
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
1159
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1160
1231
|
async function pRetry(input, options) {
|
|
1161
1232
|
return new Promise((resolve, reject) => {
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
retries: 10,
|
|
1166
|
-
...options
|
|
1233
|
+
var _a, _b, _c;
|
|
1234
|
+
options = { ...options };
|
|
1235
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
1167
1236
|
};
|
|
1237
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1238
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1168
1239
|
const operation = import_retry.default.operation(options);
|
|
1240
|
+
const abortHandler = () => {
|
|
1241
|
+
var _a2;
|
|
1242
|
+
operation.stop();
|
|
1243
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1244
|
+
};
|
|
1245
|
+
if (options.signal && !options.signal.aborted) {
|
|
1246
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1247
|
+
}
|
|
1248
|
+
const cleanUp = () => {
|
|
1249
|
+
var _a2;
|
|
1250
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1251
|
+
operation.stop();
|
|
1252
|
+
};
|
|
1169
1253
|
operation.attempt(async (attemptNumber) => {
|
|
1170
1254
|
try {
|
|
1171
|
-
|
|
1255
|
+
const result = await input(attemptNumber);
|
|
1256
|
+
cleanUp();
|
|
1257
|
+
resolve(result);
|
|
1172
1258
|
} catch (error) {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
} else {
|
|
1259
|
+
try {
|
|
1260
|
+
if (!(error instanceof Error)) {
|
|
1261
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1262
|
+
}
|
|
1263
|
+
if (error instanceof AbortError) {
|
|
1264
|
+
throw error.originalError;
|
|
1265
|
+
}
|
|
1266
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1267
|
+
throw error;
|
|
1268
|
+
}
|
|
1184
1269
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
reject(error2);
|
|
1189
|
-
return;
|
|
1270
|
+
if (!await options.shouldRetry(error)) {
|
|
1271
|
+
operation.stop();
|
|
1272
|
+
reject(error);
|
|
1190
1273
|
}
|
|
1274
|
+
await options.onFailedAttempt(error);
|
|
1191
1275
|
if (!operation.retry(error)) {
|
|
1192
|
-
|
|
1276
|
+
throw operation.mainError();
|
|
1193
1277
|
}
|
|
1278
|
+
} catch (finalError) {
|
|
1279
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1280
|
+
cleanUp();
|
|
1281
|
+
reject(finalError);
|
|
1194
1282
|
}
|
|
1195
1283
|
}
|
|
1196
1284
|
});
|
|
1197
|
-
if (options.signal && !options.signal.aborted) {
|
|
1198
|
-
options.signal.addEventListener("abort", () => {
|
|
1199
|
-
operation.stop();
|
|
1200
|
-
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1201
|
-
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1202
|
-
}, {
|
|
1203
|
-
once: true
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
1285
|
});
|
|
1207
1286
|
}
|
|
1287
|
+
|
|
1288
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1208
1289
|
var AbortError2 = class extends Error {
|
|
1209
1290
|
constructor() {
|
|
1210
1291
|
super("Throttled function aborted");
|
|
1211
1292
|
this.name = "AbortError";
|
|
1212
1293
|
}
|
|
1213
1294
|
};
|
|
1214
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1295
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1215
1296
|
if (!Number.isFinite(limit)) {
|
|
1216
1297
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1217
1298
|
}
|
|
@@ -1239,32 +1320,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1239
1320
|
const strictTicks = [];
|
|
1240
1321
|
function strictDelay() {
|
|
1241
1322
|
const now = Date.now();
|
|
1242
|
-
if (strictTicks.length
|
|
1243
|
-
strictTicks.
|
|
1244
|
-
return 0;
|
|
1323
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1324
|
+
strictTicks.length = 0;
|
|
1245
1325
|
}
|
|
1246
|
-
|
|
1247
|
-
if (now >= earliestTime) {
|
|
1326
|
+
if (strictTicks.length < limit) {
|
|
1248
1327
|
strictTicks.push(now);
|
|
1249
1328
|
return 0;
|
|
1250
1329
|
}
|
|
1251
|
-
strictTicks
|
|
1252
|
-
|
|
1330
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1331
|
+
strictTicks.shift();
|
|
1332
|
+
strictTicks.push(nextExecutionTime);
|
|
1333
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1253
1334
|
}
|
|
1254
1335
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1255
1336
|
return (function_) => {
|
|
1256
|
-
const throttled = function(...
|
|
1337
|
+
const throttled = function(...arguments_) {
|
|
1257
1338
|
if (!throttled.isEnabled) {
|
|
1258
|
-
return (async () => function_.apply(this,
|
|
1339
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1259
1340
|
}
|
|
1260
|
-
let
|
|
1341
|
+
let timeoutId;
|
|
1261
1342
|
return new Promise((resolve, reject) => {
|
|
1262
1343
|
const execute = () => {
|
|
1263
|
-
resolve(function_.apply(this,
|
|
1264
|
-
queue.delete(
|
|
1344
|
+
resolve(function_.apply(this, arguments_));
|
|
1345
|
+
queue.delete(timeoutId);
|
|
1265
1346
|
};
|
|
1266
|
-
|
|
1267
|
-
|
|
1347
|
+
const delay = getDelay();
|
|
1348
|
+
if (delay > 0) {
|
|
1349
|
+
timeoutId = setTimeout(execute, delay);
|
|
1350
|
+
queue.set(timeoutId, reject);
|
|
1351
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1352
|
+
} else {
|
|
1353
|
+
execute();
|
|
1354
|
+
}
|
|
1268
1355
|
});
|
|
1269
1356
|
};
|
|
1270
1357
|
throttled.abort = () => {
|
|
@@ -1276,16 +1363,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1276
1363
|
strictTicks.splice(0, strictTicks.length);
|
|
1277
1364
|
};
|
|
1278
1365
|
throttled.isEnabled = true;
|
|
1366
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1367
|
+
get() {
|
|
1368
|
+
return queue.size;
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1279
1371
|
return throttled;
|
|
1280
1372
|
};
|
|
1281
1373
|
}
|
|
1374
|
+
|
|
1375
|
+
// ../canvas/dist/index.mjs
|
|
1376
|
+
var __typeError3 = (msg) => {
|
|
1377
|
+
throw TypeError(msg);
|
|
1378
|
+
};
|
|
1379
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1380
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1381
|
+
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);
|
|
1282
1382
|
function createLimitPolicy({
|
|
1283
1383
|
throttle = { interval: 1e3, limit: 10 },
|
|
1284
|
-
retry:
|
|
1384
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1285
1385
|
limit = 10
|
|
1286
1386
|
}) {
|
|
1287
1387
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1288
|
-
const limiter = limit ? (
|
|
1388
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1289
1389
|
return function limitPolicy(func) {
|
|
1290
1390
|
let currentFunc = async () => await func();
|
|
1291
1391
|
if (throttler) {
|
|
@@ -1296,13 +1396,13 @@ function createLimitPolicy({
|
|
|
1296
1396
|
const limitFunc = currentFunc;
|
|
1297
1397
|
currentFunc = () => limiter(limitFunc);
|
|
1298
1398
|
}
|
|
1299
|
-
if (
|
|
1399
|
+
if (retry3) {
|
|
1300
1400
|
const retryFunc = currentFunc;
|
|
1301
1401
|
currentFunc = () => pRetry(retryFunc, {
|
|
1302
|
-
...
|
|
1402
|
+
...retry3,
|
|
1303
1403
|
onFailedAttempt: async (error) => {
|
|
1304
|
-
if (
|
|
1305
|
-
await
|
|
1404
|
+
if (retry3.onFailedAttempt) {
|
|
1405
|
+
await retry3.onFailedAttempt(error);
|
|
1306
1406
|
}
|
|
1307
1407
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1308
1408
|
throw error;
|
|
@@ -1313,19 +1413,49 @@ function createLimitPolicy({
|
|
|
1313
1413
|
return currentFunc();
|
|
1314
1414
|
};
|
|
1315
1415
|
}
|
|
1316
|
-
var
|
|
1317
|
-
function
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1416
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1417
|
+
function appendCsv(out, key, values) {
|
|
1418
|
+
if (values === void 0) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
out[key] = values.join(",");
|
|
1422
|
+
}
|
|
1423
|
+
function projectionToQuery(spec) {
|
|
1424
|
+
const out = {};
|
|
1425
|
+
if (!spec) {
|
|
1426
|
+
return out;
|
|
1427
|
+
}
|
|
1428
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1429
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1430
|
+
if (fields) {
|
|
1431
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1432
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1433
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1434
|
+
if (fields.blockDepth === "preserveAll" || typeof fields.blockDepth === "number") {
|
|
1435
|
+
out[`${p}fields[blockDepth]`] = String(fields.blockDepth);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
if (fieldTypes) {
|
|
1439
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1440
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1441
|
+
}
|
|
1442
|
+
if (slots) {
|
|
1443
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1444
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1445
|
+
if (typeof slots.depth === "number") {
|
|
1446
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1447
|
+
}
|
|
1448
|
+
if (slots.named) {
|
|
1449
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1450
|
+
for (const slotName of slotNames) {
|
|
1451
|
+
const named = slots.named[slotName];
|
|
1452
|
+
if (named && typeof named.depth === "number") {
|
|
1453
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return out;
|
|
1329
1459
|
}
|
|
1330
1460
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1331
1461
|
var CanvasClient = class extends ApiClient {
|
|
@@ -1341,17 +1471,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1341
1471
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1342
1472
|
async getCompositionList(params = {}) {
|
|
1343
1473
|
const { projectId } = this.options;
|
|
1344
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1345
|
-
const rewrittenFilters =
|
|
1474
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1475
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1476
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1346
1477
|
if (!resolveData) {
|
|
1347
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1478
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1479
|
+
...originParams,
|
|
1480
|
+
projectId,
|
|
1481
|
+
...rewrittenFilters,
|
|
1482
|
+
...rewrittenSelect
|
|
1483
|
+
});
|
|
1348
1484
|
return this.apiClient(fetchUri);
|
|
1349
1485
|
}
|
|
1350
1486
|
const edgeParams = {
|
|
1351
1487
|
...originParams,
|
|
1352
1488
|
projectId,
|
|
1353
1489
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1354
|
-
...rewrittenFilters
|
|
1490
|
+
...rewrittenFilters,
|
|
1491
|
+
...rewrittenSelect
|
|
1355
1492
|
};
|
|
1356
1493
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1357
1494
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1461,15 +1598,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1461
1598
|
}
|
|
1462
1599
|
getEntries(options) {
|
|
1463
1600
|
const { projectId } = this.options;
|
|
1464
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1465
|
-
const rewrittenFilters =
|
|
1601
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1602
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1603
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1466
1604
|
if (skipDataResolution) {
|
|
1467
|
-
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1605
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1606
|
+
...params,
|
|
1607
|
+
...rewrittenFilters,
|
|
1608
|
+
...rewrittenSelect,
|
|
1609
|
+
projectId
|
|
1610
|
+
});
|
|
1468
1611
|
return this.apiClient(url);
|
|
1469
1612
|
}
|
|
1470
1613
|
const edgeUrl = this.createUrl(
|
|
1471
1614
|
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1472
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1615
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1473
1616
|
this.edgeApiHost
|
|
1474
1617
|
);
|
|
1475
1618
|
return this.apiClient(
|
|
@@ -1633,9 +1776,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1633
1776
|
let bufferStartIndex = 0;
|
|
1634
1777
|
let bufferEndIndex = 0;
|
|
1635
1778
|
let tokenCount = 0;
|
|
1636
|
-
const handleToken = (token, type) => {
|
|
1779
|
+
const handleToken = (token, type, offset) => {
|
|
1637
1780
|
tokenCount++;
|
|
1638
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1781
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
1639
1782
|
};
|
|
1640
1783
|
let state = "text";
|
|
1641
1784
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -1646,7 +1789,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1646
1789
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
1647
1790
|
if (serialized[index - 1] === escapeCharacter) {
|
|
1648
1791
|
bufferEndIndex -= escapeCharacter.length;
|
|
1649
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1792
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1650
1793
|
return tokenCount;
|
|
1651
1794
|
}
|
|
1652
1795
|
bufferStartIndex = index;
|
|
@@ -1655,12 +1798,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1655
1798
|
}
|
|
1656
1799
|
if (state === "variable") {
|
|
1657
1800
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1658
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1801
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
1659
1802
|
return tokenCount;
|
|
1660
1803
|
}
|
|
1661
1804
|
bufferStartIndex = bufferEndIndex;
|
|
1662
1805
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1663
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1806
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1664
1807
|
return tokenCount;
|
|
1665
1808
|
}
|
|
1666
1809
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -1678,7 +1821,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1678
1821
|
state = "text";
|
|
1679
1822
|
if (bufferEndIndex > bufferStartIndex) {
|
|
1680
1823
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
1681
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1824
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
1682
1825
|
return tokenCount;
|
|
1683
1826
|
}
|
|
1684
1827
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -1692,7 +1835,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1692
1835
|
bufferStartIndex -= variablePrefix.length;
|
|
1693
1836
|
}
|
|
1694
1837
|
if (bufferStartIndex < serialized.length) {
|
|
1695
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1838
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
1696
1839
|
}
|
|
1697
1840
|
return tokenCount;
|
|
1698
1841
|
}
|
|
@@ -1709,7 +1852,7 @@ function hasReferencedVariables(value) {
|
|
|
1709
1852
|
return variableTokenCount;
|
|
1710
1853
|
}
|
|
1711
1854
|
function walkNodeTree(node, visitor, options) {
|
|
1712
|
-
var _a, _b;
|
|
1855
|
+
var _a, _b, _c;
|
|
1713
1856
|
const componentQueue = [
|
|
1714
1857
|
{
|
|
1715
1858
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1717,12 +1860,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1717
1860
|
}
|
|
1718
1861
|
];
|
|
1719
1862
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1863
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1864
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1720
1865
|
do {
|
|
1721
|
-
const currentQueueEntry =
|
|
1866
|
+
const currentQueueEntry = takeNext();
|
|
1722
1867
|
if (!currentQueueEntry) continue;
|
|
1723
1868
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1724
1869
|
let visitDescendants = true;
|
|
1725
|
-
let descendantContext = (
|
|
1870
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1726
1871
|
let visitorInfo;
|
|
1727
1872
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1728
1873
|
visitorInfo = {
|
|
@@ -1909,39 +2054,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1909
2054
|
continue;
|
|
1910
2055
|
}
|
|
1911
2056
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1912
|
-
|
|
1913
|
-
const slotKeys = Object.keys(slots);
|
|
1914
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1915
|
-
const slotKey = slotKeys[slotIndex];
|
|
1916
|
-
const components = slots[slotKey];
|
|
1917
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1918
|
-
const enqueueingComponent = components[componentIndex];
|
|
1919
|
-
const parentSlotIndexFn = () => {
|
|
1920
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1921
|
-
(x) => x === enqueueingComponent
|
|
1922
|
-
);
|
|
1923
|
-
return result;
|
|
1924
|
-
};
|
|
1925
|
-
componentQueue.push({
|
|
1926
|
-
ancestorsAndSelf: [
|
|
1927
|
-
{
|
|
1928
|
-
type: "slot",
|
|
1929
|
-
node: enqueueingComponent,
|
|
1930
|
-
parentSlot: slotKey,
|
|
1931
|
-
parentSlotIndexFn
|
|
1932
|
-
},
|
|
1933
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1934
|
-
],
|
|
1935
|
-
context: descendantContext
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
2057
|
+
const childEntries = [];
|
|
1940
2058
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1941
2059
|
if (properties) {
|
|
1942
2060
|
const propertyEntries = Object.entries(properties);
|
|
1943
|
-
for (
|
|
1944
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
2061
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1945
2062
|
if (!isNestedNodeType(propObject.type)) {
|
|
1946
2063
|
continue;
|
|
1947
2064
|
}
|
|
@@ -1961,13 +2078,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1961
2078
|
continue;
|
|
1962
2079
|
}
|
|
1963
2080
|
}
|
|
1964
|
-
const blocks = (
|
|
1965
|
-
for (
|
|
1966
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
2081
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
2082
|
+
for (const enqueueingBlock of blocks) {
|
|
1967
2083
|
const blockIndexFn = () => {
|
|
1968
2084
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1969
2085
|
};
|
|
1970
|
-
|
|
2086
|
+
childEntries.push({
|
|
1971
2087
|
ancestorsAndSelf: [
|
|
1972
2088
|
{
|
|
1973
2089
|
type: "block",
|
|
@@ -1982,6 +2098,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1982
2098
|
}
|
|
1983
2099
|
}
|
|
1984
2100
|
}
|
|
2101
|
+
if (slots) {
|
|
2102
|
+
const slotKeys = Object.keys(slots);
|
|
2103
|
+
for (const slotKey of slotKeys) {
|
|
2104
|
+
const components = slots[slotKey];
|
|
2105
|
+
for (const enqueueingComponent of components) {
|
|
2106
|
+
const parentSlotIndexFn = () => {
|
|
2107
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
2108
|
+
(x) => x === enqueueingComponent
|
|
2109
|
+
);
|
|
2110
|
+
return result;
|
|
2111
|
+
};
|
|
2112
|
+
childEntries.push({
|
|
2113
|
+
ancestorsAndSelf: [
|
|
2114
|
+
{
|
|
2115
|
+
type: "slot",
|
|
2116
|
+
node: enqueueingComponent,
|
|
2117
|
+
parentSlot: slotKey,
|
|
2118
|
+
parentSlotIndexFn
|
|
2119
|
+
},
|
|
2120
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
2121
|
+
],
|
|
2122
|
+
context: descendantContext
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
if (order === "dfs") {
|
|
2128
|
+
childEntries.reverse();
|
|
2129
|
+
}
|
|
2130
|
+
componentQueue.push(...childEntries);
|
|
1985
2131
|
} while (componentQueue.length > 0);
|
|
1986
2132
|
}
|
|
1987
2133
|
function isNestedNodeType(type) {
|
|
@@ -2093,11 +2239,34 @@ var stringOperatorEvaluators = {
|
|
|
2093
2239
|
endswith: endsWithEvaluator,
|
|
2094
2240
|
empty: emptyEvaluator
|
|
2095
2241
|
};
|
|
2242
|
+
var numericOperatorEvaluators = {
|
|
2243
|
+
gt: (left, right) => left > right,
|
|
2244
|
+
lt: (left, right) => left < right
|
|
2245
|
+
};
|
|
2246
|
+
function evaluateNumericOperator(criteria, matchValue) {
|
|
2247
|
+
const { op, value } = criteria;
|
|
2248
|
+
const evaluator = numericOperatorEvaluators[op];
|
|
2249
|
+
if (!evaluator) {
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
|
|
2253
|
+
return false;
|
|
2254
|
+
}
|
|
2255
|
+
const leftNum = Number(matchValue);
|
|
2256
|
+
const rightNum = Number(value);
|
|
2257
|
+
if (isNaN(leftNum) || isNaN(rightNum)) {
|
|
2258
|
+
return false;
|
|
2259
|
+
}
|
|
2260
|
+
return evaluator(leftNum, rightNum);
|
|
2261
|
+
}
|
|
2096
2262
|
function evaluateStringMatch(criteria, matchValue, allow) {
|
|
2097
2263
|
const { op, value } = criteria;
|
|
2098
2264
|
if (allow && !allow.has(op)) {
|
|
2099
2265
|
return null;
|
|
2100
2266
|
}
|
|
2267
|
+
if (op in numericOperatorEvaluators) {
|
|
2268
|
+
return evaluateNumericOperator(criteria, matchValue);
|
|
2269
|
+
}
|
|
2101
2270
|
let opMatch = op;
|
|
2102
2271
|
const negation = op.startsWith("!");
|
|
2103
2272
|
if (negation) {
|
|
@@ -2174,6 +2343,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
2174
2343
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
2175
2344
|
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
2176
2345
|
var _url22;
|
|
2346
|
+
var _projectsUrl;
|
|
2177
2347
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
2178
2348
|
constructor(options) {
|
|
2179
2349
|
super({ ...options, bypassCache: true });
|
|
@@ -2183,6 +2353,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2183
2353
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
2184
2354
|
return await this.apiClient(fetchUri);
|
|
2185
2355
|
}
|
|
2356
|
+
/**
|
|
2357
|
+
* Fetches projects grouped by team.
|
|
2358
|
+
* When teamId is provided, returns a single team with its projects.
|
|
2359
|
+
* When omitted, returns all accessible teams and their projects.
|
|
2360
|
+
*/
|
|
2361
|
+
async getProjects(options) {
|
|
2362
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
2363
|
+
return await this.apiClient(fetchUri);
|
|
2364
|
+
}
|
|
2186
2365
|
/** Updates or creates (based on id) a Project */
|
|
2187
2366
|
async upsert(body) {
|
|
2188
2367
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
@@ -2202,7 +2381,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2202
2381
|
}
|
|
2203
2382
|
};
|
|
2204
2383
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
2384
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
2205
2385
|
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
2386
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
2206
2387
|
var ROUTE_URL = "/api/v1/route";
|
|
2207
2388
|
var RouteClient = class extends ApiClient {
|
|
2208
2389
|
constructor(options) {
|
|
@@ -2216,7 +2397,9 @@ var RouteClient = class extends ApiClient {
|
|
|
2216
2397
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
2217
2398
|
async getRoute(options) {
|
|
2218
2399
|
const { projectId } = this.options;
|
|
2219
|
-
const
|
|
2400
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2401
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2402
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2220
2403
|
return await this.apiClient(
|
|
2221
2404
|
fetchUri,
|
|
2222
2405
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
@@ -2316,8 +2499,15 @@ var isIncontextEditingEnabled = ({
|
|
|
2316
2499
|
var isDevelopmentEnvironment = () => {
|
|
2317
2500
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
2318
2501
|
};
|
|
2502
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
2503
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
2504
|
+
return isNotPublished ? true : void 0;
|
|
2505
|
+
};
|
|
2319
2506
|
|
|
2320
2507
|
// src/clients/cache.ts
|
|
2508
|
+
var isSpecificCacheMode = (options) => {
|
|
2509
|
+
return "cache" in options;
|
|
2510
|
+
};
|
|
2321
2511
|
var isStateCacheMode = (options) => {
|
|
2322
2512
|
return "state" in options;
|
|
2323
2513
|
};
|
|
@@ -2339,7 +2529,9 @@ var resolveCache = ({
|
|
|
2339
2529
|
}) => {
|
|
2340
2530
|
let cache = void 0;
|
|
2341
2531
|
if (options) {
|
|
2342
|
-
if (
|
|
2532
|
+
if (isSpecificCacheMode(options)) {
|
|
2533
|
+
cache = options.cache;
|
|
2534
|
+
} else if (isStateCacheMode(options)) {
|
|
2343
2535
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2344
2536
|
cache = {
|
|
2345
2537
|
type: "no-cache",
|
|
@@ -2458,7 +2650,7 @@ function createLimiter(concurrency) {
|
|
|
2458
2650
|
});
|
|
2459
2651
|
};
|
|
2460
2652
|
}
|
|
2461
|
-
async function
|
|
2653
|
+
async function retry2(fn, options) {
|
|
2462
2654
|
let lastError;
|
|
2463
2655
|
let delay = 1e3;
|
|
2464
2656
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2498,7 +2690,7 @@ function createLimitPolicy2({
|
|
|
2498
2690
|
}
|
|
2499
2691
|
if (retryOptions) {
|
|
2500
2692
|
const retryFunc = currentFunc;
|
|
2501
|
-
currentFunc = () =>
|
|
2693
|
+
currentFunc = () => retry2(retryFunc, {
|
|
2502
2694
|
...retryOptions,
|
|
2503
2695
|
onFailedAttempt: async (error) => {
|
|
2504
2696
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2586,6 +2778,9 @@ var getQuirkSerialization = () => {
|
|
|
2586
2778
|
return true;
|
|
2587
2779
|
};
|
|
2588
2780
|
var getMiddlewareRuntimeCache = () => {
|
|
2781
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
2782
|
+
return false;
|
|
2783
|
+
}
|
|
2589
2784
|
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
2590
2785
|
return import_resolved.default.middlewareRuntimeCache;
|
|
2591
2786
|
}
|
|
@@ -2731,7 +2926,10 @@ var DefaultDataClient = class {
|
|
|
2731
2926
|
}
|
|
2732
2927
|
}
|
|
2733
2928
|
const manifest = await getManifest({
|
|
2734
|
-
cache: {
|
|
2929
|
+
cache: isDevelopmentEnvironment() ? {
|
|
2930
|
+
type: "no-cache",
|
|
2931
|
+
bypassCache: true
|
|
2932
|
+
} : {
|
|
2735
2933
|
type: "force-cache"
|
|
2736
2934
|
}
|
|
2737
2935
|
});
|
|
@@ -2834,20 +3032,23 @@ var DefaultDataClient = class {
|
|
|
2834
3032
|
};
|
|
2835
3033
|
}
|
|
2836
3034
|
async getRoutePageState(options) {
|
|
3035
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
2837
3036
|
const routeClient = getRouteClient({
|
|
2838
|
-
cache:
|
|
2839
|
-
type: "force-cache"
|
|
2840
|
-
} : {
|
|
3037
|
+
cache: shouldBypassCache ? {
|
|
2841
3038
|
type: "no-cache",
|
|
2842
3039
|
bypassCache: true
|
|
3040
|
+
} : {
|
|
3041
|
+
type: "force-cache"
|
|
2843
3042
|
}
|
|
2844
3043
|
});
|
|
2845
3044
|
const originalRoute = {
|
|
2846
3045
|
path: options.pageState.routePath,
|
|
2847
3046
|
state: options.pageState.compositionState,
|
|
3047
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, options.pageState.compositionState),
|
|
2848
3048
|
withComponentIDs: true,
|
|
2849
3049
|
releaseId: options.pageState.releaseId,
|
|
2850
|
-
locale: options.pageState.locale
|
|
3050
|
+
locale: options.pageState.locale,
|
|
3051
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
2851
3052
|
};
|
|
2852
3053
|
const resolvedRoute = await this.getRouteFromApi({
|
|
2853
3054
|
source: "pageState",
|
|
@@ -3021,7 +3222,8 @@ var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared
|
|
|
3021
3222
|
var evaluateRunnables = async ({
|
|
3022
3223
|
runnables,
|
|
3023
3224
|
context,
|
|
3024
|
-
compositionContext
|
|
3225
|
+
compositionContext,
|
|
3226
|
+
isPrefetch
|
|
3025
3227
|
}) => {
|
|
3026
3228
|
var _a;
|
|
3027
3229
|
const result = {
|
|
@@ -3031,6 +3233,9 @@ var evaluateRunnables = async ({
|
|
|
3031
3233
|
const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
|
|
3032
3234
|
let item;
|
|
3033
3235
|
while (item = runnablesToProcess.shift()) {
|
|
3236
|
+
if (item.type === "test" && isPrefetch) {
|
|
3237
|
+
continue;
|
|
3238
|
+
}
|
|
3034
3239
|
if (item.type === "test") {
|
|
3035
3240
|
const testResult = (0, import_next_app_router_shared4.evaluateTest)({
|
|
3036
3241
|
context,
|
|
@@ -3104,11 +3309,12 @@ function dequal(foo, bar) {
|
|
|
3104
3309
|
return foo !== foo && bar !== bar;
|
|
3105
3310
|
}
|
|
3106
3311
|
|
|
3107
|
-
// ../../node_modules/.pnpm/js-cookie@3.0.
|
|
3312
|
+
// ../../node_modules/.pnpm/js-cookie@3.0.8/node_modules/js-cookie/dist/js.cookie.mjs
|
|
3108
3313
|
function assign(target) {
|
|
3109
3314
|
for (var i = 1; i < arguments.length; i++) {
|
|
3110
3315
|
var source = arguments[i];
|
|
3111
3316
|
for (var key in source) {
|
|
3317
|
+
if (key === "__proto__") continue;
|
|
3112
3318
|
target[key] = source[key];
|
|
3113
3319
|
}
|
|
3114
3320
|
}
|
|
@@ -3165,11 +3371,11 @@ function init(converter, defaultAttributes) {
|
|
|
3165
3371
|
var value = parts.slice(1).join("=");
|
|
3166
3372
|
try {
|
|
3167
3373
|
var found = decodeURIComponent(parts[0]);
|
|
3168
|
-
jar[found] = converter.read(value, found);
|
|
3374
|
+
if (!(found in jar)) jar[found] = converter.read(value, found);
|
|
3169
3375
|
if (name === found) {
|
|
3170
3376
|
break;
|
|
3171
3377
|
}
|
|
3172
|
-
} catch (
|
|
3378
|
+
} catch (_e) {
|
|
3173
3379
|
}
|
|
3174
3380
|
}
|
|
3175
3381
|
return name ? jar[name] : jar;
|
|
@@ -3224,12 +3430,12 @@ function mitt_default(n) {
|
|
|
3224
3430
|
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
3225
3431
|
var import_rfdc2 = __toESM(require_rfdc(), 1);
|
|
3226
3432
|
var import_rfdc3 = __toESM(require_rfdc(), 1);
|
|
3227
|
-
var
|
|
3433
|
+
var __defProp3 = Object.defineProperty;
|
|
3228
3434
|
var __typeError4 = (msg) => {
|
|
3229
3435
|
throw TypeError(msg);
|
|
3230
3436
|
};
|
|
3231
|
-
var
|
|
3232
|
-
var
|
|
3437
|
+
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3438
|
+
var __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3233
3439
|
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
3234
3440
|
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3235
3441
|
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);
|
|
@@ -3306,7 +3512,7 @@ var SignalInstance = class {
|
|
|
3306
3512
|
constructor(data, evaluator, onLogMessage) {
|
|
3307
3513
|
__privateAdd4(this, _evaluator);
|
|
3308
3514
|
__privateAdd4(this, _onLogMessage);
|
|
3309
|
-
|
|
3515
|
+
__publicField3(this, "signal");
|
|
3310
3516
|
this.signal = data;
|
|
3311
3517
|
__privateSet2(this, _evaluator, evaluator);
|
|
3312
3518
|
__privateSet2(this, _onLogMessage, onLogMessage);
|
|
@@ -3361,11 +3567,10 @@ var ManifestInstance = class {
|
|
|
3361
3567
|
constructor({
|
|
3362
3568
|
manifest,
|
|
3363
3569
|
evaluator = new GroupCriteriaEvaluator({}),
|
|
3364
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3365
3570
|
onLogMessage = () => {
|
|
3366
3571
|
}
|
|
3367
3572
|
}) {
|
|
3368
|
-
|
|
3573
|
+
__publicField3(this, "data");
|
|
3369
3574
|
__privateAdd4(this, _mf);
|
|
3370
3575
|
__privateAdd4(this, _signalInstances);
|
|
3371
3576
|
__privateAdd4(this, _goalEvaluators, []);
|
|
@@ -4152,7 +4357,7 @@ var TransitionDataStore = class {
|
|
|
4152
4357
|
__privateAdd4(this, _data);
|
|
4153
4358
|
__privateAdd4(this, _initialData);
|
|
4154
4359
|
__privateAdd4(this, _mitt, mitt_default());
|
|
4155
|
-
|
|
4360
|
+
__publicField3(this, "events", {
|
|
4156
4361
|
on: __privateGet4(this, _mitt).on,
|
|
4157
4362
|
off: __privateGet4(this, _mitt).off
|
|
4158
4363
|
});
|
|
@@ -4515,10 +4720,10 @@ var _LocalStorage_instances;
|
|
|
4515
4720
|
var key_fn;
|
|
4516
4721
|
var LocalStorage = class {
|
|
4517
4722
|
constructor(partitionKey) {
|
|
4518
|
-
this
|
|
4723
|
+
__publicField3(this, "partitionKey", partitionKey);
|
|
4519
4724
|
__privateAdd4(this, _LocalStorage_instances);
|
|
4520
|
-
|
|
4521
|
-
|
|
4725
|
+
__publicField3(this, "inMemoryFallback", {});
|
|
4726
|
+
__publicField3(this, "hasLocalStorageObject", typeof document !== "undefined" && typeof localStorage !== "undefined");
|
|
4522
4727
|
}
|
|
4523
4728
|
get(key) {
|
|
4524
4729
|
const keyValue = __privateMethod(this, _LocalStorage_instances, key_fn).call(this, key);
|
|
@@ -4579,7 +4784,7 @@ var VisitorDataStore = class {
|
|
|
4579
4784
|
__privateAdd4(this, _persist);
|
|
4580
4785
|
__privateAdd4(this, _visitTimeout);
|
|
4581
4786
|
__privateAdd4(this, _options);
|
|
4582
|
-
|
|
4787
|
+
__publicField3(this, "events", {
|
|
4583
4788
|
on: __privateGet4(this, _mitt2).on,
|
|
4584
4789
|
off: __privateGet4(this, _mitt2).off
|
|
4585
4790
|
});
|
|
@@ -4780,7 +4985,7 @@ var calculateScores_fn;
|
|
|
4780
4985
|
var Context = class {
|
|
4781
4986
|
constructor(options) {
|
|
4782
4987
|
__privateAdd4(this, _Context_instances);
|
|
4783
|
-
|
|
4988
|
+
__publicField3(this, "manifest");
|
|
4784
4989
|
__privateAdd4(this, _personalizationSelectionAlgorithms);
|
|
4785
4990
|
__privateAdd4(this, _serverTransitionState);
|
|
4786
4991
|
__privateAdd4(this, _scores, {});
|
|
@@ -4790,11 +4995,11 @@ var Context = class {
|
|
|
4790
4995
|
__privateAdd4(this, _commands);
|
|
4791
4996
|
__privateAdd4(this, _requireConsentForPersonalization);
|
|
4792
4997
|
__privateAdd4(this, _mitt3, mitt_default());
|
|
4793
|
-
|
|
4998
|
+
__publicField3(this, "events", {
|
|
4794
4999
|
on: __privateGet4(this, _mitt3).on,
|
|
4795
5000
|
off: __privateGet4(this, _mitt3).off
|
|
4796
5001
|
});
|
|
4797
|
-
|
|
5002
|
+
__publicField3(this, "storage");
|
|
4798
5003
|
var _a, _b, _c;
|
|
4799
5004
|
const { manifest, ...storageOptions } = options;
|
|
4800
5005
|
__privateSet2(this, _state, {});
|
|
@@ -5392,7 +5597,8 @@ var retrieveRouteByPath = async ({
|
|
|
5392
5597
|
withComponentIDs: true,
|
|
5393
5598
|
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5394
5599
|
releaseId,
|
|
5395
|
-
locale
|
|
5600
|
+
locale,
|
|
5601
|
+
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
5396
5602
|
}
|
|
5397
5603
|
});
|
|
5398
5604
|
};
|
|
@@ -5519,7 +5725,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5519
5725
|
})
|
|
5520
5726
|
});
|
|
5521
5727
|
const context = await onDemandContext.getContext();
|
|
5522
|
-
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5728
|
+
const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
|
|
5523
5729
|
composition: composition.composition,
|
|
5524
5730
|
routePath: id,
|
|
5525
5731
|
state: composition.state,
|
|
@@ -5536,7 +5742,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5536
5742
|
searchParams: request.nextUrl.searchParams,
|
|
5537
5743
|
isDraftModeEnabled: true
|
|
5538
5744
|
// this is checked above
|
|
5539
|
-
})
|
|
5745
|
+
}),
|
|
5746
|
+
isPrefetch: false
|
|
5540
5747
|
});
|
|
5541
5748
|
const pageState = {
|
|
5542
5749
|
routePath: id,
|
|
@@ -5554,10 +5761,12 @@ var handlePlaygroundRequest = async ({
|
|
|
5554
5761
|
// this is checked above
|
|
5555
5762
|
}),
|
|
5556
5763
|
rules,
|
|
5557
|
-
locale: options.locale
|
|
5764
|
+
locale: options.locale,
|
|
5765
|
+
isPrefetch: void 0
|
|
5558
5766
|
};
|
|
5559
5767
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5560
|
-
payload: pageState
|
|
5768
|
+
payload: pageState,
|
|
5769
|
+
allComponentIds
|
|
5561
5770
|
});
|
|
5562
5771
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
|
|
5563
5772
|
if (!pathToRewriteTo) {
|
|
@@ -5571,15 +5780,16 @@ var handleRouteRequest = async ({
|
|
|
5571
5780
|
dataClient,
|
|
5572
5781
|
options
|
|
5573
5782
|
}) => {
|
|
5574
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
5783
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5784
|
+
const releaseId = (_b = (_a = options.release) == null ? void 0 : _a.id) != null ? _b : draftModeEnabled ? request.nextUrl.searchParams.get("releaseId") || void 0 : void 0;
|
|
5575
5785
|
const states = await determineState({
|
|
5576
5786
|
searchParams: request.nextUrl.searchParams,
|
|
5577
5787
|
draftModeEnabled
|
|
5578
5788
|
});
|
|
5579
|
-
const requestPath = (
|
|
5789
|
+
const requestPath = (_d = await ((_c = options.rewriteRequestPath) == null ? void 0 : _c.call(options, {
|
|
5580
5790
|
request,
|
|
5581
5791
|
url: new URL(request.url)
|
|
5582
|
-
}))) != null ?
|
|
5792
|
+
}))) != null ? _d : {
|
|
5583
5793
|
path: `${request.nextUrl.pathname}${request.nextUrl.search}`
|
|
5584
5794
|
};
|
|
5585
5795
|
const serverConfig = getServerConfig();
|
|
@@ -5590,7 +5800,7 @@ var handleRouteRequest = async ({
|
|
|
5590
5800
|
searchParams: request.nextUrl.searchParams,
|
|
5591
5801
|
draftModeEnabled,
|
|
5592
5802
|
dataClient,
|
|
5593
|
-
releaseId
|
|
5803
|
+
releaseId,
|
|
5594
5804
|
locale: options.locale
|
|
5595
5805
|
}),
|
|
5596
5806
|
createOnDemandContext({
|
|
@@ -5602,10 +5812,10 @@ var handleRouteRequest = async ({
|
|
|
5602
5812
|
})
|
|
5603
5813
|
})
|
|
5604
5814
|
]);
|
|
5605
|
-
if (!(routeResult == null ? void 0 : routeResult.route) || ((
|
|
5606
|
-
return import_server.NextResponse.
|
|
5815
|
+
if (!(routeResult == null ? void 0 : routeResult.route) || ((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "notFound") {
|
|
5816
|
+
return import_server.NextResponse.rewrite(new URL("/404", request.url));
|
|
5607
5817
|
}
|
|
5608
|
-
if (((
|
|
5818
|
+
if (((_f = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _f.type) === "redirect") {
|
|
5609
5819
|
return handleRedirect({ request, route: routeResult.route });
|
|
5610
5820
|
}
|
|
5611
5821
|
const { route } = routeResult;
|
|
@@ -5638,14 +5848,15 @@ var handleRouteRequest = async ({
|
|
|
5638
5848
|
searchParams: request.nextUrl.searchParams,
|
|
5639
5849
|
isDraftModeEnabled: draftModeEnabled
|
|
5640
5850
|
});
|
|
5641
|
-
const
|
|
5851
|
+
const isPrefetch = isPrefetchRequest(request);
|
|
5852
|
+
const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
|
|
5642
5853
|
composition: route.compositionApiResponse.composition,
|
|
5643
5854
|
routePath,
|
|
5644
5855
|
state,
|
|
5645
5856
|
context,
|
|
5646
5857
|
matchedRoute: route.matchedRoute,
|
|
5647
|
-
dynamicInputs: (
|
|
5648
|
-
releaseId
|
|
5858
|
+
dynamicInputs: (_g = route.dynamicInputs) != null ? _g : {},
|
|
5859
|
+
releaseId,
|
|
5649
5860
|
defaultConsent: determineDefaultConsent({
|
|
5650
5861
|
serverConfig,
|
|
5651
5862
|
defaultConsent: options.defaultConsent
|
|
@@ -5655,24 +5866,27 @@ var handleRouteRequest = async ({
|
|
|
5655
5866
|
searchParams: request.nextUrl.searchParams,
|
|
5656
5867
|
isDraftModeEnabled: true
|
|
5657
5868
|
// this is checked above
|
|
5658
|
-
})
|
|
5869
|
+
}),
|
|
5870
|
+
isPrefetch
|
|
5659
5871
|
});
|
|
5660
5872
|
const pageState = {
|
|
5661
5873
|
routePath,
|
|
5662
5874
|
compositionState: state,
|
|
5663
5875
|
components,
|
|
5664
5876
|
keys: requestPath.keys,
|
|
5665
|
-
releaseId
|
|
5877
|
+
releaseId,
|
|
5666
5878
|
defaultConsent: determineDefaultConsent({
|
|
5667
5879
|
serverConfig,
|
|
5668
5880
|
defaultConsent: options.defaultConsent
|
|
5669
5881
|
}),
|
|
5670
5882
|
previewMode,
|
|
5671
5883
|
rules,
|
|
5672
|
-
locale: options.locale
|
|
5884
|
+
locale: options.locale,
|
|
5885
|
+
isPrefetch: isPrefetch || void 0
|
|
5673
5886
|
};
|
|
5674
5887
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5675
|
-
payload: pageState
|
|
5888
|
+
payload: pageState,
|
|
5889
|
+
allComponentIds
|
|
5676
5890
|
});
|
|
5677
5891
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5678
5892
|
if (!pathToRewriteTo) {
|
|
@@ -5689,6 +5903,9 @@ var handleRouteRequest = async ({
|
|
|
5689
5903
|
headers
|
|
5690
5904
|
});
|
|
5691
5905
|
};
|
|
5906
|
+
var isPrefetchRequest = (request) => {
|
|
5907
|
+
return request.headers.has("next-url");
|
|
5908
|
+
};
|
|
5692
5909
|
var extractAndEvaluateRunnables = async ({
|
|
5693
5910
|
composition,
|
|
5694
5911
|
routePath,
|
|
@@ -5699,12 +5916,14 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5699
5916
|
releaseId,
|
|
5700
5917
|
defaultConsent,
|
|
5701
5918
|
keys,
|
|
5702
|
-
previewMode
|
|
5919
|
+
previewMode,
|
|
5920
|
+
isPrefetch
|
|
5703
5921
|
}) => {
|
|
5704
5922
|
const extracted = extractRunnables(composition);
|
|
5705
5923
|
const result = await evaluateRunnables({
|
|
5706
5924
|
runnables: extracted,
|
|
5707
5925
|
context,
|
|
5926
|
+
isPrefetch,
|
|
5708
5927
|
compositionContext: {
|
|
5709
5928
|
_id: composition._id,
|
|
5710
5929
|
type: composition.type,
|
|
@@ -5722,11 +5941,13 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5722
5941
|
defaultConsent,
|
|
5723
5942
|
previewMode,
|
|
5724
5943
|
rules: void 0,
|
|
5725
|
-
locale: void 0
|
|
5944
|
+
locale: void 0,
|
|
5945
|
+
isPrefetch: isPrefetch || void 0
|
|
5726
5946
|
}
|
|
5727
5947
|
}
|
|
5728
5948
|
});
|
|
5729
|
-
|
|
5949
|
+
const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
5950
|
+
return { ...result, allComponentIds };
|
|
5730
5951
|
};
|
|
5731
5952
|
var handleRedirect = ({ request, route }) => {
|
|
5732
5953
|
const href = resolveRedirectHref({
|
|
@@ -5825,5 +6046,5 @@ var determinePreviewMode = ({
|
|
|
5825
6046
|
/*! Bundled license information:
|
|
5826
6047
|
|
|
5827
6048
|
js-cookie/dist/js.cookie.mjs:
|
|
5828
|
-
(*! js-cookie v3.0.
|
|
6049
|
+
(*! js-cookie v3.0.8 | MIT *)
|
|
5829
6050
|
*/
|