@uniformdev/next-app-router 20.50.2-alpha.146 → 20.50.2-alpha.167
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 +670 -515
- package/dist/cache.mjs +670 -515
- package/dist/component.js +81 -380
- package/dist/component.mjs +81 -380
- package/dist/handler.js +755 -640
- package/dist/handler.mjs +755 -640
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +775 -649
- package/dist/index.js +778 -652
- package/dist/index.mjs +775 -649
- package/dist/middleware.js +716 -599
- package/dist/middleware.mjs +716 -599
- package/package.json +19 -19
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
12
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
14
|
};
|
|
@@ -29,12 +33,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
33
|
mod
|
|
30
34
|
));
|
|
31
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
38
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
39
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
40
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
41
|
+
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
42
|
+
set _(value) {
|
|
43
|
+
__privateSet(obj, member, value, setter);
|
|
44
|
+
},
|
|
45
|
+
get _() {
|
|
46
|
+
return __privateGet(obj, member, getter);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
32
49
|
|
|
33
50
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
34
51
|
var require_yocto_queue = __commonJS({
|
|
35
52
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
36
53
|
"use strict";
|
|
37
|
-
var
|
|
54
|
+
var Node2 = class {
|
|
38
55
|
/// value;
|
|
39
56
|
/// next;
|
|
40
57
|
constructor(value) {
|
|
@@ -42,7 +59,7 @@ var require_yocto_queue = __commonJS({
|
|
|
42
59
|
this.next = void 0;
|
|
43
60
|
}
|
|
44
61
|
};
|
|
45
|
-
var
|
|
62
|
+
var Queue2 = class {
|
|
46
63
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
47
64
|
// #_head;
|
|
48
65
|
// #_tail;
|
|
@@ -51,7 +68,7 @@ var require_yocto_queue = __commonJS({
|
|
|
51
68
|
this.clear();
|
|
52
69
|
}
|
|
53
70
|
enqueue(value) {
|
|
54
|
-
const node = new
|
|
71
|
+
const node = new Node2(value);
|
|
55
72
|
if (this._head) {
|
|
56
73
|
this._tail.next = node;
|
|
57
74
|
this._tail = node;
|
|
@@ -86,7 +103,7 @@ var require_yocto_queue = __commonJS({
|
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
105
|
};
|
|
89
|
-
module2.exports =
|
|
106
|
+
module2.exports = Queue2;
|
|
90
107
|
}
|
|
91
108
|
});
|
|
92
109
|
|
|
@@ -94,12 +111,12 @@ var require_yocto_queue = __commonJS({
|
|
|
94
111
|
var require_p_limit = __commonJS({
|
|
95
112
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
96
113
|
"use strict";
|
|
97
|
-
var
|
|
98
|
-
var
|
|
114
|
+
var Queue2 = require_yocto_queue();
|
|
115
|
+
var pLimit3 = (concurrency) => {
|
|
99
116
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
100
117
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
101
118
|
}
|
|
102
|
-
const queue = new
|
|
119
|
+
const queue = new Queue2();
|
|
103
120
|
let activeCount = 0;
|
|
104
121
|
const next = () => {
|
|
105
122
|
activeCount--;
|
|
@@ -144,13 +161,244 @@ var require_p_limit = __commonJS({
|
|
|
144
161
|
});
|
|
145
162
|
return generator;
|
|
146
163
|
};
|
|
147
|
-
module2.exports =
|
|
164
|
+
module2.exports = pLimit3;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
169
|
+
var require_retry_operation = __commonJS({
|
|
170
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
171
|
+
"use strict";
|
|
172
|
+
function RetryOperation(timeouts, options) {
|
|
173
|
+
if (typeof options === "boolean") {
|
|
174
|
+
options = { forever: options };
|
|
175
|
+
}
|
|
176
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
177
|
+
this._timeouts = timeouts;
|
|
178
|
+
this._options = options || {};
|
|
179
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
180
|
+
this._fn = null;
|
|
181
|
+
this._errors = [];
|
|
182
|
+
this._attempts = 1;
|
|
183
|
+
this._operationTimeout = null;
|
|
184
|
+
this._operationTimeoutCb = null;
|
|
185
|
+
this._timeout = null;
|
|
186
|
+
this._operationStart = null;
|
|
187
|
+
this._timer = null;
|
|
188
|
+
if (this._options.forever) {
|
|
189
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
module2.exports = RetryOperation;
|
|
193
|
+
RetryOperation.prototype.reset = function() {
|
|
194
|
+
this._attempts = 1;
|
|
195
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
196
|
+
};
|
|
197
|
+
RetryOperation.prototype.stop = function() {
|
|
198
|
+
if (this._timeout) {
|
|
199
|
+
clearTimeout(this._timeout);
|
|
200
|
+
}
|
|
201
|
+
if (this._timer) {
|
|
202
|
+
clearTimeout(this._timer);
|
|
203
|
+
}
|
|
204
|
+
this._timeouts = [];
|
|
205
|
+
this._cachedTimeouts = null;
|
|
206
|
+
};
|
|
207
|
+
RetryOperation.prototype.retry = function(err) {
|
|
208
|
+
if (this._timeout) {
|
|
209
|
+
clearTimeout(this._timeout);
|
|
210
|
+
}
|
|
211
|
+
if (!err) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
215
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
216
|
+
this._errors.push(err);
|
|
217
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
this._errors.push(err);
|
|
221
|
+
var timeout = this._timeouts.shift();
|
|
222
|
+
if (timeout === void 0) {
|
|
223
|
+
if (this._cachedTimeouts) {
|
|
224
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
225
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
226
|
+
} else {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
var self = this;
|
|
231
|
+
this._timer = setTimeout(function() {
|
|
232
|
+
self._attempts++;
|
|
233
|
+
if (self._operationTimeoutCb) {
|
|
234
|
+
self._timeout = setTimeout(function() {
|
|
235
|
+
self._operationTimeoutCb(self._attempts);
|
|
236
|
+
}, self._operationTimeout);
|
|
237
|
+
if (self._options.unref) {
|
|
238
|
+
self._timeout.unref();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
self._fn(self._attempts);
|
|
242
|
+
}, timeout);
|
|
243
|
+
if (this._options.unref) {
|
|
244
|
+
this._timer.unref();
|
|
245
|
+
}
|
|
246
|
+
return true;
|
|
247
|
+
};
|
|
248
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
249
|
+
this._fn = fn;
|
|
250
|
+
if (timeoutOps) {
|
|
251
|
+
if (timeoutOps.timeout) {
|
|
252
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
253
|
+
}
|
|
254
|
+
if (timeoutOps.cb) {
|
|
255
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
var self = this;
|
|
259
|
+
if (this._operationTimeoutCb) {
|
|
260
|
+
this._timeout = setTimeout(function() {
|
|
261
|
+
self._operationTimeoutCb();
|
|
262
|
+
}, self._operationTimeout);
|
|
263
|
+
}
|
|
264
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
265
|
+
this._fn(this._attempts);
|
|
266
|
+
};
|
|
267
|
+
RetryOperation.prototype.try = function(fn) {
|
|
268
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
269
|
+
this.attempt(fn);
|
|
270
|
+
};
|
|
271
|
+
RetryOperation.prototype.start = function(fn) {
|
|
272
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
273
|
+
this.attempt(fn);
|
|
274
|
+
};
|
|
275
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
276
|
+
RetryOperation.prototype.errors = function() {
|
|
277
|
+
return this._errors;
|
|
278
|
+
};
|
|
279
|
+
RetryOperation.prototype.attempts = function() {
|
|
280
|
+
return this._attempts;
|
|
281
|
+
};
|
|
282
|
+
RetryOperation.prototype.mainError = function() {
|
|
283
|
+
if (this._errors.length === 0) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
var counts = {};
|
|
287
|
+
var mainError = null;
|
|
288
|
+
var mainErrorCount = 0;
|
|
289
|
+
for (var i = 0; i < this._errors.length; i++) {
|
|
290
|
+
var error = this._errors[i];
|
|
291
|
+
var message = error.message;
|
|
292
|
+
var count = (counts[message] || 0) + 1;
|
|
293
|
+
counts[message] = count;
|
|
294
|
+
if (count >= mainErrorCount) {
|
|
295
|
+
mainError = error;
|
|
296
|
+
mainErrorCount = count;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return mainError;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
305
|
+
var require_retry = __commonJS({
|
|
306
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
307
|
+
"use strict";
|
|
308
|
+
var RetryOperation = require_retry_operation();
|
|
309
|
+
exports2.operation = function(options) {
|
|
310
|
+
var timeouts = exports2.timeouts(options);
|
|
311
|
+
return new RetryOperation(timeouts, {
|
|
312
|
+
forever: options && (options.forever || options.retries === Infinity),
|
|
313
|
+
unref: options && options.unref,
|
|
314
|
+
maxRetryTime: options && options.maxRetryTime
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
exports2.timeouts = function(options) {
|
|
318
|
+
if (options instanceof Array) {
|
|
319
|
+
return [].concat(options);
|
|
320
|
+
}
|
|
321
|
+
var opts = {
|
|
322
|
+
retries: 10,
|
|
323
|
+
factor: 2,
|
|
324
|
+
minTimeout: 1 * 1e3,
|
|
325
|
+
maxTimeout: Infinity,
|
|
326
|
+
randomize: false
|
|
327
|
+
};
|
|
328
|
+
for (var key in options) {
|
|
329
|
+
opts[key] = options[key];
|
|
330
|
+
}
|
|
331
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
332
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
333
|
+
}
|
|
334
|
+
var timeouts = [];
|
|
335
|
+
for (var i = 0; i < opts.retries; i++) {
|
|
336
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
337
|
+
}
|
|
338
|
+
if (options && options.forever && !timeouts.length) {
|
|
339
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
340
|
+
}
|
|
341
|
+
timeouts.sort(function(a, b) {
|
|
342
|
+
return a - b;
|
|
343
|
+
});
|
|
344
|
+
return timeouts;
|
|
345
|
+
};
|
|
346
|
+
exports2.createTimeout = function(attempt, opts) {
|
|
347
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
348
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
349
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
350
|
+
return timeout;
|
|
351
|
+
};
|
|
352
|
+
exports2.wrap = function(obj, options, methods) {
|
|
353
|
+
if (options instanceof Array) {
|
|
354
|
+
methods = options;
|
|
355
|
+
options = null;
|
|
356
|
+
}
|
|
357
|
+
if (!methods) {
|
|
358
|
+
methods = [];
|
|
359
|
+
for (var key in obj) {
|
|
360
|
+
if (typeof obj[key] === "function") {
|
|
361
|
+
methods.push(key);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
for (var i = 0; i < methods.length; i++) {
|
|
366
|
+
var method = methods[i];
|
|
367
|
+
var original = obj[method];
|
|
368
|
+
obj[method] = function retryWrapper(original2) {
|
|
369
|
+
var op = exports2.operation(options);
|
|
370
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
371
|
+
var callback = args.pop();
|
|
372
|
+
args.push(function(err) {
|
|
373
|
+
if (op.retry(err)) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (err) {
|
|
377
|
+
arguments[0] = op.mainError();
|
|
378
|
+
}
|
|
379
|
+
callback.apply(this, arguments);
|
|
380
|
+
});
|
|
381
|
+
op.attempt(function() {
|
|
382
|
+
original2.apply(obj, args);
|
|
383
|
+
});
|
|
384
|
+
}.bind(obj, original);
|
|
385
|
+
obj[method].options = options;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
392
|
+
var require_retry2 = __commonJS({
|
|
393
|
+
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports2, module2) {
|
|
394
|
+
"use strict";
|
|
395
|
+
module2.exports = require_retry();
|
|
148
396
|
}
|
|
149
397
|
});
|
|
150
398
|
|
|
151
399
|
// src/index.ts
|
|
152
|
-
var
|
|
153
|
-
__export(
|
|
400
|
+
var index_exports = {};
|
|
401
|
+
__export(index_exports, {
|
|
154
402
|
DefaultDataClient: () => DefaultDataClient,
|
|
155
403
|
UniformComposition: () => UniformComposition,
|
|
156
404
|
UniformPlayground: () => UniformPlayground,
|
|
@@ -169,7 +417,7 @@ __export(src_exports, {
|
|
|
169
417
|
resolveRouteFromCode: () => resolveRouteFromCode,
|
|
170
418
|
serverContext: () => serverContext
|
|
171
419
|
});
|
|
172
|
-
module.exports = __toCommonJS(
|
|
420
|
+
module.exports = __toCommonJS(index_exports);
|
|
173
421
|
var import_server_only5 = require("server-only");
|
|
174
422
|
|
|
175
423
|
// src/clients/canvas.ts
|
|
@@ -178,14 +426,14 @@ var import_server_only = require("server-only");
|
|
|
178
426
|
// ../context/dist/api/api.mjs
|
|
179
427
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
180
428
|
var __defProp2 = Object.defineProperty;
|
|
181
|
-
var
|
|
429
|
+
var __typeError2 = (msg) => {
|
|
182
430
|
throw TypeError(msg);
|
|
183
431
|
};
|
|
184
|
-
var
|
|
185
|
-
var
|
|
186
|
-
var
|
|
187
|
-
var
|
|
188
|
-
var
|
|
432
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
433
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
434
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
435
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
436
|
+
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);
|
|
189
437
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
190
438
|
var ApiClientError = class _ApiClientError extends Error {
|
|
191
439
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -193,18 +441,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
193
441
|
`${errorMessage}
|
|
194
442
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
195
443
|
);
|
|
196
|
-
this
|
|
197
|
-
this
|
|
198
|
-
this
|
|
199
|
-
this
|
|
200
|
-
this
|
|
201
|
-
this
|
|
444
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
445
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
446
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
447
|
+
__publicField2(this, "statusCode", statusCode);
|
|
448
|
+
__publicField2(this, "statusText", statusText);
|
|
449
|
+
__publicField2(this, "requestId", requestId);
|
|
202
450
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
203
451
|
}
|
|
204
452
|
};
|
|
205
453
|
var ApiClient = class _ApiClient {
|
|
206
454
|
constructor(options) {
|
|
207
|
-
|
|
455
|
+
__publicField2(this, "options");
|
|
208
456
|
var _a, _b, _c, _d, _e;
|
|
209
457
|
if (!options.apiKey && !options.bearerToken) {
|
|
210
458
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -374,12 +622,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
374
622
|
/** Fetches all aggregates for a project */
|
|
375
623
|
async get(options) {
|
|
376
624
|
const { projectId } = this.options;
|
|
377
|
-
const fetchUri = this.createUrl(
|
|
625
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
378
626
|
return await this.apiClient(fetchUri);
|
|
379
627
|
}
|
|
380
628
|
/** Updates or creates (based on id) an Aggregate */
|
|
381
629
|
async upsert(body) {
|
|
382
|
-
const fetchUri = this.createUrl(
|
|
630
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
383
631
|
await this.apiClient(fetchUri, {
|
|
384
632
|
method: "PUT",
|
|
385
633
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -388,7 +636,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
388
636
|
}
|
|
389
637
|
/** Deletes an Aggregate */
|
|
390
638
|
async remove(body) {
|
|
391
|
-
const fetchUri = this.createUrl(
|
|
639
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
392
640
|
await this.apiClient(fetchUri, {
|
|
393
641
|
method: "DELETE",
|
|
394
642
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -397,7 +645,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
397
645
|
}
|
|
398
646
|
};
|
|
399
647
|
_url = /* @__PURE__ */ new WeakMap();
|
|
400
|
-
|
|
648
|
+
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
401
649
|
var _url2;
|
|
402
650
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
403
651
|
constructor(options) {
|
|
@@ -406,12 +654,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
406
654
|
/** Fetches the known score dimensions for a project */
|
|
407
655
|
async get(options) {
|
|
408
656
|
const { projectId } = this.options;
|
|
409
|
-
const fetchUri = this.createUrl(
|
|
657
|
+
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
410
658
|
return await this.apiClient(fetchUri);
|
|
411
659
|
}
|
|
412
660
|
};
|
|
413
661
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
414
|
-
|
|
662
|
+
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
415
663
|
var _url3;
|
|
416
664
|
var _valueUrl;
|
|
417
665
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -421,12 +669,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
421
669
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
422
670
|
async get(options) {
|
|
423
671
|
const { projectId } = this.options;
|
|
424
|
-
const fetchUri = this.createUrl(
|
|
672
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
425
673
|
return await this.apiClient(fetchUri);
|
|
426
674
|
}
|
|
427
675
|
/** Updates or creates (based on id) an enrichment category */
|
|
428
676
|
async upsertCategory(body) {
|
|
429
|
-
const fetchUri = this.createUrl(
|
|
677
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
430
678
|
await this.apiClient(fetchUri, {
|
|
431
679
|
method: "PUT",
|
|
432
680
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -435,7 +683,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
435
683
|
}
|
|
436
684
|
/** Deletes an enrichment category */
|
|
437
685
|
async removeCategory(body) {
|
|
438
|
-
const fetchUri = this.createUrl(
|
|
686
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
439
687
|
await this.apiClient(fetchUri, {
|
|
440
688
|
method: "DELETE",
|
|
441
689
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -444,7 +692,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
444
692
|
}
|
|
445
693
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
446
694
|
async upsertValue(body) {
|
|
447
|
-
const fetchUri = this.createUrl(
|
|
695
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
448
696
|
await this.apiClient(fetchUri, {
|
|
449
697
|
method: "PUT",
|
|
450
698
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -453,7 +701,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
453
701
|
}
|
|
454
702
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
455
703
|
async removeValue(body) {
|
|
456
|
-
const fetchUri = this.createUrl(
|
|
704
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
457
705
|
await this.apiClient(fetchUri, {
|
|
458
706
|
method: "DELETE",
|
|
459
707
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -463,8 +711,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
463
711
|
};
|
|
464
712
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
465
713
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
466
|
-
|
|
467
|
-
|
|
714
|
+
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
715
|
+
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
468
716
|
var _url4;
|
|
469
717
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
470
718
|
constructor(options) {
|
|
@@ -473,7 +721,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
473
721
|
/** Fetches the Context manifest for a project */
|
|
474
722
|
async get(options) {
|
|
475
723
|
const { projectId } = this.options;
|
|
476
|
-
const fetchUri = this.createUrl(
|
|
724
|
+
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
477
725
|
return await this.apiClient(fetchUri);
|
|
478
726
|
}
|
|
479
727
|
/** Publishes the Context manifest for a project */
|
|
@@ -487,7 +735,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
487
735
|
}
|
|
488
736
|
};
|
|
489
737
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
490
|
-
|
|
738
|
+
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
491
739
|
var ManifestClient = _ManifestClient;
|
|
492
740
|
var _url5;
|
|
493
741
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
@@ -497,12 +745,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
497
745
|
/** Fetches all Quirks for a project */
|
|
498
746
|
async get(options) {
|
|
499
747
|
const { projectId } = this.options;
|
|
500
|
-
const fetchUri = this.createUrl(
|
|
748
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
501
749
|
return await this.apiClient(fetchUri);
|
|
502
750
|
}
|
|
503
751
|
/** Updates or creates (based on id) a Quirk */
|
|
504
752
|
async upsert(body) {
|
|
505
|
-
const fetchUri = this.createUrl(
|
|
753
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
506
754
|
await this.apiClient(fetchUri, {
|
|
507
755
|
method: "PUT",
|
|
508
756
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -511,7 +759,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
511
759
|
}
|
|
512
760
|
/** Deletes a Quirk */
|
|
513
761
|
async remove(body) {
|
|
514
|
-
const fetchUri = this.createUrl(
|
|
762
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
515
763
|
await this.apiClient(fetchUri, {
|
|
516
764
|
method: "DELETE",
|
|
517
765
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -520,7 +768,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
520
768
|
}
|
|
521
769
|
};
|
|
522
770
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
523
|
-
|
|
771
|
+
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
524
772
|
var _url6;
|
|
525
773
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
526
774
|
constructor(options) {
|
|
@@ -529,12 +777,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
529
777
|
/** Fetches all Signals for a project */
|
|
530
778
|
async get(options) {
|
|
531
779
|
const { projectId } = this.options;
|
|
532
|
-
const fetchUri = this.createUrl(
|
|
780
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
533
781
|
return await this.apiClient(fetchUri);
|
|
534
782
|
}
|
|
535
783
|
/** Updates or creates (based on id) a Signal */
|
|
536
784
|
async upsert(body) {
|
|
537
|
-
const fetchUri = this.createUrl(
|
|
785
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
538
786
|
await this.apiClient(fetchUri, {
|
|
539
787
|
method: "PUT",
|
|
540
788
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -543,7 +791,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
543
791
|
}
|
|
544
792
|
/** Deletes a Signal */
|
|
545
793
|
async remove(body) {
|
|
546
|
-
const fetchUri = this.createUrl(
|
|
794
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
547
795
|
await this.apiClient(fetchUri, {
|
|
548
796
|
method: "DELETE",
|
|
549
797
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -552,7 +800,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
552
800
|
}
|
|
553
801
|
};
|
|
554
802
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
555
|
-
|
|
803
|
+
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
556
804
|
var _url7;
|
|
557
805
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
558
806
|
constructor(options) {
|
|
@@ -561,12 +809,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
561
809
|
/** Fetches all Tests for a project */
|
|
562
810
|
async get(options) {
|
|
563
811
|
const { projectId } = this.options;
|
|
564
|
-
const fetchUri = this.createUrl(
|
|
812
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
565
813
|
return await this.apiClient(fetchUri);
|
|
566
814
|
}
|
|
567
815
|
/** Updates or creates (based on id) a Test */
|
|
568
816
|
async upsert(body) {
|
|
569
|
-
const fetchUri = this.createUrl(
|
|
817
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
570
818
|
await this.apiClient(fetchUri, {
|
|
571
819
|
method: "PUT",
|
|
572
820
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -575,7 +823,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
575
823
|
}
|
|
576
824
|
/** Deletes a Test */
|
|
577
825
|
async remove(body) {
|
|
578
|
-
const fetchUri = this.createUrl(
|
|
826
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
579
827
|
await this.apiClient(fetchUri, {
|
|
580
828
|
method: "DELETE",
|
|
581
829
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -584,393 +832,194 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
584
832
|
}
|
|
585
833
|
};
|
|
586
834
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
587
|
-
|
|
835
|
+
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
588
836
|
|
|
589
|
-
//
|
|
590
|
-
var
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
596
|
-
var __typeError2 = (msg) => {
|
|
597
|
-
throw TypeError(msg);
|
|
598
|
-
};
|
|
599
|
-
var __commonJS2 = (cb, mod) => function __require() {
|
|
600
|
-
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
601
|
-
};
|
|
602
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
603
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
604
|
-
for (let key of __getOwnPropNames2(from))
|
|
605
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
606
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
837
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
838
|
+
var Node = class {
|
|
839
|
+
constructor(value) {
|
|
840
|
+
__publicField(this, "value");
|
|
841
|
+
__publicField(this, "next");
|
|
842
|
+
this.value = value;
|
|
607
843
|
}
|
|
608
|
-
return to;
|
|
609
844
|
};
|
|
610
|
-
var
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
this.value = value;
|
|
629
|
-
this.next = void 0;
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
var Queue = class {
|
|
633
|
-
// TODO: Use private class fields when targeting Node.js 12.
|
|
634
|
-
// #_head;
|
|
635
|
-
// #_tail;
|
|
636
|
-
// #_size;
|
|
637
|
-
constructor() {
|
|
638
|
-
this.clear();
|
|
639
|
-
}
|
|
640
|
-
enqueue(value) {
|
|
641
|
-
const node = new Node(value);
|
|
642
|
-
if (this._head) {
|
|
643
|
-
this._tail.next = node;
|
|
644
|
-
this._tail = node;
|
|
645
|
-
} else {
|
|
646
|
-
this._head = node;
|
|
647
|
-
this._tail = node;
|
|
648
|
-
}
|
|
649
|
-
this._size++;
|
|
650
|
-
}
|
|
651
|
-
dequeue() {
|
|
652
|
-
const current = this._head;
|
|
653
|
-
if (!current) {
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
this._head = this._head.next;
|
|
657
|
-
this._size--;
|
|
658
|
-
return current.value;
|
|
659
|
-
}
|
|
660
|
-
clear() {
|
|
661
|
-
this._head = void 0;
|
|
662
|
-
this._tail = void 0;
|
|
663
|
-
this._size = 0;
|
|
664
|
-
}
|
|
665
|
-
get size() {
|
|
666
|
-
return this._size;
|
|
667
|
-
}
|
|
668
|
-
*[Symbol.iterator]() {
|
|
669
|
-
let current = this._head;
|
|
670
|
-
while (current) {
|
|
671
|
-
yield current.value;
|
|
672
|
-
current = current.next;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
module2.exports = Queue;
|
|
845
|
+
var _head, _tail, _size;
|
|
846
|
+
var Queue = class {
|
|
847
|
+
constructor() {
|
|
848
|
+
__privateAdd(this, _head);
|
|
849
|
+
__privateAdd(this, _tail);
|
|
850
|
+
__privateAdd(this, _size);
|
|
851
|
+
this.clear();
|
|
852
|
+
}
|
|
853
|
+
enqueue(value) {
|
|
854
|
+
const node = new Node(value);
|
|
855
|
+
if (__privateGet(this, _head)) {
|
|
856
|
+
__privateGet(this, _tail).next = node;
|
|
857
|
+
__privateSet(this, _tail, node);
|
|
858
|
+
} else {
|
|
859
|
+
__privateSet(this, _head, node);
|
|
860
|
+
__privateSet(this, _tail, node);
|
|
861
|
+
}
|
|
862
|
+
__privateWrapper(this, _size)._++;
|
|
677
863
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const next = () => {
|
|
690
|
-
activeCount--;
|
|
691
|
-
if (queue.size > 0) {
|
|
692
|
-
queue.dequeue()();
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
const run = async (fn, resolve, ...args) => {
|
|
696
|
-
activeCount++;
|
|
697
|
-
const result = (async () => fn(...args))();
|
|
698
|
-
resolve(result);
|
|
699
|
-
try {
|
|
700
|
-
await result;
|
|
701
|
-
} catch (e) {
|
|
702
|
-
}
|
|
703
|
-
next();
|
|
704
|
-
};
|
|
705
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
706
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
707
|
-
(async () => {
|
|
708
|
-
await Promise.resolve();
|
|
709
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
710
|
-
queue.dequeue()();
|
|
711
|
-
}
|
|
712
|
-
})();
|
|
713
|
-
};
|
|
714
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
715
|
-
enqueue(fn, resolve, ...args);
|
|
716
|
-
});
|
|
717
|
-
Object.defineProperties(generator, {
|
|
718
|
-
activeCount: {
|
|
719
|
-
get: () => activeCount
|
|
720
|
-
},
|
|
721
|
-
pendingCount: {
|
|
722
|
-
get: () => queue.size
|
|
723
|
-
},
|
|
724
|
-
clearQueue: {
|
|
725
|
-
value: () => {
|
|
726
|
-
queue.clear();
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
return generator;
|
|
731
|
-
};
|
|
732
|
-
module2.exports = pLimit2;
|
|
864
|
+
dequeue() {
|
|
865
|
+
const current = __privateGet(this, _head);
|
|
866
|
+
if (!current) {
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
870
|
+
__privateWrapper(this, _size)._--;
|
|
871
|
+
if (!__privateGet(this, _head)) {
|
|
872
|
+
__privateSet(this, _tail, void 0);
|
|
873
|
+
}
|
|
874
|
+
return current.value;
|
|
733
875
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
"use strict";
|
|
738
|
-
function RetryOperation(timeouts, options) {
|
|
739
|
-
if (typeof options === "boolean") {
|
|
740
|
-
options = { forever: options };
|
|
741
|
-
}
|
|
742
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
743
|
-
this._timeouts = timeouts;
|
|
744
|
-
this._options = options || {};
|
|
745
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
746
|
-
this._fn = null;
|
|
747
|
-
this._errors = [];
|
|
748
|
-
this._attempts = 1;
|
|
749
|
-
this._operationTimeout = null;
|
|
750
|
-
this._operationTimeoutCb = null;
|
|
751
|
-
this._timeout = null;
|
|
752
|
-
this._operationStart = null;
|
|
753
|
-
this._timer = null;
|
|
754
|
-
if (this._options.forever) {
|
|
755
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
756
|
-
}
|
|
876
|
+
peek() {
|
|
877
|
+
if (!__privateGet(this, _head)) {
|
|
878
|
+
return;
|
|
757
879
|
}
|
|
758
|
-
|
|
759
|
-
RetryOperation.prototype.reset = function() {
|
|
760
|
-
this._attempts = 1;
|
|
761
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
762
|
-
};
|
|
763
|
-
RetryOperation.prototype.stop = function() {
|
|
764
|
-
if (this._timeout) {
|
|
765
|
-
clearTimeout(this._timeout);
|
|
766
|
-
}
|
|
767
|
-
if (this._timer) {
|
|
768
|
-
clearTimeout(this._timer);
|
|
769
|
-
}
|
|
770
|
-
this._timeouts = [];
|
|
771
|
-
this._cachedTimeouts = null;
|
|
772
|
-
};
|
|
773
|
-
RetryOperation.prototype.retry = function(err) {
|
|
774
|
-
if (this._timeout) {
|
|
775
|
-
clearTimeout(this._timeout);
|
|
776
|
-
}
|
|
777
|
-
if (!err) {
|
|
778
|
-
return false;
|
|
779
|
-
}
|
|
780
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
781
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
782
|
-
this._errors.push(err);
|
|
783
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
this._errors.push(err);
|
|
787
|
-
var timeout = this._timeouts.shift();
|
|
788
|
-
if (timeout === void 0) {
|
|
789
|
-
if (this._cachedTimeouts) {
|
|
790
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
791
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
792
|
-
} else {
|
|
793
|
-
return false;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
var self = this;
|
|
797
|
-
this._timer = setTimeout(function() {
|
|
798
|
-
self._attempts++;
|
|
799
|
-
if (self._operationTimeoutCb) {
|
|
800
|
-
self._timeout = setTimeout(function() {
|
|
801
|
-
self._operationTimeoutCb(self._attempts);
|
|
802
|
-
}, self._operationTimeout);
|
|
803
|
-
if (self._options.unref) {
|
|
804
|
-
self._timeout.unref();
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
self._fn(self._attempts);
|
|
808
|
-
}, timeout);
|
|
809
|
-
if (this._options.unref) {
|
|
810
|
-
this._timer.unref();
|
|
811
|
-
}
|
|
812
|
-
return true;
|
|
813
|
-
};
|
|
814
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
815
|
-
this._fn = fn;
|
|
816
|
-
if (timeoutOps) {
|
|
817
|
-
if (timeoutOps.timeout) {
|
|
818
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
819
|
-
}
|
|
820
|
-
if (timeoutOps.cb) {
|
|
821
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
var self = this;
|
|
825
|
-
if (this._operationTimeoutCb) {
|
|
826
|
-
this._timeout = setTimeout(function() {
|
|
827
|
-
self._operationTimeoutCb();
|
|
828
|
-
}, self._operationTimeout);
|
|
829
|
-
}
|
|
830
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
831
|
-
this._fn(this._attempts);
|
|
832
|
-
};
|
|
833
|
-
RetryOperation.prototype.try = function(fn) {
|
|
834
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
835
|
-
this.attempt(fn);
|
|
836
|
-
};
|
|
837
|
-
RetryOperation.prototype.start = function(fn) {
|
|
838
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
839
|
-
this.attempt(fn);
|
|
840
|
-
};
|
|
841
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
842
|
-
RetryOperation.prototype.errors = function() {
|
|
843
|
-
return this._errors;
|
|
844
|
-
};
|
|
845
|
-
RetryOperation.prototype.attempts = function() {
|
|
846
|
-
return this._attempts;
|
|
847
|
-
};
|
|
848
|
-
RetryOperation.prototype.mainError = function() {
|
|
849
|
-
if (this._errors.length === 0) {
|
|
850
|
-
return null;
|
|
851
|
-
}
|
|
852
|
-
var counts = {};
|
|
853
|
-
var mainError = null;
|
|
854
|
-
var mainErrorCount = 0;
|
|
855
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
856
|
-
var error = this._errors[i];
|
|
857
|
-
var message = error.message;
|
|
858
|
-
var count = (counts[message] || 0) + 1;
|
|
859
|
-
counts[message] = count;
|
|
860
|
-
if (count >= mainErrorCount) {
|
|
861
|
-
mainError = error;
|
|
862
|
-
mainErrorCount = count;
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
return mainError;
|
|
866
|
-
};
|
|
880
|
+
return __privateGet(this, _head).value;
|
|
867
881
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
882
|
+
clear() {
|
|
883
|
+
__privateSet(this, _head, void 0);
|
|
884
|
+
__privateSet(this, _tail, void 0);
|
|
885
|
+
__privateSet(this, _size, 0);
|
|
886
|
+
}
|
|
887
|
+
get size() {
|
|
888
|
+
return __privateGet(this, _size);
|
|
889
|
+
}
|
|
890
|
+
*[Symbol.iterator]() {
|
|
891
|
+
let current = __privateGet(this, _head);
|
|
892
|
+
while (current) {
|
|
893
|
+
yield current.value;
|
|
894
|
+
current = current.next;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
*drain() {
|
|
898
|
+
while (__privateGet(this, _head)) {
|
|
899
|
+
yield this.dequeue();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
_head = new WeakMap();
|
|
904
|
+
_tail = new WeakMap();
|
|
905
|
+
_size = new WeakMap();
|
|
906
|
+
|
|
907
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
908
|
+
function pLimit2(concurrency) {
|
|
909
|
+
validateConcurrency(concurrency);
|
|
910
|
+
const queue = new Queue();
|
|
911
|
+
let activeCount = 0;
|
|
912
|
+
const resumeNext = () => {
|
|
913
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
914
|
+
queue.dequeue()();
|
|
915
|
+
activeCount++;
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
const next = () => {
|
|
919
|
+
activeCount--;
|
|
920
|
+
resumeNext();
|
|
921
|
+
};
|
|
922
|
+
const run = async (function_, resolve, arguments_) => {
|
|
923
|
+
const result = (async () => function_(...arguments_))();
|
|
924
|
+
resolve(result);
|
|
925
|
+
try {
|
|
926
|
+
await result;
|
|
927
|
+
} catch (e) {
|
|
928
|
+
}
|
|
929
|
+
next();
|
|
930
|
+
};
|
|
931
|
+
const enqueue = (function_, resolve, arguments_) => {
|
|
932
|
+
new Promise((internalResolve) => {
|
|
933
|
+
queue.enqueue(internalResolve);
|
|
934
|
+
}).then(
|
|
935
|
+
run.bind(void 0, function_, resolve, arguments_)
|
|
936
|
+
);
|
|
937
|
+
(async () => {
|
|
938
|
+
await Promise.resolve();
|
|
939
|
+
if (activeCount < concurrency) {
|
|
940
|
+
resumeNext();
|
|
904
941
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
942
|
+
})();
|
|
943
|
+
};
|
|
944
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
945
|
+
enqueue(function_, resolve, arguments_);
|
|
946
|
+
});
|
|
947
|
+
Object.defineProperties(generator, {
|
|
948
|
+
activeCount: {
|
|
949
|
+
get: () => activeCount
|
|
950
|
+
},
|
|
951
|
+
pendingCount: {
|
|
952
|
+
get: () => queue.size
|
|
953
|
+
},
|
|
954
|
+
clearQueue: {
|
|
955
|
+
value() {
|
|
956
|
+
queue.clear();
|
|
920
957
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
958
|
+
},
|
|
959
|
+
concurrency: {
|
|
960
|
+
get: () => concurrency,
|
|
961
|
+
set(newConcurrency) {
|
|
962
|
+
validateConcurrency(newConcurrency);
|
|
963
|
+
concurrency = newConcurrency;
|
|
964
|
+
queueMicrotask(() => {
|
|
965
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
966
|
+
resumeNext();
|
|
926
967
|
}
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
for (var i = 0; i < methods.length; i++) {
|
|
930
|
-
var method = methods[i];
|
|
931
|
-
var original = obj[method];
|
|
932
|
-
obj[method] = function retryWrapper(original2) {
|
|
933
|
-
var op = exports2.operation(options);
|
|
934
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
935
|
-
var callback = args.pop();
|
|
936
|
-
args.push(function(err) {
|
|
937
|
-
if (op.retry(err)) {
|
|
938
|
-
return;
|
|
939
|
-
}
|
|
940
|
-
if (err) {
|
|
941
|
-
arguments[0] = op.mainError();
|
|
942
|
-
}
|
|
943
|
-
callback.apply(this, arguments);
|
|
944
|
-
});
|
|
945
|
-
op.attempt(function() {
|
|
946
|
-
original2.apply(obj, args);
|
|
947
|
-
});
|
|
948
|
-
}.bind(obj, original);
|
|
949
|
-
obj[method].options = options;
|
|
968
|
+
});
|
|
950
969
|
}
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
return generator;
|
|
973
|
+
}
|
|
974
|
+
function validateConcurrency(concurrency) {
|
|
975
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
976
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
958
977
|
}
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
var
|
|
963
|
-
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
981
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
982
|
+
|
|
983
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
984
|
+
var objectToString = Object.prototype.toString;
|
|
985
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
986
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
987
|
+
"network error",
|
|
964
988
|
// Chrome
|
|
965
989
|
"NetworkError when attempting to fetch resource.",
|
|
966
990
|
// Firefox
|
|
967
991
|
"The Internet connection appears to be offline.",
|
|
968
|
-
// Safari
|
|
992
|
+
// Safari 16
|
|
969
993
|
"Network request failed",
|
|
970
994
|
// `cross-fetch`
|
|
971
|
-
"fetch failed"
|
|
995
|
+
"fetch failed",
|
|
996
|
+
// Undici (Node.js)
|
|
997
|
+
"terminated",
|
|
972
998
|
// Undici (Node.js)
|
|
999
|
+
" A network error occurred.",
|
|
1000
|
+
// Bun (WebKit)
|
|
1001
|
+
"Network connection lost"
|
|
1002
|
+
// Cloudflare Workers (fetch)
|
|
973
1003
|
]);
|
|
1004
|
+
function isNetworkError(error) {
|
|
1005
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1006
|
+
if (!isValid) {
|
|
1007
|
+
return false;
|
|
1008
|
+
}
|
|
1009
|
+
const { message, stack } = error;
|
|
1010
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1011
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
1012
|
+
}
|
|
1013
|
+
if (message.startsWith("error sending request for url")) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1017
|
+
return true;
|
|
1018
|
+
}
|
|
1019
|
+
return errorMessages.has(message);
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
974
1023
|
var AbortError = class extends Error {
|
|
975
1024
|
constructor(message) {
|
|
976
1025
|
super();
|
|
@@ -991,63 +1040,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
991
1040
|
error.retriesLeft = retriesLeft;
|
|
992
1041
|
return error;
|
|
993
1042
|
};
|
|
994
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
995
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
996
1043
|
async function pRetry(input, options) {
|
|
997
1044
|
return new Promise((resolve, reject) => {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
retries: 10,
|
|
1002
|
-
...options
|
|
1045
|
+
var _a, _b, _c;
|
|
1046
|
+
options = { ...options };
|
|
1047
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
1003
1048
|
};
|
|
1049
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1050
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
1004
1051
|
const operation = import_retry.default.operation(options);
|
|
1052
|
+
const abortHandler = () => {
|
|
1053
|
+
var _a2;
|
|
1054
|
+
operation.stop();
|
|
1055
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1056
|
+
};
|
|
1057
|
+
if (options.signal && !options.signal.aborted) {
|
|
1058
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1059
|
+
}
|
|
1060
|
+
const cleanUp = () => {
|
|
1061
|
+
var _a2;
|
|
1062
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1063
|
+
operation.stop();
|
|
1064
|
+
};
|
|
1005
1065
|
operation.attempt(async (attemptNumber) => {
|
|
1006
1066
|
try {
|
|
1007
|
-
|
|
1067
|
+
const result = await input(attemptNumber);
|
|
1068
|
+
cleanUp();
|
|
1069
|
+
resolve(result);
|
|
1008
1070
|
} catch (error) {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
} else {
|
|
1071
|
+
try {
|
|
1072
|
+
if (!(error instanceof Error)) {
|
|
1073
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1074
|
+
}
|
|
1075
|
+
if (error instanceof AbortError) {
|
|
1076
|
+
throw error.originalError;
|
|
1077
|
+
}
|
|
1078
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1079
|
+
throw error;
|
|
1080
|
+
}
|
|
1020
1081
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
reject(error2);
|
|
1025
|
-
return;
|
|
1082
|
+
if (!await options.shouldRetry(error)) {
|
|
1083
|
+
operation.stop();
|
|
1084
|
+
reject(error);
|
|
1026
1085
|
}
|
|
1086
|
+
await options.onFailedAttempt(error);
|
|
1027
1087
|
if (!operation.retry(error)) {
|
|
1028
|
-
|
|
1088
|
+
throw operation.mainError();
|
|
1029
1089
|
}
|
|
1090
|
+
} catch (finalError) {
|
|
1091
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1092
|
+
cleanUp();
|
|
1093
|
+
reject(finalError);
|
|
1030
1094
|
}
|
|
1031
1095
|
}
|
|
1032
1096
|
});
|
|
1033
|
-
if (options.signal && !options.signal.aborted) {
|
|
1034
|
-
options.signal.addEventListener("abort", () => {
|
|
1035
|
-
operation.stop();
|
|
1036
|
-
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1037
|
-
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1038
|
-
}, {
|
|
1039
|
-
once: true
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1042
1097
|
});
|
|
1043
1098
|
}
|
|
1099
|
+
|
|
1100
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1044
1101
|
var AbortError2 = class extends Error {
|
|
1045
1102
|
constructor() {
|
|
1046
1103
|
super("Throttled function aborted");
|
|
1047
1104
|
this.name = "AbortError";
|
|
1048
1105
|
}
|
|
1049
1106
|
};
|
|
1050
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1107
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1051
1108
|
if (!Number.isFinite(limit)) {
|
|
1052
1109
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1053
1110
|
}
|
|
@@ -1075,32 +1132,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1075
1132
|
const strictTicks = [];
|
|
1076
1133
|
function strictDelay() {
|
|
1077
1134
|
const now = Date.now();
|
|
1078
|
-
if (strictTicks.length
|
|
1079
|
-
strictTicks.
|
|
1080
|
-
return 0;
|
|
1135
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1136
|
+
strictTicks.length = 0;
|
|
1081
1137
|
}
|
|
1082
|
-
|
|
1083
|
-
if (now >= earliestTime) {
|
|
1138
|
+
if (strictTicks.length < limit) {
|
|
1084
1139
|
strictTicks.push(now);
|
|
1085
1140
|
return 0;
|
|
1086
1141
|
}
|
|
1087
|
-
strictTicks
|
|
1088
|
-
|
|
1142
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1143
|
+
strictTicks.shift();
|
|
1144
|
+
strictTicks.push(nextExecutionTime);
|
|
1145
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1089
1146
|
}
|
|
1090
1147
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1091
1148
|
return (function_) => {
|
|
1092
|
-
const throttled = function(...
|
|
1149
|
+
const throttled = function(...arguments_) {
|
|
1093
1150
|
if (!throttled.isEnabled) {
|
|
1094
|
-
return (async () => function_.apply(this,
|
|
1151
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1095
1152
|
}
|
|
1096
|
-
let
|
|
1153
|
+
let timeoutId;
|
|
1097
1154
|
return new Promise((resolve, reject) => {
|
|
1098
1155
|
const execute = () => {
|
|
1099
|
-
resolve(function_.apply(this,
|
|
1100
|
-
queue.delete(
|
|
1156
|
+
resolve(function_.apply(this, arguments_));
|
|
1157
|
+
queue.delete(timeoutId);
|
|
1101
1158
|
};
|
|
1102
|
-
|
|
1103
|
-
|
|
1159
|
+
const delay = getDelay();
|
|
1160
|
+
if (delay > 0) {
|
|
1161
|
+
timeoutId = setTimeout(execute, delay);
|
|
1162
|
+
queue.set(timeoutId, reject);
|
|
1163
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1164
|
+
} else {
|
|
1165
|
+
execute();
|
|
1166
|
+
}
|
|
1104
1167
|
});
|
|
1105
1168
|
};
|
|
1106
1169
|
throttled.abort = () => {
|
|
@@ -1112,16 +1175,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1112
1175
|
strictTicks.splice(0, strictTicks.length);
|
|
1113
1176
|
};
|
|
1114
1177
|
throttled.isEnabled = true;
|
|
1178
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1179
|
+
get() {
|
|
1180
|
+
return queue.size;
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1115
1183
|
return throttled;
|
|
1116
1184
|
};
|
|
1117
1185
|
}
|
|
1186
|
+
|
|
1187
|
+
// ../canvas/dist/index.mjs
|
|
1188
|
+
var __typeError3 = (msg) => {
|
|
1189
|
+
throw TypeError(msg);
|
|
1190
|
+
};
|
|
1191
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1192
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1193
|
+
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);
|
|
1118
1194
|
function createLimitPolicy({
|
|
1119
1195
|
throttle = { interval: 1e3, limit: 10 },
|
|
1120
|
-
retry:
|
|
1196
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1121
1197
|
limit = 10
|
|
1122
1198
|
}) {
|
|
1123
1199
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1124
|
-
const limiter = limit ? (
|
|
1200
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1125
1201
|
return function limitPolicy(func) {
|
|
1126
1202
|
let currentFunc = async () => await func();
|
|
1127
1203
|
if (throttler) {
|
|
@@ -1132,13 +1208,13 @@ function createLimitPolicy({
|
|
|
1132
1208
|
const limitFunc = currentFunc;
|
|
1133
1209
|
currentFunc = () => limiter(limitFunc);
|
|
1134
1210
|
}
|
|
1135
|
-
if (
|
|
1211
|
+
if (retry3) {
|
|
1136
1212
|
const retryFunc = currentFunc;
|
|
1137
1213
|
currentFunc = () => pRetry(retryFunc, {
|
|
1138
|
-
...
|
|
1214
|
+
...retry3,
|
|
1139
1215
|
onFailedAttempt: async (error) => {
|
|
1140
|
-
if (
|
|
1141
|
-
await
|
|
1216
|
+
if (retry3.onFailedAttempt) {
|
|
1217
|
+
await retry3.onFailedAttempt(error);
|
|
1142
1218
|
}
|
|
1143
1219
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1144
1220
|
throw error;
|
|
@@ -1149,123 +1225,153 @@ function createLimitPolicy({
|
|
|
1149
1225
|
return currentFunc();
|
|
1150
1226
|
};
|
|
1151
1227
|
}
|
|
1152
|
-
var
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
if (!options.limitPolicy) {
|
|
1157
|
-
options.limitPolicy = createLimitPolicy({});
|
|
1158
|
-
}
|
|
1159
|
-
super(options);
|
|
1160
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1161
|
-
this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1162
|
-
}
|
|
1163
|
-
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1164
|
-
async getCompositionList(params = {}) {
|
|
1165
|
-
const { projectId } = this.options;
|
|
1166
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1167
|
-
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1168
|
-
if (!resolveData) {
|
|
1169
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1170
|
-
return this.apiClient(fetchUri);
|
|
1171
|
-
}
|
|
1172
|
-
const edgeParams = {
|
|
1173
|
-
...originParams,
|
|
1174
|
-
projectId,
|
|
1175
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1176
|
-
...rewrittenFilters
|
|
1177
|
-
};
|
|
1178
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1179
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1180
|
-
}
|
|
1181
|
-
getCompositionByNodePath(options) {
|
|
1182
|
-
return this.getOneComposition(options);
|
|
1183
|
-
}
|
|
1184
|
-
getCompositionByNodeId(options) {
|
|
1185
|
-
return this.getOneComposition(options);
|
|
1186
|
-
}
|
|
1187
|
-
getCompositionBySlug(options) {
|
|
1188
|
-
return this.getOneComposition(options);
|
|
1189
|
-
}
|
|
1190
|
-
getCompositionById(options) {
|
|
1191
|
-
return this.getOneComposition(options);
|
|
1192
|
-
}
|
|
1193
|
-
getCompositionDefaults(options) {
|
|
1194
|
-
return this.getOneComposition(options);
|
|
1195
|
-
}
|
|
1196
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1197
|
-
async getCompositionHistory(options) {
|
|
1198
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1228
|
+
var ContentClientBase = class extends ApiClient {
|
|
1229
|
+
constructor(options, defaultBypassCache) {
|
|
1230
|
+
var _a, _b;
|
|
1231
|
+
super({
|
|
1199
1232
|
...options,
|
|
1200
|
-
|
|
1233
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1234
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1201
1235
|
});
|
|
1202
|
-
return this.apiClient(historyUrl);
|
|
1203
1236
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1237
|
+
};
|
|
1238
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1239
|
+
function appendCsv(out, key, values) {
|
|
1240
|
+
if (values === void 0) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
out[key] = values.join(",");
|
|
1244
|
+
}
|
|
1245
|
+
function projectionToQuery(spec) {
|
|
1246
|
+
const out = {};
|
|
1247
|
+
if (!spec) {
|
|
1248
|
+
return out;
|
|
1249
|
+
}
|
|
1250
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1251
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1252
|
+
if (fields) {
|
|
1253
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1254
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1255
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1256
|
+
}
|
|
1257
|
+
if (fieldTypes) {
|
|
1258
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1259
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1260
|
+
}
|
|
1261
|
+
if (slots) {
|
|
1262
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1263
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1264
|
+
if (typeof slots.depth === "number") {
|
|
1265
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1212
1266
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1267
|
+
if (slots.named) {
|
|
1268
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1269
|
+
for (const slotName of slotNames) {
|
|
1270
|
+
const named = slots.named[slotName];
|
|
1271
|
+
if (named && typeof named.depth === "number") {
|
|
1272
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return out;
|
|
1278
|
+
}
|
|
1279
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1280
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
1281
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1282
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1283
|
+
var CANVAS_TEST_SLOT = "test";
|
|
1284
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1285
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1286
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1287
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1288
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1289
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
1290
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1291
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1292
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1293
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
1294
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1295
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
1296
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1297
|
+
function resolveCompositionSelector(args) {
|
|
1298
|
+
if ("compositionId" in args) {
|
|
1299
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1300
|
+
return {
|
|
1301
|
+
readOptions,
|
|
1302
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1303
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1304
|
+
versionId,
|
|
1305
|
+
hasCompositionId: true,
|
|
1306
|
+
pinnedEdition: editionId !== void 0
|
|
1217
1307
|
};
|
|
1218
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1219
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1220
1308
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
}
|
|
1234
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1309
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1310
|
+
}
|
|
1311
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1312
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1313
|
+
constructor(options) {
|
|
1314
|
+
var _a;
|
|
1315
|
+
super(
|
|
1316
|
+
options,
|
|
1317
|
+
/* defaultBypassCache */
|
|
1318
|
+
false
|
|
1319
|
+
);
|
|
1320
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1321
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1235
1322
|
}
|
|
1236
|
-
/**
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
const { projectId } = this.options;
|
|
1240
|
-
await this.apiClient(fetchUri, {
|
|
1241
|
-
method: "DELETE",
|
|
1242
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1243
|
-
expectNoContent: true
|
|
1244
|
-
});
|
|
1323
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1324
|
+
coerceDiagnostics(diagnostics) {
|
|
1325
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1245
1326
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1327
|
+
};
|
|
1328
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1329
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1330
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1331
|
+
constructor(options) {
|
|
1332
|
+
super(options);
|
|
1251
1333
|
}
|
|
1252
|
-
/**
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1334
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1335
|
+
get(args) {
|
|
1336
|
+
var _a;
|
|
1337
|
+
const { diagnostics, select, ...rest } = args;
|
|
1338
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1339
|
+
const url = this.createUrl(
|
|
1340
|
+
EDGE_SINGLE_URL,
|
|
1341
|
+
{
|
|
1342
|
+
...readOptions,
|
|
1343
|
+
...projectionToQuery(select),
|
|
1344
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1345
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1346
|
+
compositionId,
|
|
1347
|
+
versionId,
|
|
1348
|
+
projectId: this.options.projectId,
|
|
1349
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1350
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1351
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1352
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1353
|
+
},
|
|
1354
|
+
this.edgeApiHost
|
|
1355
|
+
);
|
|
1356
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1260
1357
|
}
|
|
1261
|
-
/**
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1358
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1359
|
+
list(args = {}) {
|
|
1360
|
+
var _a;
|
|
1361
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1362
|
+
const url = this.createUrl(
|
|
1363
|
+
EDGE_LIST_URL,
|
|
1364
|
+
{
|
|
1365
|
+
...rest,
|
|
1366
|
+
...rewriteFiltersForApi(filters),
|
|
1367
|
+
...projectionToQuery(select),
|
|
1368
|
+
projectId: this.options.projectId,
|
|
1369
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1370
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1371
|
+
},
|
|
1372
|
+
this.edgeApiHost
|
|
1373
|
+
);
|
|
1374
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1269
1375
|
}
|
|
1270
1376
|
};
|
|
1271
1377
|
var _contentTypesUrl;
|
|
@@ -1278,20 +1384,26 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1278
1384
|
}
|
|
1279
1385
|
getContentTypes(options) {
|
|
1280
1386
|
const { projectId } = this.options;
|
|
1281
|
-
const fetchUri = this.createUrl(
|
|
1387
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1282
1388
|
return this.apiClient(fetchUri);
|
|
1283
1389
|
}
|
|
1284
1390
|
getEntries(options) {
|
|
1285
1391
|
const { projectId } = this.options;
|
|
1286
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1392
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1287
1393
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1394
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1288
1395
|
if (skipDataResolution) {
|
|
1289
|
-
const url = this.createUrl(
|
|
1396
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1397
|
+
...params,
|
|
1398
|
+
...rewrittenFilters,
|
|
1399
|
+
...rewrittenSelect,
|
|
1400
|
+
projectId
|
|
1401
|
+
});
|
|
1290
1402
|
return this.apiClient(url);
|
|
1291
1403
|
}
|
|
1292
1404
|
const edgeUrl = this.createUrl(
|
|
1293
|
-
|
|
1294
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1405
|
+
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1406
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1295
1407
|
this.edgeApiHost
|
|
1296
1408
|
);
|
|
1297
1409
|
return this.apiClient(
|
|
@@ -1308,7 +1420,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1308
1420
|
return this.apiClient(historyUrl);
|
|
1309
1421
|
}
|
|
1310
1422
|
async upsertContentType(body, opts = {}) {
|
|
1311
|
-
const fetchUri = this.createUrl(
|
|
1423
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1312
1424
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1313
1425
|
delete body.contentType.slugSettings;
|
|
1314
1426
|
}
|
|
@@ -1320,7 +1432,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1320
1432
|
});
|
|
1321
1433
|
}
|
|
1322
1434
|
async upsertEntry(body, options) {
|
|
1323
|
-
const fetchUri = this.createUrl(
|
|
1435
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1324
1436
|
const headers = {};
|
|
1325
1437
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1326
1438
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1334,7 +1446,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1334
1446
|
return { modified: response.headers.get("x-modified-at") };
|
|
1335
1447
|
}
|
|
1336
1448
|
async deleteContentType(body) {
|
|
1337
|
-
const fetchUri = this.createUrl(
|
|
1449
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1338
1450
|
await this.apiClient(fetchUri, {
|
|
1339
1451
|
method: "DELETE",
|
|
1340
1452
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1342,7 +1454,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1342
1454
|
});
|
|
1343
1455
|
}
|
|
1344
1456
|
async deleteEntry(body) {
|
|
1345
|
-
const fetchUri = this.createUrl(
|
|
1457
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1346
1458
|
await this.apiClient(fetchUri, {
|
|
1347
1459
|
method: "DELETE",
|
|
1348
1460
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1361,31 +1473,39 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1361
1473
|
};
|
|
1362
1474
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1363
1475
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1364
|
-
|
|
1365
|
-
|
|
1476
|
+
__privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1477
|
+
__privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1366
1478
|
var _url8;
|
|
1367
1479
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1368
1480
|
constructor(options) {
|
|
1369
1481
|
super(options);
|
|
1370
1482
|
}
|
|
1371
|
-
/** Fetches
|
|
1372
|
-
async
|
|
1483
|
+
/** Fetches a list of DataTypes for a project */
|
|
1484
|
+
async list(options) {
|
|
1373
1485
|
const { projectId } = this.options;
|
|
1374
|
-
const fetchUri = this.createUrl(
|
|
1486
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1375
1487
|
return await this.apiClient(fetchUri);
|
|
1376
1488
|
}
|
|
1489
|
+
/** @deprecated Use {@link list} instead. */
|
|
1490
|
+
async get(options) {
|
|
1491
|
+
return this.list(options);
|
|
1492
|
+
}
|
|
1377
1493
|
/** Updates or creates (based on id) a DataType */
|
|
1378
|
-
async
|
|
1379
|
-
const fetchUri = this.createUrl(
|
|
1494
|
+
async save(body) {
|
|
1495
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1380
1496
|
await this.apiClient(fetchUri, {
|
|
1381
1497
|
method: "PUT",
|
|
1382
1498
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1383
1499
|
expectNoContent: true
|
|
1384
1500
|
});
|
|
1385
1501
|
}
|
|
1502
|
+
/** @deprecated Use {@link save} instead. */
|
|
1503
|
+
async upsert(body) {
|
|
1504
|
+
return this.save(body);
|
|
1505
|
+
}
|
|
1386
1506
|
/** Deletes a DataType */
|
|
1387
1507
|
async remove(body) {
|
|
1388
|
-
const fetchUri = this.createUrl(
|
|
1508
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1389
1509
|
await this.apiClient(fetchUri, {
|
|
1390
1510
|
method: "DELETE",
|
|
1391
1511
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1394,7 +1514,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1394
1514
|
}
|
|
1395
1515
|
};
|
|
1396
1516
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1397
|
-
|
|
1517
|
+
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1398
1518
|
function getComponentPath(ancestorsAndSelf) {
|
|
1399
1519
|
const path = [];
|
|
1400
1520
|
for (let i = ancestorsAndSelf.length - 1; i >= 0; i--) {
|
|
@@ -1420,24 +1540,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1420
1540
|
}
|
|
1421
1541
|
return `.${path.join(".")}`;
|
|
1422
1542
|
}
|
|
1423
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1424
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
1425
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1426
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1427
|
-
var CANVAS_TEST_SLOT = "test";
|
|
1428
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1429
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1430
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1431
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1432
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1433
|
-
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
1434
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1435
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1436
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1437
|
-
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
1438
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1439
|
-
var PLACEHOLDER_ID = "placeholder";
|
|
1440
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1441
1543
|
function isRootEntryReference(root) {
|
|
1442
1544
|
return root.type === "root" && isEntryData(root.node);
|
|
1443
1545
|
}
|
|
@@ -1847,7 +1949,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1847
1949
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1848
1950
|
*/
|
|
1849
1951
|
get(options) {
|
|
1850
|
-
const fetchUri = this.createUrl(
|
|
1952
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1851
1953
|
...options,
|
|
1852
1954
|
teamId: this.teamId
|
|
1853
1955
|
});
|
|
@@ -1857,7 +1959,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1857
1959
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1858
1960
|
*/
|
|
1859
1961
|
async deploy(body) {
|
|
1860
|
-
const fetchUri = this.createUrl(
|
|
1962
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1861
1963
|
await this.apiClient(fetchUri, {
|
|
1862
1964
|
method: "PUT",
|
|
1863
1965
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1868,7 +1970,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1868
1970
|
* Removes a custom AI property editor from a Mesh app.
|
|
1869
1971
|
*/
|
|
1870
1972
|
async delete(body) {
|
|
1871
|
-
const fetchUri = this.createUrl(
|
|
1973
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1872
1974
|
await this.apiClient(fetchUri, {
|
|
1873
1975
|
method: "DELETE",
|
|
1874
1976
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1877,7 +1979,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1877
1979
|
}
|
|
1878
1980
|
};
|
|
1879
1981
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1880
|
-
|
|
1982
|
+
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1881
1983
|
var _url22;
|
|
1882
1984
|
var _projectsUrl;
|
|
1883
1985
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1886,7 +1988,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1886
1988
|
}
|
|
1887
1989
|
/** Fetches single Project */
|
|
1888
1990
|
async get(options) {
|
|
1889
|
-
const fetchUri = this.createUrl(
|
|
1991
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
1890
1992
|
return await this.apiClient(fetchUri);
|
|
1891
1993
|
}
|
|
1892
1994
|
/**
|
|
@@ -1894,32 +1996,44 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1894
1996
|
* When teamId is provided, returns a single team with its projects.
|
|
1895
1997
|
* When omitted, returns all accessible teams and their projects.
|
|
1896
1998
|
*/
|
|
1897
|
-
async
|
|
1898
|
-
const fetchUri = this.createUrl(
|
|
1999
|
+
async list(options) {
|
|
2000
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1899
2001
|
return await this.apiClient(fetchUri);
|
|
1900
2002
|
}
|
|
2003
|
+
/** @deprecated Use {@link list} instead. */
|
|
2004
|
+
async getProjects(options) {
|
|
2005
|
+
return this.list(options);
|
|
2006
|
+
}
|
|
1901
2007
|
/** Updates or creates (based on id) a Project */
|
|
1902
|
-
async
|
|
1903
|
-
const fetchUri = this.createUrl(
|
|
2008
|
+
async save(body) {
|
|
2009
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1904
2010
|
return await this.apiClient(fetchUri, {
|
|
1905
2011
|
method: "PUT",
|
|
1906
2012
|
body: JSON.stringify({ ...body })
|
|
1907
2013
|
});
|
|
1908
2014
|
}
|
|
2015
|
+
/** @deprecated Use {@link save} instead. */
|
|
2016
|
+
async upsert(body) {
|
|
2017
|
+
return this.save(body);
|
|
2018
|
+
}
|
|
1909
2019
|
/** Deletes a Project */
|
|
1910
|
-
async
|
|
1911
|
-
const fetchUri = this.createUrl(
|
|
2020
|
+
async remove(body) {
|
|
2021
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1912
2022
|
await this.apiClient(fetchUri, {
|
|
1913
2023
|
method: "DELETE",
|
|
1914
2024
|
body: JSON.stringify({ ...body }),
|
|
1915
2025
|
expectNoContent: true
|
|
1916
2026
|
});
|
|
1917
2027
|
}
|
|
2028
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2029
|
+
async delete(body) {
|
|
2030
|
+
return this.remove(body);
|
|
2031
|
+
}
|
|
1918
2032
|
};
|
|
1919
2033
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1920
2034
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1921
|
-
|
|
1922
|
-
|
|
2035
|
+
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
2036
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1923
2037
|
var ROUTE_URL = "/api/v1/route";
|
|
1924
2038
|
var RouteClient = class extends ApiClient {
|
|
1925
2039
|
constructor(options) {
|
|
@@ -1930,15 +2044,27 @@ var RouteClient = class extends ApiClient {
|
|
|
1930
2044
|
super(options);
|
|
1931
2045
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1932
2046
|
}
|
|
1933
|
-
/**
|
|
1934
|
-
|
|
2047
|
+
/**
|
|
2048
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
2049
|
+
*
|
|
2050
|
+
* An optional `select` projection applies to the resolved composition when
|
|
2051
|
+
* the route matches one; redirect / notFound responses pass through
|
|
2052
|
+
* untouched.
|
|
2053
|
+
*/
|
|
2054
|
+
async get(options) {
|
|
1935
2055
|
const { projectId } = this.options;
|
|
1936
|
-
const
|
|
2056
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2057
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2058
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
1937
2059
|
return await this.apiClient(
|
|
1938
2060
|
fetchUri,
|
|
1939
2061
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
1940
2062
|
);
|
|
1941
2063
|
}
|
|
2064
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
2065
|
+
async getRoute(options) {
|
|
2066
|
+
return this.get(options);
|
|
2067
|
+
}
|
|
1942
2068
|
};
|
|
1943
2069
|
function mapSlotToPersonalizedVariations(slot) {
|
|
1944
2070
|
if (!slot) return [];
|
|
@@ -2177,7 +2303,7 @@ function createLimiter(concurrency) {
|
|
|
2177
2303
|
});
|
|
2178
2304
|
};
|
|
2179
2305
|
}
|
|
2180
|
-
async function
|
|
2306
|
+
async function retry2(fn, options) {
|
|
2181
2307
|
let lastError;
|
|
2182
2308
|
let delay = 1e3;
|
|
2183
2309
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2217,7 +2343,7 @@ function createLimitPolicy2({
|
|
|
2217
2343
|
}
|
|
2218
2344
|
if (retryOptions) {
|
|
2219
2345
|
const retryFunc = currentFunc;
|
|
2220
|
-
currentFunc = () =>
|
|
2346
|
+
currentFunc = () => retry2(retryFunc, {
|
|
2221
2347
|
...retryOptions,
|
|
2222
2348
|
onFailedAttempt: async (error) => {
|
|
2223
2349
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2236,7 +2362,7 @@ function createLimitPolicy2({
|
|
|
2236
2362
|
// src/clients/canvas.ts
|
|
2237
2363
|
var getCanvasClient = (options) => {
|
|
2238
2364
|
const cache2 = resolveCanvasCache(options);
|
|
2239
|
-
return new
|
|
2365
|
+
return new CompositionDeliveryClient({
|
|
2240
2366
|
projectId: env.getProjectId(),
|
|
2241
2367
|
apiHost: env.getApiHost(),
|
|
2242
2368
|
apiKey: env.getApiKey(),
|
|
@@ -2351,14 +2477,14 @@ var getManifest = async (options) => {
|
|
|
2351
2477
|
var import_server_only3 = require("server-only");
|
|
2352
2478
|
|
|
2353
2479
|
// ../project-map/dist/index.mjs
|
|
2354
|
-
var
|
|
2480
|
+
var __typeError4 = (msg) => {
|
|
2355
2481
|
throw TypeError(msg);
|
|
2356
2482
|
};
|
|
2357
|
-
var
|
|
2358
|
-
var
|
|
2359
|
-
var
|
|
2360
|
-
var
|
|
2361
|
-
var __privateMethod = (obj, member, method) => (
|
|
2483
|
+
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
2484
|
+
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2485
|
+
var __privateAdd4 = (obj, member, value) => member.has(obj) ? __typeError4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2486
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2487
|
+
var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
|
|
2362
2488
|
var ProjectMapClient = class extends ApiClient {
|
|
2363
2489
|
constructor(options) {
|
|
2364
2490
|
super(options);
|
|
@@ -2505,12 +2631,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2505
2631
|
var _Route = class _Route2 {
|
|
2506
2632
|
constructor(route) {
|
|
2507
2633
|
this.route = route;
|
|
2508
|
-
|
|
2634
|
+
__privateAdd4(this, _routeInfo);
|
|
2509
2635
|
var _a;
|
|
2510
|
-
|
|
2636
|
+
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2511
2637
|
}
|
|
2512
2638
|
get dynamicSegmentCount() {
|
|
2513
|
-
return
|
|
2639
|
+
return __privateGet4(this, _routeInfo).segments.reduce(
|
|
2514
2640
|
(count, segment) => {
|
|
2515
2641
|
var _a;
|
|
2516
2642
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2522,7 +2648,7 @@ var _Route = class _Route2 {
|
|
|
2522
2648
|
matches(path) {
|
|
2523
2649
|
var _a, _b;
|
|
2524
2650
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2525
|
-
const { segments: routeSegments } =
|
|
2651
|
+
const { segments: routeSegments } = __privateGet4(this, _routeInfo);
|
|
2526
2652
|
if (pathSegments.length !== routeSegments.length) {
|
|
2527
2653
|
return { match: false };
|
|
2528
2654
|
}
|
|
@@ -2543,7 +2669,7 @@ var _Route = class _Route2 {
|
|
|
2543
2669
|
return { match: false };
|
|
2544
2670
|
}
|
|
2545
2671
|
}
|
|
2546
|
-
for (const [key, value] of
|
|
2672
|
+
for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
|
|
2547
2673
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2548
2674
|
}
|
|
2549
2675
|
return possibleMatch;
|
|
@@ -2553,7 +2679,7 @@ var _Route = class _Route2 {
|
|
|
2553
2679
|
*/
|
|
2554
2680
|
expand(options) {
|
|
2555
2681
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2556
|
-
const path =
|
|
2682
|
+
const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
|
|
2557
2683
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2558
2684
|
if (!dynamicSegmentName) {
|
|
2559
2685
|
return segment;
|
|
@@ -2604,7 +2730,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2604
2730
|
}
|
|
2605
2731
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2606
2732
|
};
|
|
2607
|
-
|
|
2733
|
+
__privateAdd4(_Route, _Route_static);
|
|
2608
2734
|
_Route.dynamicSegmentPrefix = ":";
|
|
2609
2735
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2610
2736
|
if (!doNotEscapeVariables) {
|
|
@@ -3296,7 +3422,7 @@ var resolvePlaygroundRoute = async ({ code }) => {
|
|
|
3296
3422
|
});
|
|
3297
3423
|
let composition = void 0;
|
|
3298
3424
|
try {
|
|
3299
|
-
composition = await canvasClient.
|
|
3425
|
+
composition = await canvasClient.get({
|
|
3300
3426
|
compositionId: pageState.routePath,
|
|
3301
3427
|
state: pageState.compositionState,
|
|
3302
3428
|
withComponentIDs: true
|
|
@@ -3442,7 +3568,7 @@ var createUniformPlaygroundStaticParams = async (options) => {
|
|
|
3442
3568
|
const routeClient = getRouteClient({
|
|
3443
3569
|
state
|
|
3444
3570
|
});
|
|
3445
|
-
route = await routeClient.
|
|
3571
|
+
route = await routeClient.get({
|
|
3446
3572
|
path: firstPath,
|
|
3447
3573
|
withComponentIDs: true,
|
|
3448
3574
|
state: CANVAS_DRAFT_STATE
|
|
@@ -3495,7 +3621,7 @@ async function processRoutePath({
|
|
|
3495
3621
|
});
|
|
3496
3622
|
const rewrittenPath = await (rewrite == null ? void 0 : rewrite({ path }));
|
|
3497
3623
|
const resolvedPath = (_a = rewrittenPath == null ? void 0 : rewrittenPath.path) != null ? _a : path;
|
|
3498
|
-
const route = await routeClient.
|
|
3624
|
+
const route = await routeClient.get({
|
|
3499
3625
|
path: resolvedPath,
|
|
3500
3626
|
withComponentIDs: true,
|
|
3501
3627
|
state: CANVAS_PUBLISHED_STATE
|
|
@@ -3748,14 +3874,14 @@ var DefaultDataClient = class {
|
|
|
3748
3874
|
if (oldCachedRoute) {
|
|
3749
3875
|
(0, import_functions.waitUntil)(
|
|
3750
3876
|
(async () => {
|
|
3751
|
-
const result2 = await routeClient.
|
|
3877
|
+
const result2 = await routeClient.get(route);
|
|
3752
3878
|
await cacheNewRoute(result2);
|
|
3753
3879
|
})()
|
|
3754
3880
|
);
|
|
3755
3881
|
return oldCachedRoute;
|
|
3756
3882
|
}
|
|
3757
3883
|
}
|
|
3758
|
-
const result = await routeClient.
|
|
3884
|
+
const result = await routeClient.get(route);
|
|
3759
3885
|
(0, import_functions.waitUntil)(
|
|
3760
3886
|
(async () => {
|
|
3761
3887
|
await Promise.all([
|