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