@uniformdev/next-app-router 20.70.0 → 20.70.1-alpha.10

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.mjs CHANGED
@@ -4,6 +4,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
11
  var __commonJS = (cb, mod) => function __require() {
8
12
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
13
  };
@@ -23,12 +27,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
27
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
28
  mod
25
29
  ));
30
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
32
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
33
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
34
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
35
+ var __privateWrapper = (obj, member, setter, getter) => ({
36
+ set _(value) {
37
+ __privateSet(obj, member, value, setter);
38
+ },
39
+ get _() {
40
+ return __privateGet(obj, member, getter);
41
+ }
42
+ });
26
43
 
27
44
  // ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
28
45
  var require_yocto_queue = __commonJS({
29
46
  "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
30
47
  "use strict";
31
- var Node = class {
48
+ var Node2 = class {
32
49
  /// value;
33
50
  /// next;
34
51
  constructor(value) {
@@ -36,7 +53,7 @@ var require_yocto_queue = __commonJS({
36
53
  this.next = void 0;
37
54
  }
38
55
  };
39
- var Queue = class {
56
+ var Queue2 = class {
40
57
  // TODO: Use private class fields when targeting Node.js 12.
41
58
  // #_head;
42
59
  // #_tail;
@@ -45,7 +62,7 @@ var require_yocto_queue = __commonJS({
45
62
  this.clear();
46
63
  }
47
64
  enqueue(value) {
48
- const node = new Node(value);
65
+ const node = new Node2(value);
49
66
  if (this._head) {
50
67
  this._tail.next = node;
51
68
  this._tail = node;
@@ -80,7 +97,7 @@ var require_yocto_queue = __commonJS({
80
97
  }
81
98
  }
82
99
  };
83
- module.exports = Queue;
100
+ module.exports = Queue2;
84
101
  }
85
102
  });
86
103
 
@@ -88,12 +105,12 @@ var require_yocto_queue = __commonJS({
88
105
  var require_p_limit = __commonJS({
89
106
  "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
90
107
  "use strict";
91
- var Queue = require_yocto_queue();
92
- var pLimit2 = (concurrency) => {
108
+ var Queue2 = require_yocto_queue();
109
+ var pLimit3 = (concurrency) => {
93
110
  if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
94
111
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
95
112
  }
96
- const queue = new Queue();
113
+ const queue = new Queue2();
97
114
  let activeCount = 0;
98
115
  const next = () => {
99
116
  activeCount--;
@@ -138,7 +155,238 @@ var require_p_limit = __commonJS({
138
155
  });
139
156
  return generator;
140
157
  };
141
- module.exports = pLimit2;
158
+ module.exports = pLimit3;
159
+ }
160
+ });
161
+
162
+ // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
163
+ var require_retry_operation = __commonJS({
164
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
165
+ "use strict";
166
+ function RetryOperation(timeouts, options) {
167
+ if (typeof options === "boolean") {
168
+ options = { forever: options };
169
+ }
170
+ this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
171
+ this._timeouts = timeouts;
172
+ this._options = options || {};
173
+ this._maxRetryTime = options && options.maxRetryTime || Infinity;
174
+ this._fn = null;
175
+ this._errors = [];
176
+ this._attempts = 1;
177
+ this._operationTimeout = null;
178
+ this._operationTimeoutCb = null;
179
+ this._timeout = null;
180
+ this._operationStart = null;
181
+ this._timer = null;
182
+ if (this._options.forever) {
183
+ this._cachedTimeouts = this._timeouts.slice(0);
184
+ }
185
+ }
186
+ module.exports = RetryOperation;
187
+ RetryOperation.prototype.reset = function() {
188
+ this._attempts = 1;
189
+ this._timeouts = this._originalTimeouts.slice(0);
190
+ };
191
+ RetryOperation.prototype.stop = function() {
192
+ if (this._timeout) {
193
+ clearTimeout(this._timeout);
194
+ }
195
+ if (this._timer) {
196
+ clearTimeout(this._timer);
197
+ }
198
+ this._timeouts = [];
199
+ this._cachedTimeouts = null;
200
+ };
201
+ RetryOperation.prototype.retry = function(err) {
202
+ if (this._timeout) {
203
+ clearTimeout(this._timeout);
204
+ }
205
+ if (!err) {
206
+ return false;
207
+ }
208
+ var currentTime = (/* @__PURE__ */ new Date()).getTime();
209
+ if (err && currentTime - this._operationStart >= this._maxRetryTime) {
210
+ this._errors.push(err);
211
+ this._errors.unshift(new Error("RetryOperation timeout occurred"));
212
+ return false;
213
+ }
214
+ this._errors.push(err);
215
+ var timeout = this._timeouts.shift();
216
+ if (timeout === void 0) {
217
+ if (this._cachedTimeouts) {
218
+ this._errors.splice(0, this._errors.length - 1);
219
+ timeout = this._cachedTimeouts.slice(-1);
220
+ } else {
221
+ return false;
222
+ }
223
+ }
224
+ var self = this;
225
+ this._timer = setTimeout(function() {
226
+ self._attempts++;
227
+ if (self._operationTimeoutCb) {
228
+ self._timeout = setTimeout(function() {
229
+ self._operationTimeoutCb(self._attempts);
230
+ }, self._operationTimeout);
231
+ if (self._options.unref) {
232
+ self._timeout.unref();
233
+ }
234
+ }
235
+ self._fn(self._attempts);
236
+ }, timeout);
237
+ if (this._options.unref) {
238
+ this._timer.unref();
239
+ }
240
+ return true;
241
+ };
242
+ RetryOperation.prototype.attempt = function(fn, timeoutOps) {
243
+ this._fn = fn;
244
+ if (timeoutOps) {
245
+ if (timeoutOps.timeout) {
246
+ this._operationTimeout = timeoutOps.timeout;
247
+ }
248
+ if (timeoutOps.cb) {
249
+ this._operationTimeoutCb = timeoutOps.cb;
250
+ }
251
+ }
252
+ var self = this;
253
+ if (this._operationTimeoutCb) {
254
+ this._timeout = setTimeout(function() {
255
+ self._operationTimeoutCb();
256
+ }, self._operationTimeout);
257
+ }
258
+ this._operationStart = (/* @__PURE__ */ new Date()).getTime();
259
+ this._fn(this._attempts);
260
+ };
261
+ RetryOperation.prototype.try = function(fn) {
262
+ console.log("Using RetryOperation.try() is deprecated");
263
+ this.attempt(fn);
264
+ };
265
+ RetryOperation.prototype.start = function(fn) {
266
+ console.log("Using RetryOperation.start() is deprecated");
267
+ this.attempt(fn);
268
+ };
269
+ RetryOperation.prototype.start = RetryOperation.prototype.try;
270
+ RetryOperation.prototype.errors = function() {
271
+ return this._errors;
272
+ };
273
+ RetryOperation.prototype.attempts = function() {
274
+ return this._attempts;
275
+ };
276
+ RetryOperation.prototype.mainError = function() {
277
+ if (this._errors.length === 0) {
278
+ return null;
279
+ }
280
+ var counts = {};
281
+ var mainError = null;
282
+ var mainErrorCount = 0;
283
+ for (var i = 0; i < this._errors.length; i++) {
284
+ var error = this._errors[i];
285
+ var message = error.message;
286
+ var count = (counts[message] || 0) + 1;
287
+ counts[message] = count;
288
+ if (count >= mainErrorCount) {
289
+ mainError = error;
290
+ mainErrorCount = count;
291
+ }
292
+ }
293
+ return mainError;
294
+ };
295
+ }
296
+ });
297
+
298
+ // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
299
+ var require_retry = __commonJS({
300
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
301
+ "use strict";
302
+ var RetryOperation = require_retry_operation();
303
+ exports.operation = function(options) {
304
+ var timeouts = exports.timeouts(options);
305
+ return new RetryOperation(timeouts, {
306
+ forever: options && (options.forever || options.retries === Infinity),
307
+ unref: options && options.unref,
308
+ maxRetryTime: options && options.maxRetryTime
309
+ });
310
+ };
311
+ exports.timeouts = function(options) {
312
+ if (options instanceof Array) {
313
+ return [].concat(options);
314
+ }
315
+ var opts = {
316
+ retries: 10,
317
+ factor: 2,
318
+ minTimeout: 1 * 1e3,
319
+ maxTimeout: Infinity,
320
+ randomize: false
321
+ };
322
+ for (var key in options) {
323
+ opts[key] = options[key];
324
+ }
325
+ if (opts.minTimeout > opts.maxTimeout) {
326
+ throw new Error("minTimeout is greater than maxTimeout");
327
+ }
328
+ var timeouts = [];
329
+ for (var i = 0; i < opts.retries; i++) {
330
+ timeouts.push(this.createTimeout(i, opts));
331
+ }
332
+ if (options && options.forever && !timeouts.length) {
333
+ timeouts.push(this.createTimeout(i, opts));
334
+ }
335
+ timeouts.sort(function(a, b) {
336
+ return a - b;
337
+ });
338
+ return timeouts;
339
+ };
340
+ exports.createTimeout = function(attempt, opts) {
341
+ var random = opts.randomize ? Math.random() + 1 : 1;
342
+ var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
343
+ timeout = Math.min(timeout, opts.maxTimeout);
344
+ return timeout;
345
+ };
346
+ exports.wrap = function(obj, options, methods) {
347
+ if (options instanceof Array) {
348
+ methods = options;
349
+ options = null;
350
+ }
351
+ if (!methods) {
352
+ methods = [];
353
+ for (var key in obj) {
354
+ if (typeof obj[key] === "function") {
355
+ methods.push(key);
356
+ }
357
+ }
358
+ }
359
+ for (var i = 0; i < methods.length; i++) {
360
+ var method = methods[i];
361
+ var original = obj[method];
362
+ obj[method] = function retryWrapper(original2) {
363
+ var op = exports.operation(options);
364
+ var args = Array.prototype.slice.call(arguments, 1);
365
+ var callback = args.pop();
366
+ args.push(function(err) {
367
+ if (op.retry(err)) {
368
+ return;
369
+ }
370
+ if (err) {
371
+ arguments[0] = op.mainError();
372
+ }
373
+ callback.apply(this, arguments);
374
+ });
375
+ op.attempt(function() {
376
+ original2.apply(obj, args);
377
+ });
378
+ }.bind(obj, original);
379
+ obj[method].options = options;
380
+ }
381
+ };
382
+ }
383
+ });
384
+
385
+ // ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
386
+ var require_retry2 = __commonJS({
387
+ "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
388
+ "use strict";
389
+ module.exports = require_retry();
142
390
  }
143
391
  });
144
392
 
@@ -148,14 +396,14 @@ import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared"
148
396
  // ../context/dist/api/api.mjs
149
397
  var import_p_limit = __toESM(require_p_limit(), 1);
150
398
  var __defProp2 = Object.defineProperty;
151
- var __typeError = (msg) => {
399
+ var __typeError2 = (msg) => {
152
400
  throw TypeError(msg);
153
401
  };
154
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
155
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
156
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
157
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
158
- 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);
402
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
403
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
404
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
405
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
406
+ 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);
159
407
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
160
408
  var ApiClientError = class _ApiClientError extends Error {
161
409
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
@@ -163,18 +411,18 @@ var ApiClientError = class _ApiClientError extends Error {
163
411
  `${errorMessage}
164
412
  ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
165
413
  );
166
- this.errorMessage = errorMessage;
167
- this.fetchMethod = fetchMethod;
168
- this.fetchUri = fetchUri;
169
- this.statusCode = statusCode;
170
- this.statusText = statusText;
171
- this.requestId = requestId;
414
+ __publicField2(this, "errorMessage", errorMessage);
415
+ __publicField2(this, "fetchMethod", fetchMethod);
416
+ __publicField2(this, "fetchUri", fetchUri);
417
+ __publicField2(this, "statusCode", statusCode);
418
+ __publicField2(this, "statusText", statusText);
419
+ __publicField2(this, "requestId", requestId);
172
420
  Object.setPrototypeOf(this, _ApiClientError.prototype);
173
421
  }
174
422
  };
175
423
  var ApiClient = class _ApiClient {
176
424
  constructor(options) {
177
- __publicField(this, "options");
425
+ __publicField2(this, "options");
178
426
  var _a, _b, _c, _d, _e;
179
427
  if (!options.apiKey && !options.bearerToken) {
180
428
  throw new Error("You must provide an API key or a bearer token");
@@ -344,12 +592,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
344
592
  /** Fetches all aggregates for a project */
345
593
  async get(options) {
346
594
  const { projectId } = this.options;
347
- const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
595
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
348
596
  return await this.apiClient(fetchUri);
349
597
  }
350
598
  /** Updates or creates (based on id) an Aggregate */
351
599
  async upsert(body) {
352
- const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
600
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
353
601
  await this.apiClient(fetchUri, {
354
602
  method: "PUT",
355
603
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -358,7 +606,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
358
606
  }
359
607
  /** Deletes an Aggregate */
360
608
  async remove(body) {
361
- const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
609
+ const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
362
610
  await this.apiClient(fetchUri, {
363
611
  method: "DELETE",
364
612
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -367,7 +615,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
367
615
  }
368
616
  };
369
617
  _url = /* @__PURE__ */ new WeakMap();
370
- __privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
618
+ __privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
371
619
  var _url2;
372
620
  var _DimensionClient = class _DimensionClient2 extends ApiClient {
373
621
  constructor(options) {
@@ -376,12 +624,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
376
624
  /** Fetches the known score dimensions for a project */
377
625
  async get(options) {
378
626
  const { projectId } = this.options;
379
- const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
627
+ const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
380
628
  return await this.apiClient(fetchUri);
381
629
  }
382
630
  };
383
631
  _url2 = /* @__PURE__ */ new WeakMap();
384
- __privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
632
+ __privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
385
633
  var _url3;
386
634
  var _valueUrl;
387
635
  var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
@@ -391,12 +639,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
391
639
  /** Fetches all enrichments and values for a project, grouped by category */
392
640
  async get(options) {
393
641
  const { projectId } = this.options;
394
- const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
642
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
395
643
  return await this.apiClient(fetchUri);
396
644
  }
397
645
  /** Updates or creates (based on id) an enrichment category */
398
646
  async upsertCategory(body) {
399
- const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
647
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
400
648
  await this.apiClient(fetchUri, {
401
649
  method: "PUT",
402
650
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -405,7 +653,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
405
653
  }
406
654
  /** Deletes an enrichment category */
407
655
  async removeCategory(body) {
408
- const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
656
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
409
657
  await this.apiClient(fetchUri, {
410
658
  method: "DELETE",
411
659
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -414,7 +662,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
414
662
  }
415
663
  /** Updates or creates (based on id) an enrichment value within an enrichment category */
416
664
  async upsertValue(body) {
417
- const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
665
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
418
666
  await this.apiClient(fetchUri, {
419
667
  method: "PUT",
420
668
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -423,7 +671,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
423
671
  }
424
672
  /** Deletes an enrichment value within an enrichment category. The category is left alone. */
425
673
  async removeValue(body) {
426
- const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
674
+ const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
427
675
  await this.apiClient(fetchUri, {
428
676
  method: "DELETE",
429
677
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -433,8 +681,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
433
681
  };
434
682
  _url3 = /* @__PURE__ */ new WeakMap();
435
683
  _valueUrl = /* @__PURE__ */ new WeakMap();
436
- __privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
437
- __privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
684
+ __privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
685
+ __privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
438
686
  var _url4;
439
687
  var _ManifestClient = class _ManifestClient2 extends ApiClient {
440
688
  constructor(options) {
@@ -443,7 +691,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
443
691
  /** Fetches the Context manifest for a project */
444
692
  async get(options) {
445
693
  const { projectId } = this.options;
446
- const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
694
+ const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
447
695
  return await this.apiClient(fetchUri);
448
696
  }
449
697
  /** Publishes the Context manifest for a project */
@@ -457,7 +705,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
457
705
  }
458
706
  };
459
707
  _url4 = /* @__PURE__ */ new WeakMap();
460
- __privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
708
+ __privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
461
709
  var ManifestClient = _ManifestClient;
462
710
  var _url5;
463
711
  var _QuirkClient = class _QuirkClient2 extends ApiClient {
@@ -467,12 +715,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
467
715
  /** Fetches all Quirks for a project */
468
716
  async get(options) {
469
717
  const { projectId } = this.options;
470
- const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
718
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
471
719
  return await this.apiClient(fetchUri);
472
720
  }
473
721
  /** Updates or creates (based on id) a Quirk */
474
722
  async upsert(body) {
475
- const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
723
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
476
724
  await this.apiClient(fetchUri, {
477
725
  method: "PUT",
478
726
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -481,7 +729,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
481
729
  }
482
730
  /** Deletes a Quirk */
483
731
  async remove(body) {
484
- const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
732
+ const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
485
733
  await this.apiClient(fetchUri, {
486
734
  method: "DELETE",
487
735
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -490,7 +738,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
490
738
  }
491
739
  };
492
740
  _url5 = /* @__PURE__ */ new WeakMap();
493
- __privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
741
+ __privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
494
742
  var _url6;
495
743
  var _SignalClient = class _SignalClient2 extends ApiClient {
496
744
  constructor(options) {
@@ -499,12 +747,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
499
747
  /** Fetches all Signals for a project */
500
748
  async get(options) {
501
749
  const { projectId } = this.options;
502
- const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
750
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
503
751
  return await this.apiClient(fetchUri);
504
752
  }
505
753
  /** Updates or creates (based on id) a Signal */
506
754
  async upsert(body) {
507
- const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
755
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
508
756
  await this.apiClient(fetchUri, {
509
757
  method: "PUT",
510
758
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -513,7 +761,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
513
761
  }
514
762
  /** Deletes a Signal */
515
763
  async remove(body) {
516
- const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
764
+ const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
517
765
  await this.apiClient(fetchUri, {
518
766
  method: "DELETE",
519
767
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -522,7 +770,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
522
770
  }
523
771
  };
524
772
  _url6 = /* @__PURE__ */ new WeakMap();
525
- __privateAdd(_SignalClient, _url6, "/api/v2/signal");
773
+ __privateAdd2(_SignalClient, _url6, "/api/v2/signal");
526
774
  var _url7;
527
775
  var _TestClient = class _TestClient2 extends ApiClient {
528
776
  constructor(options) {
@@ -531,12 +779,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
531
779
  /** Fetches all Tests for a project */
532
780
  async get(options) {
533
781
  const { projectId } = this.options;
534
- const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
782
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
535
783
  return await this.apiClient(fetchUri);
536
784
  }
537
785
  /** Updates or creates (based on id) a Test */
538
786
  async upsert(body) {
539
- const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
787
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
540
788
  await this.apiClient(fetchUri, {
541
789
  method: "PUT",
542
790
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -545,7 +793,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
545
793
  }
546
794
  /** Deletes a Test */
547
795
  async remove(body) {
548
- const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
796
+ const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
549
797
  await this.apiClient(fetchUri, {
550
798
  method: "DELETE",
551
799
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -554,393 +802,194 @@ var _TestClient = class _TestClient2 extends ApiClient {
554
802
  }
555
803
  };
556
804
  _url7 = /* @__PURE__ */ new WeakMap();
557
- __privateAdd(_TestClient, _url7, "/api/v2/test");
805
+ __privateAdd2(_TestClient, _url7, "/api/v2/test");
558
806
 
559
- // ../canvas/dist/index.mjs
560
- var __create2 = Object.create;
561
- var __defProp3 = Object.defineProperty;
562
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
563
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
564
- var __getProtoOf2 = Object.getPrototypeOf;
565
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
566
- var __typeError2 = (msg) => {
567
- throw TypeError(msg);
568
- };
569
- var __commonJS2 = (cb, mod) => function __require() {
570
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
571
- };
572
- var __copyProps2 = (to, from, except, desc) => {
573
- if (from && typeof from === "object" || typeof from === "function") {
574
- for (let key of __getOwnPropNames2(from))
575
- if (!__hasOwnProp2.call(to, key) && key !== except)
576
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
807
+ // ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
808
+ var Node = class {
809
+ constructor(value) {
810
+ __publicField(this, "value");
811
+ __publicField(this, "next");
812
+ this.value = value;
577
813
  }
578
- return to;
579
814
  };
580
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
581
- // If the importer is in node compatibility mode or this is not an ESM
582
- // file that has been converted to a CommonJS file using a Babel-
583
- // compatible transform (i.e. "__esModule" has not been set), then set
584
- // "default" to the CommonJS "module.exports" for node compatibility.
585
- isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
586
- mod
587
- ));
588
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
589
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
590
- 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);
591
- var require_yocto_queue2 = __commonJS2({
592
- "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
593
- "use strict";
594
- var Node = class {
595
- /// value;
596
- /// next;
597
- constructor(value) {
598
- this.value = value;
599
- this.next = void 0;
600
- }
601
- };
602
- var Queue = class {
603
- // TODO: Use private class fields when targeting Node.js 12.
604
- // #_head;
605
- // #_tail;
606
- // #_size;
607
- constructor() {
608
- this.clear();
609
- }
610
- enqueue(value) {
611
- const node = new Node(value);
612
- if (this._head) {
613
- this._tail.next = node;
614
- this._tail = node;
615
- } else {
616
- this._head = node;
617
- this._tail = node;
618
- }
619
- this._size++;
620
- }
621
- dequeue() {
622
- const current = this._head;
623
- if (!current) {
624
- return;
625
- }
626
- this._head = this._head.next;
627
- this._size--;
628
- return current.value;
629
- }
630
- clear() {
631
- this._head = void 0;
632
- this._tail = void 0;
633
- this._size = 0;
634
- }
635
- get size() {
636
- return this._size;
637
- }
638
- *[Symbol.iterator]() {
639
- let current = this._head;
640
- while (current) {
641
- yield current.value;
642
- current = current.next;
643
- }
644
- }
645
- };
646
- module.exports = Queue;
815
+ var _head, _tail, _size;
816
+ var Queue = class {
817
+ constructor() {
818
+ __privateAdd(this, _head);
819
+ __privateAdd(this, _tail);
820
+ __privateAdd(this, _size);
821
+ this.clear();
822
+ }
823
+ enqueue(value) {
824
+ const node = new Node(value);
825
+ if (__privateGet(this, _head)) {
826
+ __privateGet(this, _tail).next = node;
827
+ __privateSet(this, _tail, node);
828
+ } else {
829
+ __privateSet(this, _head, node);
830
+ __privateSet(this, _tail, node);
831
+ }
832
+ __privateWrapper(this, _size)._++;
647
833
  }
648
- });
649
- var require_p_limit2 = __commonJS2({
650
- "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
651
- "use strict";
652
- var Queue = require_yocto_queue2();
653
- var pLimit2 = (concurrency) => {
654
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
655
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
656
- }
657
- const queue = new Queue();
658
- let activeCount = 0;
659
- const next = () => {
660
- activeCount--;
661
- if (queue.size > 0) {
662
- queue.dequeue()();
663
- }
664
- };
665
- const run = async (fn, resolve, ...args) => {
666
- activeCount++;
667
- const result = (async () => fn(...args))();
668
- resolve(result);
669
- try {
670
- await result;
671
- } catch (e) {
672
- }
673
- next();
674
- };
675
- const enqueue = (fn, resolve, ...args) => {
676
- queue.enqueue(run.bind(null, fn, resolve, ...args));
677
- (async () => {
678
- await Promise.resolve();
679
- if (activeCount < concurrency && queue.size > 0) {
680
- queue.dequeue()();
681
- }
682
- })();
683
- };
684
- const generator = (fn, ...args) => new Promise((resolve) => {
685
- enqueue(fn, resolve, ...args);
686
- });
687
- Object.defineProperties(generator, {
688
- activeCount: {
689
- get: () => activeCount
690
- },
691
- pendingCount: {
692
- get: () => queue.size
693
- },
694
- clearQueue: {
695
- value: () => {
696
- queue.clear();
697
- }
698
- }
699
- });
700
- return generator;
701
- };
702
- module.exports = pLimit2;
834
+ dequeue() {
835
+ const current = __privateGet(this, _head);
836
+ if (!current) {
837
+ return;
838
+ }
839
+ __privateSet(this, _head, __privateGet(this, _head).next);
840
+ __privateWrapper(this, _size)._--;
841
+ if (!__privateGet(this, _head)) {
842
+ __privateSet(this, _tail, void 0);
843
+ }
844
+ return current.value;
703
845
  }
704
- });
705
- var require_retry_operation = __commonJS2({
706
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
707
- "use strict";
708
- function RetryOperation(timeouts, options) {
709
- if (typeof options === "boolean") {
710
- options = { forever: options };
711
- }
712
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
713
- this._timeouts = timeouts;
714
- this._options = options || {};
715
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
716
- this._fn = null;
717
- this._errors = [];
718
- this._attempts = 1;
719
- this._operationTimeout = null;
720
- this._operationTimeoutCb = null;
721
- this._timeout = null;
722
- this._operationStart = null;
723
- this._timer = null;
724
- if (this._options.forever) {
725
- this._cachedTimeouts = this._timeouts.slice(0);
726
- }
846
+ peek() {
847
+ if (!__privateGet(this, _head)) {
848
+ return;
727
849
  }
728
- module.exports = RetryOperation;
729
- RetryOperation.prototype.reset = function() {
730
- this._attempts = 1;
731
- this._timeouts = this._originalTimeouts.slice(0);
732
- };
733
- RetryOperation.prototype.stop = function() {
734
- if (this._timeout) {
735
- clearTimeout(this._timeout);
736
- }
737
- if (this._timer) {
738
- clearTimeout(this._timer);
739
- }
740
- this._timeouts = [];
741
- this._cachedTimeouts = null;
742
- };
743
- RetryOperation.prototype.retry = function(err) {
744
- if (this._timeout) {
745
- clearTimeout(this._timeout);
746
- }
747
- if (!err) {
748
- return false;
749
- }
750
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
751
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
752
- this._errors.push(err);
753
- this._errors.unshift(new Error("RetryOperation timeout occurred"));
754
- return false;
755
- }
756
- this._errors.push(err);
757
- var timeout = this._timeouts.shift();
758
- if (timeout === void 0) {
759
- if (this._cachedTimeouts) {
760
- this._errors.splice(0, this._errors.length - 1);
761
- timeout = this._cachedTimeouts.slice(-1);
762
- } else {
763
- return false;
764
- }
765
- }
766
- var self = this;
767
- this._timer = setTimeout(function() {
768
- self._attempts++;
769
- if (self._operationTimeoutCb) {
770
- self._timeout = setTimeout(function() {
771
- self._operationTimeoutCb(self._attempts);
772
- }, self._operationTimeout);
773
- if (self._options.unref) {
774
- self._timeout.unref();
775
- }
776
- }
777
- self._fn(self._attempts);
778
- }, timeout);
779
- if (this._options.unref) {
780
- this._timer.unref();
781
- }
782
- return true;
783
- };
784
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
785
- this._fn = fn;
786
- if (timeoutOps) {
787
- if (timeoutOps.timeout) {
788
- this._operationTimeout = timeoutOps.timeout;
789
- }
790
- if (timeoutOps.cb) {
791
- this._operationTimeoutCb = timeoutOps.cb;
792
- }
793
- }
794
- var self = this;
795
- if (this._operationTimeoutCb) {
796
- this._timeout = setTimeout(function() {
797
- self._operationTimeoutCb();
798
- }, self._operationTimeout);
799
- }
800
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
801
- this._fn(this._attempts);
802
- };
803
- RetryOperation.prototype.try = function(fn) {
804
- console.log("Using RetryOperation.try() is deprecated");
805
- this.attempt(fn);
806
- };
807
- RetryOperation.prototype.start = function(fn) {
808
- console.log("Using RetryOperation.start() is deprecated");
809
- this.attempt(fn);
810
- };
811
- RetryOperation.prototype.start = RetryOperation.prototype.try;
812
- RetryOperation.prototype.errors = function() {
813
- return this._errors;
814
- };
815
- RetryOperation.prototype.attempts = function() {
816
- return this._attempts;
817
- };
818
- RetryOperation.prototype.mainError = function() {
819
- if (this._errors.length === 0) {
820
- return null;
821
- }
822
- var counts = {};
823
- var mainError = null;
824
- var mainErrorCount = 0;
825
- for (var i = 0; i < this._errors.length; i++) {
826
- var error = this._errors[i];
827
- var message = error.message;
828
- var count = (counts[message] || 0) + 1;
829
- counts[message] = count;
830
- if (count >= mainErrorCount) {
831
- mainError = error;
832
- mainErrorCount = count;
833
- }
834
- }
835
- return mainError;
836
- };
850
+ return __privateGet(this, _head).value;
837
851
  }
838
- });
839
- var require_retry = __commonJS2({
840
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
841
- "use strict";
842
- var RetryOperation = require_retry_operation();
843
- exports.operation = function(options) {
844
- var timeouts = exports.timeouts(options);
845
- return new RetryOperation(timeouts, {
846
- forever: options && (options.forever || options.retries === Infinity),
847
- unref: options && options.unref,
848
- maxRetryTime: options && options.maxRetryTime
849
- });
850
- };
851
- exports.timeouts = function(options) {
852
- if (options instanceof Array) {
853
- return [].concat(options);
854
- }
855
- var opts = {
856
- retries: 10,
857
- factor: 2,
858
- minTimeout: 1 * 1e3,
859
- maxTimeout: Infinity,
860
- randomize: false
861
- };
862
- for (var key in options) {
863
- opts[key] = options[key];
864
- }
865
- if (opts.minTimeout > opts.maxTimeout) {
866
- throw new Error("minTimeout is greater than maxTimeout");
867
- }
868
- var timeouts = [];
869
- for (var i = 0; i < opts.retries; i++) {
870
- timeouts.push(this.createTimeout(i, opts));
871
- }
872
- if (options && options.forever && !timeouts.length) {
873
- timeouts.push(this.createTimeout(i, opts));
852
+ clear() {
853
+ __privateSet(this, _head, void 0);
854
+ __privateSet(this, _tail, void 0);
855
+ __privateSet(this, _size, 0);
856
+ }
857
+ get size() {
858
+ return __privateGet(this, _size);
859
+ }
860
+ *[Symbol.iterator]() {
861
+ let current = __privateGet(this, _head);
862
+ while (current) {
863
+ yield current.value;
864
+ current = current.next;
865
+ }
866
+ }
867
+ *drain() {
868
+ while (__privateGet(this, _head)) {
869
+ yield this.dequeue();
870
+ }
871
+ }
872
+ };
873
+ _head = new WeakMap();
874
+ _tail = new WeakMap();
875
+ _size = new WeakMap();
876
+
877
+ // ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
878
+ function pLimit2(concurrency) {
879
+ validateConcurrency(concurrency);
880
+ const queue = new Queue();
881
+ let activeCount = 0;
882
+ const resumeNext = () => {
883
+ if (activeCount < concurrency && queue.size > 0) {
884
+ queue.dequeue()();
885
+ activeCount++;
886
+ }
887
+ };
888
+ const next = () => {
889
+ activeCount--;
890
+ resumeNext();
891
+ };
892
+ const run = async (function_, resolve, arguments_) => {
893
+ const result = (async () => function_(...arguments_))();
894
+ resolve(result);
895
+ try {
896
+ await result;
897
+ } catch (e) {
898
+ }
899
+ next();
900
+ };
901
+ const enqueue = (function_, resolve, arguments_) => {
902
+ new Promise((internalResolve) => {
903
+ queue.enqueue(internalResolve);
904
+ }).then(
905
+ run.bind(void 0, function_, resolve, arguments_)
906
+ );
907
+ (async () => {
908
+ await Promise.resolve();
909
+ if (activeCount < concurrency) {
910
+ resumeNext();
874
911
  }
875
- timeouts.sort(function(a, b) {
876
- return a - b;
877
- });
878
- return timeouts;
879
- };
880
- exports.createTimeout = function(attempt, opts) {
881
- var random = opts.randomize ? Math.random() + 1 : 1;
882
- var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
883
- timeout = Math.min(timeout, opts.maxTimeout);
884
- return timeout;
885
- };
886
- exports.wrap = function(obj, options, methods) {
887
- if (options instanceof Array) {
888
- methods = options;
889
- options = null;
912
+ })();
913
+ };
914
+ const generator = (function_, ...arguments_) => new Promise((resolve) => {
915
+ enqueue(function_, resolve, arguments_);
916
+ });
917
+ Object.defineProperties(generator, {
918
+ activeCount: {
919
+ get: () => activeCount
920
+ },
921
+ pendingCount: {
922
+ get: () => queue.size
923
+ },
924
+ clearQueue: {
925
+ value() {
926
+ queue.clear();
890
927
  }
891
- if (!methods) {
892
- methods = [];
893
- for (var key in obj) {
894
- if (typeof obj[key] === "function") {
895
- methods.push(key);
928
+ },
929
+ concurrency: {
930
+ get: () => concurrency,
931
+ set(newConcurrency) {
932
+ validateConcurrency(newConcurrency);
933
+ concurrency = newConcurrency;
934
+ queueMicrotask(() => {
935
+ while (activeCount < concurrency && queue.size > 0) {
936
+ resumeNext();
896
937
  }
897
- }
898
- }
899
- for (var i = 0; i < methods.length; i++) {
900
- var method = methods[i];
901
- var original = obj[method];
902
- obj[method] = function retryWrapper(original2) {
903
- var op = exports.operation(options);
904
- var args = Array.prototype.slice.call(arguments, 1);
905
- var callback = args.pop();
906
- args.push(function(err) {
907
- if (op.retry(err)) {
908
- return;
909
- }
910
- if (err) {
911
- arguments[0] = op.mainError();
912
- }
913
- callback.apply(this, arguments);
914
- });
915
- op.attempt(function() {
916
- original2.apply(obj, args);
917
- });
918
- }.bind(obj, original);
919
- obj[method].options = options;
938
+ });
920
939
  }
921
- };
922
- }
923
- });
924
- var require_retry2 = __commonJS2({
925
- "../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module) {
926
- "use strict";
927
- module.exports = require_retry();
940
+ }
941
+ });
942
+ return generator;
943
+ }
944
+ function validateConcurrency(concurrency) {
945
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
946
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
928
947
  }
929
- });
930
- var import_p_limit2 = __toESM2(require_p_limit2());
931
- var import_retry = __toESM2(require_retry2(), 1);
932
- var networkErrorMsgs = /* @__PURE__ */ new Set([
933
- "Failed to fetch",
948
+ }
949
+
950
+ // ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
951
+ var import_retry = __toESM(require_retry2(), 1);
952
+
953
+ // ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
954
+ var objectToString = Object.prototype.toString;
955
+ var isError = (value) => objectToString.call(value) === "[object Error]";
956
+ var errorMessages = /* @__PURE__ */ new Set([
957
+ "network error",
934
958
  // Chrome
935
959
  "NetworkError when attempting to fetch resource.",
936
960
  // Firefox
937
961
  "The Internet connection appears to be offline.",
938
- // Safari
962
+ // Safari 16
939
963
  "Network request failed",
940
964
  // `cross-fetch`
941
- "fetch failed"
965
+ "fetch failed",
942
966
  // Undici (Node.js)
967
+ "terminated",
968
+ // Undici (Node.js)
969
+ " A network error occurred.",
970
+ // Bun (WebKit)
971
+ "Network connection lost"
972
+ // Cloudflare Workers (fetch)
943
973
  ]);
974
+ function isNetworkError(error) {
975
+ const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
976
+ if (!isValid) {
977
+ return false;
978
+ }
979
+ const { message, stack } = error;
980
+ if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
981
+ return stack === void 0 || "__sentry_captured__" in error;
982
+ }
983
+ if (message.startsWith("error sending request for url")) {
984
+ return true;
985
+ }
986
+ if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
987
+ return true;
988
+ }
989
+ return errorMessages.has(message);
990
+ }
991
+
992
+ // ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
944
993
  var AbortError = class extends Error {
945
994
  constructor(message) {
946
995
  super();
@@ -961,63 +1010,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
961
1010
  error.retriesLeft = retriesLeft;
962
1011
  return error;
963
1012
  };
964
- var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
965
- var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
966
1013
  async function pRetry(input, options) {
967
1014
  return new Promise((resolve, reject) => {
968
- options = {
969
- onFailedAttempt() {
970
- },
971
- retries: 10,
972
- ...options
1015
+ var _a, _b, _c;
1016
+ options = { ...options };
1017
+ (_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
973
1018
  };
1019
+ (_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
1020
+ (_c = options.retries) != null ? _c : options.retries = 10;
974
1021
  const operation = import_retry.default.operation(options);
1022
+ const abortHandler = () => {
1023
+ var _a2;
1024
+ operation.stop();
1025
+ reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
1026
+ };
1027
+ if (options.signal && !options.signal.aborted) {
1028
+ options.signal.addEventListener("abort", abortHandler, { once: true });
1029
+ }
1030
+ const cleanUp = () => {
1031
+ var _a2;
1032
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
1033
+ operation.stop();
1034
+ };
975
1035
  operation.attempt(async (attemptNumber) => {
976
1036
  try {
977
- resolve(await input(attemptNumber));
1037
+ const result = await input(attemptNumber);
1038
+ cleanUp();
1039
+ resolve(result);
978
1040
  } catch (error) {
979
- if (!(error instanceof Error)) {
980
- reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
981
- return;
982
- }
983
- if (error instanceof AbortError) {
984
- operation.stop();
985
- reject(error.originalError);
986
- } else if (error instanceof TypeError && !isNetworkError(error.message)) {
987
- operation.stop();
988
- reject(error);
989
- } else {
1041
+ try {
1042
+ if (!(error instanceof Error)) {
1043
+ throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
1044
+ }
1045
+ if (error instanceof AbortError) {
1046
+ throw error.originalError;
1047
+ }
1048
+ if (error instanceof TypeError && !isNetworkError(error)) {
1049
+ throw error;
1050
+ }
990
1051
  decorateErrorWithCounts(error, attemptNumber, options);
991
- try {
992
- await options.onFailedAttempt(error);
993
- } catch (error2) {
994
- reject(error2);
995
- return;
1052
+ if (!await options.shouldRetry(error)) {
1053
+ operation.stop();
1054
+ reject(error);
996
1055
  }
1056
+ await options.onFailedAttempt(error);
997
1057
  if (!operation.retry(error)) {
998
- reject(operation.mainError());
1058
+ throw operation.mainError();
999
1059
  }
1060
+ } catch (finalError) {
1061
+ decorateErrorWithCounts(finalError, attemptNumber, options);
1062
+ cleanUp();
1063
+ reject(finalError);
1000
1064
  }
1001
1065
  }
1002
1066
  });
1003
- if (options.signal && !options.signal.aborted) {
1004
- options.signal.addEventListener("abort", () => {
1005
- operation.stop();
1006
- const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
1007
- reject(reason instanceof Error ? reason : getDOMException(reason));
1008
- }, {
1009
- once: true
1010
- });
1011
- }
1012
1067
  });
1013
1068
  }
1069
+
1070
+ // ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
1014
1071
  var AbortError2 = class extends Error {
1015
1072
  constructor() {
1016
1073
  super("Throttled function aborted");
1017
1074
  this.name = "AbortError";
1018
1075
  }
1019
1076
  };
1020
- function pThrottle({ limit, interval, strict }) {
1077
+ function pThrottle({ limit, interval, strict, onDelay }) {
1021
1078
  if (!Number.isFinite(limit)) {
1022
1079
  throw new TypeError("Expected `limit` to be a finite number");
1023
1080
  }
@@ -1045,32 +1102,38 @@ function pThrottle({ limit, interval, strict }) {
1045
1102
  const strictTicks = [];
1046
1103
  function strictDelay() {
1047
1104
  const now = Date.now();
1048
- if (strictTicks.length < limit) {
1049
- strictTicks.push(now);
1050
- return 0;
1105
+ if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
1106
+ strictTicks.length = 0;
1051
1107
  }
1052
- const earliestTime = strictTicks.shift() + interval;
1053
- if (now >= earliestTime) {
1108
+ if (strictTicks.length < limit) {
1054
1109
  strictTicks.push(now);
1055
1110
  return 0;
1056
1111
  }
1057
- strictTicks.push(earliestTime);
1058
- return earliestTime - now;
1112
+ const nextExecutionTime = strictTicks[0] + interval;
1113
+ strictTicks.shift();
1114
+ strictTicks.push(nextExecutionTime);
1115
+ return Math.max(0, nextExecutionTime - now);
1059
1116
  }
1060
1117
  const getDelay = strict ? strictDelay : windowedDelay;
1061
1118
  return (function_) => {
1062
- const throttled = function(...args) {
1119
+ const throttled = function(...arguments_) {
1063
1120
  if (!throttled.isEnabled) {
1064
- return (async () => function_.apply(this, args))();
1121
+ return (async () => function_.apply(this, arguments_))();
1065
1122
  }
1066
- let timeout;
1123
+ let timeoutId;
1067
1124
  return new Promise((resolve, reject) => {
1068
1125
  const execute = () => {
1069
- resolve(function_.apply(this, args));
1070
- queue.delete(timeout);
1126
+ resolve(function_.apply(this, arguments_));
1127
+ queue.delete(timeoutId);
1071
1128
  };
1072
- timeout = setTimeout(execute, getDelay());
1073
- queue.set(timeout, reject);
1129
+ const delay = getDelay();
1130
+ if (delay > 0) {
1131
+ timeoutId = setTimeout(execute, delay);
1132
+ queue.set(timeoutId, reject);
1133
+ onDelay == null ? void 0 : onDelay(...arguments_);
1134
+ } else {
1135
+ execute();
1136
+ }
1074
1137
  });
1075
1138
  };
1076
1139
  throttled.abort = () => {
@@ -1082,16 +1145,29 @@ function pThrottle({ limit, interval, strict }) {
1082
1145
  strictTicks.splice(0, strictTicks.length);
1083
1146
  };
1084
1147
  throttled.isEnabled = true;
1148
+ Object.defineProperty(throttled, "queueSize", {
1149
+ get() {
1150
+ return queue.size;
1151
+ }
1152
+ });
1085
1153
  return throttled;
1086
1154
  };
1087
1155
  }
1156
+
1157
+ // ../canvas/dist/index.mjs
1158
+ var __typeError3 = (msg) => {
1159
+ throw TypeError(msg);
1160
+ };
1161
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1162
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1163
+ 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);
1088
1164
  function createLimitPolicy({
1089
1165
  throttle = { interval: 1e3, limit: 10 },
1090
- retry: retry2 = { retries: 1, factor: 1.66 },
1166
+ retry: retry3 = { retries: 1, factor: 1.66 },
1091
1167
  limit = 10
1092
1168
  }) {
1093
1169
  const throttler = throttle ? pThrottle(throttle) : null;
1094
- const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
1170
+ const limiter = limit ? pLimit2(limit) : null;
1095
1171
  return function limitPolicy(func) {
1096
1172
  let currentFunc = async () => await func();
1097
1173
  if (throttler) {
@@ -1102,13 +1178,13 @@ function createLimitPolicy({
1102
1178
  const limitFunc = currentFunc;
1103
1179
  currentFunc = () => limiter(limitFunc);
1104
1180
  }
1105
- if (retry2) {
1181
+ if (retry3) {
1106
1182
  const retryFunc = currentFunc;
1107
1183
  currentFunc = () => pRetry(retryFunc, {
1108
- ...retry2,
1184
+ ...retry3,
1109
1185
  onFailedAttempt: async (error) => {
1110
- if (retry2.onFailedAttempt) {
1111
- await retry2.onFailedAttempt(error);
1186
+ if (retry3.onFailedAttempt) {
1187
+ await retry3.onFailedAttempt(error);
1112
1188
  }
1113
1189
  if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1114
1190
  throw error;
@@ -1129,7 +1205,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1129
1205
  }
1130
1206
  getContentTypes(options) {
1131
1207
  const { projectId } = this.options;
1132
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1208
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1133
1209
  return this.apiClient(fetchUri);
1134
1210
  }
1135
1211
  getEntries(options) {
@@ -1137,11 +1213,11 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1137
1213
  const { skipDataResolution, filters, ...params } = options;
1138
1214
  const rewrittenFilters = rewriteFiltersForApi(filters);
1139
1215
  if (skipDataResolution) {
1140
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1216
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1141
1217
  return this.apiClient(url);
1142
1218
  }
1143
1219
  const edgeUrl = this.createUrl(
1144
- __privateGet2(_ContentClient2, _entriesUrl),
1220
+ __privateGet3(_ContentClient2, _entriesUrl),
1145
1221
  { ...this.getEdgeOptions(params), ...rewrittenFilters },
1146
1222
  this.edgeApiHost
1147
1223
  );
@@ -1159,7 +1235,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1159
1235
  return this.apiClient(historyUrl);
1160
1236
  }
1161
1237
  async upsertContentType(body, opts = {}) {
1162
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1238
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
1163
1239
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
1164
1240
  delete body.contentType.slugSettings;
1165
1241
  }
@@ -1171,7 +1247,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1171
1247
  });
1172
1248
  }
1173
1249
  async upsertEntry(body, options) {
1174
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1250
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
1175
1251
  const headers = {};
1176
1252
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
1177
1253
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -1185,7 +1261,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1185
1261
  return { modified: response.headers.get("x-modified-at") };
1186
1262
  }
1187
1263
  async deleteContentType(body) {
1188
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1264
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
1189
1265
  await this.apiClient(fetchUri, {
1190
1266
  method: "DELETE",
1191
1267
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1193,7 +1269,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1193
1269
  });
1194
1270
  }
1195
1271
  async deleteEntry(body) {
1196
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1272
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
1197
1273
  await this.apiClient(fetchUri, {
1198
1274
  method: "DELETE",
1199
1275
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1212,8 +1288,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1212
1288
  };
1213
1289
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
1214
1290
  _entriesUrl = /* @__PURE__ */ new WeakMap();
1215
- __privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1216
- __privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
1291
+ __privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1292
+ __privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
1217
1293
  var _url8;
1218
1294
  var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1219
1295
  constructor(options) {
@@ -1222,12 +1298,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1222
1298
  /** Fetches all DataTypes for a project */
1223
1299
  async get(options) {
1224
1300
  const { projectId } = this.options;
1225
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
1301
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
1226
1302
  return await this.apiClient(fetchUri);
1227
1303
  }
1228
1304
  /** Updates or creates (based on id) a DataType */
1229
1305
  async upsert(body) {
1230
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1306
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1231
1307
  await this.apiClient(fetchUri, {
1232
1308
  method: "PUT",
1233
1309
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1236,7 +1312,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1236
1312
  }
1237
1313
  /** Deletes a DataType */
1238
1314
  async remove(body) {
1239
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1315
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1240
1316
  await this.apiClient(fetchUri, {
1241
1317
  method: "DELETE",
1242
1318
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1245,7 +1321,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1245
1321
  }
1246
1322
  };
1247
1323
  _url8 = /* @__PURE__ */ new WeakMap();
1248
- __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
1324
+ __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
1249
1325
  var CANVAS_DRAFT_STATE = 0;
1250
1326
  var CANVAS_PUBLISHED_STATE = 64;
1251
1327
  var CANVAS_EDITOR_STATE = 63;
@@ -1264,7 +1340,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1264
1340
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
1265
1341
  */
1266
1342
  get(options) {
1267
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1343
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
1268
1344
  ...options,
1269
1345
  teamId: this.teamId
1270
1346
  });
@@ -1274,7 +1350,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1274
1350
  * Creates or updates a custom AI property editor on a Mesh app.
1275
1351
  */
1276
1352
  async deploy(body) {
1277
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1353
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1278
1354
  await this.apiClient(fetchUri, {
1279
1355
  method: "PUT",
1280
1356
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1285,7 +1361,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1285
1361
  * Removes a custom AI property editor from a Mesh app.
1286
1362
  */
1287
1363
  async delete(body) {
1288
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1364
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1289
1365
  await this.apiClient(fetchUri, {
1290
1366
  method: "DELETE",
1291
1367
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1294,7 +1370,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1294
1370
  }
1295
1371
  };
1296
1372
  _baseUrl = /* @__PURE__ */ new WeakMap();
1297
- __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1373
+ __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1298
1374
  var _url22;
1299
1375
  var _projectsUrl;
1300
1376
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
@@ -1303,7 +1379,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1303
1379
  }
1304
1380
  /** Fetches single Project */
1305
1381
  async get(options) {
1306
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
1382
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1307
1383
  return await this.apiClient(fetchUri);
1308
1384
  }
1309
1385
  /**
@@ -1312,12 +1388,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1312
1388
  * When omitted, returns all accessible teams and their projects.
1313
1389
  */
1314
1390
  async getProjects(options) {
1315
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1391
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1316
1392
  return await this.apiClient(fetchUri);
1317
1393
  }
1318
1394
  /** Updates or creates (based on id) a Project */
1319
1395
  async upsert(body) {
1320
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1396
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1321
1397
  return await this.apiClient(fetchUri, {
1322
1398
  method: "PUT",
1323
1399
  body: JSON.stringify({ ...body })
@@ -1325,7 +1401,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1325
1401
  }
1326
1402
  /** Deletes a Project */
1327
1403
  async delete(body) {
1328
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1404
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1329
1405
  await this.apiClient(fetchUri, {
1330
1406
  method: "DELETE",
1331
1407
  body: JSON.stringify({ ...body }),
@@ -1335,8 +1411,8 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1335
1411
  };
1336
1412
  _url22 = /* @__PURE__ */ new WeakMap();
1337
1413
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1338
- __privateAdd2(_ProjectClient, _url22, "/api/v1/project");
1339
- __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1414
+ __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1415
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1340
1416
  var ROUTE_URL = "/api/v1/route";
1341
1417
  var RouteClient = class extends ApiClient {
1342
1418
  constructor(options) {
@@ -1550,7 +1626,7 @@ function createLimiter(concurrency) {
1550
1626
  });
1551
1627
  };
1552
1628
  }
1553
- async function retry(fn, options) {
1629
+ async function retry2(fn, options) {
1554
1630
  let lastError;
1555
1631
  let delay = 1e3;
1556
1632
  for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
@@ -1590,7 +1666,7 @@ function createLimitPolicy2({
1590
1666
  }
1591
1667
  if (retryOptions) {
1592
1668
  const retryFunc = currentFunc;
1593
- currentFunc = () => retry(retryFunc, {
1669
+ currentFunc = () => retry2(retryFunc, {
1594
1670
  ...retryOptions,
1595
1671
  onFailedAttempt: async (error) => {
1596
1672
  if (retryOptions.onFailedAttempt) {