@uniformdev/next-app-router 20.70.1-alpha.10 → 20.70.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache.js +494 -570
- package/dist/cache.mjs +494 -570
- package/dist/component.js +366 -0
- package/dist/component.mjs +366 -0
- package/dist/handler.js +507 -583
- package/dist/handler.mjs +507 -583
- package/dist/index.esm.js +538 -607
- package/dist/index.js +548 -617
- package/dist/index.mjs +538 -607
- package/dist/middleware.js +471 -524
- package/dist/middleware.mjs +471 -524
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -5,10 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __typeError = (msg) => {
|
|
9
|
-
throw TypeError(msg);
|
|
10
|
-
};
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
13
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
10
|
};
|
|
@@ -33,25 +29,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
29
|
mod
|
|
34
30
|
));
|
|
35
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
38
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
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);
|
|
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
|
-
});
|
|
49
32
|
|
|
50
33
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
51
34
|
var require_yocto_queue = __commonJS({
|
|
52
35
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
53
36
|
"use strict";
|
|
54
|
-
var
|
|
37
|
+
var Node = class {
|
|
55
38
|
/// value;
|
|
56
39
|
/// next;
|
|
57
40
|
constructor(value) {
|
|
@@ -59,7 +42,7 @@ var require_yocto_queue = __commonJS({
|
|
|
59
42
|
this.next = void 0;
|
|
60
43
|
}
|
|
61
44
|
};
|
|
62
|
-
var
|
|
45
|
+
var Queue = class {
|
|
63
46
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
64
47
|
// #_head;
|
|
65
48
|
// #_tail;
|
|
@@ -68,7 +51,7 @@ var require_yocto_queue = __commonJS({
|
|
|
68
51
|
this.clear();
|
|
69
52
|
}
|
|
70
53
|
enqueue(value) {
|
|
71
|
-
const node = new
|
|
54
|
+
const node = new Node(value);
|
|
72
55
|
if (this._head) {
|
|
73
56
|
this._tail.next = node;
|
|
74
57
|
this._tail = node;
|
|
@@ -103,7 +86,7 @@ var require_yocto_queue = __commonJS({
|
|
|
103
86
|
}
|
|
104
87
|
}
|
|
105
88
|
};
|
|
106
|
-
module2.exports =
|
|
89
|
+
module2.exports = Queue;
|
|
107
90
|
}
|
|
108
91
|
});
|
|
109
92
|
|
|
@@ -111,12 +94,12 @@ var require_yocto_queue = __commonJS({
|
|
|
111
94
|
var require_p_limit = __commonJS({
|
|
112
95
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
113
96
|
"use strict";
|
|
114
|
-
var
|
|
115
|
-
var
|
|
97
|
+
var Queue = require_yocto_queue();
|
|
98
|
+
var pLimit2 = (concurrency) => {
|
|
116
99
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
117
100
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
118
101
|
}
|
|
119
|
-
const queue = new
|
|
102
|
+
const queue = new Queue();
|
|
120
103
|
let activeCount = 0;
|
|
121
104
|
const next = () => {
|
|
122
105
|
activeCount--;
|
|
@@ -161,238 +144,7 @@ var require_p_limit = __commonJS({
|
|
|
161
144
|
});
|
|
162
145
|
return generator;
|
|
163
146
|
};
|
|
164
|
-
module2.exports =
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
169
|
-
var require_retry_operation = __commonJS({
|
|
170
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
171
|
-
"use strict";
|
|
172
|
-
function RetryOperation(timeouts, options) {
|
|
173
|
-
if (typeof options === "boolean") {
|
|
174
|
-
options = { forever: options };
|
|
175
|
-
}
|
|
176
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
177
|
-
this._timeouts = timeouts;
|
|
178
|
-
this._options = options || {};
|
|
179
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
180
|
-
this._fn = null;
|
|
181
|
-
this._errors = [];
|
|
182
|
-
this._attempts = 1;
|
|
183
|
-
this._operationTimeout = null;
|
|
184
|
-
this._operationTimeoutCb = null;
|
|
185
|
-
this._timeout = null;
|
|
186
|
-
this._operationStart = null;
|
|
187
|
-
this._timer = null;
|
|
188
|
-
if (this._options.forever) {
|
|
189
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
module2.exports = RetryOperation;
|
|
193
|
-
RetryOperation.prototype.reset = function() {
|
|
194
|
-
this._attempts = 1;
|
|
195
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
196
|
-
};
|
|
197
|
-
RetryOperation.prototype.stop = function() {
|
|
198
|
-
if (this._timeout) {
|
|
199
|
-
clearTimeout(this._timeout);
|
|
200
|
-
}
|
|
201
|
-
if (this._timer) {
|
|
202
|
-
clearTimeout(this._timer);
|
|
203
|
-
}
|
|
204
|
-
this._timeouts = [];
|
|
205
|
-
this._cachedTimeouts = null;
|
|
206
|
-
};
|
|
207
|
-
RetryOperation.prototype.retry = function(err) {
|
|
208
|
-
if (this._timeout) {
|
|
209
|
-
clearTimeout(this._timeout);
|
|
210
|
-
}
|
|
211
|
-
if (!err) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
215
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
216
|
-
this._errors.push(err);
|
|
217
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
this._errors.push(err);
|
|
221
|
-
var timeout = this._timeouts.shift();
|
|
222
|
-
if (timeout === void 0) {
|
|
223
|
-
if (this._cachedTimeouts) {
|
|
224
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
225
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
226
|
-
} else {
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
var self = this;
|
|
231
|
-
this._timer = setTimeout(function() {
|
|
232
|
-
self._attempts++;
|
|
233
|
-
if (self._operationTimeoutCb) {
|
|
234
|
-
self._timeout = setTimeout(function() {
|
|
235
|
-
self._operationTimeoutCb(self._attempts);
|
|
236
|
-
}, self._operationTimeout);
|
|
237
|
-
if (self._options.unref) {
|
|
238
|
-
self._timeout.unref();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
self._fn(self._attempts);
|
|
242
|
-
}, timeout);
|
|
243
|
-
if (this._options.unref) {
|
|
244
|
-
this._timer.unref();
|
|
245
|
-
}
|
|
246
|
-
return true;
|
|
247
|
-
};
|
|
248
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
249
|
-
this._fn = fn;
|
|
250
|
-
if (timeoutOps) {
|
|
251
|
-
if (timeoutOps.timeout) {
|
|
252
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
253
|
-
}
|
|
254
|
-
if (timeoutOps.cb) {
|
|
255
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
var self = this;
|
|
259
|
-
if (this._operationTimeoutCb) {
|
|
260
|
-
this._timeout = setTimeout(function() {
|
|
261
|
-
self._operationTimeoutCb();
|
|
262
|
-
}, self._operationTimeout);
|
|
263
|
-
}
|
|
264
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
265
|
-
this._fn(this._attempts);
|
|
266
|
-
};
|
|
267
|
-
RetryOperation.prototype.try = function(fn) {
|
|
268
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
269
|
-
this.attempt(fn);
|
|
270
|
-
};
|
|
271
|
-
RetryOperation.prototype.start = function(fn) {
|
|
272
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
273
|
-
this.attempt(fn);
|
|
274
|
-
};
|
|
275
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
276
|
-
RetryOperation.prototype.errors = function() {
|
|
277
|
-
return this._errors;
|
|
278
|
-
};
|
|
279
|
-
RetryOperation.prototype.attempts = function() {
|
|
280
|
-
return this._attempts;
|
|
281
|
-
};
|
|
282
|
-
RetryOperation.prototype.mainError = function() {
|
|
283
|
-
if (this._errors.length === 0) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
var counts = {};
|
|
287
|
-
var mainError = null;
|
|
288
|
-
var mainErrorCount = 0;
|
|
289
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
290
|
-
var error = this._errors[i];
|
|
291
|
-
var message = error.message;
|
|
292
|
-
var count = (counts[message] || 0) + 1;
|
|
293
|
-
counts[message] = count;
|
|
294
|
-
if (count >= mainErrorCount) {
|
|
295
|
-
mainError = error;
|
|
296
|
-
mainErrorCount = count;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return mainError;
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
305
|
-
var require_retry = __commonJS({
|
|
306
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
307
|
-
"use strict";
|
|
308
|
-
var RetryOperation = require_retry_operation();
|
|
309
|
-
exports2.operation = function(options) {
|
|
310
|
-
var timeouts = exports2.timeouts(options);
|
|
311
|
-
return new RetryOperation(timeouts, {
|
|
312
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
313
|
-
unref: options && options.unref,
|
|
314
|
-
maxRetryTime: options && options.maxRetryTime
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
exports2.timeouts = function(options) {
|
|
318
|
-
if (options instanceof Array) {
|
|
319
|
-
return [].concat(options);
|
|
320
|
-
}
|
|
321
|
-
var opts = {
|
|
322
|
-
retries: 10,
|
|
323
|
-
factor: 2,
|
|
324
|
-
minTimeout: 1 * 1e3,
|
|
325
|
-
maxTimeout: Infinity,
|
|
326
|
-
randomize: false
|
|
327
|
-
};
|
|
328
|
-
for (var key in options) {
|
|
329
|
-
opts[key] = options[key];
|
|
330
|
-
}
|
|
331
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
332
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
333
|
-
}
|
|
334
|
-
var timeouts = [];
|
|
335
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
336
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
337
|
-
}
|
|
338
|
-
if (options && options.forever && !timeouts.length) {
|
|
339
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
340
|
-
}
|
|
341
|
-
timeouts.sort(function(a, b) {
|
|
342
|
-
return a - b;
|
|
343
|
-
});
|
|
344
|
-
return timeouts;
|
|
345
|
-
};
|
|
346
|
-
exports2.createTimeout = function(attempt, opts) {
|
|
347
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
348
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
349
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
350
|
-
return timeout;
|
|
351
|
-
};
|
|
352
|
-
exports2.wrap = function(obj, options, methods) {
|
|
353
|
-
if (options instanceof Array) {
|
|
354
|
-
methods = options;
|
|
355
|
-
options = null;
|
|
356
|
-
}
|
|
357
|
-
if (!methods) {
|
|
358
|
-
methods = [];
|
|
359
|
-
for (var key in obj) {
|
|
360
|
-
if (typeof obj[key] === "function") {
|
|
361
|
-
methods.push(key);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
for (var i = 0; i < methods.length; i++) {
|
|
366
|
-
var method = methods[i];
|
|
367
|
-
var original = obj[method];
|
|
368
|
-
obj[method] = function retryWrapper(original2) {
|
|
369
|
-
var op = exports2.operation(options);
|
|
370
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
371
|
-
var callback = args.pop();
|
|
372
|
-
args.push(function(err) {
|
|
373
|
-
if (op.retry(err)) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
if (err) {
|
|
377
|
-
arguments[0] = op.mainError();
|
|
378
|
-
}
|
|
379
|
-
callback.apply(this, arguments);
|
|
380
|
-
});
|
|
381
|
-
op.attempt(function() {
|
|
382
|
-
original2.apply(obj, args);
|
|
383
|
-
});
|
|
384
|
-
}.bind(obj, original);
|
|
385
|
-
obj[method].options = options;
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
392
|
-
var require_retry2 = __commonJS({
|
|
393
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
394
|
-
"use strict";
|
|
395
|
-
module2.exports = require_retry();
|
|
147
|
+
module2.exports = pLimit2;
|
|
396
148
|
}
|
|
397
149
|
});
|
|
398
150
|
|
|
@@ -426,14 +178,14 @@ var import_server_only = require("server-only");
|
|
|
426
178
|
// ../context/dist/api/api.mjs
|
|
427
179
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
428
180
|
var __defProp2 = Object.defineProperty;
|
|
429
|
-
var
|
|
181
|
+
var __typeError = (msg) => {
|
|
430
182
|
throw TypeError(msg);
|
|
431
183
|
};
|
|
432
|
-
var
|
|
433
|
-
var
|
|
434
|
-
var
|
|
435
|
-
var
|
|
436
|
-
var
|
|
184
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
185
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
186
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
187
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
188
|
+
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);
|
|
437
189
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
438
190
|
var ApiClientError = class _ApiClientError extends Error {
|
|
439
191
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -441,18 +193,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
441
193
|
`${errorMessage}
|
|
442
194
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
443
195
|
);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
196
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
197
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
198
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
199
|
+
__publicField(this, "statusCode", statusCode);
|
|
200
|
+
__publicField(this, "statusText", statusText);
|
|
201
|
+
__publicField(this, "requestId", requestId);
|
|
450
202
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
451
203
|
}
|
|
452
204
|
};
|
|
453
205
|
var ApiClient = class _ApiClient {
|
|
454
206
|
constructor(options) {
|
|
455
|
-
|
|
207
|
+
__publicField(this, "options");
|
|
456
208
|
var _a, _b, _c, _d, _e;
|
|
457
209
|
if (!options.apiKey && !options.bearerToken) {
|
|
458
210
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -622,12 +374,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
622
374
|
/** Fetches all aggregates for a project */
|
|
623
375
|
async get(options) {
|
|
624
376
|
const { projectId } = this.options;
|
|
625
|
-
const fetchUri = this.createUrl(
|
|
377
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
|
|
626
378
|
return await this.apiClient(fetchUri);
|
|
627
379
|
}
|
|
628
380
|
/** Updates or creates (based on id) an Aggregate */
|
|
629
381
|
async upsert(body) {
|
|
630
|
-
const fetchUri = this.createUrl(
|
|
382
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
631
383
|
await this.apiClient(fetchUri, {
|
|
632
384
|
method: "PUT",
|
|
633
385
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -636,7 +388,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
636
388
|
}
|
|
637
389
|
/** Deletes an Aggregate */
|
|
638
390
|
async remove(body) {
|
|
639
|
-
const fetchUri = this.createUrl(
|
|
391
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
640
392
|
await this.apiClient(fetchUri, {
|
|
641
393
|
method: "DELETE",
|
|
642
394
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -645,7 +397,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
645
397
|
}
|
|
646
398
|
};
|
|
647
399
|
_url = /* @__PURE__ */ new WeakMap();
|
|
648
|
-
|
|
400
|
+
__privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
|
|
649
401
|
var _url2;
|
|
650
402
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
651
403
|
constructor(options) {
|
|
@@ -654,12 +406,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
654
406
|
/** Fetches the known score dimensions for a project */
|
|
655
407
|
async get(options) {
|
|
656
408
|
const { projectId } = this.options;
|
|
657
|
-
const fetchUri = this.createUrl(
|
|
409
|
+
const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
|
|
658
410
|
return await this.apiClient(fetchUri);
|
|
659
411
|
}
|
|
660
412
|
};
|
|
661
413
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
662
|
-
|
|
414
|
+
__privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
|
|
663
415
|
var _url3;
|
|
664
416
|
var _valueUrl;
|
|
665
417
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -669,12 +421,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
669
421
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
670
422
|
async get(options) {
|
|
671
423
|
const { projectId } = this.options;
|
|
672
|
-
const fetchUri = this.createUrl(
|
|
424
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
673
425
|
return await this.apiClient(fetchUri);
|
|
674
426
|
}
|
|
675
427
|
/** Updates or creates (based on id) an enrichment category */
|
|
676
428
|
async upsertCategory(body) {
|
|
677
|
-
const fetchUri = this.createUrl(
|
|
429
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
678
430
|
await this.apiClient(fetchUri, {
|
|
679
431
|
method: "PUT",
|
|
680
432
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -683,7 +435,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
683
435
|
}
|
|
684
436
|
/** Deletes an enrichment category */
|
|
685
437
|
async removeCategory(body) {
|
|
686
|
-
const fetchUri = this.createUrl(
|
|
438
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
687
439
|
await this.apiClient(fetchUri, {
|
|
688
440
|
method: "DELETE",
|
|
689
441
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -692,7 +444,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
692
444
|
}
|
|
693
445
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
694
446
|
async upsertValue(body) {
|
|
695
|
-
const fetchUri = this.createUrl(
|
|
447
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
696
448
|
await this.apiClient(fetchUri, {
|
|
697
449
|
method: "PUT",
|
|
698
450
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -701,7 +453,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
701
453
|
}
|
|
702
454
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
703
455
|
async removeValue(body) {
|
|
704
|
-
const fetchUri = this.createUrl(
|
|
456
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
705
457
|
await this.apiClient(fetchUri, {
|
|
706
458
|
method: "DELETE",
|
|
707
459
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -711,8 +463,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
711
463
|
};
|
|
712
464
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
713
465
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
714
|
-
|
|
715
|
-
|
|
466
|
+
__privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
467
|
+
__privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
716
468
|
var _url4;
|
|
717
469
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
718
470
|
constructor(options) {
|
|
@@ -721,7 +473,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
721
473
|
/** Fetches the Context manifest for a project */
|
|
722
474
|
async get(options) {
|
|
723
475
|
const { projectId } = this.options;
|
|
724
|
-
const fetchUri = this.createUrl(
|
|
476
|
+
const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
|
|
725
477
|
return await this.apiClient(fetchUri);
|
|
726
478
|
}
|
|
727
479
|
/** Publishes the Context manifest for a project */
|
|
@@ -735,7 +487,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
735
487
|
}
|
|
736
488
|
};
|
|
737
489
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
738
|
-
|
|
490
|
+
__privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
|
|
739
491
|
var ManifestClient = _ManifestClient;
|
|
740
492
|
var _url5;
|
|
741
493
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
@@ -745,12 +497,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
745
497
|
/** Fetches all Quirks for a project */
|
|
746
498
|
async get(options) {
|
|
747
499
|
const { projectId } = this.options;
|
|
748
|
-
const fetchUri = this.createUrl(
|
|
500
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
|
|
749
501
|
return await this.apiClient(fetchUri);
|
|
750
502
|
}
|
|
751
503
|
/** Updates or creates (based on id) a Quirk */
|
|
752
504
|
async upsert(body) {
|
|
753
|
-
const fetchUri = this.createUrl(
|
|
505
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
754
506
|
await this.apiClient(fetchUri, {
|
|
755
507
|
method: "PUT",
|
|
756
508
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -759,7 +511,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
759
511
|
}
|
|
760
512
|
/** Deletes a Quirk */
|
|
761
513
|
async remove(body) {
|
|
762
|
-
const fetchUri = this.createUrl(
|
|
514
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
763
515
|
await this.apiClient(fetchUri, {
|
|
764
516
|
method: "DELETE",
|
|
765
517
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -768,7 +520,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
768
520
|
}
|
|
769
521
|
};
|
|
770
522
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
771
|
-
|
|
523
|
+
__privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
|
|
772
524
|
var _url6;
|
|
773
525
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
774
526
|
constructor(options) {
|
|
@@ -777,12 +529,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
777
529
|
/** Fetches all Signals for a project */
|
|
778
530
|
async get(options) {
|
|
779
531
|
const { projectId } = this.options;
|
|
780
|
-
const fetchUri = this.createUrl(
|
|
532
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
|
|
781
533
|
return await this.apiClient(fetchUri);
|
|
782
534
|
}
|
|
783
535
|
/** Updates or creates (based on id) a Signal */
|
|
784
536
|
async upsert(body) {
|
|
785
|
-
const fetchUri = this.createUrl(
|
|
537
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
786
538
|
await this.apiClient(fetchUri, {
|
|
787
539
|
method: "PUT",
|
|
788
540
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -791,7 +543,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
791
543
|
}
|
|
792
544
|
/** Deletes a Signal */
|
|
793
545
|
async remove(body) {
|
|
794
|
-
const fetchUri = this.createUrl(
|
|
546
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
795
547
|
await this.apiClient(fetchUri, {
|
|
796
548
|
method: "DELETE",
|
|
797
549
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -800,7 +552,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
800
552
|
}
|
|
801
553
|
};
|
|
802
554
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
803
|
-
|
|
555
|
+
__privateAdd(_SignalClient, _url6, "/api/v2/signal");
|
|
804
556
|
var _url7;
|
|
805
557
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
806
558
|
constructor(options) {
|
|
@@ -809,12 +561,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
809
561
|
/** Fetches all Tests for a project */
|
|
810
562
|
async get(options) {
|
|
811
563
|
const { projectId } = this.options;
|
|
812
|
-
const fetchUri = this.createUrl(
|
|
564
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
|
|
813
565
|
return await this.apiClient(fetchUri);
|
|
814
566
|
}
|
|
815
567
|
/** Updates or creates (based on id) a Test */
|
|
816
568
|
async upsert(body) {
|
|
817
|
-
const fetchUri = this.createUrl(
|
|
569
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
818
570
|
await this.apiClient(fetchUri, {
|
|
819
571
|
method: "PUT",
|
|
820
572
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -823,7 +575,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
823
575
|
}
|
|
824
576
|
/** Deletes a Test */
|
|
825
577
|
async remove(body) {
|
|
826
|
-
const fetchUri = this.createUrl(
|
|
578
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
827
579
|
await this.apiClient(fetchUri, {
|
|
828
580
|
method: "DELETE",
|
|
829
581
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -832,194 +584,393 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
832
584
|
}
|
|
833
585
|
};
|
|
834
586
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
835
|
-
|
|
587
|
+
__privateAdd(_TestClient, _url7, "/api/v2/test");
|
|
836
588
|
|
|
837
|
-
//
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
589
|
+
// ../canvas/dist/index.mjs
|
|
590
|
+
var __create2 = Object.create;
|
|
591
|
+
var __defProp3 = Object.defineProperty;
|
|
592
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
593
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
594
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
595
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
596
|
+
var __typeError2 = (msg) => {
|
|
597
|
+
throw TypeError(msg);
|
|
844
598
|
};
|
|
845
|
-
var
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
enqueue(value) {
|
|
854
|
-
const node = new Node(value);
|
|
855
|
-
if (__privateGet(this, _head)) {
|
|
856
|
-
__privateGet(this, _tail).next = node;
|
|
857
|
-
__privateSet(this, _tail, node);
|
|
858
|
-
} else {
|
|
859
|
-
__privateSet(this, _head, node);
|
|
860
|
-
__privateSet(this, _tail, node);
|
|
861
|
-
}
|
|
862
|
-
__privateWrapper(this, _size)._++;
|
|
863
|
-
}
|
|
864
|
-
dequeue() {
|
|
865
|
-
const current = __privateGet(this, _head);
|
|
866
|
-
if (!current) {
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
870
|
-
__privateWrapper(this, _size)._--;
|
|
871
|
-
if (!__privateGet(this, _head)) {
|
|
872
|
-
__privateSet(this, _tail, void 0);
|
|
873
|
-
}
|
|
874
|
-
return current.value;
|
|
875
|
-
}
|
|
876
|
-
peek() {
|
|
877
|
-
if (!__privateGet(this, _head)) {
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
return __privateGet(this, _head).value;
|
|
881
|
-
}
|
|
882
|
-
clear() {
|
|
883
|
-
__privateSet(this, _head, void 0);
|
|
884
|
-
__privateSet(this, _tail, void 0);
|
|
885
|
-
__privateSet(this, _size, 0);
|
|
599
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
600
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
601
|
+
};
|
|
602
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
603
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
604
|
+
for (let key of __getOwnPropNames2(from))
|
|
605
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
606
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
886
607
|
}
|
|
887
|
-
|
|
888
|
-
|
|
608
|
+
return to;
|
|
609
|
+
};
|
|
610
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
611
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
612
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
613
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
614
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
615
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
616
|
+
mod
|
|
617
|
+
));
|
|
618
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
619
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
620
|
+
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);
|
|
621
|
+
var require_yocto_queue2 = __commonJS2({
|
|
622
|
+
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
623
|
+
"use strict";
|
|
624
|
+
var Node = class {
|
|
625
|
+
/// value;
|
|
626
|
+
/// next;
|
|
627
|
+
constructor(value) {
|
|
628
|
+
this.value = value;
|
|
629
|
+
this.next = void 0;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
var Queue = class {
|
|
633
|
+
// TODO: Use private class fields when targeting Node.js 12.
|
|
634
|
+
// #_head;
|
|
635
|
+
// #_tail;
|
|
636
|
+
// #_size;
|
|
637
|
+
constructor() {
|
|
638
|
+
this.clear();
|
|
639
|
+
}
|
|
640
|
+
enqueue(value) {
|
|
641
|
+
const node = new Node(value);
|
|
642
|
+
if (this._head) {
|
|
643
|
+
this._tail.next = node;
|
|
644
|
+
this._tail = node;
|
|
645
|
+
} else {
|
|
646
|
+
this._head = node;
|
|
647
|
+
this._tail = node;
|
|
648
|
+
}
|
|
649
|
+
this._size++;
|
|
650
|
+
}
|
|
651
|
+
dequeue() {
|
|
652
|
+
const current = this._head;
|
|
653
|
+
if (!current) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
this._head = this._head.next;
|
|
657
|
+
this._size--;
|
|
658
|
+
return current.value;
|
|
659
|
+
}
|
|
660
|
+
clear() {
|
|
661
|
+
this._head = void 0;
|
|
662
|
+
this._tail = void 0;
|
|
663
|
+
this._size = 0;
|
|
664
|
+
}
|
|
665
|
+
get size() {
|
|
666
|
+
return this._size;
|
|
667
|
+
}
|
|
668
|
+
*[Symbol.iterator]() {
|
|
669
|
+
let current = this._head;
|
|
670
|
+
while (current) {
|
|
671
|
+
yield current.value;
|
|
672
|
+
current = current.next;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
module2.exports = Queue;
|
|
889
677
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
678
|
+
});
|
|
679
|
+
var require_p_limit2 = __commonJS2({
|
|
680
|
+
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
681
|
+
"use strict";
|
|
682
|
+
var Queue = require_yocto_queue2();
|
|
683
|
+
var pLimit2 = (concurrency) => {
|
|
684
|
+
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
685
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
686
|
+
}
|
|
687
|
+
const queue = new Queue();
|
|
688
|
+
let activeCount = 0;
|
|
689
|
+
const next = () => {
|
|
690
|
+
activeCount--;
|
|
691
|
+
if (queue.size > 0) {
|
|
692
|
+
queue.dequeue()();
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
const run = async (fn, resolve, ...args) => {
|
|
696
|
+
activeCount++;
|
|
697
|
+
const result = (async () => fn(...args))();
|
|
698
|
+
resolve(result);
|
|
699
|
+
try {
|
|
700
|
+
await result;
|
|
701
|
+
} catch (e) {
|
|
702
|
+
}
|
|
703
|
+
next();
|
|
704
|
+
};
|
|
705
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
706
|
+
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
707
|
+
(async () => {
|
|
708
|
+
await Promise.resolve();
|
|
709
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
710
|
+
queue.dequeue()();
|
|
711
|
+
}
|
|
712
|
+
})();
|
|
713
|
+
};
|
|
714
|
+
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
715
|
+
enqueue(fn, resolve, ...args);
|
|
716
|
+
});
|
|
717
|
+
Object.defineProperties(generator, {
|
|
718
|
+
activeCount: {
|
|
719
|
+
get: () => activeCount
|
|
720
|
+
},
|
|
721
|
+
pendingCount: {
|
|
722
|
+
get: () => queue.size
|
|
723
|
+
},
|
|
724
|
+
clearQueue: {
|
|
725
|
+
value: () => {
|
|
726
|
+
queue.clear();
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
return generator;
|
|
731
|
+
};
|
|
732
|
+
module2.exports = pLimit2;
|
|
896
733
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
734
|
+
});
|
|
735
|
+
var require_retry_operation = __commonJS2({
|
|
736
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
737
|
+
"use strict";
|
|
738
|
+
function RetryOperation(timeouts, options) {
|
|
739
|
+
if (typeof options === "boolean") {
|
|
740
|
+
options = { forever: options };
|
|
741
|
+
}
|
|
742
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
743
|
+
this._timeouts = timeouts;
|
|
744
|
+
this._options = options || {};
|
|
745
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
746
|
+
this._fn = null;
|
|
747
|
+
this._errors = [];
|
|
748
|
+
this._attempts = 1;
|
|
749
|
+
this._operationTimeout = null;
|
|
750
|
+
this._operationTimeoutCb = null;
|
|
751
|
+
this._timeout = null;
|
|
752
|
+
this._operationStart = null;
|
|
753
|
+
this._timer = null;
|
|
754
|
+
if (this._options.forever) {
|
|
755
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
756
|
+
}
|
|
900
757
|
}
|
|
758
|
+
module2.exports = RetryOperation;
|
|
759
|
+
RetryOperation.prototype.reset = function() {
|
|
760
|
+
this._attempts = 1;
|
|
761
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
762
|
+
};
|
|
763
|
+
RetryOperation.prototype.stop = function() {
|
|
764
|
+
if (this._timeout) {
|
|
765
|
+
clearTimeout(this._timeout);
|
|
766
|
+
}
|
|
767
|
+
if (this._timer) {
|
|
768
|
+
clearTimeout(this._timer);
|
|
769
|
+
}
|
|
770
|
+
this._timeouts = [];
|
|
771
|
+
this._cachedTimeouts = null;
|
|
772
|
+
};
|
|
773
|
+
RetryOperation.prototype.retry = function(err) {
|
|
774
|
+
if (this._timeout) {
|
|
775
|
+
clearTimeout(this._timeout);
|
|
776
|
+
}
|
|
777
|
+
if (!err) {
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
781
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
782
|
+
this._errors.push(err);
|
|
783
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
this._errors.push(err);
|
|
787
|
+
var timeout = this._timeouts.shift();
|
|
788
|
+
if (timeout === void 0) {
|
|
789
|
+
if (this._cachedTimeouts) {
|
|
790
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
791
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
792
|
+
} else {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
var self = this;
|
|
797
|
+
this._timer = setTimeout(function() {
|
|
798
|
+
self._attempts++;
|
|
799
|
+
if (self._operationTimeoutCb) {
|
|
800
|
+
self._timeout = setTimeout(function() {
|
|
801
|
+
self._operationTimeoutCb(self._attempts);
|
|
802
|
+
}, self._operationTimeout);
|
|
803
|
+
if (self._options.unref) {
|
|
804
|
+
self._timeout.unref();
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
self._fn(self._attempts);
|
|
808
|
+
}, timeout);
|
|
809
|
+
if (this._options.unref) {
|
|
810
|
+
this._timer.unref();
|
|
811
|
+
}
|
|
812
|
+
return true;
|
|
813
|
+
};
|
|
814
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
815
|
+
this._fn = fn;
|
|
816
|
+
if (timeoutOps) {
|
|
817
|
+
if (timeoutOps.timeout) {
|
|
818
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
819
|
+
}
|
|
820
|
+
if (timeoutOps.cb) {
|
|
821
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
var self = this;
|
|
825
|
+
if (this._operationTimeoutCb) {
|
|
826
|
+
this._timeout = setTimeout(function() {
|
|
827
|
+
self._operationTimeoutCb();
|
|
828
|
+
}, self._operationTimeout);
|
|
829
|
+
}
|
|
830
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
831
|
+
this._fn(this._attempts);
|
|
832
|
+
};
|
|
833
|
+
RetryOperation.prototype.try = function(fn) {
|
|
834
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
835
|
+
this.attempt(fn);
|
|
836
|
+
};
|
|
837
|
+
RetryOperation.prototype.start = function(fn) {
|
|
838
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
839
|
+
this.attempt(fn);
|
|
840
|
+
};
|
|
841
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
842
|
+
RetryOperation.prototype.errors = function() {
|
|
843
|
+
return this._errors;
|
|
844
|
+
};
|
|
845
|
+
RetryOperation.prototype.attempts = function() {
|
|
846
|
+
return this._attempts;
|
|
847
|
+
};
|
|
848
|
+
RetryOperation.prototype.mainError = function() {
|
|
849
|
+
if (this._errors.length === 0) {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
var counts = {};
|
|
853
|
+
var mainError = null;
|
|
854
|
+
var mainErrorCount = 0;
|
|
855
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
856
|
+
var error = this._errors[i];
|
|
857
|
+
var message = error.message;
|
|
858
|
+
var count = (counts[message] || 0) + 1;
|
|
859
|
+
counts[message] = count;
|
|
860
|
+
if (count >= mainErrorCount) {
|
|
861
|
+
mainError = error;
|
|
862
|
+
mainErrorCount = count;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return mainError;
|
|
866
|
+
};
|
|
901
867
|
}
|
|
902
|
-
};
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
const next = () => {
|
|
919
|
-
activeCount--;
|
|
920
|
-
resumeNext();
|
|
921
|
-
};
|
|
922
|
-
const run = async (function_, resolve, arguments_) => {
|
|
923
|
-
const result = (async () => function_(...arguments_))();
|
|
924
|
-
resolve(result);
|
|
925
|
-
try {
|
|
926
|
-
await result;
|
|
927
|
-
} catch (e) {
|
|
928
|
-
}
|
|
929
|
-
next();
|
|
930
|
-
};
|
|
931
|
-
const enqueue = (function_, resolve, arguments_) => {
|
|
932
|
-
new Promise((internalResolve) => {
|
|
933
|
-
queue.enqueue(internalResolve);
|
|
934
|
-
}).then(
|
|
935
|
-
run.bind(void 0, function_, resolve, arguments_)
|
|
936
|
-
);
|
|
937
|
-
(async () => {
|
|
938
|
-
await Promise.resolve();
|
|
939
|
-
if (activeCount < concurrency) {
|
|
940
|
-
resumeNext();
|
|
868
|
+
});
|
|
869
|
+
var require_retry = __commonJS2({
|
|
870
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
871
|
+
"use strict";
|
|
872
|
+
var RetryOperation = require_retry_operation();
|
|
873
|
+
exports2.operation = function(options) {
|
|
874
|
+
var timeouts = exports2.timeouts(options);
|
|
875
|
+
return new RetryOperation(timeouts, {
|
|
876
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
877
|
+
unref: options && options.unref,
|
|
878
|
+
maxRetryTime: options && options.maxRetryTime
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
exports2.timeouts = function(options) {
|
|
882
|
+
if (options instanceof Array) {
|
|
883
|
+
return [].concat(options);
|
|
941
884
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
pendingCount: {
|
|
952
|
-
get: () => queue.size
|
|
953
|
-
},
|
|
954
|
-
clearQueue: {
|
|
955
|
-
value() {
|
|
956
|
-
queue.clear();
|
|
885
|
+
var opts = {
|
|
886
|
+
retries: 10,
|
|
887
|
+
factor: 2,
|
|
888
|
+
minTimeout: 1 * 1e3,
|
|
889
|
+
maxTimeout: Infinity,
|
|
890
|
+
randomize: false
|
|
891
|
+
};
|
|
892
|
+
for (var key in options) {
|
|
893
|
+
opts[key] = options[key];
|
|
957
894
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
895
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
896
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
897
|
+
}
|
|
898
|
+
var timeouts = [];
|
|
899
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
900
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
901
|
+
}
|
|
902
|
+
if (options && options.forever && !timeouts.length) {
|
|
903
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
904
|
+
}
|
|
905
|
+
timeouts.sort(function(a, b) {
|
|
906
|
+
return a - b;
|
|
907
|
+
});
|
|
908
|
+
return timeouts;
|
|
909
|
+
};
|
|
910
|
+
exports2.createTimeout = function(attempt, opts) {
|
|
911
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
912
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
913
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
914
|
+
return timeout;
|
|
915
|
+
};
|
|
916
|
+
exports2.wrap = function(obj, options, methods) {
|
|
917
|
+
if (options instanceof Array) {
|
|
918
|
+
methods = options;
|
|
919
|
+
options = null;
|
|
920
|
+
}
|
|
921
|
+
if (!methods) {
|
|
922
|
+
methods = [];
|
|
923
|
+
for (var key in obj) {
|
|
924
|
+
if (typeof obj[key] === "function") {
|
|
925
|
+
methods.push(key);
|
|
967
926
|
}
|
|
968
|
-
}
|
|
927
|
+
}
|
|
969
928
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
929
|
+
for (var i = 0; i < methods.length; i++) {
|
|
930
|
+
var method = methods[i];
|
|
931
|
+
var original = obj[method];
|
|
932
|
+
obj[method] = function retryWrapper(original2) {
|
|
933
|
+
var op = exports2.operation(options);
|
|
934
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
935
|
+
var callback = args.pop();
|
|
936
|
+
args.push(function(err) {
|
|
937
|
+
if (op.retry(err)) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
if (err) {
|
|
941
|
+
arguments[0] = op.mainError();
|
|
942
|
+
}
|
|
943
|
+
callback.apply(this, arguments);
|
|
944
|
+
});
|
|
945
|
+
op.attempt(function() {
|
|
946
|
+
original2.apply(obj, args);
|
|
947
|
+
});
|
|
948
|
+
}.bind(obj, original);
|
|
949
|
+
obj[method].options = options;
|
|
950
|
+
}
|
|
951
|
+
};
|
|
977
952
|
}
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
var
|
|
986
|
-
var
|
|
987
|
-
|
|
953
|
+
});
|
|
954
|
+
var require_retry2 = __commonJS2({
|
|
955
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
956
|
+
"use strict";
|
|
957
|
+
module2.exports = require_retry();
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
961
|
+
var import_retry = __toESM2(require_retry2(), 1);
|
|
962
|
+
var networkErrorMsgs = /* @__PURE__ */ new Set([
|
|
963
|
+
"Failed to fetch",
|
|
988
964
|
// Chrome
|
|
989
965
|
"NetworkError when attempting to fetch resource.",
|
|
990
966
|
// Firefox
|
|
991
967
|
"The Internet connection appears to be offline.",
|
|
992
|
-
// Safari
|
|
968
|
+
// Safari
|
|
993
969
|
"Network request failed",
|
|
994
970
|
// `cross-fetch`
|
|
995
|
-
"fetch failed"
|
|
971
|
+
"fetch failed"
|
|
996
972
|
// Undici (Node.js)
|
|
997
|
-
"terminated",
|
|
998
|
-
// Undici (Node.js)
|
|
999
|
-
" A network error occurred.",
|
|
1000
|
-
// Bun (WebKit)
|
|
1001
|
-
"Network connection lost"
|
|
1002
|
-
// Cloudflare Workers (fetch)
|
|
1003
973
|
]);
|
|
1004
|
-
function isNetworkError(error) {
|
|
1005
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1006
|
-
if (!isValid) {
|
|
1007
|
-
return false;
|
|
1008
|
-
}
|
|
1009
|
-
const { message, stack } = error;
|
|
1010
|
-
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1011
|
-
return stack === void 0 || "__sentry_captured__" in error;
|
|
1012
|
-
}
|
|
1013
|
-
if (message.startsWith("error sending request for url")) {
|
|
1014
|
-
return true;
|
|
1015
|
-
}
|
|
1016
|
-
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1017
|
-
return true;
|
|
1018
|
-
}
|
|
1019
|
-
return errorMessages.has(message);
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1023
974
|
var AbortError = class extends Error {
|
|
1024
975
|
constructor(message) {
|
|
1025
976
|
super();
|
|
@@ -1040,71 +991,63 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1040
991
|
error.retriesLeft = retriesLeft;
|
|
1041
992
|
return error;
|
|
1042
993
|
};
|
|
994
|
+
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
995
|
+
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1043
996
|
async function pRetry(input, options) {
|
|
1044
997
|
return new Promise((resolve, reject) => {
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
998
|
+
options = {
|
|
999
|
+
onFailedAttempt() {
|
|
1000
|
+
},
|
|
1001
|
+
retries: 10,
|
|
1002
|
+
...options
|
|
1048
1003
|
};
|
|
1049
|
-
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1050
|
-
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1051
1004
|
const operation = import_retry.default.operation(options);
|
|
1052
|
-
const abortHandler = () => {
|
|
1053
|
-
var _a2;
|
|
1054
|
-
operation.stop();
|
|
1055
|
-
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1056
|
-
};
|
|
1057
|
-
if (options.signal && !options.signal.aborted) {
|
|
1058
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1059
|
-
}
|
|
1060
|
-
const cleanUp = () => {
|
|
1061
|
-
var _a2;
|
|
1062
|
-
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1063
|
-
operation.stop();
|
|
1064
|
-
};
|
|
1065
1005
|
operation.attempt(async (attemptNumber) => {
|
|
1066
1006
|
try {
|
|
1067
|
-
|
|
1068
|
-
cleanUp();
|
|
1069
|
-
resolve(result);
|
|
1007
|
+
resolve(await input(attemptNumber));
|
|
1070
1008
|
} catch (error) {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1009
|
+
if (!(error instanceof Error)) {
|
|
1010
|
+
reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (error instanceof AbortError) {
|
|
1014
|
+
operation.stop();
|
|
1015
|
+
reject(error.originalError);
|
|
1016
|
+
} else if (error instanceof TypeError && !isNetworkError(error.message)) {
|
|
1017
|
+
operation.stop();
|
|
1018
|
+
reject(error);
|
|
1019
|
+
} else {
|
|
1081
1020
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1021
|
+
try {
|
|
1022
|
+
await options.onFailedAttempt(error);
|
|
1023
|
+
} catch (error2) {
|
|
1024
|
+
reject(error2);
|
|
1025
|
+
return;
|
|
1085
1026
|
}
|
|
1086
|
-
await options.onFailedAttempt(error);
|
|
1087
1027
|
if (!operation.retry(error)) {
|
|
1088
|
-
|
|
1028
|
+
reject(operation.mainError());
|
|
1089
1029
|
}
|
|
1090
|
-
} catch (finalError) {
|
|
1091
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1092
|
-
cleanUp();
|
|
1093
|
-
reject(finalError);
|
|
1094
1030
|
}
|
|
1095
1031
|
}
|
|
1096
1032
|
});
|
|
1033
|
+
if (options.signal && !options.signal.aborted) {
|
|
1034
|
+
options.signal.addEventListener("abort", () => {
|
|
1035
|
+
operation.stop();
|
|
1036
|
+
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1037
|
+
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1038
|
+
}, {
|
|
1039
|
+
once: true
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1097
1042
|
});
|
|
1098
1043
|
}
|
|
1099
|
-
|
|
1100
|
-
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1101
1044
|
var AbortError2 = class extends Error {
|
|
1102
1045
|
constructor() {
|
|
1103
1046
|
super("Throttled function aborted");
|
|
1104
1047
|
this.name = "AbortError";
|
|
1105
1048
|
}
|
|
1106
1049
|
};
|
|
1107
|
-
function pThrottle({ limit, interval, strict
|
|
1050
|
+
function pThrottle({ limit, interval, strict }) {
|
|
1108
1051
|
if (!Number.isFinite(limit)) {
|
|
1109
1052
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1110
1053
|
}
|
|
@@ -1132,38 +1075,32 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1132
1075
|
const strictTicks = [];
|
|
1133
1076
|
function strictDelay() {
|
|
1134
1077
|
const now = Date.now();
|
|
1135
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1136
|
-
strictTicks.length = 0;
|
|
1137
|
-
}
|
|
1138
1078
|
if (strictTicks.length < limit) {
|
|
1139
1079
|
strictTicks.push(now);
|
|
1140
1080
|
return 0;
|
|
1141
1081
|
}
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1082
|
+
const earliestTime = strictTicks.shift() + interval;
|
|
1083
|
+
if (now >= earliestTime) {
|
|
1084
|
+
strictTicks.push(now);
|
|
1085
|
+
return 0;
|
|
1086
|
+
}
|
|
1087
|
+
strictTicks.push(earliestTime);
|
|
1088
|
+
return earliestTime - now;
|
|
1146
1089
|
}
|
|
1147
1090
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1148
1091
|
return (function_) => {
|
|
1149
|
-
const throttled = function(...
|
|
1092
|
+
const throttled = function(...args) {
|
|
1150
1093
|
if (!throttled.isEnabled) {
|
|
1151
|
-
return (async () => function_.apply(this,
|
|
1094
|
+
return (async () => function_.apply(this, args))();
|
|
1152
1095
|
}
|
|
1153
|
-
let
|
|
1096
|
+
let timeout;
|
|
1154
1097
|
return new Promise((resolve, reject) => {
|
|
1155
1098
|
const execute = () => {
|
|
1156
|
-
resolve(function_.apply(this,
|
|
1157
|
-
queue.delete(
|
|
1099
|
+
resolve(function_.apply(this, args));
|
|
1100
|
+
queue.delete(timeout);
|
|
1158
1101
|
};
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
timeoutId = setTimeout(execute, delay);
|
|
1162
|
-
queue.set(timeoutId, reject);
|
|
1163
|
-
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1164
|
-
} else {
|
|
1165
|
-
execute();
|
|
1166
|
-
}
|
|
1102
|
+
timeout = setTimeout(execute, getDelay());
|
|
1103
|
+
queue.set(timeout, reject);
|
|
1167
1104
|
});
|
|
1168
1105
|
};
|
|
1169
1106
|
throttled.abort = () => {
|
|
@@ -1175,29 +1112,16 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1175
1112
|
strictTicks.splice(0, strictTicks.length);
|
|
1176
1113
|
};
|
|
1177
1114
|
throttled.isEnabled = true;
|
|
1178
|
-
Object.defineProperty(throttled, "queueSize", {
|
|
1179
|
-
get() {
|
|
1180
|
-
return queue.size;
|
|
1181
|
-
}
|
|
1182
|
-
});
|
|
1183
1115
|
return throttled;
|
|
1184
1116
|
};
|
|
1185
1117
|
}
|
|
1186
|
-
|
|
1187
|
-
// ../canvas/dist/index.mjs
|
|
1188
|
-
var __typeError3 = (msg) => {
|
|
1189
|
-
throw TypeError(msg);
|
|
1190
|
-
};
|
|
1191
|
-
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1192
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1193
|
-
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);
|
|
1194
1118
|
function createLimitPolicy({
|
|
1195
1119
|
throttle = { interval: 1e3, limit: 10 },
|
|
1196
|
-
retry:
|
|
1120
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
1197
1121
|
limit = 10
|
|
1198
1122
|
}) {
|
|
1199
1123
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1200
|
-
const limiter = limit ?
|
|
1124
|
+
const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
|
|
1201
1125
|
return function limitPolicy(func) {
|
|
1202
1126
|
let currentFunc = async () => await func();
|
|
1203
1127
|
if (throttler) {
|
|
@@ -1208,13 +1132,13 @@ function createLimitPolicy({
|
|
|
1208
1132
|
const limitFunc = currentFunc;
|
|
1209
1133
|
currentFunc = () => limiter(limitFunc);
|
|
1210
1134
|
}
|
|
1211
|
-
if (
|
|
1135
|
+
if (retry2) {
|
|
1212
1136
|
const retryFunc = currentFunc;
|
|
1213
1137
|
currentFunc = () => pRetry(retryFunc, {
|
|
1214
|
-
...
|
|
1138
|
+
...retry2,
|
|
1215
1139
|
onFailedAttempt: async (error) => {
|
|
1216
|
-
if (
|
|
1217
|
-
await
|
|
1140
|
+
if (retry2.onFailedAttempt) {
|
|
1141
|
+
await retry2.onFailedAttempt(error);
|
|
1218
1142
|
}
|
|
1219
1143
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1220
1144
|
throw error;
|
|
@@ -1297,15 +1221,15 @@ var CanvasClient = class extends ApiClient {
|
|
|
1297
1221
|
/** Updates or creates a Canvas component definition */
|
|
1298
1222
|
async updateComposition(body, options) {
|
|
1299
1223
|
const fetchUri = this.createUrl(CANVAS_URL);
|
|
1300
|
-
const
|
|
1224
|
+
const headers2 = {};
|
|
1301
1225
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1302
|
-
|
|
1226
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1303
1227
|
}
|
|
1304
1228
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1305
1229
|
method: "PUT",
|
|
1306
1230
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1307
1231
|
expectNoContent: true,
|
|
1308
|
-
headers
|
|
1232
|
+
headers: headers2
|
|
1309
1233
|
});
|
|
1310
1234
|
return { modified: response.headers.get("x-modified-at") };
|
|
1311
1235
|
}
|
|
@@ -1354,7 +1278,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1354
1278
|
}
|
|
1355
1279
|
getContentTypes(options) {
|
|
1356
1280
|
const { projectId } = this.options;
|
|
1357
|
-
const fetchUri = this.createUrl(
|
|
1281
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1358
1282
|
return this.apiClient(fetchUri);
|
|
1359
1283
|
}
|
|
1360
1284
|
getEntries(options) {
|
|
@@ -1362,11 +1286,11 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1362
1286
|
const { skipDataResolution, filters, ...params } = options;
|
|
1363
1287
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1364
1288
|
if (skipDataResolution) {
|
|
1365
|
-
const url = this.createUrl(
|
|
1289
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1366
1290
|
return this.apiClient(url);
|
|
1367
1291
|
}
|
|
1368
1292
|
const edgeUrl = this.createUrl(
|
|
1369
|
-
|
|
1293
|
+
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1370
1294
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1371
1295
|
this.edgeApiHost
|
|
1372
1296
|
);
|
|
@@ -1384,7 +1308,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1384
1308
|
return this.apiClient(historyUrl);
|
|
1385
1309
|
}
|
|
1386
1310
|
async upsertContentType(body, opts = {}) {
|
|
1387
|
-
const fetchUri = this.createUrl(
|
|
1311
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1388
1312
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1389
1313
|
delete body.contentType.slugSettings;
|
|
1390
1314
|
}
|
|
@@ -1396,21 +1320,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1396
1320
|
});
|
|
1397
1321
|
}
|
|
1398
1322
|
async upsertEntry(body, options) {
|
|
1399
|
-
const fetchUri = this.createUrl(
|
|
1400
|
-
const
|
|
1323
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1324
|
+
const headers2 = {};
|
|
1401
1325
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1402
|
-
|
|
1326
|
+
headers2["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
1403
1327
|
}
|
|
1404
1328
|
const { response } = await this.apiClientWithResponse(fetchUri, {
|
|
1405
1329
|
method: "PUT",
|
|
1406
1330
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1407
1331
|
expectNoContent: true,
|
|
1408
|
-
headers
|
|
1332
|
+
headers: headers2
|
|
1409
1333
|
});
|
|
1410
1334
|
return { modified: response.headers.get("x-modified-at") };
|
|
1411
1335
|
}
|
|
1412
1336
|
async deleteContentType(body) {
|
|
1413
|
-
const fetchUri = this.createUrl(
|
|
1337
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1414
1338
|
await this.apiClient(fetchUri, {
|
|
1415
1339
|
method: "DELETE",
|
|
1416
1340
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1418,7 +1342,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1418
1342
|
});
|
|
1419
1343
|
}
|
|
1420
1344
|
async deleteEntry(body) {
|
|
1421
|
-
const fetchUri = this.createUrl(
|
|
1345
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1422
1346
|
await this.apiClient(fetchUri, {
|
|
1423
1347
|
method: "DELETE",
|
|
1424
1348
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1437,8 +1361,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1437
1361
|
};
|
|
1438
1362
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1439
1363
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1440
|
-
|
|
1441
|
-
|
|
1364
|
+
__privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1365
|
+
__privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1442
1366
|
var _url8;
|
|
1443
1367
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1444
1368
|
constructor(options) {
|
|
@@ -1447,12 +1371,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1447
1371
|
/** Fetches all DataTypes for a project */
|
|
1448
1372
|
async get(options) {
|
|
1449
1373
|
const { projectId } = this.options;
|
|
1450
|
-
const fetchUri = this.createUrl(
|
|
1374
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1451
1375
|
return await this.apiClient(fetchUri);
|
|
1452
1376
|
}
|
|
1453
1377
|
/** Updates or creates (based on id) a DataType */
|
|
1454
1378
|
async upsert(body) {
|
|
1455
|
-
const fetchUri = this.createUrl(
|
|
1379
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
1456
1380
|
await this.apiClient(fetchUri, {
|
|
1457
1381
|
method: "PUT",
|
|
1458
1382
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1461,7 +1385,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1461
1385
|
}
|
|
1462
1386
|
/** Deletes a DataType */
|
|
1463
1387
|
async remove(body) {
|
|
1464
|
-
const fetchUri = this.createUrl(
|
|
1388
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
1465
1389
|
await this.apiClient(fetchUri, {
|
|
1466
1390
|
method: "DELETE",
|
|
1467
1391
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1470,7 +1394,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1470
1394
|
}
|
|
1471
1395
|
};
|
|
1472
1396
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1473
|
-
|
|
1397
|
+
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1474
1398
|
function getComponentPath(ancestorsAndSelf) {
|
|
1475
1399
|
const path = [];
|
|
1476
1400
|
for (let i = ancestorsAndSelf.length - 1; i >= 0; i--) {
|
|
@@ -1923,7 +1847,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1923
1847
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1924
1848
|
*/
|
|
1925
1849
|
get(options) {
|
|
1926
|
-
const fetchUri = this.createUrl(
|
|
1850
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1927
1851
|
...options,
|
|
1928
1852
|
teamId: this.teamId
|
|
1929
1853
|
});
|
|
@@ -1933,7 +1857,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1933
1857
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1934
1858
|
*/
|
|
1935
1859
|
async deploy(body) {
|
|
1936
|
-
const fetchUri = this.createUrl(
|
|
1860
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1937
1861
|
await this.apiClient(fetchUri, {
|
|
1938
1862
|
method: "PUT",
|
|
1939
1863
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1944,7 +1868,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1944
1868
|
* Removes a custom AI property editor from a Mesh app.
|
|
1945
1869
|
*/
|
|
1946
1870
|
async delete(body) {
|
|
1947
|
-
const fetchUri = this.createUrl(
|
|
1871
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1948
1872
|
await this.apiClient(fetchUri, {
|
|
1949
1873
|
method: "DELETE",
|
|
1950
1874
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1953,7 +1877,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1953
1877
|
}
|
|
1954
1878
|
};
|
|
1955
1879
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1956
|
-
|
|
1880
|
+
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1957
1881
|
var _url22;
|
|
1958
1882
|
var _projectsUrl;
|
|
1959
1883
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1962,7 +1886,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1962
1886
|
}
|
|
1963
1887
|
/** Fetches single Project */
|
|
1964
1888
|
async get(options) {
|
|
1965
|
-
const fetchUri = this.createUrl(
|
|
1889
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1966
1890
|
return await this.apiClient(fetchUri);
|
|
1967
1891
|
}
|
|
1968
1892
|
/**
|
|
@@ -1971,12 +1895,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1971
1895
|
* When omitted, returns all accessible teams and their projects.
|
|
1972
1896
|
*/
|
|
1973
1897
|
async getProjects(options) {
|
|
1974
|
-
const fetchUri = this.createUrl(
|
|
1898
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1975
1899
|
return await this.apiClient(fetchUri);
|
|
1976
1900
|
}
|
|
1977
1901
|
/** Updates or creates (based on id) a Project */
|
|
1978
1902
|
async upsert(body) {
|
|
1979
|
-
const fetchUri = this.createUrl(
|
|
1903
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
1980
1904
|
return await this.apiClient(fetchUri, {
|
|
1981
1905
|
method: "PUT",
|
|
1982
1906
|
body: JSON.stringify({ ...body })
|
|
@@ -1984,7 +1908,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1984
1908
|
}
|
|
1985
1909
|
/** Deletes a Project */
|
|
1986
1910
|
async delete(body) {
|
|
1987
|
-
const fetchUri = this.createUrl(
|
|
1911
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
1988
1912
|
await this.apiClient(fetchUri, {
|
|
1989
1913
|
method: "DELETE",
|
|
1990
1914
|
body: JSON.stringify({ ...body }),
|
|
@@ -1994,8 +1918,8 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1994
1918
|
};
|
|
1995
1919
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1996
1920
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1997
|
-
|
|
1998
|
-
|
|
1921
|
+
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1922
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1999
1923
|
var ROUTE_URL = "/api/v1/route";
|
|
2000
1924
|
var RouteClient = class extends ApiClient {
|
|
2001
1925
|
constructor(options) {
|
|
@@ -2253,7 +2177,7 @@ function createLimiter(concurrency) {
|
|
|
2253
2177
|
});
|
|
2254
2178
|
};
|
|
2255
2179
|
}
|
|
2256
|
-
async function
|
|
2180
|
+
async function retry(fn, options) {
|
|
2257
2181
|
let lastError;
|
|
2258
2182
|
let delay = 1e3;
|
|
2259
2183
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2293,7 +2217,7 @@ function createLimitPolicy2({
|
|
|
2293
2217
|
}
|
|
2294
2218
|
if (retryOptions) {
|
|
2295
2219
|
const retryFunc = currentFunc;
|
|
2296
|
-
currentFunc = () =>
|
|
2220
|
+
currentFunc = () => retry(retryFunc, {
|
|
2297
2221
|
...retryOptions,
|
|
2298
2222
|
onFailedAttempt: async (error) => {
|
|
2299
2223
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2427,14 +2351,14 @@ var getManifest = async (options) => {
|
|
|
2427
2351
|
var import_server_only3 = require("server-only");
|
|
2428
2352
|
|
|
2429
2353
|
// ../project-map/dist/index.mjs
|
|
2430
|
-
var
|
|
2354
|
+
var __typeError3 = (msg) => {
|
|
2431
2355
|
throw TypeError(msg);
|
|
2432
2356
|
};
|
|
2433
|
-
var
|
|
2434
|
-
var
|
|
2435
|
-
var
|
|
2436
|
-
var
|
|
2437
|
-
var __privateMethod = (obj, member, method) => (
|
|
2357
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
2358
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2359
|
+
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);
|
|
2360
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2361
|
+
var __privateMethod = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
|
|
2438
2362
|
var ProjectMapClient = class extends ApiClient {
|
|
2439
2363
|
constructor(options) {
|
|
2440
2364
|
super(options);
|
|
@@ -2581,12 +2505,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2581
2505
|
var _Route = class _Route2 {
|
|
2582
2506
|
constructor(route) {
|
|
2583
2507
|
this.route = route;
|
|
2584
|
-
|
|
2508
|
+
__privateAdd3(this, _routeInfo);
|
|
2585
2509
|
var _a;
|
|
2586
|
-
|
|
2510
|
+
__privateSet(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2587
2511
|
}
|
|
2588
2512
|
get dynamicSegmentCount() {
|
|
2589
|
-
return
|
|
2513
|
+
return __privateGet3(this, _routeInfo).segments.reduce(
|
|
2590
2514
|
(count, segment) => {
|
|
2591
2515
|
var _a;
|
|
2592
2516
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2598,7 +2522,7 @@ var _Route = class _Route2 {
|
|
|
2598
2522
|
matches(path) {
|
|
2599
2523
|
var _a, _b;
|
|
2600
2524
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2601
|
-
const { segments: routeSegments } =
|
|
2525
|
+
const { segments: routeSegments } = __privateGet3(this, _routeInfo);
|
|
2602
2526
|
if (pathSegments.length !== routeSegments.length) {
|
|
2603
2527
|
return { match: false };
|
|
2604
2528
|
}
|
|
@@ -2619,7 +2543,7 @@ var _Route = class _Route2 {
|
|
|
2619
2543
|
return { match: false };
|
|
2620
2544
|
}
|
|
2621
2545
|
}
|
|
2622
|
-
for (const [key, value] of
|
|
2546
|
+
for (const [key, value] of __privateGet3(this, _routeInfo).queryParams) {
|
|
2623
2547
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2624
2548
|
}
|
|
2625
2549
|
return possibleMatch;
|
|
@@ -2629,7 +2553,7 @@ var _Route = class _Route2 {
|
|
|
2629
2553
|
*/
|
|
2630
2554
|
expand(options) {
|
|
2631
2555
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2632
|
-
const path =
|
|
2556
|
+
const path = __privateGet3(this, _routeInfo).segments.map((segment) => {
|
|
2633
2557
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2634
2558
|
if (!dynamicSegmentName) {
|
|
2635
2559
|
return segment;
|
|
@@ -2680,7 +2604,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2680
2604
|
}
|
|
2681
2605
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2682
2606
|
};
|
|
2683
|
-
|
|
2607
|
+
__privateAdd3(_Route, _Route_static);
|
|
2684
2608
|
_Route.dynamicSegmentPrefix = ":";
|
|
2685
2609
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2686
2610
|
if (!doNotEscapeVariables) {
|
|
@@ -2779,10 +2703,15 @@ var getRouteClient = (options) => {
|
|
|
2779
2703
|
// src/components/UniformComposition.tsx
|
|
2780
2704
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
2781
2705
|
var import_next_app_router_client5 = require("@uniformdev/next-app-router-client");
|
|
2782
|
-
var
|
|
2706
|
+
var import_next_app_router_shared3 = require("@uniformdev/next-app-router-shared");
|
|
2707
|
+
var import_headers = require("next/headers");
|
|
2783
2708
|
var import_navigation = require("next/navigation");
|
|
2784
2709
|
var import_react6 = __toESM(require("react"));
|
|
2785
2710
|
|
|
2711
|
+
// src/config/routeCode.ts
|
|
2712
|
+
var UNIFORM_DRAFT_SEGMENT = "__uniform_draft";
|
|
2713
|
+
var UNIFORM_DRAFT_CODE_HEADER = "x-uniform-code";
|
|
2714
|
+
|
|
2786
2715
|
// src/data/extract/extractTest.ts
|
|
2787
2716
|
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
2788
2717
|
var extractTest = ({ component }) => {
|
|
@@ -2957,15 +2886,9 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
|
2957
2886
|
};
|
|
2958
2887
|
|
|
2959
2888
|
// src/components/UniformCompositionWrapper.tsx
|
|
2960
|
-
var import_next_app_router_shared3 = require("@uniformdev/next-app-router-shared");
|
|
2961
2889
|
var import_react3 = __toESM(require("react"));
|
|
2962
|
-
var UniformCompositionWrapper = ({
|
|
2963
|
-
|
|
2964
|
-
children
|
|
2965
|
-
}) => {
|
|
2966
|
-
const data = (0, import_next_app_router_shared3.deserializeEvaluationResult)({ input: code });
|
|
2967
|
-
const WrapperComponent = data.compositionState === CANVAS_EDITOR_STATE || data.compositionState === CANVAS_DRAFT_STATE ? import_react3.Suspense : import_react3.Fragment;
|
|
2968
|
-
return /* @__PURE__ */ import_react3.default.createElement(WrapperComponent, null, children);
|
|
2890
|
+
var UniformCompositionWrapper = ({ children }) => {
|
|
2891
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.Fragment, null, children);
|
|
2969
2892
|
};
|
|
2970
2893
|
|
|
2971
2894
|
// src/components/UniformContext.tsx
|
|
@@ -3063,8 +2986,16 @@ async function UniformCompositionInner({
|
|
|
3063
2986
|
dataClient
|
|
3064
2987
|
}) {
|
|
3065
2988
|
var _a, _b;
|
|
2989
|
+
let effectiveCode = code;
|
|
2990
|
+
if (code === UNIFORM_DRAFT_SEGMENT) {
|
|
2991
|
+
const draftCode = (await (0, import_headers.headers)()).get(UNIFORM_DRAFT_CODE_HEADER);
|
|
2992
|
+
if (!draftCode) {
|
|
2993
|
+
(0, import_navigation.notFound)();
|
|
2994
|
+
}
|
|
2995
|
+
effectiveCode = draftCode;
|
|
2996
|
+
}
|
|
3066
2997
|
const result = await resolveRoute({
|
|
3067
|
-
code,
|
|
2998
|
+
code: effectiveCode,
|
|
3068
2999
|
dataClient
|
|
3069
3000
|
});
|
|
3070
3001
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
@@ -3104,7 +3035,7 @@ async function UniformCompositionInner({
|
|
|
3104
3035
|
{
|
|
3105
3036
|
clientContextComponent,
|
|
3106
3037
|
result: {
|
|
3107
|
-
code,
|
|
3038
|
+
code: effectiveCode,
|
|
3108
3039
|
pageState,
|
|
3109
3040
|
route
|
|
3110
3041
|
}
|
|
@@ -3243,7 +3174,7 @@ var resolveComponents = ({
|
|
|
3243
3174
|
childNode = elements;
|
|
3244
3175
|
}
|
|
3245
3176
|
if (visibilityRules) {
|
|
3246
|
-
const isVisible = (0,
|
|
3177
|
+
const isVisible = (0, import_next_app_router_shared3.resolveRuleFromPageState)({
|
|
3247
3178
|
pageState,
|
|
3248
3179
|
rule: visibilityRules
|
|
3249
3180
|
});
|
|
@@ -3358,13 +3289,13 @@ var resolveSlots = ({
|
|
|
3358
3289
|
};
|
|
3359
3290
|
|
|
3360
3291
|
// src/components/UniformPlayground.tsx
|
|
3361
|
-
var
|
|
3292
|
+
var import_headers2 = require("next/headers");
|
|
3362
3293
|
var import_react7 = __toESM(require("react"));
|
|
3363
3294
|
|
|
3364
3295
|
// src/data/resolvePlaygroundRoute.ts
|
|
3365
|
-
var
|
|
3296
|
+
var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared");
|
|
3366
3297
|
var resolvePlaygroundRoute = async ({ code }) => {
|
|
3367
|
-
const pageState = (0,
|
|
3298
|
+
const pageState = (0, import_next_app_router_shared4.deserializeEvaluationResult)({ input: code });
|
|
3368
3299
|
const canvasClient = getCanvasClient({
|
|
3369
3300
|
cache: {
|
|
3370
3301
|
type: "no-cache"
|
|
@@ -3403,7 +3334,7 @@ var resolvePlaygroundRoute = async ({ code }) => {
|
|
|
3403
3334
|
|
|
3404
3335
|
// src/components/UniformPlayground.tsx
|
|
3405
3336
|
var UniformPlayground = async ({ resolveRoute, ...rest }) => {
|
|
3406
|
-
const isDraftMode = (await (0,
|
|
3337
|
+
const isDraftMode = (await (0, import_headers2.draftMode)()).isEnabled;
|
|
3407
3338
|
if (!isDraftMode) {
|
|
3408
3339
|
return /* @__PURE__ */ import_react7.default.createElement("div", null, /* @__PURE__ */ import_react7.default.createElement("h1", null, "Playground is only available in draft mode"));
|
|
3409
3340
|
}
|
|
@@ -3411,18 +3342,18 @@ var UniformPlayground = async ({ resolveRoute, ...rest }) => {
|
|
|
3411
3342
|
};
|
|
3412
3343
|
|
|
3413
3344
|
// src/components/generateStaticParams.ts
|
|
3414
|
-
var
|
|
3345
|
+
var import_next_app_router_shared7 = require("@uniformdev/next-app-router-shared");
|
|
3415
3346
|
|
|
3416
3347
|
// src/data/extract/extractRunnables.ts
|
|
3417
|
-
var
|
|
3348
|
+
var import_next_app_router_shared6 = require("@uniformdev/next-app-router-shared");
|
|
3418
3349
|
|
|
3419
3350
|
// src/data/extract/extractPersonalization.ts
|
|
3420
|
-
var
|
|
3351
|
+
var import_next_app_router_shared5 = require("@uniformdev/next-app-router-shared");
|
|
3421
3352
|
var extractPersonalization = ({
|
|
3422
3353
|
component
|
|
3423
3354
|
}) => {
|
|
3424
3355
|
var _a, _b, _c;
|
|
3425
|
-
const trackingEventName = (0,
|
|
3356
|
+
const trackingEventName = (0, import_next_app_router_shared5.extractPersonalizationName)({ component });
|
|
3426
3357
|
const countParameter = (_a = component.parameters) == null ? void 0 : _a.count;
|
|
3427
3358
|
const algorithmParameter = (_b = component.parameters) == null ? void 0 : _b.algorithm;
|
|
3428
3359
|
const count = countParameter == null ? void 0 : countParameter.value;
|
|
@@ -3494,7 +3425,7 @@ var extractRunnables = (composition) => {
|
|
|
3494
3425
|
if (visibilityRules) {
|
|
3495
3426
|
runnable.push({
|
|
3496
3427
|
type: "visibility",
|
|
3497
|
-
_id: (0,
|
|
3428
|
+
_id: (0, import_next_app_router_shared6.getRuleId)(visibilityRules),
|
|
3498
3429
|
variantId: findAncestorVariant(node.ancestorsAndSelf),
|
|
3499
3430
|
rules: visibilityRules
|
|
3500
3431
|
});
|
|
@@ -3721,7 +3652,7 @@ var generatePossiblePageStates = ({
|
|
|
3721
3652
|
};
|
|
3722
3653
|
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3723
3654
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3724
|
-
return allStates.map((payload) => (0,
|
|
3655
|
+
return allStates.map((payload) => (0, import_next_app_router_shared7.serializeEvaluationResult)({ payload, allComponentIds }));
|
|
3725
3656
|
};
|
|
3726
3657
|
function permutationsWithoutRepetition(options, k) {
|
|
3727
3658
|
if (k === 0) return [[]];
|
|
@@ -3924,16 +3855,16 @@ var expireMiddlewareCacheTag = async (tag) => {
|
|
|
3924
3855
|
};
|
|
3925
3856
|
|
|
3926
3857
|
// src/data/precomputeComposition.ts
|
|
3927
|
-
var
|
|
3858
|
+
var import_next_app_router_shared8 = require("@uniformdev/next-app-router-shared");
|
|
3928
3859
|
var shouldEvaluateTest = (test, evaluateTests) => {
|
|
3929
3860
|
return typeof evaluateTests === "function" ? evaluateTests({
|
|
3930
|
-
name: (0,
|
|
3861
|
+
name: (0, import_next_app_router_shared8.extractTestName)({ component: test }),
|
|
3931
3862
|
component: test
|
|
3932
3863
|
}) : evaluateTests;
|
|
3933
3864
|
};
|
|
3934
3865
|
var shouldEvaluatePersonalization = (personalization, evaluatePersonalizations) => {
|
|
3935
3866
|
const result = typeof evaluatePersonalizations === "function" ? evaluatePersonalizations({
|
|
3936
|
-
name: (0,
|
|
3867
|
+
name: (0, import_next_app_router_shared8.extractPersonalizationName)({ component: personalization }),
|
|
3937
3868
|
component: personalization
|
|
3938
3869
|
}) : evaluatePersonalizations;
|
|
3939
3870
|
return result;
|
|
@@ -3951,7 +3882,7 @@ var precomputeComposition = ({
|
|
|
3951
3882
|
var _a, _b;
|
|
3952
3883
|
if (node.type === "component") {
|
|
3953
3884
|
const component = node.node;
|
|
3954
|
-
const pageStateComponent = (0,
|
|
3885
|
+
const pageStateComponent = (0, import_next_app_router_shared8.resolveComponentFromPageState)({
|
|
3955
3886
|
pageState,
|
|
3956
3887
|
componentId: component._id
|
|
3957
3888
|
});
|
|
@@ -3992,12 +3923,12 @@ var precomputeComposition = ({
|
|
|
3992
3923
|
};
|
|
3993
3924
|
|
|
3994
3925
|
// src/data/resolveRouteFromCode.ts
|
|
3995
|
-
var
|
|
3926
|
+
var import_next_app_router_shared9 = require("@uniformdev/next-app-router-shared");
|
|
3996
3927
|
var resolveRouteFromCode = async ({
|
|
3997
3928
|
code,
|
|
3998
3929
|
dataClient: providedDataClient
|
|
3999
3930
|
}) => {
|
|
4000
|
-
const pageState = (0,
|
|
3931
|
+
const pageState = (0, import_next_app_router_shared9.deserializeEvaluationResult)({ input: code });
|
|
4001
3932
|
const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
|
|
4002
3933
|
const { route } = await dataClient.getRoute({
|
|
4003
3934
|
source: "pageState",
|