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