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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cache.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) {
@@ -176,18 +424,18 @@ var ApiClientError = class _ApiClientError extends Error {
176
424
  `${errorMessage}
177
425
  ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
178
426
  );
179
- this.errorMessage = errorMessage;
180
- this.fetchMethod = fetchMethod;
181
- this.fetchUri = fetchUri;
182
- this.statusCode = statusCode;
183
- this.statusText = statusText;
184
- this.requestId = requestId;
427
+ __publicField2(this, "errorMessage", errorMessage);
428
+ __publicField2(this, "fetchMethod", fetchMethod);
429
+ __publicField2(this, "fetchUri", fetchUri);
430
+ __publicField2(this, "statusCode", statusCode);
431
+ __publicField2(this, "statusText", statusText);
432
+ __publicField2(this, "requestId", requestId);
185
433
  Object.setPrototypeOf(this, _ApiClientError.prototype);
186
434
  }
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,194 @@ 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([
946
- "Failed to fetch",
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.3.2/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",
947
971
  // Chrome
948
972
  "NetworkError when attempting to fetch resource.",
949
973
  // Firefox
950
974
  "The Internet connection appears to be offline.",
951
- // Safari
975
+ // Safari 16
952
976
  "Network request failed",
953
977
  // `cross-fetch`
954
- "fetch failed"
978
+ "fetch failed",
955
979
  // Undici (Node.js)
980
+ "terminated",
981
+ // Undici (Node.js)
982
+ " A network error occurred.",
983
+ // Bun (WebKit)
984
+ "Network connection lost"
985
+ // Cloudflare Workers (fetch)
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
+ const { message, stack } = error;
993
+ if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
994
+ return stack === void 0 || "__sentry_captured__" in error;
995
+ }
996
+ if (message.startsWith("error sending request for url")) {
997
+ return true;
998
+ }
999
+ if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
1000
+ return true;
1001
+ }
1002
+ return errorMessages.has(message);
1003
+ }
1004
+
1005
+ // ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
957
1006
  var AbortError = class extends Error {
958
1007
  constructor(message) {
959
1008
  super();
@@ -974,63 +1023,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
974
1023
  error.retriesLeft = retriesLeft;
975
1024
  return error;
976
1025
  };
977
- var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
978
- var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
979
1026
  async function pRetry(input, options) {
980
1027
  return new Promise((resolve, reject) => {
981
- options = {
982
- onFailedAttempt() {
983
- },
984
- retries: 10,
985
- ...options
1028
+ var _a, _b, _c;
1029
+ options = { ...options };
1030
+ (_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
986
1031
  };
1032
+ (_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
1033
+ (_c = options.retries) != null ? _c : options.retries = 10;
987
1034
  const operation = import_retry.default.operation(options);
1035
+ const abortHandler = () => {
1036
+ var _a2;
1037
+ operation.stop();
1038
+ reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
1039
+ };
1040
+ if (options.signal && !options.signal.aborted) {
1041
+ options.signal.addEventListener("abort", abortHandler, { once: true });
1042
+ }
1043
+ const cleanUp = () => {
1044
+ var _a2;
1045
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
1046
+ operation.stop();
1047
+ };
988
1048
  operation.attempt(async (attemptNumber) => {
989
1049
  try {
990
- resolve(await input(attemptNumber));
1050
+ const result = await input(attemptNumber);
1051
+ cleanUp();
1052
+ resolve(result);
991
1053
  } 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 {
1054
+ try {
1055
+ if (!(error instanceof Error)) {
1056
+ throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
1057
+ }
1058
+ if (error instanceof AbortError) {
1059
+ throw error.originalError;
1060
+ }
1061
+ if (error instanceof TypeError && !isNetworkError(error)) {
1062
+ throw error;
1063
+ }
1003
1064
  decorateErrorWithCounts(error, attemptNumber, options);
1004
- try {
1005
- await options.onFailedAttempt(error);
1006
- } catch (error2) {
1007
- reject(error2);
1008
- return;
1065
+ if (!await options.shouldRetry(error)) {
1066
+ operation.stop();
1067
+ reject(error);
1009
1068
  }
1069
+ await options.onFailedAttempt(error);
1010
1070
  if (!operation.retry(error)) {
1011
- reject(operation.mainError());
1071
+ throw operation.mainError();
1012
1072
  }
1073
+ } catch (finalError) {
1074
+ decorateErrorWithCounts(finalError, attemptNumber, options);
1075
+ cleanUp();
1076
+ reject(finalError);
1013
1077
  }
1014
1078
  }
1015
1079
  });
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
1080
  });
1026
1081
  }
1082
+
1083
+ // ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
1027
1084
  var AbortError2 = class extends Error {
1028
1085
  constructor() {
1029
1086
  super("Throttled function aborted");
1030
1087
  this.name = "AbortError";
1031
1088
  }
1032
1089
  };
1033
- function pThrottle({ limit, interval, strict }) {
1090
+ function pThrottle({ limit, interval, strict, onDelay }) {
1034
1091
  if (!Number.isFinite(limit)) {
1035
1092
  throw new TypeError("Expected `limit` to be a finite number");
1036
1093
  }
@@ -1058,32 +1115,38 @@ function pThrottle({ limit, interval, strict }) {
1058
1115
  const strictTicks = [];
1059
1116
  function strictDelay() {
1060
1117
  const now = Date.now();
1061
- if (strictTicks.length < limit) {
1062
- strictTicks.push(now);
1063
- return 0;
1118
+ if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
1119
+ strictTicks.length = 0;
1064
1120
  }
1065
- const earliestTime = strictTicks.shift() + interval;
1066
- if (now >= earliestTime) {
1121
+ if (strictTicks.length < limit) {
1067
1122
  strictTicks.push(now);
1068
1123
  return 0;
1069
1124
  }
1070
- strictTicks.push(earliestTime);
1071
- return earliestTime - now;
1125
+ const nextExecutionTime = strictTicks[0] + interval;
1126
+ strictTicks.shift();
1127
+ strictTicks.push(nextExecutionTime);
1128
+ return Math.max(0, nextExecutionTime - now);
1072
1129
  }
1073
1130
  const getDelay = strict ? strictDelay : windowedDelay;
1074
1131
  return (function_) => {
1075
- const throttled = function(...args) {
1132
+ const throttled = function(...arguments_) {
1076
1133
  if (!throttled.isEnabled) {
1077
- return (async () => function_.apply(this, args))();
1134
+ return (async () => function_.apply(this, arguments_))();
1078
1135
  }
1079
- let timeout;
1136
+ let timeoutId;
1080
1137
  return new Promise((resolve, reject) => {
1081
1138
  const execute = () => {
1082
- resolve(function_.apply(this, args));
1083
- queue.delete(timeout);
1139
+ resolve(function_.apply(this, arguments_));
1140
+ queue.delete(timeoutId);
1084
1141
  };
1085
- timeout = setTimeout(execute, getDelay());
1086
- queue.set(timeout, reject);
1142
+ const delay = getDelay();
1143
+ if (delay > 0) {
1144
+ timeoutId = setTimeout(execute, delay);
1145
+ queue.set(timeoutId, reject);
1146
+ onDelay == null ? void 0 : onDelay(...arguments_);
1147
+ } else {
1148
+ execute();
1149
+ }
1087
1150
  });
1088
1151
  };
1089
1152
  throttled.abort = () => {
@@ -1095,16 +1158,29 @@ function pThrottle({ limit, interval, strict }) {
1095
1158
  strictTicks.splice(0, strictTicks.length);
1096
1159
  };
1097
1160
  throttled.isEnabled = true;
1161
+ Object.defineProperty(throttled, "queueSize", {
1162
+ get() {
1163
+ return queue.size;
1164
+ }
1165
+ });
1098
1166
  return throttled;
1099
1167
  };
1100
1168
  }
1169
+
1170
+ // ../canvas/dist/index.mjs
1171
+ var __typeError3 = (msg) => {
1172
+ throw TypeError(msg);
1173
+ };
1174
+ var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
1175
+ var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1176
+ 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
1177
  function createLimitPolicy({
1102
1178
  throttle = { interval: 1e3, limit: 10 },
1103
- retry: retry2 = { retries: 1, factor: 1.66 },
1179
+ retry: retry3 = { retries: 1, factor: 1.66 },
1104
1180
  limit = 10
1105
1181
  }) {
1106
1182
  const throttler = throttle ? pThrottle(throttle) : null;
1107
- const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
1183
+ const limiter = limit ? pLimit2(limit) : null;
1108
1184
  return function limitPolicy(func) {
1109
1185
  let currentFunc = async () => await func();
1110
1186
  if (throttler) {
@@ -1115,13 +1191,13 @@ function createLimitPolicy({
1115
1191
  const limitFunc = currentFunc;
1116
1192
  currentFunc = () => limiter(limitFunc);
1117
1193
  }
1118
- if (retry2) {
1194
+ if (retry3) {
1119
1195
  const retryFunc = currentFunc;
1120
1196
  currentFunc = () => pRetry(retryFunc, {
1121
- ...retry2,
1197
+ ...retry3,
1122
1198
  onFailedAttempt: async (error) => {
1123
- if (retry2.onFailedAttempt) {
1124
- await retry2.onFailedAttempt(error);
1199
+ if (retry3.onFailedAttempt) {
1200
+ await retry3.onFailedAttempt(error);
1125
1201
  }
1126
1202
  if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
1127
1203
  throw error;
@@ -1142,7 +1218,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1142
1218
  }
1143
1219
  getContentTypes(options) {
1144
1220
  const { projectId } = this.options;
1145
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1221
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
1146
1222
  return this.apiClient(fetchUri);
1147
1223
  }
1148
1224
  getEntries(options) {
@@ -1150,11 +1226,11 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1150
1226
  const { skipDataResolution, filters, ...params } = options;
1151
1227
  const rewrittenFilters = rewriteFiltersForApi(filters);
1152
1228
  if (skipDataResolution) {
1153
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1229
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1154
1230
  return this.apiClient(url);
1155
1231
  }
1156
1232
  const edgeUrl = this.createUrl(
1157
- __privateGet2(_ContentClient2, _entriesUrl),
1233
+ __privateGet3(_ContentClient2, _entriesUrl),
1158
1234
  { ...this.getEdgeOptions(params), ...rewrittenFilters },
1159
1235
  this.edgeApiHost
1160
1236
  );
@@ -1172,7 +1248,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1172
1248
  return this.apiClient(historyUrl);
1173
1249
  }
1174
1250
  async upsertContentType(body, opts = {}) {
1175
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1251
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
1176
1252
  if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
1177
1253
  delete body.contentType.slugSettings;
1178
1254
  }
@@ -1184,7 +1260,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1184
1260
  });
1185
1261
  }
1186
1262
  async upsertEntry(body, options) {
1187
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1263
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
1188
1264
  const headers = {};
1189
1265
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
1190
1266
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -1198,7 +1274,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1198
1274
  return { modified: response.headers.get("x-modified-at") };
1199
1275
  }
1200
1276
  async deleteContentType(body) {
1201
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
1277
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
1202
1278
  await this.apiClient(fetchUri, {
1203
1279
  method: "DELETE",
1204
1280
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1206,7 +1282,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1206
1282
  });
1207
1283
  }
1208
1284
  async deleteEntry(body) {
1209
- const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
1285
+ const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
1210
1286
  await this.apiClient(fetchUri, {
1211
1287
  method: "DELETE",
1212
1288
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1225,8 +1301,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1225
1301
  };
1226
1302
  _contentTypesUrl = /* @__PURE__ */ new WeakMap();
1227
1303
  _entriesUrl = /* @__PURE__ */ new WeakMap();
1228
- __privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1229
- __privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
1304
+ __privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
1305
+ __privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
1230
1306
  var _url8;
1231
1307
  var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1232
1308
  constructor(options) {
@@ -1235,12 +1311,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1235
1311
  /** Fetches all DataTypes for a project */
1236
1312
  async get(options) {
1237
1313
  const { projectId } = this.options;
1238
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
1314
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
1239
1315
  return await this.apiClient(fetchUri);
1240
1316
  }
1241
1317
  /** Updates or creates (based on id) a DataType */
1242
1318
  async upsert(body) {
1243
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1319
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1244
1320
  await this.apiClient(fetchUri, {
1245
1321
  method: "PUT",
1246
1322
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1249,7 +1325,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1249
1325
  }
1250
1326
  /** Deletes a DataType */
1251
1327
  async remove(body) {
1252
- const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
1328
+ const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1253
1329
  await this.apiClient(fetchUri, {
1254
1330
  method: "DELETE",
1255
1331
  body: JSON.stringify({ ...body, projectId: this.options.projectId }),
@@ -1258,7 +1334,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1258
1334
  }
1259
1335
  };
1260
1336
  _url8 = /* @__PURE__ */ new WeakMap();
1261
- __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
1337
+ __privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
1262
1338
  var CANVAS_DRAFT_STATE = 0;
1263
1339
  var CANVAS_PUBLISHED_STATE = 64;
1264
1340
  var CANVAS_EDITOR_STATE = 63;
@@ -1277,7 +1353,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1277
1353
  * Gets a list of property type and hook names for the current team, including public integrations' hooks.
1278
1354
  */
1279
1355
  get(options) {
1280
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
1356
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
1281
1357
  ...options,
1282
1358
  teamId: this.teamId
1283
1359
  });
@@ -1287,7 +1363,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1287
1363
  * Creates or updates a custom AI property editor on a Mesh app.
1288
1364
  */
1289
1365
  async deploy(body) {
1290
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1366
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1291
1367
  await this.apiClient(fetchUri, {
1292
1368
  method: "PUT",
1293
1369
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1298,7 +1374,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1298
1374
  * Removes a custom AI property editor from a Mesh app.
1299
1375
  */
1300
1376
  async delete(body) {
1301
- const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
1377
+ const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
1302
1378
  await this.apiClient(fetchUri, {
1303
1379
  method: "DELETE",
1304
1380
  body: JSON.stringify({ ...body, teamId: this.teamId }),
@@ -1307,7 +1383,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
1307
1383
  }
1308
1384
  };
1309
1385
  _baseUrl = /* @__PURE__ */ new WeakMap();
1310
- __privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1386
+ __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
1311
1387
  var _url22;
1312
1388
  var _projectsUrl;
1313
1389
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
@@ -1316,7 +1392,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1316
1392
  }
1317
1393
  /** Fetches single Project */
1318
1394
  async get(options) {
1319
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
1395
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
1320
1396
  return await this.apiClient(fetchUri);
1321
1397
  }
1322
1398
  /**
@@ -1325,12 +1401,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1325
1401
  * When omitted, returns all accessible teams and their projects.
1326
1402
  */
1327
1403
  async getProjects(options) {
1328
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1404
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
1329
1405
  return await this.apiClient(fetchUri);
1330
1406
  }
1331
1407
  /** Updates or creates (based on id) a Project */
1332
1408
  async upsert(body) {
1333
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1409
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1334
1410
  return await this.apiClient(fetchUri, {
1335
1411
  method: "PUT",
1336
1412
  body: JSON.stringify({ ...body })
@@ -1338,7 +1414,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1338
1414
  }
1339
1415
  /** Deletes a Project */
1340
1416
  async delete(body) {
1341
- const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
1417
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
1342
1418
  await this.apiClient(fetchUri, {
1343
1419
  method: "DELETE",
1344
1420
  body: JSON.stringify({ ...body }),
@@ -1348,8 +1424,8 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
1348
1424
  };
1349
1425
  _url22 = /* @__PURE__ */ new WeakMap();
1350
1426
  _projectsUrl = /* @__PURE__ */ new WeakMap();
1351
- __privateAdd2(_ProjectClient, _url22, "/api/v1/project");
1352
- __privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
1427
+ __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
1428
+ __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
1353
1429
  var ROUTE_URL = "/api/v1/route";
1354
1430
  var RouteClient = class extends ApiClient {
1355
1431
  constructor(options) {
@@ -1563,7 +1639,7 @@ function createLimiter(concurrency) {
1563
1639
  });
1564
1640
  };
1565
1641
  }
1566
- async function retry(fn, options) {
1642
+ async function retry2(fn, options) {
1567
1643
  let lastError;
1568
1644
  let delay = 1e3;
1569
1645
  for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
@@ -1603,7 +1679,7 @@ function createLimitPolicy2({
1603
1679
  }
1604
1680
  if (retryOptions) {
1605
1681
  const retryFunc = currentFunc;
1606
- currentFunc = () => retry(retryFunc, {
1682
+ currentFunc = () => retry2(retryFunc, {
1607
1683
  ...retryOptions,
1608
1684
  onFailedAttempt: async (error) => {
1609
1685
  if (retryOptions.onFailedAttempt) {