@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/cache.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
|
|
|
@@ -409,14 +161,14 @@ var import_next_app_router_shared = require("@uniformdev/next-app-router-shared"
|
|
|
409
161
|
// ../context/dist/api/api.mjs
|
|
410
162
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
411
163
|
var __defProp2 = Object.defineProperty;
|
|
412
|
-
var
|
|
164
|
+
var __typeError = (msg) => {
|
|
413
165
|
throw TypeError(msg);
|
|
414
166
|
};
|
|
415
|
-
var
|
|
416
|
-
var
|
|
417
|
-
var
|
|
418
|
-
var
|
|
419
|
-
var
|
|
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);
|
|
420
172
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
421
173
|
var ApiClientError = class _ApiClientError extends Error {
|
|
422
174
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -424,18 +176,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
424
176
|
`${errorMessage}
|
|
425
177
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
426
178
|
);
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
179
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
180
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
181
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
182
|
+
__publicField(this, "statusCode", statusCode);
|
|
183
|
+
__publicField(this, "statusText", statusText);
|
|
184
|
+
__publicField(this, "requestId", requestId);
|
|
433
185
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
434
186
|
}
|
|
435
187
|
};
|
|
436
188
|
var ApiClient = class _ApiClient {
|
|
437
189
|
constructor(options) {
|
|
438
|
-
|
|
190
|
+
__publicField(this, "options");
|
|
439
191
|
var _a, _b, _c, _d, _e;
|
|
440
192
|
if (!options.apiKey && !options.bearerToken) {
|
|
441
193
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -605,12 +357,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
605
357
|
/** Fetches all aggregates for a project */
|
|
606
358
|
async get(options) {
|
|
607
359
|
const { projectId } = this.options;
|
|
608
|
-
const fetchUri = this.createUrl(
|
|
360
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
|
|
609
361
|
return await this.apiClient(fetchUri);
|
|
610
362
|
}
|
|
611
363
|
/** Updates or creates (based on id) an Aggregate */
|
|
612
364
|
async upsert(body) {
|
|
613
|
-
const fetchUri = this.createUrl(
|
|
365
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
614
366
|
await this.apiClient(fetchUri, {
|
|
615
367
|
method: "PUT",
|
|
616
368
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -619,7 +371,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
619
371
|
}
|
|
620
372
|
/** Deletes an Aggregate */
|
|
621
373
|
async remove(body) {
|
|
622
|
-
const fetchUri = this.createUrl(
|
|
374
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
623
375
|
await this.apiClient(fetchUri, {
|
|
624
376
|
method: "DELETE",
|
|
625
377
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -628,7 +380,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
628
380
|
}
|
|
629
381
|
};
|
|
630
382
|
_url = /* @__PURE__ */ new WeakMap();
|
|
631
|
-
|
|
383
|
+
__privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
|
|
632
384
|
var _url2;
|
|
633
385
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
634
386
|
constructor(options) {
|
|
@@ -637,12 +389,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
637
389
|
/** Fetches the known score dimensions for a project */
|
|
638
390
|
async get(options) {
|
|
639
391
|
const { projectId } = this.options;
|
|
640
|
-
const fetchUri = this.createUrl(
|
|
392
|
+
const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
|
|
641
393
|
return await this.apiClient(fetchUri);
|
|
642
394
|
}
|
|
643
395
|
};
|
|
644
396
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
645
|
-
|
|
397
|
+
__privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
|
|
646
398
|
var _url3;
|
|
647
399
|
var _valueUrl;
|
|
648
400
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -652,12 +404,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
652
404
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
653
405
|
async get(options) {
|
|
654
406
|
const { projectId } = this.options;
|
|
655
|
-
const fetchUri = this.createUrl(
|
|
407
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
656
408
|
return await this.apiClient(fetchUri);
|
|
657
409
|
}
|
|
658
410
|
/** Updates or creates (based on id) an enrichment category */
|
|
659
411
|
async upsertCategory(body) {
|
|
660
|
-
const fetchUri = this.createUrl(
|
|
412
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
661
413
|
await this.apiClient(fetchUri, {
|
|
662
414
|
method: "PUT",
|
|
663
415
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -666,7 +418,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
666
418
|
}
|
|
667
419
|
/** Deletes an enrichment category */
|
|
668
420
|
async removeCategory(body) {
|
|
669
|
-
const fetchUri = this.createUrl(
|
|
421
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
670
422
|
await this.apiClient(fetchUri, {
|
|
671
423
|
method: "DELETE",
|
|
672
424
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -675,7 +427,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
675
427
|
}
|
|
676
428
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
677
429
|
async upsertValue(body) {
|
|
678
|
-
const fetchUri = this.createUrl(
|
|
430
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
679
431
|
await this.apiClient(fetchUri, {
|
|
680
432
|
method: "PUT",
|
|
681
433
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -684,7 +436,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
684
436
|
}
|
|
685
437
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
686
438
|
async removeValue(body) {
|
|
687
|
-
const fetchUri = this.createUrl(
|
|
439
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
688
440
|
await this.apiClient(fetchUri, {
|
|
689
441
|
method: "DELETE",
|
|
690
442
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -694,8 +446,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
694
446
|
};
|
|
695
447
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
696
448
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
697
|
-
|
|
698
|
-
|
|
449
|
+
__privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
450
|
+
__privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
699
451
|
var _url4;
|
|
700
452
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
701
453
|
constructor(options) {
|
|
@@ -704,7 +456,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
704
456
|
/** Fetches the Context manifest for a project */
|
|
705
457
|
async get(options) {
|
|
706
458
|
const { projectId } = this.options;
|
|
707
|
-
const fetchUri = this.createUrl(
|
|
459
|
+
const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
|
|
708
460
|
return await this.apiClient(fetchUri);
|
|
709
461
|
}
|
|
710
462
|
/** Publishes the Context manifest for a project */
|
|
@@ -718,7 +470,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
718
470
|
}
|
|
719
471
|
};
|
|
720
472
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
721
|
-
|
|
473
|
+
__privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
|
|
722
474
|
var ManifestClient = _ManifestClient;
|
|
723
475
|
var _url5;
|
|
724
476
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
@@ -728,12 +480,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
728
480
|
/** Fetches all Quirks for a project */
|
|
729
481
|
async get(options) {
|
|
730
482
|
const { projectId } = this.options;
|
|
731
|
-
const fetchUri = this.createUrl(
|
|
483
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
|
|
732
484
|
return await this.apiClient(fetchUri);
|
|
733
485
|
}
|
|
734
486
|
/** Updates or creates (based on id) a Quirk */
|
|
735
487
|
async upsert(body) {
|
|
736
|
-
const fetchUri = this.createUrl(
|
|
488
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
737
489
|
await this.apiClient(fetchUri, {
|
|
738
490
|
method: "PUT",
|
|
739
491
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -742,7 +494,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
742
494
|
}
|
|
743
495
|
/** Deletes a Quirk */
|
|
744
496
|
async remove(body) {
|
|
745
|
-
const fetchUri = this.createUrl(
|
|
497
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
746
498
|
await this.apiClient(fetchUri, {
|
|
747
499
|
method: "DELETE",
|
|
748
500
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -751,7 +503,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
751
503
|
}
|
|
752
504
|
};
|
|
753
505
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
754
|
-
|
|
506
|
+
__privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
|
|
755
507
|
var _url6;
|
|
756
508
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
757
509
|
constructor(options) {
|
|
@@ -760,12 +512,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
760
512
|
/** Fetches all Signals for a project */
|
|
761
513
|
async get(options) {
|
|
762
514
|
const { projectId } = this.options;
|
|
763
|
-
const fetchUri = this.createUrl(
|
|
515
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
|
|
764
516
|
return await this.apiClient(fetchUri);
|
|
765
517
|
}
|
|
766
518
|
/** Updates or creates (based on id) a Signal */
|
|
767
519
|
async upsert(body) {
|
|
768
|
-
const fetchUri = this.createUrl(
|
|
520
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
769
521
|
await this.apiClient(fetchUri, {
|
|
770
522
|
method: "PUT",
|
|
771
523
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -774,7 +526,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
774
526
|
}
|
|
775
527
|
/** Deletes a Signal */
|
|
776
528
|
async remove(body) {
|
|
777
|
-
const fetchUri = this.createUrl(
|
|
529
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
778
530
|
await this.apiClient(fetchUri, {
|
|
779
531
|
method: "DELETE",
|
|
780
532
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -783,7 +535,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
783
535
|
}
|
|
784
536
|
};
|
|
785
537
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
786
|
-
|
|
538
|
+
__privateAdd(_SignalClient, _url6, "/api/v2/signal");
|
|
787
539
|
var _url7;
|
|
788
540
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
789
541
|
constructor(options) {
|
|
@@ -792,12 +544,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
792
544
|
/** Fetches all Tests for a project */
|
|
793
545
|
async get(options) {
|
|
794
546
|
const { projectId } = this.options;
|
|
795
|
-
const fetchUri = this.createUrl(
|
|
547
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
|
|
796
548
|
return await this.apiClient(fetchUri);
|
|
797
549
|
}
|
|
798
550
|
/** Updates or creates (based on id) a Test */
|
|
799
551
|
async upsert(body) {
|
|
800
|
-
const fetchUri = this.createUrl(
|
|
552
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
801
553
|
await this.apiClient(fetchUri, {
|
|
802
554
|
method: "PUT",
|
|
803
555
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -806,7 +558,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
806
558
|
}
|
|
807
559
|
/** Deletes a Test */
|
|
808
560
|
async remove(body) {
|
|
809
|
-
const fetchUri = this.createUrl(
|
|
561
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
810
562
|
await this.apiClient(fetchUri, {
|
|
811
563
|
method: "DELETE",
|
|
812
564
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -815,194 +567,393 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
815
567
|
}
|
|
816
568
|
};
|
|
817
569
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
818
|
-
|
|
570
|
+
__privateAdd(_TestClient, _url7, "/api/v2/test");
|
|
819
571
|
|
|
820
|
-
//
|
|
821
|
-
var
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
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);
|
|
827
581
|
};
|
|
828
|
-
var
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
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)._++;
|
|
846
|
-
}
|
|
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;
|
|
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 });
|
|
858
590
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
591
|
+
return to;
|
|
592
|
+
};
|
|
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;
|
|
872
660
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
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;
|
|
879
716
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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
|
+
}
|
|
883
740
|
}
|
|
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
|
+
};
|
|
884
850
|
}
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
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();
|
|
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);
|
|
924
867
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
pendingCount: {
|
|
935
|
-
get: () => queue.size
|
|
936
|
-
},
|
|
937
|
-
clearQueue: {
|
|
938
|
-
value() {
|
|
939
|
-
queue.clear();
|
|
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];
|
|
940
877
|
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
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));
|
|
887
|
+
}
|
|
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;
|
|
903
|
+
}
|
|
904
|
+
if (!methods) {
|
|
905
|
+
methods = [];
|
|
906
|
+
for (var key in obj) {
|
|
907
|
+
if (typeof obj[key] === "function") {
|
|
908
|
+
methods.push(key);
|
|
950
909
|
}
|
|
951
|
-
}
|
|
910
|
+
}
|
|
952
911
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
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;
|
|
933
|
+
}
|
|
934
|
+
};
|
|
960
935
|
}
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
var
|
|
969
|
-
var
|
|
970
|
-
|
|
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();
|
|
941
|
+
}
|
|
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",
|
|
971
947
|
// Chrome
|
|
972
948
|
"NetworkError when attempting to fetch resource.",
|
|
973
949
|
// Firefox
|
|
974
950
|
"The Internet connection appears to be offline.",
|
|
975
|
-
// Safari
|
|
951
|
+
// Safari
|
|
976
952
|
"Network request failed",
|
|
977
953
|
// `cross-fetch`
|
|
978
|
-
"fetch failed"
|
|
954
|
+
"fetch failed"
|
|
979
955
|
// 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)
|
|
986
956
|
]);
|
|
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
|
|
1006
957
|
var AbortError = class extends Error {
|
|
1007
958
|
constructor(message) {
|
|
1008
959
|
super();
|
|
@@ -1023,71 +974,63 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
1023
974
|
error.retriesLeft = retriesLeft;
|
|
1024
975
|
return error;
|
|
1025
976
|
};
|
|
977
|
+
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
978
|
+
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
1026
979
|
async function pRetry(input, options) {
|
|
1027
980
|
return new Promise((resolve, reject) => {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
981
|
+
options = {
|
|
982
|
+
onFailedAttempt() {
|
|
983
|
+
},
|
|
984
|
+
retries: 10,
|
|
985
|
+
...options
|
|
1031
986
|
};
|
|
1032
|
-
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1033
|
-
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1034
987
|
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
|
-
};
|
|
1048
988
|
operation.attempt(async (attemptNumber) => {
|
|
1049
989
|
try {
|
|
1050
|
-
|
|
1051
|
-
cleanUp();
|
|
1052
|
-
resolve(result);
|
|
990
|
+
resolve(await input(attemptNumber));
|
|
1053
991
|
} catch (error) {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
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 {
|
|
1064
1003
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1004
|
+
try {
|
|
1005
|
+
await options.onFailedAttempt(error);
|
|
1006
|
+
} catch (error2) {
|
|
1007
|
+
reject(error2);
|
|
1008
|
+
return;
|
|
1068
1009
|
}
|
|
1069
|
-
await options.onFailedAttempt(error);
|
|
1070
1010
|
if (!operation.retry(error)) {
|
|
1071
|
-
|
|
1011
|
+
reject(operation.mainError());
|
|
1072
1012
|
}
|
|
1073
|
-
} catch (finalError) {
|
|
1074
|
-
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1075
|
-
cleanUp();
|
|
1076
|
-
reject(finalError);
|
|
1077
1013
|
}
|
|
1078
1014
|
}
|
|
1079
1015
|
});
|
|
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
|
+
}
|
|
1080
1025
|
});
|
|
1081
1026
|
}
|
|
1082
|
-
|
|
1083
|
-
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1084
1027
|
var AbortError2 = class extends Error {
|
|
1085
1028
|
constructor() {
|
|
1086
1029
|
super("Throttled function aborted");
|
|
1087
1030
|
this.name = "AbortError";
|
|
1088
1031
|
}
|
|
1089
1032
|
};
|
|
1090
|
-
function pThrottle({ limit, interval, strict
|
|
1033
|
+
function pThrottle({ limit, interval, strict }) {
|
|
1091
1034
|
if (!Number.isFinite(limit)) {
|
|
1092
1035
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1093
1036
|
}
|
|
@@ -1115,38 +1058,32 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1115
1058
|
const strictTicks = [];
|
|
1116
1059
|
function strictDelay() {
|
|
1117
1060
|
const now = Date.now();
|
|
1118
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1119
|
-
strictTicks.length = 0;
|
|
1120
|
-
}
|
|
1121
1061
|
if (strictTicks.length < limit) {
|
|
1122
1062
|
strictTicks.push(now);
|
|
1123
1063
|
return 0;
|
|
1124
1064
|
}
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1065
|
+
const earliestTime = strictTicks.shift() + interval;
|
|
1066
|
+
if (now >= earliestTime) {
|
|
1067
|
+
strictTicks.push(now);
|
|
1068
|
+
return 0;
|
|
1069
|
+
}
|
|
1070
|
+
strictTicks.push(earliestTime);
|
|
1071
|
+
return earliestTime - now;
|
|
1129
1072
|
}
|
|
1130
1073
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1131
1074
|
return (function_) => {
|
|
1132
|
-
const throttled = function(...
|
|
1075
|
+
const throttled = function(...args) {
|
|
1133
1076
|
if (!throttled.isEnabled) {
|
|
1134
|
-
return (async () => function_.apply(this,
|
|
1077
|
+
return (async () => function_.apply(this, args))();
|
|
1135
1078
|
}
|
|
1136
|
-
let
|
|
1079
|
+
let timeout;
|
|
1137
1080
|
return new Promise((resolve, reject) => {
|
|
1138
1081
|
const execute = () => {
|
|
1139
|
-
resolve(function_.apply(this,
|
|
1140
|
-
queue.delete(
|
|
1082
|
+
resolve(function_.apply(this, args));
|
|
1083
|
+
queue.delete(timeout);
|
|
1141
1084
|
};
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
timeoutId = setTimeout(execute, delay);
|
|
1145
|
-
queue.set(timeoutId, reject);
|
|
1146
|
-
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1147
|
-
} else {
|
|
1148
|
-
execute();
|
|
1149
|
-
}
|
|
1085
|
+
timeout = setTimeout(execute, getDelay());
|
|
1086
|
+
queue.set(timeout, reject);
|
|
1150
1087
|
});
|
|
1151
1088
|
};
|
|
1152
1089
|
throttled.abort = () => {
|
|
@@ -1158,29 +1095,16 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1158
1095
|
strictTicks.splice(0, strictTicks.length);
|
|
1159
1096
|
};
|
|
1160
1097
|
throttled.isEnabled = true;
|
|
1161
|
-
Object.defineProperty(throttled, "queueSize", {
|
|
1162
|
-
get() {
|
|
1163
|
-
return queue.size;
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1166
1098
|
return throttled;
|
|
1167
1099
|
};
|
|
1168
1100
|
}
|
|
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);
|
|
1177
1101
|
function createLimitPolicy({
|
|
1178
1102
|
throttle = { interval: 1e3, limit: 10 },
|
|
1179
|
-
retry:
|
|
1103
|
+
retry: retry2 = { retries: 1, factor: 1.66 },
|
|
1180
1104
|
limit = 10
|
|
1181
1105
|
}) {
|
|
1182
1106
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1183
|
-
const limiter = limit ?
|
|
1107
|
+
const limiter = limit ? (0, import_p_limit2.default)(limit) : null;
|
|
1184
1108
|
return function limitPolicy(func) {
|
|
1185
1109
|
let currentFunc = async () => await func();
|
|
1186
1110
|
if (throttler) {
|
|
@@ -1191,13 +1115,13 @@ function createLimitPolicy({
|
|
|
1191
1115
|
const limitFunc = currentFunc;
|
|
1192
1116
|
currentFunc = () => limiter(limitFunc);
|
|
1193
1117
|
}
|
|
1194
|
-
if (
|
|
1118
|
+
if (retry2) {
|
|
1195
1119
|
const retryFunc = currentFunc;
|
|
1196
1120
|
currentFunc = () => pRetry(retryFunc, {
|
|
1197
|
-
...
|
|
1121
|
+
...retry2,
|
|
1198
1122
|
onFailedAttempt: async (error) => {
|
|
1199
|
-
if (
|
|
1200
|
-
await
|
|
1123
|
+
if (retry2.onFailedAttempt) {
|
|
1124
|
+
await retry2.onFailedAttempt(error);
|
|
1201
1125
|
}
|
|
1202
1126
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1203
1127
|
throw error;
|
|
@@ -1218,7 +1142,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1218
1142
|
}
|
|
1219
1143
|
getContentTypes(options) {
|
|
1220
1144
|
const { projectId } = this.options;
|
|
1221
|
-
const fetchUri = this.createUrl(
|
|
1145
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1222
1146
|
return this.apiClient(fetchUri);
|
|
1223
1147
|
}
|
|
1224
1148
|
getEntries(options) {
|
|
@@ -1226,11 +1150,11 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1226
1150
|
const { skipDataResolution, filters, ...params } = options;
|
|
1227
1151
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1228
1152
|
if (skipDataResolution) {
|
|
1229
|
-
const url = this.createUrl(
|
|
1153
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1230
1154
|
return this.apiClient(url);
|
|
1231
1155
|
}
|
|
1232
1156
|
const edgeUrl = this.createUrl(
|
|
1233
|
-
|
|
1157
|
+
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1234
1158
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1235
1159
|
this.edgeApiHost
|
|
1236
1160
|
);
|
|
@@ -1248,7 +1172,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1248
1172
|
return this.apiClient(historyUrl);
|
|
1249
1173
|
}
|
|
1250
1174
|
async upsertContentType(body, opts = {}) {
|
|
1251
|
-
const fetchUri = this.createUrl(
|
|
1175
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1252
1176
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1253
1177
|
delete body.contentType.slugSettings;
|
|
1254
1178
|
}
|
|
@@ -1260,7 +1184,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1260
1184
|
});
|
|
1261
1185
|
}
|
|
1262
1186
|
async upsertEntry(body, options) {
|
|
1263
|
-
const fetchUri = this.createUrl(
|
|
1187
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1264
1188
|
const headers = {};
|
|
1265
1189
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1266
1190
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1274,7 +1198,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1274
1198
|
return { modified: response.headers.get("x-modified-at") };
|
|
1275
1199
|
}
|
|
1276
1200
|
async deleteContentType(body) {
|
|
1277
|
-
const fetchUri = this.createUrl(
|
|
1201
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1278
1202
|
await this.apiClient(fetchUri, {
|
|
1279
1203
|
method: "DELETE",
|
|
1280
1204
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1282,7 +1206,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1282
1206
|
});
|
|
1283
1207
|
}
|
|
1284
1208
|
async deleteEntry(body) {
|
|
1285
|
-
const fetchUri = this.createUrl(
|
|
1209
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1286
1210
|
await this.apiClient(fetchUri, {
|
|
1287
1211
|
method: "DELETE",
|
|
1288
1212
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1301,8 +1225,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1301
1225
|
};
|
|
1302
1226
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1303
1227
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1304
|
-
|
|
1305
|
-
|
|
1228
|
+
__privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1229
|
+
__privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1306
1230
|
var _url8;
|
|
1307
1231
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1308
1232
|
constructor(options) {
|
|
@@ -1311,12 +1235,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1311
1235
|
/** Fetches all DataTypes for a project */
|
|
1312
1236
|
async get(options) {
|
|
1313
1237
|
const { projectId } = this.options;
|
|
1314
|
-
const fetchUri = this.createUrl(
|
|
1238
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1315
1239
|
return await this.apiClient(fetchUri);
|
|
1316
1240
|
}
|
|
1317
1241
|
/** Updates or creates (based on id) a DataType */
|
|
1318
1242
|
async upsert(body) {
|
|
1319
|
-
const fetchUri = this.createUrl(
|
|
1243
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
1320
1244
|
await this.apiClient(fetchUri, {
|
|
1321
1245
|
method: "PUT",
|
|
1322
1246
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1325,7 +1249,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1325
1249
|
}
|
|
1326
1250
|
/** Deletes a DataType */
|
|
1327
1251
|
async remove(body) {
|
|
1328
|
-
const fetchUri = this.createUrl(
|
|
1252
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
1329
1253
|
await this.apiClient(fetchUri, {
|
|
1330
1254
|
method: "DELETE",
|
|
1331
1255
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1334,7 +1258,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1334
1258
|
}
|
|
1335
1259
|
};
|
|
1336
1260
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1337
|
-
|
|
1261
|
+
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1338
1262
|
var CANVAS_DRAFT_STATE = 0;
|
|
1339
1263
|
var CANVAS_PUBLISHED_STATE = 64;
|
|
1340
1264
|
var CANVAS_EDITOR_STATE = 63;
|
|
@@ -1353,7 +1277,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1353
1277
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1354
1278
|
*/
|
|
1355
1279
|
get(options) {
|
|
1356
|
-
const fetchUri = this.createUrl(
|
|
1280
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1357
1281
|
...options,
|
|
1358
1282
|
teamId: this.teamId
|
|
1359
1283
|
});
|
|
@@ -1363,7 +1287,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1363
1287
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1364
1288
|
*/
|
|
1365
1289
|
async deploy(body) {
|
|
1366
|
-
const fetchUri = this.createUrl(
|
|
1290
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1367
1291
|
await this.apiClient(fetchUri, {
|
|
1368
1292
|
method: "PUT",
|
|
1369
1293
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1374,7 +1298,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1374
1298
|
* Removes a custom AI property editor from a Mesh app.
|
|
1375
1299
|
*/
|
|
1376
1300
|
async delete(body) {
|
|
1377
|
-
const fetchUri = this.createUrl(
|
|
1301
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1378
1302
|
await this.apiClient(fetchUri, {
|
|
1379
1303
|
method: "DELETE",
|
|
1380
1304
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1383,7 +1307,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1383
1307
|
}
|
|
1384
1308
|
};
|
|
1385
1309
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1386
|
-
|
|
1310
|
+
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1387
1311
|
var _url22;
|
|
1388
1312
|
var _projectsUrl;
|
|
1389
1313
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1392,7 +1316,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1392
1316
|
}
|
|
1393
1317
|
/** Fetches single Project */
|
|
1394
1318
|
async get(options) {
|
|
1395
|
-
const fetchUri = this.createUrl(
|
|
1319
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1396
1320
|
return await this.apiClient(fetchUri);
|
|
1397
1321
|
}
|
|
1398
1322
|
/**
|
|
@@ -1401,12 +1325,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1401
1325
|
* When omitted, returns all accessible teams and their projects.
|
|
1402
1326
|
*/
|
|
1403
1327
|
async getProjects(options) {
|
|
1404
|
-
const fetchUri = this.createUrl(
|
|
1328
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1405
1329
|
return await this.apiClient(fetchUri);
|
|
1406
1330
|
}
|
|
1407
1331
|
/** Updates or creates (based on id) a Project */
|
|
1408
1332
|
async upsert(body) {
|
|
1409
|
-
const fetchUri = this.createUrl(
|
|
1333
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
1410
1334
|
return await this.apiClient(fetchUri, {
|
|
1411
1335
|
method: "PUT",
|
|
1412
1336
|
body: JSON.stringify({ ...body })
|
|
@@ -1414,7 +1338,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1414
1338
|
}
|
|
1415
1339
|
/** Deletes a Project */
|
|
1416
1340
|
async delete(body) {
|
|
1417
|
-
const fetchUri = this.createUrl(
|
|
1341
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
1418
1342
|
await this.apiClient(fetchUri, {
|
|
1419
1343
|
method: "DELETE",
|
|
1420
1344
|
body: JSON.stringify({ ...body }),
|
|
@@ -1424,8 +1348,8 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1424
1348
|
};
|
|
1425
1349
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1426
1350
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1427
|
-
|
|
1428
|
-
|
|
1351
|
+
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1352
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1429
1353
|
var ROUTE_URL = "/api/v1/route";
|
|
1430
1354
|
var RouteClient = class extends ApiClient {
|
|
1431
1355
|
constructor(options) {
|
|
@@ -1639,7 +1563,7 @@ function createLimiter(concurrency) {
|
|
|
1639
1563
|
});
|
|
1640
1564
|
};
|
|
1641
1565
|
}
|
|
1642
|
-
async function
|
|
1566
|
+
async function retry(fn, options) {
|
|
1643
1567
|
let lastError;
|
|
1644
1568
|
let delay = 1e3;
|
|
1645
1569
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -1679,7 +1603,7 @@ function createLimitPolicy2({
|
|
|
1679
1603
|
}
|
|
1680
1604
|
if (retryOptions) {
|
|
1681
1605
|
const retryFunc = currentFunc;
|
|
1682
|
-
currentFunc = () =>
|
|
1606
|
+
currentFunc = () => retry(retryFunc, {
|
|
1683
1607
|
...retryOptions,
|
|
1684
1608
|
onFailedAttempt: async (error) => {
|
|
1685
1609
|
if (retryOptions.onFailedAttempt) {
|