@uniformdev/next-app-router 20.61.2-alpha.3 → 20.61.2-alpha.4

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) {
@@ -174,7 +422,7 @@ var ApiClientError = class _ApiClientError extends Error {
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,187 @@ 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([
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.1.0/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",
958
+ // Chrome
933
959
  "Failed to fetch",
934
960
  // Chrome
935
961
  "NetworkError when attempting to fetch resource.",
936
962
  // Firefox
937
963
  "The Internet connection appears to be offline.",
938
- // Safari
964
+ // Safari 16
965
+ "Load failed",
966
+ // Safari 17+
939
967
  "Network request failed",
940
968
  // `cross-fetch`
941
- "fetch failed"
969
+ "fetch failed",
970
+ // Undici (Node.js)
971
+ "terminated"
942
972
  // Undici (Node.js)
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
+ if (error.message === "Load failed") {
980
+ return error.stack === void 0;
981
+ }
982
+ return errorMessages.has(error.message);
983
+ }
984
+
985
+ // ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
944
986
  var AbortError = class extends Error {
945
987
  constructor(message) {
946
988
  super();
@@ -961,63 +1003,68 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
961
1003
  error.retriesLeft = retriesLeft;
962
1004
  return error;
963
1005
  };
964
- var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
965
- var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
966
1006
  async function pRetry(input, options) {
967
1007
  return new Promise((resolve, reject) => {
968
- options = {
969
- onFailedAttempt() {
970
- },
971
- retries: 10,
972
- ...options
1008
+ var _a, _b, _c;
1009
+ options = { ...options };
1010
+ (_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
973
1011
  };
1012
+ (_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
1013
+ (_c = options.retries) != null ? _c : options.retries = 10;
974
1014
  const operation = import_retry.default.operation(options);
1015
+ const abortHandler = () => {
1016
+ var _a2;
1017
+ operation.stop();
1018
+ reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
1019
+ };
1020
+ if (options.signal && !options.signal.aborted) {
1021
+ options.signal.addEventListener("abort", abortHandler, { once: true });
1022
+ }
1023
+ const cleanUp = () => {
1024
+ var _a2;
1025
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
1026
+ operation.stop();
1027
+ };
975
1028
  operation.attempt(async (attemptNumber) => {
976
1029
  try {
977
- resolve(await input(attemptNumber));
1030
+ const result = await input(attemptNumber);
1031
+ cleanUp();
1032
+ resolve(result);
978
1033
  } 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 {
1034
+ try {
1035
+ if (!(error instanceof Error)) {
1036
+ throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
1037
+ }
1038
+ if (error instanceof AbortError) {
1039
+ throw error.originalError;
1040
+ }
1041
+ if (error instanceof TypeError && !isNetworkError(error)) {
1042
+ throw error;
1043
+ }
990
1044
  decorateErrorWithCounts(error, attemptNumber, options);
991
- try {
992
- await options.onFailedAttempt(error);
993
- } catch (error2) {
994
- reject(error2);
995
- return;
1045
+ if (!await options.shouldRetry(error)) {
1046
+ operation.stop();
1047
+ reject(error);
996
1048
  }
1049
+ await options.onFailedAttempt(error);
997
1050
  if (!operation.retry(error)) {
998
- reject(operation.mainError());
1051
+ throw operation.mainError();
999
1052
  }
1053
+ } catch (finalError) {
1054
+ decorateErrorWithCounts(finalError, attemptNumber, options);
1055
+ cleanUp();
1056
+ reject(finalError);
1000
1057
  }
1001
1058
  }
1002
1059
  });
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
1060
  });
1013
1061
  }
1014
- var AbortError2 = class extends Error {
1015
- constructor() {
1016
- super("Throttled function aborted");
1017
- this.name = "AbortError";
1018
- }
1019
- };
1020
- function pThrottle({ limit, interval, strict }) {
1062
+
1063
+ // ../../node_modules/.pnpm/p-throttle@7.0.0/node_modules/p-throttle/index.js
1064
+ var registry = new FinalizationRegistry(({ signal, aborted }) => {
1065
+ signal == null ? void 0 : signal.removeEventListener("abort", aborted);
1066
+ });
1067
+ function pThrottle({ limit, interval, strict, signal, onDelay }) {
1021
1068
  if (!Number.isFinite(limit)) {
1022
1069
  throw new TypeError("Expected `limit` to be a finite number");
1023
1070
  }
@@ -1045,53 +1092,75 @@ function pThrottle({ limit, interval, strict }) {
1045
1092
  const strictTicks = [];
1046
1093
  function strictDelay() {
1047
1094
  const now = Date.now();
1048
- if (strictTicks.length < limit) {
1049
- strictTicks.push(now);
1050
- return 0;
1095
+ if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
1096
+ strictTicks.length = 0;
1051
1097
  }
1052
- const earliestTime = strictTicks.shift() + interval;
1053
- if (now >= earliestTime) {
1098
+ if (strictTicks.length < limit) {
1054
1099
  strictTicks.push(now);
1055
1100
  return 0;
1056
1101
  }
1057
- strictTicks.push(earliestTime);
1058
- return earliestTime - now;
1102
+ const nextExecutionTime = strictTicks[0] + interval;
1103
+ strictTicks.shift();
1104
+ strictTicks.push(nextExecutionTime);
1105
+ return Math.max(0, nextExecutionTime - now);
1059
1106
  }
1060
1107
  const getDelay = strict ? strictDelay : windowedDelay;
1061
1108
  return (function_) => {
1062
- const throttled = function(...args) {
1109
+ const throttled = function(...arguments_) {
1063
1110
  if (!throttled.isEnabled) {
1064
- return (async () => function_.apply(this, args))();
1111
+ return (async () => function_.apply(this, arguments_))();
1065
1112
  }
1066
- let timeout;
1113
+ let timeoutId;
1067
1114
  return new Promise((resolve, reject) => {
1068
1115
  const execute = () => {
1069
- resolve(function_.apply(this, args));
1070
- queue.delete(timeout);
1116
+ resolve(function_.apply(this, arguments_));
1117
+ queue.delete(timeoutId);
1071
1118
  };
1072
- timeout = setTimeout(execute, getDelay());
1073
- queue.set(timeout, reject);
1119
+ const delay = getDelay();
1120
+ if (delay > 0) {
1121
+ timeoutId = setTimeout(execute, delay);
1122
+ queue.set(timeoutId, reject);
1123
+ onDelay == null ? void 0 : onDelay(...arguments_);
1124
+ } else {
1125
+ execute();
1126
+ }
1074
1127
  });
1075
1128
  };
1076
- throttled.abort = () => {
1129
+ const aborted = () => {
1077
1130
  for (const timeout of queue.keys()) {
1078
1131
  clearTimeout(timeout);
1079
- queue.get(timeout)(new AbortError2());
1132
+ queue.get(timeout)(signal.reason);
1080
1133
  }
1081
1134
  queue.clear();
1082
1135
  strictTicks.splice(0, strictTicks.length);
1083
1136
  };
1137
+ registry.register(throttled, { signal, aborted });
1138
+ signal == null ? void 0 : signal.throwIfAborted();
1139
+ signal == null ? void 0 : signal.addEventListener("abort", aborted, { once: true });
1084
1140
  throttled.isEnabled = true;
1141
+ Object.defineProperty(throttled, "queueSize", {
1142
+ get() {
1143
+ return queue.size;
1144
+ }
1145
+ });
1085
1146
  return throttled;
1086
1147
  };
1087
1148
  }
1149
+
1150
+ // ../canvas/dist/index.mjs
1151
+ var __typeError3 = (msg) => {
1152
+ throw TypeError(msg);
1153
+ };
1154
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1155
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1156
+ 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
1157
  function createLimitPolicy({
1089
1158
  throttle = { interval: 1e3, limit: 10 },
1090
- retry: retry2 = { retries: 1, factor: 1.66 },
1159
+ retry: retry3 = { retries: 1, factor: 1.66 },
1091
1160
  limit = 10
1092
1161
  }) {
1093
1162
  const throttler = throttle ? pThrottle(throttle) : null;
1094
- const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
1163
+ const limiter = limit ? pLimit2(limit) : null;
1095
1164
  return function limitPolicy(func) {
1096
1165
  let currentFunc = async () => await func();
1097
1166
  if (throttler) {
@@ -1102,13 +1171,13 @@ function createLimitPolicy({
1102
1171
  const limitFunc = currentFunc;
1103
1172
  currentFunc = () => limiter(limitFunc);
1104
1173
  }
1105
- if (retry2) {
1174
+ if (retry3) {
1106
1175
  const retryFunc = currentFunc;
1107
1176
  currentFunc = () => pRetry(retryFunc, {
1108
- ...retry2,
1177
+ ...retry3,
1109
1178
  onFailedAttempt: async (error) => {
1110
- if (retry2.onFailedAttempt) {
1111
- await retry2.onFailedAttempt(error);
1179
+ if (retry3.onFailedAttempt) {
1180
+ await retry3.onFailedAttempt(error);
1112
1181
  }
1113
1182
  if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1114
1183
  throw error;
@@ -1129,7 +1198,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1129
1198
  }
1130
1199
  getContentTypes(options) {
1131
1200
  const { projectId } = this.options;
1132
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1201
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1133
1202
  return this.apiClient(fetchUri);
1134
1203
  }
1135
1204
  getEntries(options) {
@@ -1137,11 +1206,11 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1137
1206
  const { skipDataResolution, filters, ...params } = options;
1138
1207
  const rewrittenFilters = rewriteFiltersForApi(filters);
1139
1208
  if (skipDataResolution) {
1140
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1209
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1141
1210
  return this.apiClient(url);
1142
1211
  }
1143
1212
  const edgeUrl = this.createUrl(
1144
- __privateGet2(_ContentClient2, _entriesUrl),
1213
+ __privateGet3(_ContentClient2, _entriesUrl),
1145
1214
  { ...this.getEdgeOptions(params), ...rewrittenFilters },
1146
1215
  this.edgeApiHost
1147
1216
  );
@@ -1159,7 +1228,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1159
1228
  return this.apiClient(historyUrl);
1160
1229
  }
1161
1230
  async upsertContentType(body, opts = {}) {
1162
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1231
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
1163
1232
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
1164
1233
  delete body.contentType.slugSettings;
1165
1234
  }
@@ -1171,7 +1240,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1171
1240
  });
1172
1241
  }
1173
1242
  async upsertEntry(body, options) {
1174
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1243
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
1175
1244
  const headers = {};
1176
1245
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
1177
1246
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -1185,7 +1254,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1185
1254
  return { modified: response.headers.get("x-modified-at") };
1186
1255
  }
1187
1256
  async deleteContentType(body) {
1188
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1257
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
1189
1258
  await this.apiClient(fetchUri, {
1190
1259
  method: "DELETE",
1191
1260
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1193,7 +1262,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1193
1262
  });
1194
1263
  }
1195
1264
  async deleteEntry(body) {
1196
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1265
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
1197
1266
  await this.apiClient(fetchUri, {
1198
1267
  method: "DELETE",
1199
1268
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1212,8 +1281,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1212
1281
  };
1213
1282
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
1214
1283
  _entriesUrl = /* @__PURE__ */ new WeakMap();
1215
- __privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1216
- __privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
1284
+ __privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1285
+ __privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
1217
1286
  var _url8;
1218
1287
  var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1219
1288
  constructor(options) {
@@ -1222,12 +1291,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1222
1291
  /** Fetches all DataTypes for a project */
1223
1292
  async get(options) {
1224
1293
  const { projectId } = this.options;
1225
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
1294
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
1226
1295
  return await this.apiClient(fetchUri);
1227
1296
  }
1228
1297
  /** Updates or creates (based on id) a DataType */
1229
1298
  async upsert(body) {
1230
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1299
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1231
1300
  await this.apiClient(fetchUri, {
1232
1301
  method: "PUT",
1233
1302
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1236,7 +1305,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1236
1305
  }
1237
1306
  /** Deletes a DataType */
1238
1307
  async remove(body) {
1239
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1308
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1240
1309
  await this.apiClient(fetchUri, {
1241
1310
  method: "DELETE",
1242
1311
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1245,7 +1314,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1245
1314
  }
1246
1315
  };
1247
1316
  _url8 = /* @__PURE__ */ new WeakMap();
1248
- __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
1317
+ __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
1249
1318
  var CANVAS_DRAFT_STATE = 0;
1250
1319
  var CANVAS_PUBLISHED_STATE = 64;
1251
1320
  var CANVAS_EDITOR_STATE = 63;
@@ -1264,7 +1333,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1264
1333
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
1265
1334
  */
1266
1335
  get(options) {
1267
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1336
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
1268
1337
  ...options,
1269
1338
  teamId: this.teamId
1270
1339
  });
@@ -1274,7 +1343,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1274
1343
  * Creates or updates a custom AI property editor on a Mesh app.
1275
1344
  */
1276
1345
  async deploy(body) {
1277
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1346
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1278
1347
  await this.apiClient(fetchUri, {
1279
1348
  method: "PUT",
1280
1349
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1285,7 +1354,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1285
1354
  * Removes a custom AI property editor from a Mesh app.
1286
1355
  */
1287
1356
  async delete(body) {
1288
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1357
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1289
1358
  await this.apiClient(fetchUri, {
1290
1359
  method: "DELETE",
1291
1360
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1294,7 +1363,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1294
1363
  }
1295
1364
  };
1296
1365
  _baseUrl = /* @__PURE__ */ new WeakMap();
1297
- __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1366
+ __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1298
1367
  var _url22;
1299
1368
  var _projectsUrl;
1300
1369
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
@@ -1303,7 +1372,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1303
1372
  }
1304
1373
  /** Fetches single Project */
1305
1374
  async get(options) {
1306
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
1375
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1307
1376
  return await this.apiClient(fetchUri);
1308
1377
  }
1309
1378
  /**
@@ -1312,12 +1381,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1312
1381
  * When omitted, returns all accessible teams and their projects.
1313
1382
  */
1314
1383
  async getProjects(options) {
1315
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1384
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1316
1385
  return await this.apiClient(fetchUri);
1317
1386
  }
1318
1387
  /** Updates or creates (based on id) a Project */
1319
1388
  async upsert(body) {
1320
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1389
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1321
1390
  return await this.apiClient(fetchUri, {
1322
1391
  method: "PUT",
1323
1392
  body: JSON.stringify({ ...body })
@@ -1325,7 +1394,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1325
1394
  }
1326
1395
  /** Deletes a Project */
1327
1396
  async delete(body) {
1328
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1397
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1329
1398
  await this.apiClient(fetchUri, {
1330
1399
  method: "DELETE",
1331
1400
  body: JSON.stringify({ ...body }),
@@ -1335,8 +1404,8 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1335
1404
  };
1336
1405
  _url22 = /* @__PURE__ */ new WeakMap();
1337
1406
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1338
- __privateAdd2(_ProjectClient, _url22, "/api/v1/project");
1339
- __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1407
+ __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1408
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1340
1409
  var ROUTE_URL = "/api/v1/route";
1341
1410
  var RouteClient = class extends ApiClient {
1342
1411
  constructor(options) {
@@ -1550,7 +1619,7 @@ function createLimiter(concurrency) {
1550
1619
  });
1551
1620
  };
1552
1621
  }
1553
- async function retry(fn, options) {
1622
+ async function retry2(fn, options) {
1554
1623
  let lastError;
1555
1624
  let delay = 1e3;
1556
1625
  for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
@@ -1590,7 +1659,7 @@ function createLimitPolicy2({
1590
1659
  }
1591
1660
  if (retryOptions) {
1592
1661
  const retryFunc = currentFunc;
1593
- currentFunc = () => retry(retryFunc, {
1662
+ currentFunc = () => retry2(retryFunc, {
1594
1663
  ...retryOptions,
1595
1664
  onFailedAttempt: async (error) => {
1596
1665
  if (retryOptions.onFailedAttempt) {