@uniformdev/next-app-router 20.50.2-alpha.149 → 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.mjs
CHANGED
|
@@ -4,6 +4,10 @@ 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;
|
|
7
11
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
12
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
13
|
};
|
|
@@ -23,12 +27,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
27
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
28
|
mod
|
|
25
29
|
));
|
|
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
|
+
});
|
|
26
43
|
|
|
27
44
|
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
28
45
|
var require_yocto_queue = __commonJS({
|
|
29
46
|
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
|
|
30
47
|
"use strict";
|
|
31
|
-
var
|
|
48
|
+
var Node2 = class {
|
|
32
49
|
/// value;
|
|
33
50
|
/// next;
|
|
34
51
|
constructor(value) {
|
|
@@ -36,7 +53,7 @@ var require_yocto_queue = __commonJS({
|
|
|
36
53
|
this.next = void 0;
|
|
37
54
|
}
|
|
38
55
|
};
|
|
39
|
-
var
|
|
56
|
+
var Queue2 = class {
|
|
40
57
|
// TODO: Use private class fields when targeting Node.js 12.
|
|
41
58
|
// #_head;
|
|
42
59
|
// #_tail;
|
|
@@ -45,7 +62,7 @@ var require_yocto_queue = __commonJS({
|
|
|
45
62
|
this.clear();
|
|
46
63
|
}
|
|
47
64
|
enqueue(value) {
|
|
48
|
-
const node = new
|
|
65
|
+
const node = new Node2(value);
|
|
49
66
|
if (this._head) {
|
|
50
67
|
this._tail.next = node;
|
|
51
68
|
this._tail = node;
|
|
@@ -80,7 +97,7 @@ var require_yocto_queue = __commonJS({
|
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
99
|
};
|
|
83
|
-
module.exports =
|
|
100
|
+
module.exports = Queue2;
|
|
84
101
|
}
|
|
85
102
|
});
|
|
86
103
|
|
|
@@ -88,12 +105,12 @@ var require_yocto_queue = __commonJS({
|
|
|
88
105
|
var require_p_limit = __commonJS({
|
|
89
106
|
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
|
|
90
107
|
"use strict";
|
|
91
|
-
var
|
|
92
|
-
var
|
|
108
|
+
var Queue2 = require_yocto_queue();
|
|
109
|
+
var pLimit3 = (concurrency) => {
|
|
93
110
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
94
111
|
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
95
112
|
}
|
|
96
|
-
const queue = new
|
|
113
|
+
const queue = new Queue2();
|
|
97
114
|
let activeCount = 0;
|
|
98
115
|
const next = () => {
|
|
99
116
|
activeCount--;
|
|
@@ -138,7 +155,238 @@ var require_p_limit = __commonJS({
|
|
|
138
155
|
});
|
|
139
156
|
return generator;
|
|
140
157
|
};
|
|
141
|
-
module.exports =
|
|
158
|
+
module.exports = pLimit3;
|
|
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();
|
|
142
390
|
}
|
|
143
391
|
});
|
|
144
392
|
|
|
@@ -151,14 +399,14 @@ import "server-only";
|
|
|
151
399
|
// ../context/dist/api/api.mjs
|
|
152
400
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
153
401
|
var __defProp2 = Object.defineProperty;
|
|
154
|
-
var
|
|
402
|
+
var __typeError2 = (msg) => {
|
|
155
403
|
throw TypeError(msg);
|
|
156
404
|
};
|
|
157
|
-
var
|
|
158
|
-
var
|
|
159
|
-
var
|
|
160
|
-
var
|
|
161
|
-
var
|
|
405
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
406
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
407
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
408
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
409
|
+
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);
|
|
162
410
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
163
411
|
var ApiClientError = class _ApiClientError extends Error {
|
|
164
412
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -166,18 +414,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
166
414
|
`${errorMessage}
|
|
167
415
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
168
416
|
);
|
|
169
|
-
this
|
|
170
|
-
this
|
|
171
|
-
this
|
|
172
|
-
this
|
|
173
|
-
this
|
|
174
|
-
this
|
|
417
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
418
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
419
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
420
|
+
__publicField2(this, "statusCode", statusCode);
|
|
421
|
+
__publicField2(this, "statusText", statusText);
|
|
422
|
+
__publicField2(this, "requestId", requestId);
|
|
175
423
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
176
424
|
}
|
|
177
425
|
};
|
|
178
426
|
var ApiClient = class _ApiClient {
|
|
179
427
|
constructor(options) {
|
|
180
|
-
|
|
428
|
+
__publicField2(this, "options");
|
|
181
429
|
var _a, _b, _c, _d, _e;
|
|
182
430
|
if (!options.apiKey && !options.bearerToken) {
|
|
183
431
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -347,12 +595,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
347
595
|
/** Fetches all aggregates for a project */
|
|
348
596
|
async get(options) {
|
|
349
597
|
const { projectId } = this.options;
|
|
350
|
-
const fetchUri = this.createUrl(
|
|
598
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
351
599
|
return await this.apiClient(fetchUri);
|
|
352
600
|
}
|
|
353
601
|
/** Updates or creates (based on id) an Aggregate */
|
|
354
602
|
async upsert(body) {
|
|
355
|
-
const fetchUri = this.createUrl(
|
|
603
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
356
604
|
await this.apiClient(fetchUri, {
|
|
357
605
|
method: "PUT",
|
|
358
606
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -361,7 +609,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
361
609
|
}
|
|
362
610
|
/** Deletes an Aggregate */
|
|
363
611
|
async remove(body) {
|
|
364
|
-
const fetchUri = this.createUrl(
|
|
612
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
365
613
|
await this.apiClient(fetchUri, {
|
|
366
614
|
method: "DELETE",
|
|
367
615
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -370,7 +618,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
370
618
|
}
|
|
371
619
|
};
|
|
372
620
|
_url = /* @__PURE__ */ new WeakMap();
|
|
373
|
-
|
|
621
|
+
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
374
622
|
var _url2;
|
|
375
623
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
376
624
|
constructor(options) {
|
|
@@ -379,12 +627,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
379
627
|
/** Fetches the known score dimensions for a project */
|
|
380
628
|
async get(options) {
|
|
381
629
|
const { projectId } = this.options;
|
|
382
|
-
const fetchUri = this.createUrl(
|
|
630
|
+
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
383
631
|
return await this.apiClient(fetchUri);
|
|
384
632
|
}
|
|
385
633
|
};
|
|
386
634
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
387
|
-
|
|
635
|
+
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
388
636
|
var _url3;
|
|
389
637
|
var _valueUrl;
|
|
390
638
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -394,12 +642,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
394
642
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
395
643
|
async get(options) {
|
|
396
644
|
const { projectId } = this.options;
|
|
397
|
-
const fetchUri = this.createUrl(
|
|
645
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
398
646
|
return await this.apiClient(fetchUri);
|
|
399
647
|
}
|
|
400
648
|
/** Updates or creates (based on id) an enrichment category */
|
|
401
649
|
async upsertCategory(body) {
|
|
402
|
-
const fetchUri = this.createUrl(
|
|
650
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
403
651
|
await this.apiClient(fetchUri, {
|
|
404
652
|
method: "PUT",
|
|
405
653
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -408,7 +656,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
408
656
|
}
|
|
409
657
|
/** Deletes an enrichment category */
|
|
410
658
|
async removeCategory(body) {
|
|
411
|
-
const fetchUri = this.createUrl(
|
|
659
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
412
660
|
await this.apiClient(fetchUri, {
|
|
413
661
|
method: "DELETE",
|
|
414
662
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -417,7 +665,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
417
665
|
}
|
|
418
666
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
419
667
|
async upsertValue(body) {
|
|
420
|
-
const fetchUri = this.createUrl(
|
|
668
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
421
669
|
await this.apiClient(fetchUri, {
|
|
422
670
|
method: "PUT",
|
|
423
671
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -426,7 +674,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
426
674
|
}
|
|
427
675
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
428
676
|
async removeValue(body) {
|
|
429
|
-
const fetchUri = this.createUrl(
|
|
677
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
430
678
|
await this.apiClient(fetchUri, {
|
|
431
679
|
method: "DELETE",
|
|
432
680
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -436,8 +684,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
436
684
|
};
|
|
437
685
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
438
686
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
439
|
-
|
|
440
|
-
|
|
687
|
+
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
688
|
+
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
441
689
|
var _url4;
|
|
442
690
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
443
691
|
constructor(options) {
|
|
@@ -446,7 +694,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
446
694
|
/** Fetches the Context manifest for a project */
|
|
447
695
|
async get(options) {
|
|
448
696
|
const { projectId } = this.options;
|
|
449
|
-
const fetchUri = this.createUrl(
|
|
697
|
+
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
450
698
|
return await this.apiClient(fetchUri);
|
|
451
699
|
}
|
|
452
700
|
/** Publishes the Context manifest for a project */
|
|
@@ -460,7 +708,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
460
708
|
}
|
|
461
709
|
};
|
|
462
710
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
463
|
-
|
|
711
|
+
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
464
712
|
var ManifestClient = _ManifestClient;
|
|
465
713
|
var _url5;
|
|
466
714
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
@@ -470,12 +718,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
470
718
|
/** Fetches all Quirks for a project */
|
|
471
719
|
async get(options) {
|
|
472
720
|
const { projectId } = this.options;
|
|
473
|
-
const fetchUri = this.createUrl(
|
|
721
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
474
722
|
return await this.apiClient(fetchUri);
|
|
475
723
|
}
|
|
476
724
|
/** Updates or creates (based on id) a Quirk */
|
|
477
725
|
async upsert(body) {
|
|
478
|
-
const fetchUri = this.createUrl(
|
|
726
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
479
727
|
await this.apiClient(fetchUri, {
|
|
480
728
|
method: "PUT",
|
|
481
729
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -484,7 +732,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
484
732
|
}
|
|
485
733
|
/** Deletes a Quirk */
|
|
486
734
|
async remove(body) {
|
|
487
|
-
const fetchUri = this.createUrl(
|
|
735
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
488
736
|
await this.apiClient(fetchUri, {
|
|
489
737
|
method: "DELETE",
|
|
490
738
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -493,7 +741,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
493
741
|
}
|
|
494
742
|
};
|
|
495
743
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
496
|
-
|
|
744
|
+
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
497
745
|
var _url6;
|
|
498
746
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
499
747
|
constructor(options) {
|
|
@@ -502,12 +750,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
502
750
|
/** Fetches all Signals for a project */
|
|
503
751
|
async get(options) {
|
|
504
752
|
const { projectId } = this.options;
|
|
505
|
-
const fetchUri = this.createUrl(
|
|
753
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
506
754
|
return await this.apiClient(fetchUri);
|
|
507
755
|
}
|
|
508
756
|
/** Updates or creates (based on id) a Signal */
|
|
509
757
|
async upsert(body) {
|
|
510
|
-
const fetchUri = this.createUrl(
|
|
758
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
511
759
|
await this.apiClient(fetchUri, {
|
|
512
760
|
method: "PUT",
|
|
513
761
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -516,7 +764,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
516
764
|
}
|
|
517
765
|
/** Deletes a Signal */
|
|
518
766
|
async remove(body) {
|
|
519
|
-
const fetchUri = this.createUrl(
|
|
767
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
520
768
|
await this.apiClient(fetchUri, {
|
|
521
769
|
method: "DELETE",
|
|
522
770
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -525,7 +773,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
525
773
|
}
|
|
526
774
|
};
|
|
527
775
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
528
|
-
|
|
776
|
+
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
529
777
|
var _url7;
|
|
530
778
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
531
779
|
constructor(options) {
|
|
@@ -534,12 +782,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
534
782
|
/** Fetches all Tests for a project */
|
|
535
783
|
async get(options) {
|
|
536
784
|
const { projectId } = this.options;
|
|
537
|
-
const fetchUri = this.createUrl(
|
|
785
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
538
786
|
return await this.apiClient(fetchUri);
|
|
539
787
|
}
|
|
540
788
|
/** Updates or creates (based on id) a Test */
|
|
541
789
|
async upsert(body) {
|
|
542
|
-
const fetchUri = this.createUrl(
|
|
790
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
543
791
|
await this.apiClient(fetchUri, {
|
|
544
792
|
method: "PUT",
|
|
545
793
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -548,7 +796,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
548
796
|
}
|
|
549
797
|
/** Deletes a Test */
|
|
550
798
|
async remove(body) {
|
|
551
|
-
const fetchUri = this.createUrl(
|
|
799
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
552
800
|
await this.apiClient(fetchUri, {
|
|
553
801
|
method: "DELETE",
|
|
554
802
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -557,393 +805,194 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
557
805
|
}
|
|
558
806
|
};
|
|
559
807
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
560
|
-
|
|
808
|
+
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
561
809
|
|
|
562
|
-
//
|
|
563
|
-
var
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
569
|
-
var __typeError2 = (msg) => {
|
|
570
|
-
throw TypeError(msg);
|
|
571
|
-
};
|
|
572
|
-
var __commonJS2 = (cb, mod) => function __require() {
|
|
573
|
-
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
574
|
-
};
|
|
575
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
576
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
577
|
-
for (let key of __getOwnPropNames2(from))
|
|
578
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
579
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
810
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
811
|
+
var Node = class {
|
|
812
|
+
constructor(value) {
|
|
813
|
+
__publicField(this, "value");
|
|
814
|
+
__publicField(this, "next");
|
|
815
|
+
this.value = value;
|
|
580
816
|
}
|
|
581
|
-
return to;
|
|
582
817
|
};
|
|
583
|
-
var
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
this.value = value;
|
|
602
|
-
this.next = void 0;
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
var Queue = class {
|
|
606
|
-
// TODO: Use private class fields when targeting Node.js 12.
|
|
607
|
-
// #_head;
|
|
608
|
-
// #_tail;
|
|
609
|
-
// #_size;
|
|
610
|
-
constructor() {
|
|
611
|
-
this.clear();
|
|
612
|
-
}
|
|
613
|
-
enqueue(value) {
|
|
614
|
-
const node = new Node(value);
|
|
615
|
-
if (this._head) {
|
|
616
|
-
this._tail.next = node;
|
|
617
|
-
this._tail = node;
|
|
618
|
-
} else {
|
|
619
|
-
this._head = node;
|
|
620
|
-
this._tail = node;
|
|
621
|
-
}
|
|
622
|
-
this._size++;
|
|
623
|
-
}
|
|
624
|
-
dequeue() {
|
|
625
|
-
const current = this._head;
|
|
626
|
-
if (!current) {
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
this._head = this._head.next;
|
|
630
|
-
this._size--;
|
|
631
|
-
return current.value;
|
|
632
|
-
}
|
|
633
|
-
clear() {
|
|
634
|
-
this._head = void 0;
|
|
635
|
-
this._tail = void 0;
|
|
636
|
-
this._size = 0;
|
|
637
|
-
}
|
|
638
|
-
get size() {
|
|
639
|
-
return this._size;
|
|
640
|
-
}
|
|
641
|
-
*[Symbol.iterator]() {
|
|
642
|
-
let current = this._head;
|
|
643
|
-
while (current) {
|
|
644
|
-
yield current.value;
|
|
645
|
-
current = current.next;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
module.exports = Queue;
|
|
818
|
+
var _head, _tail, _size;
|
|
819
|
+
var Queue = class {
|
|
820
|
+
constructor() {
|
|
821
|
+
__privateAdd(this, _head);
|
|
822
|
+
__privateAdd(this, _tail);
|
|
823
|
+
__privateAdd(this, _size);
|
|
824
|
+
this.clear();
|
|
825
|
+
}
|
|
826
|
+
enqueue(value) {
|
|
827
|
+
const node = new Node(value);
|
|
828
|
+
if (__privateGet(this, _head)) {
|
|
829
|
+
__privateGet(this, _tail).next = node;
|
|
830
|
+
__privateSet(this, _tail, node);
|
|
831
|
+
} else {
|
|
832
|
+
__privateSet(this, _head, node);
|
|
833
|
+
__privateSet(this, _tail, node);
|
|
834
|
+
}
|
|
835
|
+
__privateWrapper(this, _size)._++;
|
|
650
836
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
const next = () => {
|
|
663
|
-
activeCount--;
|
|
664
|
-
if (queue.size > 0) {
|
|
665
|
-
queue.dequeue()();
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
const run = async (fn, resolve, ...args) => {
|
|
669
|
-
activeCount++;
|
|
670
|
-
const result = (async () => fn(...args))();
|
|
671
|
-
resolve(result);
|
|
672
|
-
try {
|
|
673
|
-
await result;
|
|
674
|
-
} catch (e) {
|
|
675
|
-
}
|
|
676
|
-
next();
|
|
677
|
-
};
|
|
678
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
679
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
680
|
-
(async () => {
|
|
681
|
-
await Promise.resolve();
|
|
682
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
683
|
-
queue.dequeue()();
|
|
684
|
-
}
|
|
685
|
-
})();
|
|
686
|
-
};
|
|
687
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
688
|
-
enqueue(fn, resolve, ...args);
|
|
689
|
-
});
|
|
690
|
-
Object.defineProperties(generator, {
|
|
691
|
-
activeCount: {
|
|
692
|
-
get: () => activeCount
|
|
693
|
-
},
|
|
694
|
-
pendingCount: {
|
|
695
|
-
get: () => queue.size
|
|
696
|
-
},
|
|
697
|
-
clearQueue: {
|
|
698
|
-
value: () => {
|
|
699
|
-
queue.clear();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
return generator;
|
|
704
|
-
};
|
|
705
|
-
module.exports = pLimit2;
|
|
837
|
+
dequeue() {
|
|
838
|
+
const current = __privateGet(this, _head);
|
|
839
|
+
if (!current) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
843
|
+
__privateWrapper(this, _size)._--;
|
|
844
|
+
if (!__privateGet(this, _head)) {
|
|
845
|
+
__privateSet(this, _tail, void 0);
|
|
846
|
+
}
|
|
847
|
+
return current.value;
|
|
706
848
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
"use strict";
|
|
711
|
-
function RetryOperation(timeouts, options) {
|
|
712
|
-
if (typeof options === "boolean") {
|
|
713
|
-
options = { forever: options };
|
|
714
|
-
}
|
|
715
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
716
|
-
this._timeouts = timeouts;
|
|
717
|
-
this._options = options || {};
|
|
718
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
719
|
-
this._fn = null;
|
|
720
|
-
this._errors = [];
|
|
721
|
-
this._attempts = 1;
|
|
722
|
-
this._operationTimeout = null;
|
|
723
|
-
this._operationTimeoutCb = null;
|
|
724
|
-
this._timeout = null;
|
|
725
|
-
this._operationStart = null;
|
|
726
|
-
this._timer = null;
|
|
727
|
-
if (this._options.forever) {
|
|
728
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
729
|
-
}
|
|
849
|
+
peek() {
|
|
850
|
+
if (!__privateGet(this, _head)) {
|
|
851
|
+
return;
|
|
730
852
|
}
|
|
731
|
-
|
|
732
|
-
RetryOperation.prototype.reset = function() {
|
|
733
|
-
this._attempts = 1;
|
|
734
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
735
|
-
};
|
|
736
|
-
RetryOperation.prototype.stop = function() {
|
|
737
|
-
if (this._timeout) {
|
|
738
|
-
clearTimeout(this._timeout);
|
|
739
|
-
}
|
|
740
|
-
if (this._timer) {
|
|
741
|
-
clearTimeout(this._timer);
|
|
742
|
-
}
|
|
743
|
-
this._timeouts = [];
|
|
744
|
-
this._cachedTimeouts = null;
|
|
745
|
-
};
|
|
746
|
-
RetryOperation.prototype.retry = function(err) {
|
|
747
|
-
if (this._timeout) {
|
|
748
|
-
clearTimeout(this._timeout);
|
|
749
|
-
}
|
|
750
|
-
if (!err) {
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
754
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
755
|
-
this._errors.push(err);
|
|
756
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
757
|
-
return false;
|
|
758
|
-
}
|
|
759
|
-
this._errors.push(err);
|
|
760
|
-
var timeout = this._timeouts.shift();
|
|
761
|
-
if (timeout === void 0) {
|
|
762
|
-
if (this._cachedTimeouts) {
|
|
763
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
764
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
765
|
-
} else {
|
|
766
|
-
return false;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
var self = this;
|
|
770
|
-
this._timer = setTimeout(function() {
|
|
771
|
-
self._attempts++;
|
|
772
|
-
if (self._operationTimeoutCb) {
|
|
773
|
-
self._timeout = setTimeout(function() {
|
|
774
|
-
self._operationTimeoutCb(self._attempts);
|
|
775
|
-
}, self._operationTimeout);
|
|
776
|
-
if (self._options.unref) {
|
|
777
|
-
self._timeout.unref();
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
self._fn(self._attempts);
|
|
781
|
-
}, timeout);
|
|
782
|
-
if (this._options.unref) {
|
|
783
|
-
this._timer.unref();
|
|
784
|
-
}
|
|
785
|
-
return true;
|
|
786
|
-
};
|
|
787
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
788
|
-
this._fn = fn;
|
|
789
|
-
if (timeoutOps) {
|
|
790
|
-
if (timeoutOps.timeout) {
|
|
791
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
792
|
-
}
|
|
793
|
-
if (timeoutOps.cb) {
|
|
794
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
var self = this;
|
|
798
|
-
if (this._operationTimeoutCb) {
|
|
799
|
-
this._timeout = setTimeout(function() {
|
|
800
|
-
self._operationTimeoutCb();
|
|
801
|
-
}, self._operationTimeout);
|
|
802
|
-
}
|
|
803
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
804
|
-
this._fn(this._attempts);
|
|
805
|
-
};
|
|
806
|
-
RetryOperation.prototype.try = function(fn) {
|
|
807
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
808
|
-
this.attempt(fn);
|
|
809
|
-
};
|
|
810
|
-
RetryOperation.prototype.start = function(fn) {
|
|
811
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
812
|
-
this.attempt(fn);
|
|
813
|
-
};
|
|
814
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
815
|
-
RetryOperation.prototype.errors = function() {
|
|
816
|
-
return this._errors;
|
|
817
|
-
};
|
|
818
|
-
RetryOperation.prototype.attempts = function() {
|
|
819
|
-
return this._attempts;
|
|
820
|
-
};
|
|
821
|
-
RetryOperation.prototype.mainError = function() {
|
|
822
|
-
if (this._errors.length === 0) {
|
|
823
|
-
return null;
|
|
824
|
-
}
|
|
825
|
-
var counts = {};
|
|
826
|
-
var mainError = null;
|
|
827
|
-
var mainErrorCount = 0;
|
|
828
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
829
|
-
var error = this._errors[i];
|
|
830
|
-
var message = error.message;
|
|
831
|
-
var count = (counts[message] || 0) + 1;
|
|
832
|
-
counts[message] = count;
|
|
833
|
-
if (count >= mainErrorCount) {
|
|
834
|
-
mainError = error;
|
|
835
|
-
mainErrorCount = count;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
return mainError;
|
|
839
|
-
};
|
|
853
|
+
return __privateGet(this, _head).value;
|
|
840
854
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
855
|
+
clear() {
|
|
856
|
+
__privateSet(this, _head, void 0);
|
|
857
|
+
__privateSet(this, _tail, void 0);
|
|
858
|
+
__privateSet(this, _size, 0);
|
|
859
|
+
}
|
|
860
|
+
get size() {
|
|
861
|
+
return __privateGet(this, _size);
|
|
862
|
+
}
|
|
863
|
+
*[Symbol.iterator]() {
|
|
864
|
+
let current = __privateGet(this, _head);
|
|
865
|
+
while (current) {
|
|
866
|
+
yield current.value;
|
|
867
|
+
current = current.next;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
*drain() {
|
|
871
|
+
while (__privateGet(this, _head)) {
|
|
872
|
+
yield this.dequeue();
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
_head = new WeakMap();
|
|
877
|
+
_tail = new WeakMap();
|
|
878
|
+
_size = new WeakMap();
|
|
879
|
+
|
|
880
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
881
|
+
function pLimit2(concurrency) {
|
|
882
|
+
validateConcurrency(concurrency);
|
|
883
|
+
const queue = new Queue();
|
|
884
|
+
let activeCount = 0;
|
|
885
|
+
const resumeNext = () => {
|
|
886
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
887
|
+
queue.dequeue()();
|
|
888
|
+
activeCount++;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
const next = () => {
|
|
892
|
+
activeCount--;
|
|
893
|
+
resumeNext();
|
|
894
|
+
};
|
|
895
|
+
const run = async (function_, resolve, arguments_) => {
|
|
896
|
+
const result = (async () => function_(...arguments_))();
|
|
897
|
+
resolve(result);
|
|
898
|
+
try {
|
|
899
|
+
await result;
|
|
900
|
+
} catch (e) {
|
|
901
|
+
}
|
|
902
|
+
next();
|
|
903
|
+
};
|
|
904
|
+
const enqueue = (function_, resolve, arguments_) => {
|
|
905
|
+
new Promise((internalResolve) => {
|
|
906
|
+
queue.enqueue(internalResolve);
|
|
907
|
+
}).then(
|
|
908
|
+
run.bind(void 0, function_, resolve, arguments_)
|
|
909
|
+
);
|
|
910
|
+
(async () => {
|
|
911
|
+
await Promise.resolve();
|
|
912
|
+
if (activeCount < concurrency) {
|
|
913
|
+
resumeNext();
|
|
877
914
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
915
|
+
})();
|
|
916
|
+
};
|
|
917
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
918
|
+
enqueue(function_, resolve, arguments_);
|
|
919
|
+
});
|
|
920
|
+
Object.defineProperties(generator, {
|
|
921
|
+
activeCount: {
|
|
922
|
+
get: () => activeCount
|
|
923
|
+
},
|
|
924
|
+
pendingCount: {
|
|
925
|
+
get: () => queue.size
|
|
926
|
+
},
|
|
927
|
+
clearQueue: {
|
|
928
|
+
value() {
|
|
929
|
+
queue.clear();
|
|
893
930
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
931
|
+
},
|
|
932
|
+
concurrency: {
|
|
933
|
+
get: () => concurrency,
|
|
934
|
+
set(newConcurrency) {
|
|
935
|
+
validateConcurrency(newConcurrency);
|
|
936
|
+
concurrency = newConcurrency;
|
|
937
|
+
queueMicrotask(() => {
|
|
938
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
939
|
+
resumeNext();
|
|
899
940
|
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
for (var i = 0; i < methods.length; i++) {
|
|
903
|
-
var method = methods[i];
|
|
904
|
-
var original = obj[method];
|
|
905
|
-
obj[method] = function retryWrapper(original2) {
|
|
906
|
-
var op = exports.operation(options);
|
|
907
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
908
|
-
var callback = args.pop();
|
|
909
|
-
args.push(function(err) {
|
|
910
|
-
if (op.retry(err)) {
|
|
911
|
-
return;
|
|
912
|
-
}
|
|
913
|
-
if (err) {
|
|
914
|
-
arguments[0] = op.mainError();
|
|
915
|
-
}
|
|
916
|
-
callback.apply(this, arguments);
|
|
917
|
-
});
|
|
918
|
-
op.attempt(function() {
|
|
919
|
-
original2.apply(obj, args);
|
|
920
|
-
});
|
|
921
|
-
}.bind(obj, original);
|
|
922
|
-
obj[method].options = options;
|
|
941
|
+
});
|
|
923
942
|
}
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
return generator;
|
|
946
|
+
}
|
|
947
|
+
function validateConcurrency(concurrency) {
|
|
948
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
949
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
931
950
|
}
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
var
|
|
936
|
-
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
954
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
955
|
+
|
|
956
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
957
|
+
var objectToString = Object.prototype.toString;
|
|
958
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
959
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
960
|
+
"network error",
|
|
937
961
|
// Chrome
|
|
938
962
|
"NetworkError when attempting to fetch resource.",
|
|
939
963
|
// Firefox
|
|
940
964
|
"The Internet connection appears to be offline.",
|
|
941
|
-
// Safari
|
|
965
|
+
// Safari 16
|
|
942
966
|
"Network request failed",
|
|
943
967
|
// `cross-fetch`
|
|
944
|
-
"fetch failed"
|
|
968
|
+
"fetch failed",
|
|
969
|
+
// Undici (Node.js)
|
|
970
|
+
"terminated",
|
|
945
971
|
// Undici (Node.js)
|
|
972
|
+
" A network error occurred.",
|
|
973
|
+
// Bun (WebKit)
|
|
974
|
+
"Network connection lost"
|
|
975
|
+
// Cloudflare Workers (fetch)
|
|
946
976
|
]);
|
|
977
|
+
function isNetworkError(error) {
|
|
978
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
979
|
+
if (!isValid) {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
const { message, stack } = error;
|
|
983
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
984
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
985
|
+
}
|
|
986
|
+
if (message.startsWith("error sending request for url")) {
|
|
987
|
+
return true;
|
|
988
|
+
}
|
|
989
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
990
|
+
return true;
|
|
991
|
+
}
|
|
992
|
+
return errorMessages.has(message);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
947
996
|
var AbortError = class extends Error {
|
|
948
997
|
constructor(message) {
|
|
949
998
|
super();
|
|
@@ -964,63 +1013,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
964
1013
|
error.retriesLeft = retriesLeft;
|
|
965
1014
|
return error;
|
|
966
1015
|
};
|
|
967
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
968
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
969
1016
|
async function pRetry(input, options) {
|
|
970
1017
|
return new Promise((resolve, reject) => {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
retries: 10,
|
|
975
|
-
...options
|
|
1018
|
+
var _a, _b, _c;
|
|
1019
|
+
options = { ...options };
|
|
1020
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
976
1021
|
};
|
|
1022
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1023
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
977
1024
|
const operation = import_retry.default.operation(options);
|
|
1025
|
+
const abortHandler = () => {
|
|
1026
|
+
var _a2;
|
|
1027
|
+
operation.stop();
|
|
1028
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1029
|
+
};
|
|
1030
|
+
if (options.signal && !options.signal.aborted) {
|
|
1031
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1032
|
+
}
|
|
1033
|
+
const cleanUp = () => {
|
|
1034
|
+
var _a2;
|
|
1035
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1036
|
+
operation.stop();
|
|
1037
|
+
};
|
|
978
1038
|
operation.attempt(async (attemptNumber) => {
|
|
979
1039
|
try {
|
|
980
|
-
|
|
1040
|
+
const result = await input(attemptNumber);
|
|
1041
|
+
cleanUp();
|
|
1042
|
+
resolve(result);
|
|
981
1043
|
} catch (error) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
} else {
|
|
1044
|
+
try {
|
|
1045
|
+
if (!(error instanceof Error)) {
|
|
1046
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1047
|
+
}
|
|
1048
|
+
if (error instanceof AbortError) {
|
|
1049
|
+
throw error.originalError;
|
|
1050
|
+
}
|
|
1051
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1052
|
+
throw error;
|
|
1053
|
+
}
|
|
993
1054
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
reject(error2);
|
|
998
|
-
return;
|
|
1055
|
+
if (!await options.shouldRetry(error)) {
|
|
1056
|
+
operation.stop();
|
|
1057
|
+
reject(error);
|
|
999
1058
|
}
|
|
1059
|
+
await options.onFailedAttempt(error);
|
|
1000
1060
|
if (!operation.retry(error)) {
|
|
1001
|
-
|
|
1061
|
+
throw operation.mainError();
|
|
1002
1062
|
}
|
|
1063
|
+
} catch (finalError) {
|
|
1064
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1065
|
+
cleanUp();
|
|
1066
|
+
reject(finalError);
|
|
1003
1067
|
}
|
|
1004
1068
|
}
|
|
1005
1069
|
});
|
|
1006
|
-
if (options.signal && !options.signal.aborted) {
|
|
1007
|
-
options.signal.addEventListener("abort", () => {
|
|
1008
|
-
operation.stop();
|
|
1009
|
-
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1010
|
-
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1011
|
-
}, {
|
|
1012
|
-
once: true
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
1070
|
});
|
|
1016
1071
|
}
|
|
1072
|
+
|
|
1073
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1017
1074
|
var AbortError2 = class extends Error {
|
|
1018
1075
|
constructor() {
|
|
1019
1076
|
super("Throttled function aborted");
|
|
1020
1077
|
this.name = "AbortError";
|
|
1021
1078
|
}
|
|
1022
1079
|
};
|
|
1023
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1080
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1024
1081
|
if (!Number.isFinite(limit)) {
|
|
1025
1082
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1026
1083
|
}
|
|
@@ -1048,32 +1105,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1048
1105
|
const strictTicks = [];
|
|
1049
1106
|
function strictDelay() {
|
|
1050
1107
|
const now = Date.now();
|
|
1051
|
-
if (strictTicks.length
|
|
1052
|
-
strictTicks.
|
|
1053
|
-
return 0;
|
|
1108
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1109
|
+
strictTicks.length = 0;
|
|
1054
1110
|
}
|
|
1055
|
-
|
|
1056
|
-
if (now >= earliestTime) {
|
|
1111
|
+
if (strictTicks.length < limit) {
|
|
1057
1112
|
strictTicks.push(now);
|
|
1058
1113
|
return 0;
|
|
1059
1114
|
}
|
|
1060
|
-
strictTicks
|
|
1061
|
-
|
|
1115
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1116
|
+
strictTicks.shift();
|
|
1117
|
+
strictTicks.push(nextExecutionTime);
|
|
1118
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1062
1119
|
}
|
|
1063
1120
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1064
1121
|
return (function_) => {
|
|
1065
|
-
const throttled = function(...
|
|
1122
|
+
const throttled = function(...arguments_) {
|
|
1066
1123
|
if (!throttled.isEnabled) {
|
|
1067
|
-
return (async () => function_.apply(this,
|
|
1124
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1068
1125
|
}
|
|
1069
|
-
let
|
|
1126
|
+
let timeoutId;
|
|
1070
1127
|
return new Promise((resolve, reject) => {
|
|
1071
1128
|
const execute = () => {
|
|
1072
|
-
resolve(function_.apply(this,
|
|
1073
|
-
queue.delete(
|
|
1129
|
+
resolve(function_.apply(this, arguments_));
|
|
1130
|
+
queue.delete(timeoutId);
|
|
1074
1131
|
};
|
|
1075
|
-
|
|
1076
|
-
|
|
1132
|
+
const delay = getDelay();
|
|
1133
|
+
if (delay > 0) {
|
|
1134
|
+
timeoutId = setTimeout(execute, delay);
|
|
1135
|
+
queue.set(timeoutId, reject);
|
|
1136
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1137
|
+
} else {
|
|
1138
|
+
execute();
|
|
1139
|
+
}
|
|
1077
1140
|
});
|
|
1078
1141
|
};
|
|
1079
1142
|
throttled.abort = () => {
|
|
@@ -1085,16 +1148,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1085
1148
|
strictTicks.splice(0, strictTicks.length);
|
|
1086
1149
|
};
|
|
1087
1150
|
throttled.isEnabled = true;
|
|
1151
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1152
|
+
get() {
|
|
1153
|
+
return queue.size;
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1088
1156
|
return throttled;
|
|
1089
1157
|
};
|
|
1090
1158
|
}
|
|
1159
|
+
|
|
1160
|
+
// ../canvas/dist/index.mjs
|
|
1161
|
+
var __typeError3 = (msg) => {
|
|
1162
|
+
throw TypeError(msg);
|
|
1163
|
+
};
|
|
1164
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1165
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1166
|
+
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);
|
|
1091
1167
|
function createLimitPolicy({
|
|
1092
1168
|
throttle = { interval: 1e3, limit: 10 },
|
|
1093
|
-
retry:
|
|
1169
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1094
1170
|
limit = 10
|
|
1095
1171
|
}) {
|
|
1096
1172
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1097
|
-
const limiter = limit ? (
|
|
1173
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1098
1174
|
return function limitPolicy(func) {
|
|
1099
1175
|
let currentFunc = async () => await func();
|
|
1100
1176
|
if (throttler) {
|
|
@@ -1105,13 +1181,13 @@ function createLimitPolicy({
|
|
|
1105
1181
|
const limitFunc = currentFunc;
|
|
1106
1182
|
currentFunc = () => limiter(limitFunc);
|
|
1107
1183
|
}
|
|
1108
|
-
if (
|
|
1184
|
+
if (retry3) {
|
|
1109
1185
|
const retryFunc = currentFunc;
|
|
1110
1186
|
currentFunc = () => pRetry(retryFunc, {
|
|
1111
|
-
...
|
|
1187
|
+
...retry3,
|
|
1112
1188
|
onFailedAttempt: async (error) => {
|
|
1113
|
-
if (
|
|
1114
|
-
await
|
|
1189
|
+
if (retry3.onFailedAttempt) {
|
|
1190
|
+
await retry3.onFailedAttempt(error);
|
|
1115
1191
|
}
|
|
1116
1192
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1117
1193
|
throw error;
|
|
@@ -1122,123 +1198,153 @@ function createLimitPolicy({
|
|
|
1122
1198
|
return currentFunc();
|
|
1123
1199
|
};
|
|
1124
1200
|
}
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
if (!options.limitPolicy) {
|
|
1130
|
-
options.limitPolicy = createLimitPolicy({});
|
|
1131
|
-
}
|
|
1132
|
-
super(options);
|
|
1133
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1134
|
-
this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1135
|
-
}
|
|
1136
|
-
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1137
|
-
async getCompositionList(params = {}) {
|
|
1138
|
-
const { projectId } = this.options;
|
|
1139
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1140
|
-
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1141
|
-
if (!resolveData) {
|
|
1142
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1143
|
-
return this.apiClient(fetchUri);
|
|
1144
|
-
}
|
|
1145
|
-
const edgeParams = {
|
|
1146
|
-
...originParams,
|
|
1147
|
-
projectId,
|
|
1148
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1149
|
-
...rewrittenFilters
|
|
1150
|
-
};
|
|
1151
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1152
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1153
|
-
}
|
|
1154
|
-
getCompositionByNodePath(options) {
|
|
1155
|
-
return this.getOneComposition(options);
|
|
1156
|
-
}
|
|
1157
|
-
getCompositionByNodeId(options) {
|
|
1158
|
-
return this.getOneComposition(options);
|
|
1159
|
-
}
|
|
1160
|
-
getCompositionBySlug(options) {
|
|
1161
|
-
return this.getOneComposition(options);
|
|
1162
|
-
}
|
|
1163
|
-
getCompositionById(options) {
|
|
1164
|
-
return this.getOneComposition(options);
|
|
1165
|
-
}
|
|
1166
|
-
getCompositionDefaults(options) {
|
|
1167
|
-
return this.getOneComposition(options);
|
|
1168
|
-
}
|
|
1169
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1170
|
-
async getCompositionHistory(options) {
|
|
1171
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1201
|
+
var ContentClientBase = class extends ApiClient {
|
|
1202
|
+
constructor(options, defaultBypassCache) {
|
|
1203
|
+
var _a, _b;
|
|
1204
|
+
super({
|
|
1172
1205
|
...options,
|
|
1173
|
-
|
|
1206
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1207
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1174
1208
|
});
|
|
1175
|
-
return this.apiClient(historyUrl);
|
|
1176
1209
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1210
|
+
};
|
|
1211
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1212
|
+
function appendCsv(out, key, values) {
|
|
1213
|
+
if (values === void 0) {
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
out[key] = values.join(",");
|
|
1217
|
+
}
|
|
1218
|
+
function projectionToQuery(spec) {
|
|
1219
|
+
const out = {};
|
|
1220
|
+
if (!spec) {
|
|
1221
|
+
return out;
|
|
1222
|
+
}
|
|
1223
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1224
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1225
|
+
if (fields) {
|
|
1226
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1227
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1228
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1229
|
+
}
|
|
1230
|
+
if (fieldTypes) {
|
|
1231
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1232
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1233
|
+
}
|
|
1234
|
+
if (slots) {
|
|
1235
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1236
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1237
|
+
if (typeof slots.depth === "number") {
|
|
1238
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1185
1239
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1240
|
+
if (slots.named) {
|
|
1241
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1242
|
+
for (const slotName of slotNames) {
|
|
1243
|
+
const named = slots.named[slotName];
|
|
1244
|
+
if (named && typeof named.depth === "number") {
|
|
1245
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
return out;
|
|
1251
|
+
}
|
|
1252
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1253
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
1254
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1255
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1256
|
+
var CANVAS_TEST_SLOT = "test";
|
|
1257
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1258
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1259
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1260
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1261
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1262
|
+
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
1263
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1264
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1265
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1266
|
+
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
1267
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1268
|
+
var PLACEHOLDER_ID = "placeholder";
|
|
1269
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1270
|
+
function resolveCompositionSelector(args) {
|
|
1271
|
+
if ("compositionId" in args) {
|
|
1272
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1273
|
+
return {
|
|
1274
|
+
readOptions,
|
|
1275
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1276
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1277
|
+
versionId,
|
|
1278
|
+
hasCompositionId: true,
|
|
1279
|
+
pinnedEdition: editionId !== void 0
|
|
1190
1280
|
};
|
|
1191
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1192
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1193
1281
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
}
|
|
1207
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1282
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1283
|
+
}
|
|
1284
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1285
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1286
|
+
constructor(options) {
|
|
1287
|
+
var _a;
|
|
1288
|
+
super(
|
|
1289
|
+
options,
|
|
1290
|
+
/* defaultBypassCache */
|
|
1291
|
+
false
|
|
1292
|
+
);
|
|
1293
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1294
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1208
1295
|
}
|
|
1209
|
-
/**
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
const { projectId } = this.options;
|
|
1213
|
-
await this.apiClient(fetchUri, {
|
|
1214
|
-
method: "DELETE",
|
|
1215
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1216
|
-
expectNoContent: true
|
|
1217
|
-
});
|
|
1296
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1297
|
+
coerceDiagnostics(diagnostics) {
|
|
1298
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1218
1299
|
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1300
|
+
};
|
|
1301
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1302
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1303
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1304
|
+
constructor(options) {
|
|
1305
|
+
super(options);
|
|
1224
1306
|
}
|
|
1225
|
-
/**
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1307
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1308
|
+
get(args) {
|
|
1309
|
+
var _a;
|
|
1310
|
+
const { diagnostics, select, ...rest } = args;
|
|
1311
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1312
|
+
const url = this.createUrl(
|
|
1313
|
+
EDGE_SINGLE_URL,
|
|
1314
|
+
{
|
|
1315
|
+
...readOptions,
|
|
1316
|
+
...projectionToQuery(select),
|
|
1317
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1318
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1319
|
+
compositionId,
|
|
1320
|
+
versionId,
|
|
1321
|
+
projectId: this.options.projectId,
|
|
1322
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1323
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1324
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1325
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1326
|
+
},
|
|
1327
|
+
this.edgeApiHost
|
|
1328
|
+
);
|
|
1329
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1233
1330
|
}
|
|
1234
|
-
/**
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1331
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1332
|
+
list(args = {}) {
|
|
1333
|
+
var _a;
|
|
1334
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1335
|
+
const url = this.createUrl(
|
|
1336
|
+
EDGE_LIST_URL,
|
|
1337
|
+
{
|
|
1338
|
+
...rest,
|
|
1339
|
+
...rewriteFiltersForApi(filters),
|
|
1340
|
+
...projectionToQuery(select),
|
|
1341
|
+
projectId: this.options.projectId,
|
|
1342
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1343
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1344
|
+
},
|
|
1345
|
+
this.edgeApiHost
|
|
1346
|
+
);
|
|
1347
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1242
1348
|
}
|
|
1243
1349
|
};
|
|
1244
1350
|
var _contentTypesUrl;
|
|
@@ -1251,20 +1357,26 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1251
1357
|
}
|
|
1252
1358
|
getContentTypes(options) {
|
|
1253
1359
|
const { projectId } = this.options;
|
|
1254
|
-
const fetchUri = this.createUrl(
|
|
1360
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1255
1361
|
return this.apiClient(fetchUri);
|
|
1256
1362
|
}
|
|
1257
1363
|
getEntries(options) {
|
|
1258
1364
|
const { projectId } = this.options;
|
|
1259
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1365
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1260
1366
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1367
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1261
1368
|
if (skipDataResolution) {
|
|
1262
|
-
const url = this.createUrl(
|
|
1369
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1370
|
+
...params,
|
|
1371
|
+
...rewrittenFilters,
|
|
1372
|
+
...rewrittenSelect,
|
|
1373
|
+
projectId
|
|
1374
|
+
});
|
|
1263
1375
|
return this.apiClient(url);
|
|
1264
1376
|
}
|
|
1265
1377
|
const edgeUrl = this.createUrl(
|
|
1266
|
-
|
|
1267
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1378
|
+
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1379
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1268
1380
|
this.edgeApiHost
|
|
1269
1381
|
);
|
|
1270
1382
|
return this.apiClient(
|
|
@@ -1281,7 +1393,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1281
1393
|
return this.apiClient(historyUrl);
|
|
1282
1394
|
}
|
|
1283
1395
|
async upsertContentType(body, opts = {}) {
|
|
1284
|
-
const fetchUri = this.createUrl(
|
|
1396
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1285
1397
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1286
1398
|
delete body.contentType.slugSettings;
|
|
1287
1399
|
}
|
|
@@ -1293,7 +1405,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1293
1405
|
});
|
|
1294
1406
|
}
|
|
1295
1407
|
async upsertEntry(body, options) {
|
|
1296
|
-
const fetchUri = this.createUrl(
|
|
1408
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1297
1409
|
const headers = {};
|
|
1298
1410
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1299
1411
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1307,7 +1419,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1307
1419
|
return { modified: response.headers.get("x-modified-at") };
|
|
1308
1420
|
}
|
|
1309
1421
|
async deleteContentType(body) {
|
|
1310
|
-
const fetchUri = this.createUrl(
|
|
1422
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1311
1423
|
await this.apiClient(fetchUri, {
|
|
1312
1424
|
method: "DELETE",
|
|
1313
1425
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1315,7 +1427,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1315
1427
|
});
|
|
1316
1428
|
}
|
|
1317
1429
|
async deleteEntry(body) {
|
|
1318
|
-
const fetchUri = this.createUrl(
|
|
1430
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1319
1431
|
await this.apiClient(fetchUri, {
|
|
1320
1432
|
method: "DELETE",
|
|
1321
1433
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1334,31 +1446,39 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1334
1446
|
};
|
|
1335
1447
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1336
1448
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1337
|
-
|
|
1338
|
-
|
|
1449
|
+
__privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1450
|
+
__privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1339
1451
|
var _url8;
|
|
1340
1452
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1341
1453
|
constructor(options) {
|
|
1342
1454
|
super(options);
|
|
1343
1455
|
}
|
|
1344
|
-
/** Fetches
|
|
1345
|
-
async
|
|
1456
|
+
/** Fetches a list of DataTypes for a project */
|
|
1457
|
+
async list(options) {
|
|
1346
1458
|
const { projectId } = this.options;
|
|
1347
|
-
const fetchUri = this.createUrl(
|
|
1459
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1348
1460
|
return await this.apiClient(fetchUri);
|
|
1349
1461
|
}
|
|
1462
|
+
/** @deprecated Use {@link list} instead. */
|
|
1463
|
+
async get(options) {
|
|
1464
|
+
return this.list(options);
|
|
1465
|
+
}
|
|
1350
1466
|
/** Updates or creates (based on id) a DataType */
|
|
1351
|
-
async
|
|
1352
|
-
const fetchUri = this.createUrl(
|
|
1467
|
+
async save(body) {
|
|
1468
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1353
1469
|
await this.apiClient(fetchUri, {
|
|
1354
1470
|
method: "PUT",
|
|
1355
1471
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1356
1472
|
expectNoContent: true
|
|
1357
1473
|
});
|
|
1358
1474
|
}
|
|
1475
|
+
/** @deprecated Use {@link save} instead. */
|
|
1476
|
+
async upsert(body) {
|
|
1477
|
+
return this.save(body);
|
|
1478
|
+
}
|
|
1359
1479
|
/** Deletes a DataType */
|
|
1360
1480
|
async remove(body) {
|
|
1361
|
-
const fetchUri = this.createUrl(
|
|
1481
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1362
1482
|
await this.apiClient(fetchUri, {
|
|
1363
1483
|
method: "DELETE",
|
|
1364
1484
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1367,7 +1487,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1367
1487
|
}
|
|
1368
1488
|
};
|
|
1369
1489
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1370
|
-
|
|
1490
|
+
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1371
1491
|
function getComponentPath(ancestorsAndSelf) {
|
|
1372
1492
|
const path = [];
|
|
1373
1493
|
for (let i = ancestorsAndSelf.length - 1; i >= 0; i--) {
|
|
@@ -1393,24 +1513,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1393
1513
|
}
|
|
1394
1514
|
return `.${path.join(".")}`;
|
|
1395
1515
|
}
|
|
1396
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1397
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
1398
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1399
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1400
|
-
var CANVAS_TEST_SLOT = "test";
|
|
1401
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1402
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1403
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1404
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1405
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1406
|
-
var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
|
|
1407
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1408
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1409
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1410
|
-
var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
|
|
1411
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1412
|
-
var PLACEHOLDER_ID = "placeholder";
|
|
1413
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1414
1516
|
function isRootEntryReference(root) {
|
|
1415
1517
|
return root.type === "root" && isEntryData(root.node);
|
|
1416
1518
|
}
|
|
@@ -1820,7 +1922,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1820
1922
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1821
1923
|
*/
|
|
1822
1924
|
get(options) {
|
|
1823
|
-
const fetchUri = this.createUrl(
|
|
1925
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1824
1926
|
...options,
|
|
1825
1927
|
teamId: this.teamId
|
|
1826
1928
|
});
|
|
@@ -1830,7 +1932,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1830
1932
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1831
1933
|
*/
|
|
1832
1934
|
async deploy(body) {
|
|
1833
|
-
const fetchUri = this.createUrl(
|
|
1935
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1834
1936
|
await this.apiClient(fetchUri, {
|
|
1835
1937
|
method: "PUT",
|
|
1836
1938
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1841,7 +1943,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1841
1943
|
* Removes a custom AI property editor from a Mesh app.
|
|
1842
1944
|
*/
|
|
1843
1945
|
async delete(body) {
|
|
1844
|
-
const fetchUri = this.createUrl(
|
|
1946
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1845
1947
|
await this.apiClient(fetchUri, {
|
|
1846
1948
|
method: "DELETE",
|
|
1847
1949
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1850,7 +1952,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1850
1952
|
}
|
|
1851
1953
|
};
|
|
1852
1954
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1853
|
-
|
|
1955
|
+
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1854
1956
|
var _url22;
|
|
1855
1957
|
var _projectsUrl;
|
|
1856
1958
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1859,7 +1961,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1859
1961
|
}
|
|
1860
1962
|
/** Fetches single Project */
|
|
1861
1963
|
async get(options) {
|
|
1862
|
-
const fetchUri = this.createUrl(
|
|
1964
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
1863
1965
|
return await this.apiClient(fetchUri);
|
|
1864
1966
|
}
|
|
1865
1967
|
/**
|
|
@@ -1867,32 +1969,44 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1867
1969
|
* When teamId is provided, returns a single team with its projects.
|
|
1868
1970
|
* When omitted, returns all accessible teams and their projects.
|
|
1869
1971
|
*/
|
|
1870
|
-
async
|
|
1871
|
-
const fetchUri = this.createUrl(
|
|
1972
|
+
async list(options) {
|
|
1973
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1872
1974
|
return await this.apiClient(fetchUri);
|
|
1873
1975
|
}
|
|
1976
|
+
/** @deprecated Use {@link list} instead. */
|
|
1977
|
+
async getProjects(options) {
|
|
1978
|
+
return this.list(options);
|
|
1979
|
+
}
|
|
1874
1980
|
/** Updates or creates (based on id) a Project */
|
|
1875
|
-
async
|
|
1876
|
-
const fetchUri = this.createUrl(
|
|
1981
|
+
async save(body) {
|
|
1982
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1877
1983
|
return await this.apiClient(fetchUri, {
|
|
1878
1984
|
method: "PUT",
|
|
1879
1985
|
body: JSON.stringify({ ...body })
|
|
1880
1986
|
});
|
|
1881
1987
|
}
|
|
1988
|
+
/** @deprecated Use {@link save} instead. */
|
|
1989
|
+
async upsert(body) {
|
|
1990
|
+
return this.save(body);
|
|
1991
|
+
}
|
|
1882
1992
|
/** Deletes a Project */
|
|
1883
|
-
async
|
|
1884
|
-
const fetchUri = this.createUrl(
|
|
1993
|
+
async remove(body) {
|
|
1994
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1885
1995
|
await this.apiClient(fetchUri, {
|
|
1886
1996
|
method: "DELETE",
|
|
1887
1997
|
body: JSON.stringify({ ...body }),
|
|
1888
1998
|
expectNoContent: true
|
|
1889
1999
|
});
|
|
1890
2000
|
}
|
|
2001
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2002
|
+
async delete(body) {
|
|
2003
|
+
return this.remove(body);
|
|
2004
|
+
}
|
|
1891
2005
|
};
|
|
1892
2006
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1893
2007
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1894
|
-
|
|
1895
|
-
|
|
2008
|
+
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
2009
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1896
2010
|
var ROUTE_URL = "/api/v1/route";
|
|
1897
2011
|
var RouteClient = class extends ApiClient {
|
|
1898
2012
|
constructor(options) {
|
|
@@ -1903,15 +2017,27 @@ var RouteClient = class extends ApiClient {
|
|
|
1903
2017
|
super(options);
|
|
1904
2018
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1905
2019
|
}
|
|
1906
|
-
/**
|
|
1907
|
-
|
|
2020
|
+
/**
|
|
2021
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
2022
|
+
*
|
|
2023
|
+
* An optional `select` projection applies to the resolved composition when
|
|
2024
|
+
* the route matches one; redirect / notFound responses pass through
|
|
2025
|
+
* untouched.
|
|
2026
|
+
*/
|
|
2027
|
+
async get(options) {
|
|
1908
2028
|
const { projectId } = this.options;
|
|
1909
|
-
const
|
|
2029
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2030
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2031
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
1910
2032
|
return await this.apiClient(
|
|
1911
2033
|
fetchUri,
|
|
1912
2034
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
1913
2035
|
);
|
|
1914
2036
|
}
|
|
2037
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
2038
|
+
async getRoute(options) {
|
|
2039
|
+
return this.get(options);
|
|
2040
|
+
}
|
|
1915
2041
|
};
|
|
1916
2042
|
function mapSlotToPersonalizedVariations(slot) {
|
|
1917
2043
|
if (!slot) return [];
|
|
@@ -2150,7 +2276,7 @@ function createLimiter(concurrency) {
|
|
|
2150
2276
|
});
|
|
2151
2277
|
};
|
|
2152
2278
|
}
|
|
2153
|
-
async function
|
|
2279
|
+
async function retry2(fn, options) {
|
|
2154
2280
|
let lastError;
|
|
2155
2281
|
let delay = 1e3;
|
|
2156
2282
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -2190,7 +2316,7 @@ function createLimitPolicy2({
|
|
|
2190
2316
|
}
|
|
2191
2317
|
if (retryOptions) {
|
|
2192
2318
|
const retryFunc = currentFunc;
|
|
2193
|
-
currentFunc = () =>
|
|
2319
|
+
currentFunc = () => retry2(retryFunc, {
|
|
2194
2320
|
...retryOptions,
|
|
2195
2321
|
onFailedAttempt: async (error) => {
|
|
2196
2322
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2209,7 +2335,7 @@ function createLimitPolicy2({
|
|
|
2209
2335
|
// src/clients/canvas.ts
|
|
2210
2336
|
var getCanvasClient = (options) => {
|
|
2211
2337
|
const cache2 = resolveCanvasCache(options);
|
|
2212
|
-
return new
|
|
2338
|
+
return new CompositionDeliveryClient({
|
|
2213
2339
|
projectId: env.getProjectId(),
|
|
2214
2340
|
apiHost: env.getApiHost(),
|
|
2215
2341
|
apiKey: env.getApiKey(),
|
|
@@ -2324,14 +2450,14 @@ var getManifest = async (options) => {
|
|
|
2324
2450
|
import "server-only";
|
|
2325
2451
|
|
|
2326
2452
|
// ../project-map/dist/index.mjs
|
|
2327
|
-
var
|
|
2453
|
+
var __typeError4 = (msg) => {
|
|
2328
2454
|
throw TypeError(msg);
|
|
2329
2455
|
};
|
|
2330
|
-
var
|
|
2331
|
-
var
|
|
2332
|
-
var
|
|
2333
|
-
var
|
|
2334
|
-
var __privateMethod = (obj, member, method) => (
|
|
2456
|
+
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
2457
|
+
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2458
|
+
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);
|
|
2459
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2460
|
+
var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
|
|
2335
2461
|
var ProjectMapClient = class extends ApiClient {
|
|
2336
2462
|
constructor(options) {
|
|
2337
2463
|
super(options);
|
|
@@ -2478,12 +2604,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2478
2604
|
var _Route = class _Route2 {
|
|
2479
2605
|
constructor(route) {
|
|
2480
2606
|
this.route = route;
|
|
2481
|
-
|
|
2607
|
+
__privateAdd4(this, _routeInfo);
|
|
2482
2608
|
var _a;
|
|
2483
|
-
|
|
2609
|
+
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2484
2610
|
}
|
|
2485
2611
|
get dynamicSegmentCount() {
|
|
2486
|
-
return
|
|
2612
|
+
return __privateGet4(this, _routeInfo).segments.reduce(
|
|
2487
2613
|
(count, segment) => {
|
|
2488
2614
|
var _a;
|
|
2489
2615
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2495,7 +2621,7 @@ var _Route = class _Route2 {
|
|
|
2495
2621
|
matches(path) {
|
|
2496
2622
|
var _a, _b;
|
|
2497
2623
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2498
|
-
const { segments: routeSegments } =
|
|
2624
|
+
const { segments: routeSegments } = __privateGet4(this, _routeInfo);
|
|
2499
2625
|
if (pathSegments.length !== routeSegments.length) {
|
|
2500
2626
|
return { match: false };
|
|
2501
2627
|
}
|
|
@@ -2516,7 +2642,7 @@ var _Route = class _Route2 {
|
|
|
2516
2642
|
return { match: false };
|
|
2517
2643
|
}
|
|
2518
2644
|
}
|
|
2519
|
-
for (const [key, value] of
|
|
2645
|
+
for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
|
|
2520
2646
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2521
2647
|
}
|
|
2522
2648
|
return possibleMatch;
|
|
@@ -2526,7 +2652,7 @@ var _Route = class _Route2 {
|
|
|
2526
2652
|
*/
|
|
2527
2653
|
expand(options) {
|
|
2528
2654
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2529
|
-
const path =
|
|
2655
|
+
const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
|
|
2530
2656
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2531
2657
|
if (!dynamicSegmentName) {
|
|
2532
2658
|
return segment;
|
|
@@ -2577,7 +2703,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2577
2703
|
}
|
|
2578
2704
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2579
2705
|
};
|
|
2580
|
-
|
|
2706
|
+
__privateAdd4(_Route, _Route_static);
|
|
2581
2707
|
_Route.dynamicSegmentPrefix = ":";
|
|
2582
2708
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2583
2709
|
if (!doNotEscapeVariables) {
|
|
@@ -3273,7 +3399,7 @@ var resolvePlaygroundRoute = async ({ code }) => {
|
|
|
3273
3399
|
});
|
|
3274
3400
|
let composition = void 0;
|
|
3275
3401
|
try {
|
|
3276
|
-
composition = await canvasClient.
|
|
3402
|
+
composition = await canvasClient.get({
|
|
3277
3403
|
compositionId: pageState.routePath,
|
|
3278
3404
|
state: pageState.compositionState,
|
|
3279
3405
|
withComponentIDs: true
|
|
@@ -3421,7 +3547,7 @@ var createUniformPlaygroundStaticParams = async (options) => {
|
|
|
3421
3547
|
const routeClient = getRouteClient({
|
|
3422
3548
|
state
|
|
3423
3549
|
});
|
|
3424
|
-
route = await routeClient.
|
|
3550
|
+
route = await routeClient.get({
|
|
3425
3551
|
path: firstPath,
|
|
3426
3552
|
withComponentIDs: true,
|
|
3427
3553
|
state: CANVAS_DRAFT_STATE
|
|
@@ -3474,7 +3600,7 @@ async function processRoutePath({
|
|
|
3474
3600
|
});
|
|
3475
3601
|
const rewrittenPath = await (rewrite == null ? void 0 : rewrite({ path }));
|
|
3476
3602
|
const resolvedPath = (_a = rewrittenPath == null ? void 0 : rewrittenPath.path) != null ? _a : path;
|
|
3477
|
-
const route = await routeClient.
|
|
3603
|
+
const route = await routeClient.get({
|
|
3478
3604
|
path: resolvedPath,
|
|
3479
3605
|
withComponentIDs: true,
|
|
3480
3606
|
state: CANVAS_PUBLISHED_STATE
|
|
@@ -3727,14 +3853,14 @@ var DefaultDataClient = class {
|
|
|
3727
3853
|
if (oldCachedRoute) {
|
|
3728
3854
|
waitUntil(
|
|
3729
3855
|
(async () => {
|
|
3730
|
-
const result2 = await routeClient.
|
|
3856
|
+
const result2 = await routeClient.get(route);
|
|
3731
3857
|
await cacheNewRoute(result2);
|
|
3732
3858
|
})()
|
|
3733
3859
|
);
|
|
3734
3860
|
return oldCachedRoute;
|
|
3735
3861
|
}
|
|
3736
3862
|
}
|
|
3737
|
-
const result = await routeClient.
|
|
3863
|
+
const result = await routeClient.get(route);
|
|
3738
3864
|
waitUntil(
|
|
3739
3865
|
(async () => {
|
|
3740
3866
|
await Promise.all([
|