@uniformdev/next-app-router 20.70.1-alpha.10 → 20.70.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache.js +494 -570
- package/dist/cache.mjs +494 -570
- package/dist/component.js +366 -0
- package/dist/component.mjs +366 -0
- package/dist/handler.js +507 -583
- package/dist/handler.mjs +507 -583
- package/dist/index.esm.js +538 -607
- package/dist/index.js +548 -617
- package/dist/index.mjs +538 -607
- package/dist/middleware.js +471 -524
- package/dist/middleware.mjs +471 -524
- package/package.json +8 -8
package/dist/handler.js
CHANGED
|
@@ -5,10 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __typeError = (msg) => {
|
|
9
|
-
throw TypeError(msg);
|
|
10
|
-
};
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
13
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
10
|
};
|
|
@@ -33,25 +29,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
29
|
mod
|
|
34
30
|
));
|
|
35
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
38
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
39
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
40
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
41
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
42
|
-
set _(value) {
|
|
43
|
-
__privateSet(obj, member, value, setter);
|
|
44
|
-
},
|
|
45
|
-
get _() {
|
|
46
|
-
return __privateGet(obj, member, getter);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
32
|
|
|
50
33
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
51
34
|
var require_yocto_queue = __commonJS({
|
|
52
35
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
53
36
|
"use strict";
|
|
54
|
-
var
|
|
37
|
+
var Node = class {
|
|
55
38
|
/// value;
|
|
56
39
|
/// next;
|
|
57
40
|
constructor(value) {
|
|
@@ -59,7 +42,7 @@ var require_yocto_queue = __commonJS({
|
|
|
59
42
|
this.next = void 0;
|
|
60
43
|
}
|
|
61
44
|
};
|
|
62
|
-
var
|
|
45
|
+
var Queue = class {
|
|
63
46
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
64
47
|
// #_head;
|
|
65
48
|
// #_tail;
|
|
@@ -68,7 +51,7 @@ var require_yocto_queue = __commonJS({
|
|
|
68
51
|
this.clear();
|
|
69
52
|
}
|
|
70
53
|
enqueue(value) {
|
|
71
|
-
const node = new
|
|
54
|
+
const node = new Node(value);
|
|
72
55
|
if (this._head) {
|
|
73
56
|
this._tail.next = node;
|
|
74
57
|
this._tail = node;
|
|
@@ -103,7 +86,7 @@ var require_yocto_queue = __commonJS({
|
|
|
103
86
|
}
|
|
104
87
|
}
|
|
105
88
|
};
|
|
106
|
-
module2.exports =
|
|
89
|
+
module2.exports = Queue;
|
|
107
90
|
}
|
|
108
91
|
});
|
|
109
92
|
|
|
@@ -111,12 +94,12 @@ var require_yocto_queue = __commonJS({
|
|
|
111
94
|
var require_p_limit = __commonJS({
|
|
112
95
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
113
96
|
"use strict";
|
|
114
|
-
var
|
|
115
|
-
var
|
|
97
|
+
var Queue = require_yocto_queue();
|
|
98
|
+
var pLimit2 = (concurrency) => {
|
|
116
99
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
117
100
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
118
101
|
}
|
|
119
|
-
const queue = new
|
|
102
|
+
const queue = new Queue();
|
|
120
103
|
let activeCount = 0;
|
|
121
104
|
const next = () => {
|
|
122
105
|
activeCount--;
|
|
@@ -161,238 +144,7 @@ var require_p_limit = __commonJS({
|
|
|
161
144
|
});
|
|
162
145
|
return generator;
|
|
163
146
|
};
|
|
164
|
-
module2.exports =
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
169
|
-
var require_retry_operation = __commonJS({
|
|
170
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
171
|
-
"use strict";
|
|
172
|
-
function RetryOperation(timeouts, options) {
|
|
173
|
-
if (typeof options === "boolean") {
|
|
174
|
-
options = { forever: options };
|
|
175
|
-
}
|
|
176
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
177
|
-
this._timeouts = timeouts;
|
|
178
|
-
this._options = options || {};
|
|
179
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
180
|
-
this._fn = null;
|
|
181
|
-
this._errors = [];
|
|
182
|
-
this._attempts = 1;
|
|
183
|
-
this._operationTimeout = null;
|
|
184
|
-
this._operationTimeoutCb = null;
|
|
185
|
-
this._timeout = null;
|
|
186
|
-
this._operationStart = null;
|
|
187
|
-
this._timer = null;
|
|
188
|
-
if (this._options.forever) {
|
|
189
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
module2.exports = RetryOperation;
|
|
193
|
-
RetryOperation.prototype.reset = function() {
|
|
194
|
-
this._attempts = 1;
|
|
195
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
196
|
-
};
|
|
197
|
-
RetryOperation.prototype.stop = function() {
|
|
198
|
-
if (this._timeout) {
|
|
199
|
-
clearTimeout(this._timeout);
|
|
200
|
-
}
|
|
201
|
-
if (this._timer) {
|
|
202
|
-
clearTimeout(this._timer);
|
|
203
|
-
}
|
|
204
|
-
this._timeouts = [];
|
|
205
|
-
this._cachedTimeouts = null;
|
|
206
|
-
};
|
|
207
|
-
RetryOperation.prototype.retry = function(err) {
|
|
208
|
-
if (this._timeout) {
|
|
209
|
-
clearTimeout(this._timeout);
|
|
210
|
-
}
|
|
211
|
-
if (!err) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
215
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
216
|
-
this._errors.push(err);
|
|
217
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
this._errors.push(err);
|
|
221
|
-
var timeout = this._timeouts.shift();
|
|
222
|
-
if (timeout === void 0) {
|
|
223
|
-
if (this._cachedTimeouts) {
|
|
224
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
225
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
226
|
-
} else {
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
var self = this;
|
|
231
|
-
this._timer = setTimeout(function() {
|
|
232
|
-
self._attempts++;
|
|
233
|
-
if (self._operationTimeoutCb) {
|
|
234
|
-
self._timeout = setTimeout(function() {
|
|
235
|
-
self._operationTimeoutCb(self._attempts);
|
|
236
|
-
}, self._operationTimeout);
|
|
237
|
-
if (self._options.unref) {
|
|
238
|
-
self._timeout.unref();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
self._fn(self._attempts);
|
|
242
|
-
}, timeout);
|
|
243
|
-
if (this._options.unref) {
|
|
244
|
-
this._timer.unref();
|
|
245
|
-
}
|
|
246
|
-
return true;
|
|
247
|
-
};
|
|
248
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
249
|
-
this._fn = fn;
|
|
250
|
-
if (timeoutOps) {
|
|
251
|
-
if (timeoutOps.timeout) {
|
|
252
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
253
|
-
}
|
|
254
|
-
if (timeoutOps.cb) {
|
|
255
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
var self = this;
|
|
259
|
-
if (this._operationTimeoutCb) {
|
|
260
|
-
this._timeout = setTimeout(function() {
|
|
261
|
-
self._operationTimeoutCb();
|
|
262
|
-
}, self._operationTimeout);
|
|
263
|
-
}
|
|
264
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
265
|
-
this._fn(this._attempts);
|
|
266
|
-
};
|
|
267
|
-
RetryOperation.prototype.try = function(fn) {
|
|
268
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
269
|
-
this.attempt(fn);
|
|
270
|
-
};
|
|
271
|
-
RetryOperation.prototype.start = function(fn) {
|
|
272
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
273
|
-
this.attempt(fn);
|
|
274
|
-
};
|
|
275
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
276
|
-
RetryOperation.prototype.errors = function() {
|
|
277
|
-
return this._errors;
|
|
278
|
-
};
|
|
279
|
-
RetryOperation.prototype.attempts = function() {
|
|
280
|
-
return this._attempts;
|
|
281
|
-
};
|
|
282
|
-
RetryOperation.prototype.mainError = function() {
|
|
283
|
-
if (this._errors.length === 0) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
var counts = {};
|
|
287
|
-
var mainError = null;
|
|
288
|
-
var mainErrorCount = 0;
|
|
289
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
290
|
-
var error = this._errors[i];
|
|
291
|
-
var message = error.message;
|
|
292
|
-
var count = (counts[message] || 0) + 1;
|
|
293
|
-
counts[message] = count;
|
|
294
|
-
if (count >= mainErrorCount) {
|
|
295
|
-
mainError = error;
|
|
296
|
-
mainErrorCount = count;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return mainError;
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
305
|
-
var require_retry = __commonJS({
|
|
306
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
307
|
-
"use strict";
|
|
308
|
-
var RetryOperation = require_retry_operation();
|
|
309
|
-
exports2.operation = function(options) {
|
|
310
|
-
var timeouts = exports2.timeouts(options);
|
|
311
|
-
return new RetryOperation(timeouts, {
|
|
312
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
313
|
-
unref: options && options.unref,
|
|
314
|
-
maxRetryTime: options && options.maxRetryTime
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
exports2.timeouts = function(options) {
|
|
318
|
-
if (options instanceof Array) {
|
|
319
|
-
return [].concat(options);
|
|
320
|
-
}
|
|
321
|
-
var opts = {
|
|
322
|
-
retries: 10,
|
|
323
|
-
factor: 2,
|
|
324
|
-
minTimeout: 1 * 1e3,
|
|
325
|
-
maxTimeout: Infinity,
|
|
326
|
-
randomize: false
|
|
327
|
-
};
|
|
328
|
-
for (var key in options) {
|
|
329
|
-
opts[key] = options[key];
|
|
330
|
-
}
|
|
331
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
332
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
333
|
-
}
|
|
334
|
-
var timeouts = [];
|
|
335
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
336
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
337
|
-
}
|
|
338
|
-
if (options && options.forever && !timeouts.length) {
|
|
339
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
340
|
-
}
|
|
341
|
-
timeouts.sort(function(a, b) {
|
|
342
|
-
return a - b;
|
|
343
|
-
});
|
|
344
|
-
return timeouts;
|
|
345
|
-
};
|
|
346
|
-
exports2.createTimeout = function(attempt, opts) {
|
|
347
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
348
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
349
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
350
|
-
return timeout;
|
|
351
|
-
};
|
|
352
|
-
exports2.wrap = function(obj, options, methods) {
|
|
353
|
-
if (options instanceof Array) {
|
|
354
|
-
methods = options;
|
|
355
|
-
options = null;
|
|
356
|
-
}
|
|
357
|
-
if (!methods) {
|
|
358
|
-
methods = [];
|
|
359
|
-
for (var key in obj) {
|
|
360
|
-
if (typeof obj[key] === "function") {
|
|
361
|
-
methods.push(key);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
for (var i = 0; i < methods.length; i++) {
|
|
366
|
-
var method = methods[i];
|
|
367
|
-
var original = obj[method];
|
|
368
|
-
obj[method] = function retryWrapper(original2) {
|
|
369
|
-
var op = exports2.operation(options);
|
|
370
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
371
|
-
var callback = args.pop();
|
|
372
|
-
args.push(function(err) {
|
|
373
|
-
if (op.retry(err)) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
if (err) {
|
|
377
|
-
arguments[0] = op.mainError();
|
|
378
|
-
}
|
|
379
|
-
callback.apply(this, arguments);
|
|
380
|
-
});
|
|
381
|
-
op.attempt(function() {
|
|
382
|
-
original2.apply(obj, args);
|
|
383
|
-
});
|
|
384
|
-
}.bind(obj, original);
|
|
385
|
-
obj[method].options = options;
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
392
|
-
var require_retry2 = __commonJS({
|
|
393
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
394
|
-
"use strict";
|
|
395
|
-
module2.exports = require_retry();
|
|
147
|
+
module2.exports = pLimit2;
|
|
396
148
|
}
|
|
397
149
|
});
|
|
398
150
|
|
|
@@ -408,14 +160,14 @@ module.exports = __toCommonJS(handler_exports);
|
|
|
408
160
|
// ../context/dist/api/api.mjs
|
|
409
161
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
410
162
|
var __defProp2 = Object.defineProperty;
|
|
411
|
-
var
|
|
163
|
+
var __typeError = (msg) => {
|
|
412
164
|
throw TypeError(msg);
|
|
413
165
|
};
|
|
414
|
-
var
|
|
415
|
-
var
|
|
416
|
-
var
|
|
417
|
-
var
|
|
418
|
-
var
|
|
166
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
167
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
168
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
169
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
170
|
+
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);
|
|
419
171
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
420
172
|
var ApiClientError = class _ApiClientError extends Error {
|
|
421
173
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -423,18 +175,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
423
175
|
`${errorMessage}
|
|
424
176
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
425
177
|
);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
178
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
179
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
180
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
181
|
+
__publicField(this, "statusCode", statusCode);
|
|
182
|
+
__publicField(this, "statusText", statusText);
|
|
183
|
+
__publicField(this, "requestId", requestId);
|
|
432
184
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
433
185
|
}
|
|
434
186
|
};
|
|
435
187
|
var ApiClient = class _ApiClient {
|
|
436
188
|
constructor(options) {
|
|
437
|
-
|
|
189
|
+
__publicField(this, "options");
|
|
438
190
|
var _a, _b, _c, _d, _e;
|
|
439
191
|
if (!options.apiKey && !options.bearerToken) {
|
|
440
192
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -604,12 +356,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
604
356
|
/** Fetches all aggregates for a project */
|
|
605
357
|
async get(options) {
|
|
606
358
|
const { projectId } = this.options;
|
|
607
|
-
const fetchUri = this.createUrl(
|
|
359
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
|
|
608
360
|
return await this.apiClient(fetchUri);
|
|
609
361
|
}
|
|
610
362
|
/** Updates or creates (based on id) an Aggregate */
|
|
611
363
|
async upsert(body) {
|
|
612
|
-
const fetchUri = this.createUrl(
|
|
364
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
613
365
|
await this.apiClient(fetchUri, {
|
|
614
366
|
method: "PUT",
|
|
615
367
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -618,7 +370,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
618
370
|
}
|
|
619
371
|
/** Deletes an Aggregate */
|
|
620
372
|
async remove(body) {
|
|
621
|
-
const fetchUri = this.createUrl(
|
|
373
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
622
374
|
await this.apiClient(fetchUri, {
|
|
623
375
|
method: "DELETE",
|
|
624
376
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -627,7 +379,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
627
379
|
}
|
|
628
380
|
};
|
|
629
381
|
_url = /* @__PURE__ */ new WeakMap();
|
|
630
|
-
|
|
382
|
+
__privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
|
|
631
383
|
var _url2;
|
|
632
384
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
633
385
|
constructor(options) {
|
|
@@ -636,12 +388,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
636
388
|
/** Fetches the known score dimensions for a project */
|
|
637
389
|
async get(options) {
|
|
638
390
|
const { projectId } = this.options;
|
|
639
|
-
const fetchUri = this.createUrl(
|
|
391
|
+
const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
|
|
640
392
|
return await this.apiClient(fetchUri);
|
|
641
393
|
}
|
|
642
394
|
};
|
|
643
395
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
644
|
-
|
|
396
|
+
__privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
|
|
645
397
|
var _url3;
|
|
646
398
|
var _valueUrl;
|
|
647
399
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -651,12 +403,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
651
403
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
652
404
|
async get(options) {
|
|
653
405
|
const { projectId } = this.options;
|
|
654
|
-
const fetchUri = this.createUrl(
|
|
406
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
655
407
|
return await this.apiClient(fetchUri);
|
|
656
408
|
}
|
|
657
409
|
/** Updates or creates (based on id) an enrichment category */
|
|
658
410
|
async upsertCategory(body) {
|
|
659
|
-
const fetchUri = this.createUrl(
|
|
411
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
660
412
|
await this.apiClient(fetchUri, {
|
|
661
413
|
method: "PUT",
|
|
662
414
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -665,7 +417,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
665
417
|
}
|
|
666
418
|
/** Deletes an enrichment category */
|
|
667
419
|
async removeCategory(body) {
|
|
668
|
-
const fetchUri = this.createUrl(
|
|
420
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
669
421
|
await this.apiClient(fetchUri, {
|
|
670
422
|
method: "DELETE",
|
|
671
423
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -674,7 +426,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
674
426
|
}
|
|
675
427
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
676
428
|
async upsertValue(body) {
|
|
677
|
-
const fetchUri = this.createUrl(
|
|
429
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
678
430
|
await this.apiClient(fetchUri, {
|
|
679
431
|
method: "PUT",
|
|
680
432
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -683,7 +435,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
683
435
|
}
|
|
684
436
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
685
437
|
async removeValue(body) {
|
|
686
|
-
const fetchUri = this.createUrl(
|
|
438
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
687
439
|
await this.apiClient(fetchUri, {
|
|
688
440
|
method: "DELETE",
|
|
689
441
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -693,8 +445,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
693
445
|
};
|
|
694
446
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
695
447
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
696
|
-
|
|
697
|
-
|
|
448
|
+
__privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
449
|
+
__privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
698
450
|
var _url4;
|
|
699
451
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
700
452
|
constructor(options) {
|
|
@@ -703,7 +455,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
703
455
|
/** Fetches the Context manifest for a project */
|
|
704
456
|
async get(options) {
|
|
705
457
|
const { projectId } = this.options;
|
|
706
|
-
const fetchUri = this.createUrl(
|
|
458
|
+
const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
|
|
707
459
|
return await this.apiClient(fetchUri);
|
|
708
460
|
}
|
|
709
461
|
/** Publishes the Context manifest for a project */
|
|
@@ -717,7 +469,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
717
469
|
}
|
|
718
470
|
};
|
|
719
471
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
720
|
-
|
|
472
|
+
__privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
|
|
721
473
|
var _url5;
|
|
722
474
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
723
475
|
constructor(options) {
|
|
@@ -726,12 +478,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
726
478
|
/** Fetches all Quirks for a project */
|
|
727
479
|
async get(options) {
|
|
728
480
|
const { projectId } = this.options;
|
|
729
|
-
const fetchUri = this.createUrl(
|
|
481
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
|
|
730
482
|
return await this.apiClient(fetchUri);
|
|
731
483
|
}
|
|
732
484
|
/** Updates or creates (based on id) a Quirk */
|
|
733
485
|
async upsert(body) {
|
|
734
|
-
const fetchUri = this.createUrl(
|
|
486
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
735
487
|
await this.apiClient(fetchUri, {
|
|
736
488
|
method: "PUT",
|
|
737
489
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -740,7 +492,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
740
492
|
}
|
|
741
493
|
/** Deletes a Quirk */
|
|
742
494
|
async remove(body) {
|
|
743
|
-
const fetchUri = this.createUrl(
|
|
495
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
744
496
|
await this.apiClient(fetchUri, {
|
|
745
497
|
method: "DELETE",
|
|
746
498
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -749,7 +501,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
749
501
|
}
|
|
750
502
|
};
|
|
751
503
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
752
|
-
|
|
504
|
+
__privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
|
|
753
505
|
var _url6;
|
|
754
506
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
755
507
|
constructor(options) {
|
|
@@ -758,12 +510,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
758
510
|
/** Fetches all Signals for a project */
|
|
759
511
|
async get(options) {
|
|
760
512
|
const { projectId } = this.options;
|
|
761
|
-
const fetchUri = this.createUrl(
|
|
513
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
|
|
762
514
|
return await this.apiClient(fetchUri);
|
|
763
515
|
}
|
|
764
516
|
/** Updates or creates (based on id) a Signal */
|
|
765
517
|
async upsert(body) {
|
|
766
|
-
const fetchUri = this.createUrl(
|
|
518
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
767
519
|
await this.apiClient(fetchUri, {
|
|
768
520
|
method: "PUT",
|
|
769
521
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -772,7 +524,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
772
524
|
}
|
|
773
525
|
/** Deletes a Signal */
|
|
774
526
|
async remove(body) {
|
|
775
|
-
const fetchUri = this.createUrl(
|
|
527
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
776
528
|
await this.apiClient(fetchUri, {
|
|
777
529
|
method: "DELETE",
|
|
778
530
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -781,7 +533,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
781
533
|
}
|
|
782
534
|
};
|
|
783
535
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
784
|
-
|
|
536
|
+
__privateAdd(_SignalClient, _url6, "/api/v2/signal");
|
|
785
537
|
var _url7;
|
|
786
538
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
787
539
|
constructor(options) {
|
|
@@ -790,12 +542,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
790
542
|
/** Fetches all Tests for a project */
|
|
791
543
|
async get(options) {
|
|
792
544
|
const { projectId } = this.options;
|
|
793
|
-
const fetchUri = this.createUrl(
|
|
545
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
|
|
794
546
|
return await this.apiClient(fetchUri);
|
|
795
547
|
}
|
|
796
548
|
/** Updates or creates (based on id) a Test */
|
|
797
549
|
async upsert(body) {
|
|
798
|
-
const fetchUri = this.createUrl(
|
|
550
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
799
551
|
await this.apiClient(fetchUri, {
|
|
800
552
|
method: "PUT",
|
|
801
553
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -804,7 +556,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
804
556
|
}
|
|
805
557
|
/** Deletes a Test */
|
|
806
558
|
async remove(body) {
|
|
807
|
-
const fetchUri = this.createUrl(
|
|
559
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
808
560
|
await this.apiClient(fetchUri, {
|
|
809
561
|
method: "DELETE",
|
|
810
562
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -813,194 +565,393 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
813
565
|
}
|
|
814
566
|
};
|
|
815
567
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
816
|
-
|
|
568
|
+
__privateAdd(_TestClient, _url7, "/api/v2/test");
|
|
817
569
|
|
|
818
|
-
//
|
|
819
|
-
var
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
570
|
+
// ../canvas/dist/index.mjs
|
|
571
|
+
var __create2 = Object.create;
|
|
572
|
+
var __defProp3 = Object.defineProperty;
|
|
573
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
574
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
575
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
576
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
577
|
+
var __typeError2 = (msg) => {
|
|
578
|
+
throw TypeError(msg);
|
|
825
579
|
};
|
|
826
|
-
var
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
enqueue(value) {
|
|
835
|
-
const node = new Node(value);
|
|
836
|
-
if (__privateGet(this, _head)) {
|
|
837
|
-
__privateGet(this, _tail).next = node;
|
|
838
|
-
__privateSet(this, _tail, node);
|
|
839
|
-
} else {
|
|
840
|
-
__privateSet(this, _head, node);
|
|
841
|
-
__privateSet(this, _tail, node);
|
|
842
|
-
}
|
|
843
|
-
__privateWrapper(this, _size)._++;
|
|
844
|
-
}
|
|
845
|
-
dequeue() {
|
|
846
|
-
const current = __privateGet(this, _head);
|
|
847
|
-
if (!current) {
|
|
848
|
-
return;
|
|
849
|
-
}
|
|
850
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
851
|
-
__privateWrapper(this, _size)._--;
|
|
852
|
-
if (!__privateGet(this, _head)) {
|
|
853
|
-
__privateSet(this, _tail, void 0);
|
|
854
|
-
}
|
|
855
|
-
return current.value;
|
|
856
|
-
}
|
|
857
|
-
peek() {
|
|
858
|
-
if (!__privateGet(this, _head)) {
|
|
859
|
-
return;
|
|
860
|
-
}
|
|
861
|
-
return __privateGet(this, _head).value;
|
|
862
|
-
}
|
|
863
|
-
clear() {
|
|
864
|
-
__privateSet(this, _head, void 0);
|
|
865
|
-
__privateSet(this, _tail, void 0);
|
|
866
|
-
__privateSet(this, _size, 0);
|
|
580
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
581
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
582
|
+
};
|
|
583
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
584
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
585
|
+
for (let key of __getOwnPropNames2(from))
|
|
586
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
587
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
867
588
|
}
|
|
868
|
-
|
|
869
|
-
|
|
589
|
+
return to;
|
|
590
|
+
};
|
|
591
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
592
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
593
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
594
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
595
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
596
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
597
|
+
mod
|
|
598
|
+
));
|
|
599
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
600
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
601
|
+
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);
|
|
602
|
+
var require_yocto_queue2 = __commonJS2({
|
|
603
|
+
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
604
|
+
"use strict";
|
|
605
|
+
var Node = class {
|
|
606
|
+
/// value;
|
|
607
|
+
/// next;
|
|
608
|
+
constructor(value) {
|
|
609
|
+
this.value = value;
|
|
610
|
+
this.next = void 0;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
var Queue = class {
|
|
614
|
+
// TODO: Use private class fields when targeting Node.js 12.
|
|
615
|
+
// #_head;
|
|
616
|
+
// #_tail;
|
|
617
|
+
// #_size;
|
|
618
|
+
constructor() {
|
|
619
|
+
this.clear();
|
|
620
|
+
}
|
|
621
|
+
enqueue(value) {
|
|
622
|
+
const node = new Node(value);
|
|
623
|
+
if (this._head) {
|
|
624
|
+
this._tail.next = node;
|
|
625
|
+
this._tail = node;
|
|
626
|
+
} else {
|
|
627
|
+
this._head = node;
|
|
628
|
+
this._tail = node;
|
|
629
|
+
}
|
|
630
|
+
this._size++;
|
|
631
|
+
}
|
|
632
|
+
dequeue() {
|
|
633
|
+
const current = this._head;
|
|
634
|
+
if (!current) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
this._head = this._head.next;
|
|
638
|
+
this._size--;
|
|
639
|
+
return current.value;
|
|
640
|
+
}
|
|
641
|
+
clear() {
|
|
642
|
+
this._head = void 0;
|
|
643
|
+
this._tail = void 0;
|
|
644
|
+
this._size = 0;
|
|
645
|
+
}
|
|
646
|
+
get size() {
|
|
647
|
+
return this._size;
|
|
648
|
+
}
|
|
649
|
+
*[Symbol.iterator]() {
|
|
650
|
+
let current = this._head;
|
|
651
|
+
while (current) {
|
|
652
|
+
yield current.value;
|
|
653
|
+
current = current.next;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
module2.exports = Queue;
|
|
870
658
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
659
|
+
});
|
|
660
|
+
var require_p_limit2 = __commonJS2({
|
|
661
|
+
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
662
|
+
"use strict";
|
|
663
|
+
var Queue = require_yocto_queue2();
|
|
664
|
+
var pLimit2 = (concurrency) => {
|
|
665
|
+
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
666
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
667
|
+
}
|
|
668
|
+
const queue = new Queue();
|
|
669
|
+
let activeCount = 0;
|
|
670
|
+
const next = () => {
|
|
671
|
+
activeCount--;
|
|
672
|
+
if (queue.size > 0) {
|
|
673
|
+
queue.dequeue()();
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
const run = async (fn, resolve, ...args) => {
|
|
677
|
+
activeCount++;
|
|
678
|
+
const result = (async () => fn(...args))();
|
|
679
|
+
resolve(result);
|
|
680
|
+
try {
|
|
681
|
+
await result;
|
|
682
|
+
} catch (e) {
|
|
683
|
+
}
|
|
684
|
+
next();
|
|
685
|
+
};
|
|
686
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
687
|
+
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
688
|
+
(async () => {
|
|
689
|
+
await Promise.resolve();
|
|
690
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
691
|
+
queue.dequeue()();
|
|
692
|
+
}
|
|
693
|
+
})();
|
|
694
|
+
};
|
|
695
|
+
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
696
|
+
enqueue(fn, resolve, ...args);
|
|
697
|
+
});
|
|
698
|
+
Object.defineProperties(generator, {
|
|
699
|
+
activeCount: {
|
|
700
|
+
get: () => activeCount
|
|
701
|
+
},
|
|
702
|
+
pendingCount: {
|
|
703
|
+
get: () => queue.size
|
|
704
|
+
},
|
|
705
|
+
clearQueue: {
|
|
706
|
+
value: () => {
|
|
707
|
+
queue.clear();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
return generator;
|
|
712
|
+
};
|
|
713
|
+
module2.exports = pLimit2;
|
|
877
714
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
715
|
+
});
|
|
716
|
+
var require_retry_operation = __commonJS2({
|
|
717
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
718
|
+
"use strict";
|
|
719
|
+
function RetryOperation(timeouts, options) {
|
|
720
|
+
if (typeof options === "boolean") {
|
|
721
|
+
options = { forever: options };
|
|
722
|
+
}
|
|
723
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
724
|
+
this._timeouts = timeouts;
|
|
725
|
+
this._options = options || {};
|
|
726
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
727
|
+
this._fn = null;
|
|
728
|
+
this._errors = [];
|
|
729
|
+
this._attempts = 1;
|
|
730
|
+
this._operationTimeout = null;
|
|
731
|
+
this._operationTimeoutCb = null;
|
|
732
|
+
this._timeout = null;
|
|
733
|
+
this._operationStart = null;
|
|
734
|
+
this._timer = null;
|
|
735
|
+
if (this._options.forever) {
|
|
736
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
737
|
+
}
|
|
881
738
|
}
|
|
739
|
+
module2.exports = RetryOperation;
|
|
740
|
+
RetryOperation.prototype.reset = function() {
|
|
741
|
+
this._attempts = 1;
|
|
742
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
743
|
+
};
|
|
744
|
+
RetryOperation.prototype.stop = function() {
|
|
745
|
+
if (this._timeout) {
|
|
746
|
+
clearTimeout(this._timeout);
|
|
747
|
+
}
|
|
748
|
+
if (this._timer) {
|
|
749
|
+
clearTimeout(this._timer);
|
|
750
|
+
}
|
|
751
|
+
this._timeouts = [];
|
|
752
|
+
this._cachedTimeouts = null;
|
|
753
|
+
};
|
|
754
|
+
RetryOperation.prototype.retry = function(err) {
|
|
755
|
+
if (this._timeout) {
|
|
756
|
+
clearTimeout(this._timeout);
|
|
757
|
+
}
|
|
758
|
+
if (!err) {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
762
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
763
|
+
this._errors.push(err);
|
|
764
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
this._errors.push(err);
|
|
768
|
+
var timeout = this._timeouts.shift();
|
|
769
|
+
if (timeout === void 0) {
|
|
770
|
+
if (this._cachedTimeouts) {
|
|
771
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
772
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
773
|
+
} else {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
var self = this;
|
|
778
|
+
this._timer = setTimeout(function() {
|
|
779
|
+
self._attempts++;
|
|
780
|
+
if (self._operationTimeoutCb) {
|
|
781
|
+
self._timeout = setTimeout(function() {
|
|
782
|
+
self._operationTimeoutCb(self._attempts);
|
|
783
|
+
}, self._operationTimeout);
|
|
784
|
+
if (self._options.unref) {
|
|
785
|
+
self._timeout.unref();
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
self._fn(self._attempts);
|
|
789
|
+
}, timeout);
|
|
790
|
+
if (this._options.unref) {
|
|
791
|
+
this._timer.unref();
|
|
792
|
+
}
|
|
793
|
+
return true;
|
|
794
|
+
};
|
|
795
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
796
|
+
this._fn = fn;
|
|
797
|
+
if (timeoutOps) {
|
|
798
|
+
if (timeoutOps.timeout) {
|
|
799
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
800
|
+
}
|
|
801
|
+
if (timeoutOps.cb) {
|
|
802
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
var self = this;
|
|
806
|
+
if (this._operationTimeoutCb) {
|
|
807
|
+
this._timeout = setTimeout(function() {
|
|
808
|
+
self._operationTimeoutCb();
|
|
809
|
+
}, self._operationTimeout);
|
|
810
|
+
}
|
|
811
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
812
|
+
this._fn(this._attempts);
|
|
813
|
+
};
|
|
814
|
+
RetryOperation.prototype.try = function(fn) {
|
|
815
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
816
|
+
this.attempt(fn);
|
|
817
|
+
};
|
|
818
|
+
RetryOperation.prototype.start = function(fn) {
|
|
819
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
820
|
+
this.attempt(fn);
|
|
821
|
+
};
|
|
822
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
823
|
+
RetryOperation.prototype.errors = function() {
|
|
824
|
+
return this._errors;
|
|
825
|
+
};
|
|
826
|
+
RetryOperation.prototype.attempts = function() {
|
|
827
|
+
return this._attempts;
|
|
828
|
+
};
|
|
829
|
+
RetryOperation.prototype.mainError = function() {
|
|
830
|
+
if (this._errors.length === 0) {
|
|
831
|
+
return null;
|
|
832
|
+
}
|
|
833
|
+
var counts = {};
|
|
834
|
+
var mainError = null;
|
|
835
|
+
var mainErrorCount = 0;
|
|
836
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
837
|
+
var error = this._errors[i];
|
|
838
|
+
var message = error.message;
|
|
839
|
+
var count = (counts[message] || 0) + 1;
|
|
840
|
+
counts[message] = count;
|
|
841
|
+
if (count >= mainErrorCount) {
|
|
842
|
+
mainError = error;
|
|
843
|
+
mainErrorCount = count;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return mainError;
|
|
847
|
+
};
|
|
882
848
|
}
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const next = () => {
|
|
900
|
-
activeCount--;
|
|
901
|
-
resumeNext();
|
|
902
|
-
};
|
|
903
|
-
const run = async (function_, resolve, arguments_) => {
|
|
904
|
-
const result = (async () => function_(...arguments_))();
|
|
905
|
-
resolve(result);
|
|
906
|
-
try {
|
|
907
|
-
await result;
|
|
908
|
-
} catch (e) {
|
|
909
|
-
}
|
|
910
|
-
next();
|
|
911
|
-
};
|
|
912
|
-
const enqueue = (function_, resolve, arguments_) => {
|
|
913
|
-
new Promise((internalResolve) => {
|
|
914
|
-
queue.enqueue(internalResolve);
|
|
915
|
-
}).then(
|
|
916
|
-
run.bind(void 0, function_, resolve, arguments_)
|
|
917
|
-
);
|
|
918
|
-
(async () => {
|
|
919
|
-
await Promise.resolve();
|
|
920
|
-
if (activeCount < concurrency) {
|
|
921
|
-
resumeNext();
|
|
849
|
+
});
|
|
850
|
+
var require_retry = __commonJS2({
|
|
851
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
852
|
+
"use strict";
|
|
853
|
+
var RetryOperation = require_retry_operation();
|
|
854
|
+
exports2.operation = function(options) {
|
|
855
|
+
var timeouts = exports2.timeouts(options);
|
|
856
|
+
return new RetryOperation(timeouts, {
|
|
857
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
858
|
+
unref: options && options.unref,
|
|
859
|
+
maxRetryTime: options && options.maxRetryTime
|
|
860
|
+
});
|
|
861
|
+
};
|
|
862
|
+
exports2.timeouts = function(options) {
|
|
863
|
+
if (options instanceof Array) {
|
|
864
|
+
return [].concat(options);
|
|
922
865
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
pendingCount: {
|
|
933
|
-
get: () => queue.size
|
|
934
|
-
},
|
|
935
|
-
clearQueue: {
|
|
936
|
-
value() {
|
|
937
|
-
queue.clear();
|
|
866
|
+
var opts = {
|
|
867
|
+
retries: 10,
|
|
868
|
+
factor: 2,
|
|
869
|
+
minTimeout: 1 * 1e3,
|
|
870
|
+
maxTimeout: Infinity,
|
|
871
|
+
randomize: false
|
|
872
|
+
};
|
|
873
|
+
for (var key in options) {
|
|
874
|
+
opts[key] = options[key];
|
|
938
875
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
876
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
877
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
878
|
+
}
|
|
879
|
+
var timeouts = [];
|
|
880
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
881
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
882
|
+
}
|
|
883
|
+
if (options && options.forever && !timeouts.length) {
|
|
884
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
885
|
+
}
|
|
886
|
+
timeouts.sort(function(a, b) {
|
|
887
|
+
return a - b;
|
|
888
|
+
});
|
|
889
|
+
return timeouts;
|
|
890
|
+
};
|
|
891
|
+
exports2.createTimeout = function(attempt, opts) {
|
|
892
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
893
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
894
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
895
|
+
return timeout;
|
|
896
|
+
};
|
|
897
|
+
exports2.wrap = function(obj, options, methods) {
|
|
898
|
+
if (options instanceof Array) {
|
|
899
|
+
methods = options;
|
|
900
|
+
options = null;
|
|
901
|
+
}
|
|
902
|
+
if (!methods) {
|
|
903
|
+
methods = [];
|
|
904
|
+
for (var key in obj) {
|
|
905
|
+
if (typeof obj[key] === "function") {
|
|
906
|
+
methods.push(key);
|
|
948
907
|
}
|
|
949
|
-
}
|
|
908
|
+
}
|
|
950
909
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
910
|
+
for (var i = 0; i < methods.length; i++) {
|
|
911
|
+
var method = methods[i];
|
|
912
|
+
var original = obj[method];
|
|
913
|
+
obj[method] = function retryWrapper(original2) {
|
|
914
|
+
var op = exports2.operation(options);
|
|
915
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
916
|
+
var callback = args.pop();
|
|
917
|
+
args.push(function(err) {
|
|
918
|
+
if (op.retry(err)) {
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
if (err) {
|
|
922
|
+
arguments[0] = op.mainError();
|
|
923
|
+
}
|
|
924
|
+
callback.apply(this, arguments);
|
|
925
|
+
});
|
|
926
|
+
op.attempt(function() {
|
|
927
|
+
original2.apply(obj, args);
|
|
928
|
+
});
|
|
929
|
+
}.bind(obj, original);
|
|
930
|
+
obj[method].options = options;
|
|
931
|
+
}
|
|
932
|
+
};
|
|
958
933
|
}
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
var
|
|
967
|
-
var
|
|
968
|
-
|
|
934
|
+
});
|
|
935
|
+
var require_retry2 = __commonJS2({
|
|
936
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
937
|
+
"use strict";
|
|
938
|
+
module2.exports = require_retry();
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
942
|
+
var import_retry = __toESM2(require_retry2(), 1);
|
|
943
|
+
var networkErrorMsgs = /* @__PURE__ */ new Set([
|
|
944
|
+
"Failed to fetch",
|
|
969
945
|
// Chrome
|
|
970
946
|
"NetworkError when attempting to fetch resource.",
|
|
971
947
|
// Firefox
|
|
972
948
|
"The Internet connection appears to be offline.",
|
|
973
|
-
// Safari
|
|
949
|
+
// Safari
|
|
974
950
|
"Network request failed",
|
|
975
951
|
// `cross-fetch`
|
|
976
|
-
"fetch failed"
|
|
977
|
-
// Undici (Node.js)
|
|
978
|
-
"terminated",
|
|
952
|
+
"fetch failed"
|
|
979
953
|
// Undici (Node.js)
|
|
980
|
-
" A network error occurred.",
|
|
981
|
-
// Bun (WebKit)
|
|
982
|
-
"Network connection lost"
|
|
983
|
-
// Cloudflare Workers (fetch)
|
|
984
954
|
]);
|
|
985
|
-
function isNetworkError(error) {
|
|
986
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
987
|
-
if (!isValid) {
|
|
988
|
-
return false;
|
|
989
|
-
}
|
|
990
|
-
const { message, stack } = error;
|
|
991
|
-
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
992
|
-
return stack === void 0 || "__sentry_captured__" in error;
|
|
993
|
-
}
|
|
994
|
-
if (message.startsWith("error sending request for url")) {
|
|
995
|
-
return true;
|
|
996
|
-
}
|
|
997
|
-
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
998
|
-
return true;
|
|
999
|
-
}
|
|
1000
|
-
return errorMessages.has(message);
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
1004
955
|
var AbortError = class extends Error {
|
|
1005
956
|
constructor(message) {
|
|
1006
957
|
super();
|
|
@@ -1021,71 +972,63 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1021
972
|
error.retriesLeft = retriesLeft;
|
|
1022
973
|
return error;
|
|
1023
974
|
};
|
|
975
|
+
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
976
|
+
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1024
977
|
async function pRetry(input, options) {
|
|
1025
978
|
return new Promise((resolve, reject) => {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
979
|
+
options = {
|
|
980
|
+
onFailedAttempt() {
|
|
981
|
+
},
|
|
982
|
+
retries: 10,
|
|
983
|
+
...options
|
|
1029
984
|
};
|
|
1030
|
-
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1031
|
-
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1032
985
|
const operation = import_retry.default.operation(options);
|
|
1033
|
-
const abortHandler = () => {
|
|
1034
|
-
var _a2;
|
|
1035
|
-
operation.stop();
|
|
1036
|
-
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1037
|
-
};
|
|
1038
|
-
if (options.signal && !options.signal.aborted) {
|
|
1039
|
-
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1040
|
-
}
|
|
1041
|
-
const cleanUp = () => {
|
|
1042
|
-
var _a2;
|
|
1043
|
-
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1044
|
-
operation.stop();
|
|
1045
|
-
};
|
|
1046
986
|
operation.attempt(async (attemptNumber) => {
|
|
1047
987
|
try {
|
|
1048
|
-
|
|
1049
|
-
cleanUp();
|
|
1050
|
-
resolve(result);
|
|
988
|
+
resolve(await input(attemptNumber));
|
|
1051
989
|
} catch (error) {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
990
|
+
if (!(error instanceof Error)) {
|
|
991
|
+
reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
if (error instanceof AbortError) {
|
|
995
|
+
operation.stop();
|
|
996
|
+
reject(error.originalError);
|
|
997
|
+
} else if (error instanceof TypeError && !isNetworkError(error.message)) {
|
|
998
|
+
operation.stop();
|
|
999
|
+
reject(error);
|
|
1000
|
+
} else {
|
|
1062
1001
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1002
|
+
try {
|
|
1003
|
+
await options.onFailedAttempt(error);
|
|
1004
|
+
} catch (error2) {
|
|
1005
|
+
reject(error2);
|
|
1006
|
+
return;
|
|
1066
1007
|
}
|
|
1067
|
-
await options.onFailedAttempt(error);
|
|
1068
1008
|
if (!operation.retry(error)) {
|
|
1069
|
-
|
|
1009
|
+
reject(operation.mainError());
|
|
1070
1010
|
}
|
|
1071
|
-
} catch (finalError) {
|
|
1072
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1073
|
-
cleanUp();
|
|
1074
|
-
reject(finalError);
|
|
1075
1011
|
}
|
|
1076
1012
|
}
|
|
1077
1013
|
});
|
|
1014
|
+
if (options.signal && !options.signal.aborted) {
|
|
1015
|
+
options.signal.addEventListener("abort", () => {
|
|
1016
|
+
operation.stop();
|
|
1017
|
+
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1018
|
+
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1019
|
+
}, {
|
|
1020
|
+
once: true
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1078
1023
|
});
|
|
1079
1024
|
}
|
|
1080
|
-
|
|
1081
|
-
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1082
1025
|
var AbortError2 = class extends Error {
|
|
1083
1026
|
constructor() {
|
|
1084
1027
|
super("Throttled function aborted");
|
|
1085
1028
|
this.name = "AbortError";
|
|
1086
1029
|
}
|
|
1087
1030
|
};
|
|
1088
|
-
function pThrottle({ limit, interval, strict
|
|
1031
|
+
function pThrottle({ limit, interval, strict }) {
|
|
1089
1032
|
if (!Number.isFinite(limit)) {
|
|
1090
1033
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1091
1034
|
}
|
|
@@ -1113,38 +1056,32 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1113
1056
|
const strictTicks = [];
|
|
1114
1057
|
function strictDelay() {
|
|
1115
1058
|
const now = Date.now();
|
|
1116
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1117
|
-
strictTicks.length = 0;
|
|
1118
|
-
}
|
|
1119
1059
|
if (strictTicks.length < limit) {
|
|
1120
1060
|
strictTicks.push(now);
|
|
1121
1061
|
return 0;
|
|
1122
1062
|
}
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1063
|
+
const earliestTime = strictTicks.shift() + interval;
|
|
1064
|
+
if (now >= earliestTime) {
|
|
1065
|
+
strictTicks.push(now);
|
|
1066
|
+
return 0;
|
|
1067
|
+
}
|
|
1068
|
+
strictTicks.push(earliestTime);
|
|
1069
|
+
return earliestTime - now;
|
|
1127
1070
|
}
|
|
1128
1071
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1129
1072
|
return (function_) => {
|
|
1130
|
-
const throttled = function(...
|
|
1073
|
+
const throttled = function(...args) {
|
|
1131
1074
|
if (!throttled.isEnabled) {
|
|
1132
|
-
return (async () => function_.apply(this,
|
|
1075
|
+
return (async () => function_.apply(this, args))();
|
|
1133
1076
|
}
|
|
1134
|
-
let
|
|
1077
|
+
let timeout;
|
|
1135
1078
|
return new Promise((resolve, reject) => {
|
|
1136
1079
|
const execute = () => {
|
|
1137
|
-
resolve(function_.apply(this,
|
|
1138
|
-
queue.delete(
|
|
1080
|
+
resolve(function_.apply(this, args));
|
|
1081
|
+
queue.delete(timeout);
|
|
1139
1082
|
};
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
timeoutId = setTimeout(execute, delay);
|
|
1143
|
-
queue.set(timeoutId, reject);
|
|
1144
|
-
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1145
|
-
} else {
|
|
1146
|
-
execute();
|
|
1147
|
-
}
|
|
1083
|
+
timeout = setTimeout(execute, getDelay());
|
|
1084
|
+
queue.set(timeout, reject);
|
|
1148
1085
|
});
|
|
1149
1086
|
};
|
|
1150
1087
|
throttled.abort = () => {
|
|
@@ -1156,29 +1093,16 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1156
1093
|
strictTicks.splice(0, strictTicks.length);
|
|
1157
1094
|
};
|
|
1158
1095
|
throttled.isEnabled = true;
|
|
1159
|
-
Object.defineProperty(throttled, "queueSize", {
|
|
1160
|
-
get() {
|
|
1161
|
-
return queue.size;
|
|
1162
|
-
}
|
|
1163
|
-
});
|
|
1164
1096
|
return throttled;
|
|
1165
1097
|
};
|
|
1166
1098
|
}
|
|
1167
|
-
|
|
1168
|
-
// ../canvas/dist/index.mjs
|
|
1169
|
-
var __typeError3 = (msg) => {
|
|
1170
|
-
throw TypeError(msg);
|
|
1171
|
-
};
|
|
1172
|
-
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1173
|
-
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1174
|
-
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);
|
|
1175
1099
|
function createLimitPolicy({
|
|
1176
1100
|
throttle = { interval: 1e3, limit: 10 },
|
|
1177
|
-
retry:
|
|
1101
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
1178
1102
|
limit = 10
|
|
1179
1103
|
}) {
|
|
1180
1104
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1181
|
-
const limiter = limit ?
|
|
1105
|
+
const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
|
|
1182
1106
|
return function limitPolicy(func) {
|
|
1183
1107
|
let currentFunc = async () => await func();
|
|
1184
1108
|
if (throttler) {
|
|
@@ -1189,13 +1113,13 @@ function createLimitPolicy({
|
|
|
1189
1113
|
const limitFunc = currentFunc;
|
|
1190
1114
|
currentFunc = () => limiter(limitFunc);
|
|
1191
1115
|
}
|
|
1192
|
-
if (
|
|
1116
|
+
if (retry2) {
|
|
1193
1117
|
const retryFunc = currentFunc;
|
|
1194
1118
|
currentFunc = () => pRetry(retryFunc, {
|
|
1195
|
-
...
|
|
1119
|
+
...retry2,
|
|
1196
1120
|
onFailedAttempt: async (error) => {
|
|
1197
|
-
if (
|
|
1198
|
-
await
|
|
1121
|
+
if (retry2.onFailedAttempt) {
|
|
1122
|
+
await retry2.onFailedAttempt(error);
|
|
1199
1123
|
}
|
|
1200
1124
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1201
1125
|
throw error;
|
|
@@ -1335,7 +1259,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1335
1259
|
}
|
|
1336
1260
|
getContentTypes(options) {
|
|
1337
1261
|
const { projectId } = this.options;
|
|
1338
|
-
const fetchUri = this.createUrl(
|
|
1262
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1339
1263
|
return this.apiClient(fetchUri);
|
|
1340
1264
|
}
|
|
1341
1265
|
getEntries(options) {
|
|
@@ -1343,11 +1267,11 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1343
1267
|
const { skipDataResolution, filters, ...params } = options;
|
|
1344
1268
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1345
1269
|
if (skipDataResolution) {
|
|
1346
|
-
const url = this.createUrl(
|
|
1270
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1347
1271
|
return this.apiClient(url);
|
|
1348
1272
|
}
|
|
1349
1273
|
const edgeUrl = this.createUrl(
|
|
1350
|
-
|
|
1274
|
+
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1351
1275
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1352
1276
|
this.edgeApiHost
|
|
1353
1277
|
);
|
|
@@ -1365,7 +1289,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1365
1289
|
return this.apiClient(historyUrl);
|
|
1366
1290
|
}
|
|
1367
1291
|
async upsertContentType(body, opts = {}) {
|
|
1368
|
-
const fetchUri = this.createUrl(
|
|
1292
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1369
1293
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1370
1294
|
delete body.contentType.slugSettings;
|
|
1371
1295
|
}
|
|
@@ -1377,7 +1301,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1377
1301
|
});
|
|
1378
1302
|
}
|
|
1379
1303
|
async upsertEntry(body, options) {
|
|
1380
|
-
const fetchUri = this.createUrl(
|
|
1304
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1381
1305
|
const headers = {};
|
|
1382
1306
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1383
1307
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1391,7 +1315,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1391
1315
|
return { modified: response.headers.get("x-modified-at") };
|
|
1392
1316
|
}
|
|
1393
1317
|
async deleteContentType(body) {
|
|
1394
|
-
const fetchUri = this.createUrl(
|
|
1318
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1395
1319
|
await this.apiClient(fetchUri, {
|
|
1396
1320
|
method: "DELETE",
|
|
1397
1321
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1399,7 +1323,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1399
1323
|
});
|
|
1400
1324
|
}
|
|
1401
1325
|
async deleteEntry(body) {
|
|
1402
|
-
const fetchUri = this.createUrl(
|
|
1326
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1403
1327
|
await this.apiClient(fetchUri, {
|
|
1404
1328
|
method: "DELETE",
|
|
1405
1329
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1418,8 +1342,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1418
1342
|
};
|
|
1419
1343
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1420
1344
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1421
|
-
|
|
1422
|
-
|
|
1345
|
+
__privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1346
|
+
__privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1423
1347
|
var _url8;
|
|
1424
1348
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1425
1349
|
constructor(options) {
|
|
@@ -1428,12 +1352,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1428
1352
|
/** Fetches all DataTypes for a project */
|
|
1429
1353
|
async get(options) {
|
|
1430
1354
|
const { projectId } = this.options;
|
|
1431
|
-
const fetchUri = this.createUrl(
|
|
1355
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1432
1356
|
return await this.apiClient(fetchUri);
|
|
1433
1357
|
}
|
|
1434
1358
|
/** Updates or creates (based on id) a DataType */
|
|
1435
1359
|
async upsert(body) {
|
|
1436
|
-
const fetchUri = this.createUrl(
|
|
1360
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
1437
1361
|
await this.apiClient(fetchUri, {
|
|
1438
1362
|
method: "PUT",
|
|
1439
1363
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1442,7 +1366,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1442
1366
|
}
|
|
1443
1367
|
/** Deletes a DataType */
|
|
1444
1368
|
async remove(body) {
|
|
1445
|
-
const fetchUri = this.createUrl(
|
|
1369
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
1446
1370
|
await this.apiClient(fetchUri, {
|
|
1447
1371
|
method: "DELETE",
|
|
1448
1372
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1451,7 +1375,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1451
1375
|
}
|
|
1452
1376
|
};
|
|
1453
1377
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1454
|
-
|
|
1378
|
+
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1455
1379
|
var CANVAS_DRAFT_STATE = 0;
|
|
1456
1380
|
var CANVAS_EDITOR_STATE = 63;
|
|
1457
1381
|
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
@@ -1547,7 +1471,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1547
1471
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1548
1472
|
*/
|
|
1549
1473
|
get(options) {
|
|
1550
|
-
const fetchUri = this.createUrl(
|
|
1474
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1551
1475
|
...options,
|
|
1552
1476
|
teamId: this.teamId
|
|
1553
1477
|
});
|
|
@@ -1557,7 +1481,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1557
1481
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1558
1482
|
*/
|
|
1559
1483
|
async deploy(body) {
|
|
1560
|
-
const fetchUri = this.createUrl(
|
|
1484
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1561
1485
|
await this.apiClient(fetchUri, {
|
|
1562
1486
|
method: "PUT",
|
|
1563
1487
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1568,7 +1492,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1568
1492
|
* Removes a custom AI property editor from a Mesh app.
|
|
1569
1493
|
*/
|
|
1570
1494
|
async delete(body) {
|
|
1571
|
-
const fetchUri = this.createUrl(
|
|
1495
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1572
1496
|
await this.apiClient(fetchUri, {
|
|
1573
1497
|
method: "DELETE",
|
|
1574
1498
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1577,7 +1501,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1577
1501
|
}
|
|
1578
1502
|
};
|
|
1579
1503
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1580
|
-
|
|
1504
|
+
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1581
1505
|
var _url22;
|
|
1582
1506
|
var _projectsUrl;
|
|
1583
1507
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1586,7 +1510,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1586
1510
|
}
|
|
1587
1511
|
/** Fetches single Project */
|
|
1588
1512
|
async get(options) {
|
|
1589
|
-
const fetchUri = this.createUrl(
|
|
1513
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1590
1514
|
return await this.apiClient(fetchUri);
|
|
1591
1515
|
}
|
|
1592
1516
|
/**
|
|
@@ -1595,12 +1519,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1595
1519
|
* When omitted, returns all accessible teams and their projects.
|
|
1596
1520
|
*/
|
|
1597
1521
|
async getProjects(options) {
|
|
1598
|
-
const fetchUri = this.createUrl(
|
|
1522
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1599
1523
|
return await this.apiClient(fetchUri);
|
|
1600
1524
|
}
|
|
1601
1525
|
/** Updates or creates (based on id) a Project */
|
|
1602
1526
|
async upsert(body) {
|
|
1603
|
-
const fetchUri = this.createUrl(
|
|
1527
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
1604
1528
|
return await this.apiClient(fetchUri, {
|
|
1605
1529
|
method: "PUT",
|
|
1606
1530
|
body: JSON.stringify({ ...body })
|
|
@@ -1608,7 +1532,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1608
1532
|
}
|
|
1609
1533
|
/** Deletes a Project */
|
|
1610
1534
|
async delete(body) {
|
|
1611
|
-
const fetchUri = this.createUrl(
|
|
1535
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
1612
1536
|
await this.apiClient(fetchUri, {
|
|
1613
1537
|
method: "DELETE",
|
|
1614
1538
|
body: JSON.stringify({ ...body }),
|
|
@@ -1618,8 +1542,8 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1618
1542
|
};
|
|
1619
1543
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1620
1544
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1621
|
-
|
|
1622
|
-
|
|
1545
|
+
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1546
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1623
1547
|
var isAllowedReferrer = (referrer) => {
|
|
1624
1548
|
return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
|
|
1625
1549
|
};
|
|
@@ -2016,7 +1940,7 @@ function createLimiter(concurrency) {
|
|
|
2016
1940
|
});
|
|
2017
1941
|
};
|
|
2018
1942
|
}
|
|
2019
|
-
async function
|
|
1943
|
+
async function retry(fn, options) {
|
|
2020
1944
|
let lastError;
|
|
2021
1945
|
let delay = 1e3;
|
|
2022
1946
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2056,7 +1980,7 @@ function createLimitPolicy2({
|
|
|
2056
1980
|
}
|
|
2057
1981
|
if (retryOptions) {
|
|
2058
1982
|
const retryFunc = currentFunc;
|
|
2059
|
-
currentFunc = () =>
|
|
1983
|
+
currentFunc = () => retry(retryFunc, {
|
|
2060
1984
|
...retryOptions,
|
|
2061
1985
|
onFailedAttempt: async (error) => {
|
|
2062
1986
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2130,14 +2054,14 @@ var getCanvasClient = (options) => {
|
|
|
2130
2054
|
var import_server_only2 = require("server-only");
|
|
2131
2055
|
|
|
2132
2056
|
// ../project-map/dist/index.mjs
|
|
2133
|
-
var
|
|
2057
|
+
var __typeError3 = (msg) => {
|
|
2134
2058
|
throw TypeError(msg);
|
|
2135
2059
|
};
|
|
2136
|
-
var
|
|
2137
|
-
var
|
|
2138
|
-
var
|
|
2139
|
-
var
|
|
2140
|
-
var __privateMethod = (obj, member, method) => (
|
|
2060
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
2061
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2062
|
+
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);
|
|
2063
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2064
|
+
var __privateMethod = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
|
|
2141
2065
|
var ProjectMapClient = class extends ApiClient {
|
|
2142
2066
|
constructor(options) {
|
|
2143
2067
|
super(options);
|
|
@@ -2284,12 +2208,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2284
2208
|
var _Route = class _Route2 {
|
|
2285
2209
|
constructor(route) {
|
|
2286
2210
|
this.route = route;
|
|
2287
|
-
|
|
2211
|
+
__privateAdd3(this, _routeInfo);
|
|
2288
2212
|
var _a;
|
|
2289
|
-
|
|
2213
|
+
__privateSet(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2290
2214
|
}
|
|
2291
2215
|
get dynamicSegmentCount() {
|
|
2292
|
-
return
|
|
2216
|
+
return __privateGet3(this, _routeInfo).segments.reduce(
|
|
2293
2217
|
(count, segment) => {
|
|
2294
2218
|
var _a;
|
|
2295
2219
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2301,7 +2225,7 @@ var _Route = class _Route2 {
|
|
|
2301
2225
|
matches(path) {
|
|
2302
2226
|
var _a, _b;
|
|
2303
2227
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2304
|
-
const { segments: routeSegments } =
|
|
2228
|
+
const { segments: routeSegments } = __privateGet3(this, _routeInfo);
|
|
2305
2229
|
if (pathSegments.length !== routeSegments.length) {
|
|
2306
2230
|
return { match: false };
|
|
2307
2231
|
}
|
|
@@ -2322,7 +2246,7 @@ var _Route = class _Route2 {
|
|
|
2322
2246
|
return { match: false };
|
|
2323
2247
|
}
|
|
2324
2248
|
}
|
|
2325
|
-
for (const [key, value] of
|
|
2249
|
+
for (const [key, value] of __privateGet3(this, _routeInfo).queryParams) {
|
|
2326
2250
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2327
2251
|
}
|
|
2328
2252
|
return possibleMatch;
|
|
@@ -2332,7 +2256,7 @@ var _Route = class _Route2 {
|
|
|
2332
2256
|
*/
|
|
2333
2257
|
expand(options) {
|
|
2334
2258
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2335
|
-
const path =
|
|
2259
|
+
const path = __privateGet3(this, _routeInfo).segments.map((segment) => {
|
|
2336
2260
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2337
2261
|
if (!dynamicSegmentName) {
|
|
2338
2262
|
return segment;
|
|
@@ -2383,7 +2307,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2383
2307
|
}
|
|
2384
2308
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2385
2309
|
};
|
|
2386
|
-
|
|
2310
|
+
__privateAdd3(_Route, _Route_static);
|
|
2387
2311
|
_Route.dynamicSegmentPrefix = ":";
|
|
2388
2312
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2389
2313
|
if (!doNotEscapeVariables) {
|