@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/handler.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,7 +161,238 @@ 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
|
|
|
@@ -160,14 +408,14 @@ module.exports = __toCommonJS(handler_exports);
|
|
|
160
408
|
// ../context/dist/api/api.mjs
|
|
161
409
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
162
410
|
var __defProp2 = Object.defineProperty;
|
|
163
|
-
var
|
|
411
|
+
var __typeError2 = (msg) => {
|
|
164
412
|
throw TypeError(msg);
|
|
165
413
|
};
|
|
166
|
-
var
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
var
|
|
170
|
-
var
|
|
414
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
415
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
416
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
417
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
418
|
+
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);
|
|
171
419
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
172
420
|
var ApiClientError = class _ApiClientError extends Error {
|
|
173
421
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -175,18 +423,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
175
423
|
`${errorMessage}
|
|
176
424
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
177
425
|
);
|
|
178
|
-
this
|
|
179
|
-
this
|
|
180
|
-
this
|
|
181
|
-
this
|
|
182
|
-
this
|
|
183
|
-
this
|
|
426
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
427
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
428
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
429
|
+
__publicField2(this, "statusCode", statusCode);
|
|
430
|
+
__publicField2(this, "statusText", statusText);
|
|
431
|
+
__publicField2(this, "requestId", requestId);
|
|
184
432
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
185
433
|
}
|
|
186
434
|
};
|
|
187
435
|
var ApiClient = class _ApiClient {
|
|
188
436
|
constructor(options) {
|
|
189
|
-
|
|
437
|
+
__publicField2(this, "options");
|
|
190
438
|
var _a, _b, _c, _d, _e;
|
|
191
439
|
if (!options.apiKey && !options.bearerToken) {
|
|
192
440
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -356,12 +604,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
356
604
|
/** Fetches all aggregates for a project */
|
|
357
605
|
async get(options) {
|
|
358
606
|
const { projectId } = this.options;
|
|
359
|
-
const fetchUri = this.createUrl(
|
|
607
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
360
608
|
return await this.apiClient(fetchUri);
|
|
361
609
|
}
|
|
362
610
|
/** Updates or creates (based on id) an Aggregate */
|
|
363
611
|
async upsert(body) {
|
|
364
|
-
const fetchUri = this.createUrl(
|
|
612
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
365
613
|
await this.apiClient(fetchUri, {
|
|
366
614
|
method: "PUT",
|
|
367
615
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -370,7 +618,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
370
618
|
}
|
|
371
619
|
/** Deletes an Aggregate */
|
|
372
620
|
async remove(body) {
|
|
373
|
-
const fetchUri = this.createUrl(
|
|
621
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
374
622
|
await this.apiClient(fetchUri, {
|
|
375
623
|
method: "DELETE",
|
|
376
624
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -379,7 +627,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
379
627
|
}
|
|
380
628
|
};
|
|
381
629
|
_url = /* @__PURE__ */ new WeakMap();
|
|
382
|
-
|
|
630
|
+
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
383
631
|
var _url2;
|
|
384
632
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
385
633
|
constructor(options) {
|
|
@@ -388,12 +636,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
388
636
|
/** Fetches the known score dimensions for a project */
|
|
389
637
|
async get(options) {
|
|
390
638
|
const { projectId } = this.options;
|
|
391
|
-
const fetchUri = this.createUrl(
|
|
639
|
+
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
392
640
|
return await this.apiClient(fetchUri);
|
|
393
641
|
}
|
|
394
642
|
};
|
|
395
643
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
396
|
-
|
|
644
|
+
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
397
645
|
var _url3;
|
|
398
646
|
var _valueUrl;
|
|
399
647
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -403,12 +651,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
403
651
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
404
652
|
async get(options) {
|
|
405
653
|
const { projectId } = this.options;
|
|
406
|
-
const fetchUri = this.createUrl(
|
|
654
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
407
655
|
return await this.apiClient(fetchUri);
|
|
408
656
|
}
|
|
409
657
|
/** Updates or creates (based on id) an enrichment category */
|
|
410
658
|
async upsertCategory(body) {
|
|
411
|
-
const fetchUri = this.createUrl(
|
|
659
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
412
660
|
await this.apiClient(fetchUri, {
|
|
413
661
|
method: "PUT",
|
|
414
662
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -417,7 +665,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
417
665
|
}
|
|
418
666
|
/** Deletes an enrichment category */
|
|
419
667
|
async removeCategory(body) {
|
|
420
|
-
const fetchUri = this.createUrl(
|
|
668
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
421
669
|
await this.apiClient(fetchUri, {
|
|
422
670
|
method: "DELETE",
|
|
423
671
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -426,7 +674,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
426
674
|
}
|
|
427
675
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
428
676
|
async upsertValue(body) {
|
|
429
|
-
const fetchUri = this.createUrl(
|
|
677
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
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 value within an enrichment category. The category is left alone. */
|
|
437
685
|
async removeValue(body) {
|
|
438
|
-
const fetchUri = this.createUrl(
|
|
686
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
439
687
|
await this.apiClient(fetchUri, {
|
|
440
688
|
method: "DELETE",
|
|
441
689
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -445,8 +693,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
445
693
|
};
|
|
446
694
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
447
695
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
448
|
-
|
|
449
|
-
|
|
696
|
+
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
697
|
+
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
450
698
|
var _url4;
|
|
451
699
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
452
700
|
constructor(options) {
|
|
@@ -455,7 +703,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
455
703
|
/** Fetches the Context manifest for a project */
|
|
456
704
|
async get(options) {
|
|
457
705
|
const { projectId } = this.options;
|
|
458
|
-
const fetchUri = this.createUrl(
|
|
706
|
+
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
459
707
|
return await this.apiClient(fetchUri);
|
|
460
708
|
}
|
|
461
709
|
/** Publishes the Context manifest for a project */
|
|
@@ -469,7 +717,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
469
717
|
}
|
|
470
718
|
};
|
|
471
719
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
472
|
-
|
|
720
|
+
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
473
721
|
var _url5;
|
|
474
722
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
475
723
|
constructor(options) {
|
|
@@ -478,12 +726,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
478
726
|
/** Fetches all Quirks for a project */
|
|
479
727
|
async get(options) {
|
|
480
728
|
const { projectId } = this.options;
|
|
481
|
-
const fetchUri = this.createUrl(
|
|
729
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
482
730
|
return await this.apiClient(fetchUri);
|
|
483
731
|
}
|
|
484
732
|
/** Updates or creates (based on id) a Quirk */
|
|
485
733
|
async upsert(body) {
|
|
486
|
-
const fetchUri = this.createUrl(
|
|
734
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
487
735
|
await this.apiClient(fetchUri, {
|
|
488
736
|
method: "PUT",
|
|
489
737
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -492,7 +740,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
492
740
|
}
|
|
493
741
|
/** Deletes a Quirk */
|
|
494
742
|
async remove(body) {
|
|
495
|
-
const fetchUri = this.createUrl(
|
|
743
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
496
744
|
await this.apiClient(fetchUri, {
|
|
497
745
|
method: "DELETE",
|
|
498
746
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -501,7 +749,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
501
749
|
}
|
|
502
750
|
};
|
|
503
751
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
504
|
-
|
|
752
|
+
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
505
753
|
var _url6;
|
|
506
754
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
507
755
|
constructor(options) {
|
|
@@ -510,12 +758,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
510
758
|
/** Fetches all Signals for a project */
|
|
511
759
|
async get(options) {
|
|
512
760
|
const { projectId } = this.options;
|
|
513
|
-
const fetchUri = this.createUrl(
|
|
761
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
514
762
|
return await this.apiClient(fetchUri);
|
|
515
763
|
}
|
|
516
764
|
/** Updates or creates (based on id) a Signal */
|
|
517
765
|
async upsert(body) {
|
|
518
|
-
const fetchUri = this.createUrl(
|
|
766
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
519
767
|
await this.apiClient(fetchUri, {
|
|
520
768
|
method: "PUT",
|
|
521
769
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -524,7 +772,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
524
772
|
}
|
|
525
773
|
/** Deletes a Signal */
|
|
526
774
|
async remove(body) {
|
|
527
|
-
const fetchUri = this.createUrl(
|
|
775
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
528
776
|
await this.apiClient(fetchUri, {
|
|
529
777
|
method: "DELETE",
|
|
530
778
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -533,7 +781,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
533
781
|
}
|
|
534
782
|
};
|
|
535
783
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
536
|
-
|
|
784
|
+
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
537
785
|
var _url7;
|
|
538
786
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
539
787
|
constructor(options) {
|
|
@@ -542,12 +790,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
542
790
|
/** Fetches all Tests for a project */
|
|
543
791
|
async get(options) {
|
|
544
792
|
const { projectId } = this.options;
|
|
545
|
-
const fetchUri = this.createUrl(
|
|
793
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
546
794
|
return await this.apiClient(fetchUri);
|
|
547
795
|
}
|
|
548
796
|
/** Updates or creates (based on id) a Test */
|
|
549
797
|
async upsert(body) {
|
|
550
|
-
const fetchUri = this.createUrl(
|
|
798
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
551
799
|
await this.apiClient(fetchUri, {
|
|
552
800
|
method: "PUT",
|
|
553
801
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -556,7 +804,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
556
804
|
}
|
|
557
805
|
/** Deletes a Test */
|
|
558
806
|
async remove(body) {
|
|
559
|
-
const fetchUri = this.createUrl(
|
|
807
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
560
808
|
await this.apiClient(fetchUri, {
|
|
561
809
|
method: "DELETE",
|
|
562
810
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -565,393 +813,194 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
565
813
|
}
|
|
566
814
|
};
|
|
567
815
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
//
|
|
571
|
-
var
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
)
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
dequeue()
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
const run = async (fn, resolve, ...args) => {
|
|
677
|
-
activeCount++;
|
|
678
|
-
const result = (async () => fn(...args))();
|
|
679
|
-
resolve(result);
|
|
680
|
-
try {
|
|
681
|
-
await result;
|
|
682
|
-
} catch (e) {
|
|
683
|
-
}
|
|
684
|
-
next();
|
|
685
|
-
};
|
|
686
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
687
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
688
|
-
(async () => {
|
|
689
|
-
await Promise.resolve();
|
|
690
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
691
|
-
queue.dequeue()();
|
|
692
|
-
}
|
|
693
|
-
})();
|
|
694
|
-
};
|
|
695
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
696
|
-
enqueue(fn, resolve, ...args);
|
|
697
|
-
});
|
|
698
|
-
Object.defineProperties(generator, {
|
|
699
|
-
activeCount: {
|
|
700
|
-
get: () => activeCount
|
|
701
|
-
},
|
|
702
|
-
pendingCount: {
|
|
703
|
-
get: () => queue.size
|
|
704
|
-
},
|
|
705
|
-
clearQueue: {
|
|
706
|
-
value: () => {
|
|
707
|
-
queue.clear();
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
|
-
return generator;
|
|
712
|
-
};
|
|
713
|
-
module2.exports = pLimit2;
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
var require_retry_operation = __commonJS2({
|
|
717
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
718
|
-
"use strict";
|
|
719
|
-
function RetryOperation(timeouts, options) {
|
|
720
|
-
if (typeof options === "boolean") {
|
|
721
|
-
options = { forever: options };
|
|
722
|
-
}
|
|
723
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
724
|
-
this._timeouts = timeouts;
|
|
725
|
-
this._options = options || {};
|
|
726
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
727
|
-
this._fn = null;
|
|
728
|
-
this._errors = [];
|
|
729
|
-
this._attempts = 1;
|
|
730
|
-
this._operationTimeout = null;
|
|
731
|
-
this._operationTimeoutCb = null;
|
|
732
|
-
this._timeout = null;
|
|
733
|
-
this._operationStart = null;
|
|
734
|
-
this._timer = null;
|
|
735
|
-
if (this._options.forever) {
|
|
736
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
module2.exports = RetryOperation;
|
|
740
|
-
RetryOperation.prototype.reset = function() {
|
|
741
|
-
this._attempts = 1;
|
|
742
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
743
|
-
};
|
|
744
|
-
RetryOperation.prototype.stop = function() {
|
|
745
|
-
if (this._timeout) {
|
|
746
|
-
clearTimeout(this._timeout);
|
|
747
|
-
}
|
|
748
|
-
if (this._timer) {
|
|
749
|
-
clearTimeout(this._timer);
|
|
750
|
-
}
|
|
751
|
-
this._timeouts = [];
|
|
752
|
-
this._cachedTimeouts = null;
|
|
753
|
-
};
|
|
754
|
-
RetryOperation.prototype.retry = function(err) {
|
|
755
|
-
if (this._timeout) {
|
|
756
|
-
clearTimeout(this._timeout);
|
|
757
|
-
}
|
|
758
|
-
if (!err) {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
762
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
763
|
-
this._errors.push(err);
|
|
764
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
this._errors.push(err);
|
|
768
|
-
var timeout = this._timeouts.shift();
|
|
769
|
-
if (timeout === void 0) {
|
|
770
|
-
if (this._cachedTimeouts) {
|
|
771
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
772
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
773
|
-
} else {
|
|
774
|
-
return false;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
var self = this;
|
|
778
|
-
this._timer = setTimeout(function() {
|
|
779
|
-
self._attempts++;
|
|
780
|
-
if (self._operationTimeoutCb) {
|
|
781
|
-
self._timeout = setTimeout(function() {
|
|
782
|
-
self._operationTimeoutCb(self._attempts);
|
|
783
|
-
}, self._operationTimeout);
|
|
784
|
-
if (self._options.unref) {
|
|
785
|
-
self._timeout.unref();
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
self._fn(self._attempts);
|
|
789
|
-
}, timeout);
|
|
790
|
-
if (this._options.unref) {
|
|
791
|
-
this._timer.unref();
|
|
792
|
-
}
|
|
793
|
-
return true;
|
|
794
|
-
};
|
|
795
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
796
|
-
this._fn = fn;
|
|
797
|
-
if (timeoutOps) {
|
|
798
|
-
if (timeoutOps.timeout) {
|
|
799
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
800
|
-
}
|
|
801
|
-
if (timeoutOps.cb) {
|
|
802
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
var self = this;
|
|
806
|
-
if (this._operationTimeoutCb) {
|
|
807
|
-
this._timeout = setTimeout(function() {
|
|
808
|
-
self._operationTimeoutCb();
|
|
809
|
-
}, self._operationTimeout);
|
|
810
|
-
}
|
|
811
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
812
|
-
this._fn(this._attempts);
|
|
813
|
-
};
|
|
814
|
-
RetryOperation.prototype.try = function(fn) {
|
|
815
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
816
|
-
this.attempt(fn);
|
|
817
|
-
};
|
|
818
|
-
RetryOperation.prototype.start = function(fn) {
|
|
819
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
820
|
-
this.attempt(fn);
|
|
821
|
-
};
|
|
822
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
823
|
-
RetryOperation.prototype.errors = function() {
|
|
824
|
-
return this._errors;
|
|
825
|
-
};
|
|
826
|
-
RetryOperation.prototype.attempts = function() {
|
|
827
|
-
return this._attempts;
|
|
828
|
-
};
|
|
829
|
-
RetryOperation.prototype.mainError = function() {
|
|
830
|
-
if (this._errors.length === 0) {
|
|
831
|
-
return null;
|
|
832
|
-
}
|
|
833
|
-
var counts = {};
|
|
834
|
-
var mainError = null;
|
|
835
|
-
var mainErrorCount = 0;
|
|
836
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
837
|
-
var error = this._errors[i];
|
|
838
|
-
var message = error.message;
|
|
839
|
-
var count = (counts[message] || 0) + 1;
|
|
840
|
-
counts[message] = count;
|
|
841
|
-
if (count >= mainErrorCount) {
|
|
842
|
-
mainError = error;
|
|
843
|
-
mainErrorCount = count;
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
return mainError;
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
});
|
|
850
|
-
var require_retry = __commonJS2({
|
|
851
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports2) {
|
|
852
|
-
"use strict";
|
|
853
|
-
var RetryOperation = require_retry_operation();
|
|
854
|
-
exports2.operation = function(options) {
|
|
855
|
-
var timeouts = exports2.timeouts(options);
|
|
856
|
-
return new RetryOperation(timeouts, {
|
|
857
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
858
|
-
unref: options && options.unref,
|
|
859
|
-
maxRetryTime: options && options.maxRetryTime
|
|
860
|
-
});
|
|
861
|
-
};
|
|
862
|
-
exports2.timeouts = function(options) {
|
|
863
|
-
if (options instanceof Array) {
|
|
864
|
-
return [].concat(options);
|
|
865
|
-
}
|
|
866
|
-
var opts = {
|
|
867
|
-
retries: 10,
|
|
868
|
-
factor: 2,
|
|
869
|
-
minTimeout: 1 * 1e3,
|
|
870
|
-
maxTimeout: Infinity,
|
|
871
|
-
randomize: false
|
|
872
|
-
};
|
|
873
|
-
for (var key in options) {
|
|
874
|
-
opts[key] = options[key];
|
|
875
|
-
}
|
|
876
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
877
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
878
|
-
}
|
|
879
|
-
var timeouts = [];
|
|
880
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
881
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
882
|
-
}
|
|
883
|
-
if (options && options.forever && !timeouts.length) {
|
|
884
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
816
|
+
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
817
|
+
|
|
818
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
819
|
+
var Node = class {
|
|
820
|
+
constructor(value) {
|
|
821
|
+
__publicField(this, "value");
|
|
822
|
+
__publicField(this, "next");
|
|
823
|
+
this.value = value;
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
var _head, _tail, _size;
|
|
827
|
+
var Queue = class {
|
|
828
|
+
constructor() {
|
|
829
|
+
__privateAdd(this, _head);
|
|
830
|
+
__privateAdd(this, _tail);
|
|
831
|
+
__privateAdd(this, _size);
|
|
832
|
+
this.clear();
|
|
833
|
+
}
|
|
834
|
+
enqueue(value) {
|
|
835
|
+
const node = new Node(value);
|
|
836
|
+
if (__privateGet(this, _head)) {
|
|
837
|
+
__privateGet(this, _tail).next = node;
|
|
838
|
+
__privateSet(this, _tail, node);
|
|
839
|
+
} else {
|
|
840
|
+
__privateSet(this, _head, node);
|
|
841
|
+
__privateSet(this, _tail, node);
|
|
842
|
+
}
|
|
843
|
+
__privateWrapper(this, _size)._++;
|
|
844
|
+
}
|
|
845
|
+
dequeue() {
|
|
846
|
+
const current = __privateGet(this, _head);
|
|
847
|
+
if (!current) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
851
|
+
__privateWrapper(this, _size)._--;
|
|
852
|
+
if (!__privateGet(this, _head)) {
|
|
853
|
+
__privateSet(this, _tail, void 0);
|
|
854
|
+
}
|
|
855
|
+
return current.value;
|
|
856
|
+
}
|
|
857
|
+
peek() {
|
|
858
|
+
if (!__privateGet(this, _head)) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
return __privateGet(this, _head).value;
|
|
862
|
+
}
|
|
863
|
+
clear() {
|
|
864
|
+
__privateSet(this, _head, void 0);
|
|
865
|
+
__privateSet(this, _tail, void 0);
|
|
866
|
+
__privateSet(this, _size, 0);
|
|
867
|
+
}
|
|
868
|
+
get size() {
|
|
869
|
+
return __privateGet(this, _size);
|
|
870
|
+
}
|
|
871
|
+
*[Symbol.iterator]() {
|
|
872
|
+
let current = __privateGet(this, _head);
|
|
873
|
+
while (current) {
|
|
874
|
+
yield current.value;
|
|
875
|
+
current = current.next;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
*drain() {
|
|
879
|
+
while (__privateGet(this, _head)) {
|
|
880
|
+
yield this.dequeue();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
_head = new WeakMap();
|
|
885
|
+
_tail = new WeakMap();
|
|
886
|
+
_size = new WeakMap();
|
|
887
|
+
|
|
888
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
889
|
+
function pLimit2(concurrency) {
|
|
890
|
+
validateConcurrency(concurrency);
|
|
891
|
+
const queue = new Queue();
|
|
892
|
+
let activeCount = 0;
|
|
893
|
+
const resumeNext = () => {
|
|
894
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
895
|
+
queue.dequeue()();
|
|
896
|
+
activeCount++;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
const next = () => {
|
|
900
|
+
activeCount--;
|
|
901
|
+
resumeNext();
|
|
902
|
+
};
|
|
903
|
+
const run = async (function_, resolve, arguments_) => {
|
|
904
|
+
const result = (async () => function_(...arguments_))();
|
|
905
|
+
resolve(result);
|
|
906
|
+
try {
|
|
907
|
+
await result;
|
|
908
|
+
} catch (e) {
|
|
909
|
+
}
|
|
910
|
+
next();
|
|
911
|
+
};
|
|
912
|
+
const enqueue = (function_, resolve, arguments_) => {
|
|
913
|
+
new Promise((internalResolve) => {
|
|
914
|
+
queue.enqueue(internalResolve);
|
|
915
|
+
}).then(
|
|
916
|
+
run.bind(void 0, function_, resolve, arguments_)
|
|
917
|
+
);
|
|
918
|
+
(async () => {
|
|
919
|
+
await Promise.resolve();
|
|
920
|
+
if (activeCount < concurrency) {
|
|
921
|
+
resumeNext();
|
|
885
922
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
923
|
+
})();
|
|
924
|
+
};
|
|
925
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
926
|
+
enqueue(function_, resolve, arguments_);
|
|
927
|
+
});
|
|
928
|
+
Object.defineProperties(generator, {
|
|
929
|
+
activeCount: {
|
|
930
|
+
get: () => activeCount
|
|
931
|
+
},
|
|
932
|
+
pendingCount: {
|
|
933
|
+
get: () => queue.size
|
|
934
|
+
},
|
|
935
|
+
clearQueue: {
|
|
936
|
+
value() {
|
|
937
|
+
queue.clear();
|
|
901
938
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
939
|
+
},
|
|
940
|
+
concurrency: {
|
|
941
|
+
get: () => concurrency,
|
|
942
|
+
set(newConcurrency) {
|
|
943
|
+
validateConcurrency(newConcurrency);
|
|
944
|
+
concurrency = newConcurrency;
|
|
945
|
+
queueMicrotask(() => {
|
|
946
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
947
|
+
resumeNext();
|
|
907
948
|
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
for (var i = 0; i < methods.length; i++) {
|
|
911
|
-
var method = methods[i];
|
|
912
|
-
var original = obj[method];
|
|
913
|
-
obj[method] = function retryWrapper(original2) {
|
|
914
|
-
var op = exports2.operation(options);
|
|
915
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
916
|
-
var callback = args.pop();
|
|
917
|
-
args.push(function(err) {
|
|
918
|
-
if (op.retry(err)) {
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
if (err) {
|
|
922
|
-
arguments[0] = op.mainError();
|
|
923
|
-
}
|
|
924
|
-
callback.apply(this, arguments);
|
|
925
|
-
});
|
|
926
|
-
op.attempt(function() {
|
|
927
|
-
original2.apply(obj, args);
|
|
928
|
-
});
|
|
929
|
-
}.bind(obj, original);
|
|
930
|
-
obj[method].options = options;
|
|
949
|
+
});
|
|
931
950
|
}
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
return generator;
|
|
954
|
+
}
|
|
955
|
+
function validateConcurrency(concurrency) {
|
|
956
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
957
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
939
958
|
}
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
var
|
|
944
|
-
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
962
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
963
|
+
|
|
964
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
965
|
+
var objectToString = Object.prototype.toString;
|
|
966
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
967
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
968
|
+
"network error",
|
|
945
969
|
// Chrome
|
|
946
970
|
"NetworkError when attempting to fetch resource.",
|
|
947
971
|
// Firefox
|
|
948
972
|
"The Internet connection appears to be offline.",
|
|
949
|
-
// Safari
|
|
973
|
+
// Safari 16
|
|
950
974
|
"Network request failed",
|
|
951
975
|
// `cross-fetch`
|
|
952
|
-
"fetch failed"
|
|
976
|
+
"fetch failed",
|
|
953
977
|
// Undici (Node.js)
|
|
978
|
+
"terminated",
|
|
979
|
+
// Undici (Node.js)
|
|
980
|
+
" A network error occurred.",
|
|
981
|
+
// Bun (WebKit)
|
|
982
|
+
"Network connection lost"
|
|
983
|
+
// Cloudflare Workers (fetch)
|
|
954
984
|
]);
|
|
985
|
+
function isNetworkError(error) {
|
|
986
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
987
|
+
if (!isValid) {
|
|
988
|
+
return false;
|
|
989
|
+
}
|
|
990
|
+
const { message, stack } = error;
|
|
991
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
992
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
993
|
+
}
|
|
994
|
+
if (message.startsWith("error sending request for url")) {
|
|
995
|
+
return true;
|
|
996
|
+
}
|
|
997
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
998
|
+
return true;
|
|
999
|
+
}
|
|
1000
|
+
return errorMessages.has(message);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
955
1004
|
var AbortError = class extends Error {
|
|
956
1005
|
constructor(message) {
|
|
957
1006
|
super();
|
|
@@ -972,63 +1021,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
972
1021
|
error.retriesLeft = retriesLeft;
|
|
973
1022
|
return error;
|
|
974
1023
|
};
|
|
975
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
976
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
977
1024
|
async function pRetry(input, options) {
|
|
978
1025
|
return new Promise((resolve, reject) => {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
retries: 10,
|
|
983
|
-
...options
|
|
1026
|
+
var _a, _b, _c;
|
|
1027
|
+
options = { ...options };
|
|
1028
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
984
1029
|
};
|
|
1030
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1031
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
985
1032
|
const operation = import_retry.default.operation(options);
|
|
1033
|
+
const abortHandler = () => {
|
|
1034
|
+
var _a2;
|
|
1035
|
+
operation.stop();
|
|
1036
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1037
|
+
};
|
|
1038
|
+
if (options.signal && !options.signal.aborted) {
|
|
1039
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1040
|
+
}
|
|
1041
|
+
const cleanUp = () => {
|
|
1042
|
+
var _a2;
|
|
1043
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1044
|
+
operation.stop();
|
|
1045
|
+
};
|
|
986
1046
|
operation.attempt(async (attemptNumber) => {
|
|
987
1047
|
try {
|
|
988
|
-
|
|
1048
|
+
const result = await input(attemptNumber);
|
|
1049
|
+
cleanUp();
|
|
1050
|
+
resolve(result);
|
|
989
1051
|
} catch (error) {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
} else {
|
|
1052
|
+
try {
|
|
1053
|
+
if (!(error instanceof Error)) {
|
|
1054
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1055
|
+
}
|
|
1056
|
+
if (error instanceof AbortError) {
|
|
1057
|
+
throw error.originalError;
|
|
1058
|
+
}
|
|
1059
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1060
|
+
throw error;
|
|
1061
|
+
}
|
|
1001
1062
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
reject(error2);
|
|
1006
|
-
return;
|
|
1063
|
+
if (!await options.shouldRetry(error)) {
|
|
1064
|
+
operation.stop();
|
|
1065
|
+
reject(error);
|
|
1007
1066
|
}
|
|
1067
|
+
await options.onFailedAttempt(error);
|
|
1008
1068
|
if (!operation.retry(error)) {
|
|
1009
|
-
|
|
1069
|
+
throw operation.mainError();
|
|
1010
1070
|
}
|
|
1071
|
+
} catch (finalError) {
|
|
1072
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1073
|
+
cleanUp();
|
|
1074
|
+
reject(finalError);
|
|
1011
1075
|
}
|
|
1012
1076
|
}
|
|
1013
1077
|
});
|
|
1014
|
-
if (options.signal && !options.signal.aborted) {
|
|
1015
|
-
options.signal.addEventListener("abort", () => {
|
|
1016
|
-
operation.stop();
|
|
1017
|
-
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1018
|
-
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1019
|
-
}, {
|
|
1020
|
-
once: true
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
1078
|
});
|
|
1024
1079
|
}
|
|
1080
|
+
|
|
1081
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1025
1082
|
var AbortError2 = class extends Error {
|
|
1026
1083
|
constructor() {
|
|
1027
1084
|
super("Throttled function aborted");
|
|
1028
1085
|
this.name = "AbortError";
|
|
1029
1086
|
}
|
|
1030
1087
|
};
|
|
1031
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1088
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1032
1089
|
if (!Number.isFinite(limit)) {
|
|
1033
1090
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1034
1091
|
}
|
|
@@ -1056,32 +1113,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1056
1113
|
const strictTicks = [];
|
|
1057
1114
|
function strictDelay() {
|
|
1058
1115
|
const now = Date.now();
|
|
1059
|
-
if (strictTicks.length
|
|
1060
|
-
strictTicks.
|
|
1061
|
-
return 0;
|
|
1116
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1117
|
+
strictTicks.length = 0;
|
|
1062
1118
|
}
|
|
1063
|
-
|
|
1064
|
-
if (now >= earliestTime) {
|
|
1119
|
+
if (strictTicks.length < limit) {
|
|
1065
1120
|
strictTicks.push(now);
|
|
1066
1121
|
return 0;
|
|
1067
1122
|
}
|
|
1068
|
-
strictTicks
|
|
1069
|
-
|
|
1123
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1124
|
+
strictTicks.shift();
|
|
1125
|
+
strictTicks.push(nextExecutionTime);
|
|
1126
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1070
1127
|
}
|
|
1071
1128
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1072
1129
|
return (function_) => {
|
|
1073
|
-
const throttled = function(...
|
|
1130
|
+
const throttled = function(...arguments_) {
|
|
1074
1131
|
if (!throttled.isEnabled) {
|
|
1075
|
-
return (async () => function_.apply(this,
|
|
1132
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1076
1133
|
}
|
|
1077
|
-
let
|
|
1134
|
+
let timeoutId;
|
|
1078
1135
|
return new Promise((resolve, reject) => {
|
|
1079
1136
|
const execute = () => {
|
|
1080
|
-
resolve(function_.apply(this,
|
|
1081
|
-
queue.delete(
|
|
1137
|
+
resolve(function_.apply(this, arguments_));
|
|
1138
|
+
queue.delete(timeoutId);
|
|
1082
1139
|
};
|
|
1083
|
-
|
|
1084
|
-
|
|
1140
|
+
const delay = getDelay();
|
|
1141
|
+
if (delay > 0) {
|
|
1142
|
+
timeoutId = setTimeout(execute, delay);
|
|
1143
|
+
queue.set(timeoutId, reject);
|
|
1144
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1145
|
+
} else {
|
|
1146
|
+
execute();
|
|
1147
|
+
}
|
|
1085
1148
|
});
|
|
1086
1149
|
};
|
|
1087
1150
|
throttled.abort = () => {
|
|
@@ -1093,16 +1156,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1093
1156
|
strictTicks.splice(0, strictTicks.length);
|
|
1094
1157
|
};
|
|
1095
1158
|
throttled.isEnabled = true;
|
|
1159
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1160
|
+
get() {
|
|
1161
|
+
return queue.size;
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1096
1164
|
return throttled;
|
|
1097
1165
|
};
|
|
1098
1166
|
}
|
|
1167
|
+
|
|
1168
|
+
// ../canvas/dist/index.mjs
|
|
1169
|
+
var __typeError3 = (msg) => {
|
|
1170
|
+
throw TypeError(msg);
|
|
1171
|
+
};
|
|
1172
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1173
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1174
|
+
var __privateAdd3 = (obj, member, value) => member.has(obj) ? __typeError3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1099
1175
|
function createLimitPolicy({
|
|
1100
1176
|
throttle = { interval: 1e3, limit: 10 },
|
|
1101
|
-
retry:
|
|
1177
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1102
1178
|
limit = 10
|
|
1103
1179
|
}) {
|
|
1104
1180
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1105
|
-
const limiter = limit ? (
|
|
1181
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1106
1182
|
return function limitPolicy(func) {
|
|
1107
1183
|
let currentFunc = async () => await func();
|
|
1108
1184
|
if (throttler) {
|
|
@@ -1113,13 +1189,13 @@ function createLimitPolicy({
|
|
|
1113
1189
|
const limitFunc = currentFunc;
|
|
1114
1190
|
currentFunc = () => limiter(limitFunc);
|
|
1115
1191
|
}
|
|
1116
|
-
if (
|
|
1192
|
+
if (retry3) {
|
|
1117
1193
|
const retryFunc = currentFunc;
|
|
1118
1194
|
currentFunc = () => pRetry(retryFunc, {
|
|
1119
|
-
...
|
|
1195
|
+
...retry3,
|
|
1120
1196
|
onFailedAttempt: async (error) => {
|
|
1121
|
-
if (
|
|
1122
|
-
await
|
|
1197
|
+
if (retry3.onFailedAttempt) {
|
|
1198
|
+
await retry3.onFailedAttempt(error);
|
|
1123
1199
|
}
|
|
1124
1200
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1125
1201
|
throw error;
|
|
@@ -1130,123 +1206,145 @@ function createLimitPolicy({
|
|
|
1130
1206
|
return currentFunc();
|
|
1131
1207
|
};
|
|
1132
1208
|
}
|
|
1133
|
-
var
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
if (!options.limitPolicy) {
|
|
1138
|
-
options.limitPolicy = createLimitPolicy({});
|
|
1139
|
-
}
|
|
1140
|
-
super(options);
|
|
1141
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1142
|
-
this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1143
|
-
}
|
|
1144
|
-
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1145
|
-
async getCompositionList(params = {}) {
|
|
1146
|
-
const { projectId } = this.options;
|
|
1147
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1148
|
-
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1149
|
-
if (!resolveData) {
|
|
1150
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1151
|
-
return this.apiClient(fetchUri);
|
|
1152
|
-
}
|
|
1153
|
-
const edgeParams = {
|
|
1154
|
-
...originParams,
|
|
1155
|
-
projectId,
|
|
1156
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1157
|
-
...rewrittenFilters
|
|
1158
|
-
};
|
|
1159
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1160
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1161
|
-
}
|
|
1162
|
-
getCompositionByNodePath(options) {
|
|
1163
|
-
return this.getOneComposition(options);
|
|
1164
|
-
}
|
|
1165
|
-
getCompositionByNodeId(options) {
|
|
1166
|
-
return this.getOneComposition(options);
|
|
1167
|
-
}
|
|
1168
|
-
getCompositionBySlug(options) {
|
|
1169
|
-
return this.getOneComposition(options);
|
|
1170
|
-
}
|
|
1171
|
-
getCompositionById(options) {
|
|
1172
|
-
return this.getOneComposition(options);
|
|
1173
|
-
}
|
|
1174
|
-
getCompositionDefaults(options) {
|
|
1175
|
-
return this.getOneComposition(options);
|
|
1176
|
-
}
|
|
1177
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1178
|
-
async getCompositionHistory(options) {
|
|
1179
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1209
|
+
var ContentClientBase = class extends ApiClient {
|
|
1210
|
+
constructor(options, defaultBypassCache) {
|
|
1211
|
+
var _a, _b;
|
|
1212
|
+
super({
|
|
1180
1213
|
...options,
|
|
1181
|
-
|
|
1214
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1215
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1182
1216
|
});
|
|
1183
|
-
return this.apiClient(historyUrl);
|
|
1184
1217
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1218
|
+
};
|
|
1219
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1220
|
+
function appendCsv(out, key, values) {
|
|
1221
|
+
if (values === void 0) {
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
out[key] = values.join(",");
|
|
1225
|
+
}
|
|
1226
|
+
function projectionToQuery(spec) {
|
|
1227
|
+
const out = {};
|
|
1228
|
+
if (!spec) {
|
|
1229
|
+
return out;
|
|
1230
|
+
}
|
|
1231
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1232
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1233
|
+
if (fields) {
|
|
1234
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1235
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1236
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1237
|
+
}
|
|
1238
|
+
if (fieldTypes) {
|
|
1239
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1240
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1241
|
+
}
|
|
1242
|
+
if (slots) {
|
|
1243
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1244
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1245
|
+
if (typeof slots.depth === "number") {
|
|
1246
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1247
|
+
}
|
|
1248
|
+
if (slots.named) {
|
|
1249
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1250
|
+
for (const slotName of slotNames) {
|
|
1251
|
+
const named = slots.named[slotName];
|
|
1252
|
+
if (named && typeof named.depth === "number") {
|
|
1253
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1193
1256
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1257
|
+
}
|
|
1258
|
+
return out;
|
|
1259
|
+
}
|
|
1260
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1261
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1262
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
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 SECRET_QUERY_STRING_PARAM = "secret";
|
|
1267
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1268
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
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
|
|
1198
1280
|
};
|
|
1199
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1200
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1201
1281
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
}
|
|
1215
|
-
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;
|
|
1216
1295
|
}
|
|
1217
|
-
/**
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
const { projectId } = this.options;
|
|
1221
|
-
await this.apiClient(fetchUri, {
|
|
1222
|
-
method: "DELETE",
|
|
1223
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1224
|
-
expectNoContent: true
|
|
1225
|
-
});
|
|
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;
|
|
1226
1299
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
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);
|
|
1232
1306
|
}
|
|
1233
|
-
/**
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
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);
|
|
1241
1330
|
}
|
|
1242
|
-
/**
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
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);
|
|
1250
1348
|
}
|
|
1251
1349
|
};
|
|
1252
1350
|
var _contentTypesUrl;
|
|
@@ -1259,20 +1357,26 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1259
1357
|
}
|
|
1260
1358
|
getContentTypes(options) {
|
|
1261
1359
|
const { projectId } = this.options;
|
|
1262
|
-
const fetchUri = this.createUrl(
|
|
1360
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1263
1361
|
return this.apiClient(fetchUri);
|
|
1264
1362
|
}
|
|
1265
1363
|
getEntries(options) {
|
|
1266
1364
|
const { projectId } = this.options;
|
|
1267
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1365
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1268
1366
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1367
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1269
1368
|
if (skipDataResolution) {
|
|
1270
|
-
const url = this.createUrl(
|
|
1369
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1370
|
+
...params,
|
|
1371
|
+
...rewrittenFilters,
|
|
1372
|
+
...rewrittenSelect,
|
|
1373
|
+
projectId
|
|
1374
|
+
});
|
|
1271
1375
|
return this.apiClient(url);
|
|
1272
1376
|
}
|
|
1273
1377
|
const edgeUrl = this.createUrl(
|
|
1274
|
-
|
|
1275
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1378
|
+
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1379
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1276
1380
|
this.edgeApiHost
|
|
1277
1381
|
);
|
|
1278
1382
|
return this.apiClient(
|
|
@@ -1289,7 +1393,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1289
1393
|
return this.apiClient(historyUrl);
|
|
1290
1394
|
}
|
|
1291
1395
|
async upsertContentType(body, opts = {}) {
|
|
1292
|
-
const fetchUri = this.createUrl(
|
|
1396
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1293
1397
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1294
1398
|
delete body.contentType.slugSettings;
|
|
1295
1399
|
}
|
|
@@ -1301,7 +1405,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1301
1405
|
});
|
|
1302
1406
|
}
|
|
1303
1407
|
async upsertEntry(body, options) {
|
|
1304
|
-
const fetchUri = this.createUrl(
|
|
1408
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1305
1409
|
const headers = {};
|
|
1306
1410
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1307
1411
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1315,7 +1419,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1315
1419
|
return { modified: response.headers.get("x-modified-at") };
|
|
1316
1420
|
}
|
|
1317
1421
|
async deleteContentType(body) {
|
|
1318
|
-
const fetchUri = this.createUrl(
|
|
1422
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1319
1423
|
await this.apiClient(fetchUri, {
|
|
1320
1424
|
method: "DELETE",
|
|
1321
1425
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1323,7 +1427,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1323
1427
|
});
|
|
1324
1428
|
}
|
|
1325
1429
|
async deleteEntry(body) {
|
|
1326
|
-
const fetchUri = this.createUrl(
|
|
1430
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1327
1431
|
await this.apiClient(fetchUri, {
|
|
1328
1432
|
method: "DELETE",
|
|
1329
1433
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1342,31 +1446,39 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1342
1446
|
};
|
|
1343
1447
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1344
1448
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1345
|
-
|
|
1346
|
-
|
|
1449
|
+
__privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1450
|
+
__privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1347
1451
|
var _url8;
|
|
1348
1452
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1349
1453
|
constructor(options) {
|
|
1350
1454
|
super(options);
|
|
1351
1455
|
}
|
|
1352
|
-
/** Fetches
|
|
1353
|
-
async
|
|
1456
|
+
/** Fetches a list of DataTypes for a project */
|
|
1457
|
+
async list(options) {
|
|
1354
1458
|
const { projectId } = this.options;
|
|
1355
|
-
const fetchUri = this.createUrl(
|
|
1459
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1356
1460
|
return await this.apiClient(fetchUri);
|
|
1357
1461
|
}
|
|
1462
|
+
/** @deprecated Use {@link list} instead. */
|
|
1463
|
+
async get(options) {
|
|
1464
|
+
return this.list(options);
|
|
1465
|
+
}
|
|
1358
1466
|
/** Updates or creates (based on id) a DataType */
|
|
1359
|
-
async
|
|
1360
|
-
const fetchUri = this.createUrl(
|
|
1467
|
+
async save(body) {
|
|
1468
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1361
1469
|
await this.apiClient(fetchUri, {
|
|
1362
1470
|
method: "PUT",
|
|
1363
1471
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1364
1472
|
expectNoContent: true
|
|
1365
1473
|
});
|
|
1366
1474
|
}
|
|
1475
|
+
/** @deprecated Use {@link save} instead. */
|
|
1476
|
+
async upsert(body) {
|
|
1477
|
+
return this.save(body);
|
|
1478
|
+
}
|
|
1367
1479
|
/** Deletes a DataType */
|
|
1368
1480
|
async remove(body) {
|
|
1369
|
-
const fetchUri = this.createUrl(
|
|
1481
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1370
1482
|
await this.apiClient(fetchUri, {
|
|
1371
1483
|
method: "DELETE",
|
|
1372
1484
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1375,16 +1487,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1375
1487
|
}
|
|
1376
1488
|
};
|
|
1377
1489
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1378
|
-
|
|
1379
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1380
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1381
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1382
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1383
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1384
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
1385
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1386
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
1387
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1490
|
+
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1388
1491
|
var escapeCharacter = "\\";
|
|
1389
1492
|
var variablePrefix = "${";
|
|
1390
1493
|
var variableSuffix = "}";
|
|
@@ -1471,7 +1574,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1471
1574
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1472
1575
|
*/
|
|
1473
1576
|
get(options) {
|
|
1474
|
-
const fetchUri = this.createUrl(
|
|
1577
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1475
1578
|
...options,
|
|
1476
1579
|
teamId: this.teamId
|
|
1477
1580
|
});
|
|
@@ -1481,7 +1584,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1481
1584
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1482
1585
|
*/
|
|
1483
1586
|
async deploy(body) {
|
|
1484
|
-
const fetchUri = this.createUrl(
|
|
1587
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1485
1588
|
await this.apiClient(fetchUri, {
|
|
1486
1589
|
method: "PUT",
|
|
1487
1590
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1492,7 +1595,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1492
1595
|
* Removes a custom AI property editor from a Mesh app.
|
|
1493
1596
|
*/
|
|
1494
1597
|
async delete(body) {
|
|
1495
|
-
const fetchUri = this.createUrl(
|
|
1598
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1496
1599
|
await this.apiClient(fetchUri, {
|
|
1497
1600
|
method: "DELETE",
|
|
1498
1601
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1501,7 +1604,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1501
1604
|
}
|
|
1502
1605
|
};
|
|
1503
1606
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1504
|
-
|
|
1607
|
+
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1505
1608
|
var _url22;
|
|
1506
1609
|
var _projectsUrl;
|
|
1507
1610
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1510,7 +1613,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1510
1613
|
}
|
|
1511
1614
|
/** Fetches single Project */
|
|
1512
1615
|
async get(options) {
|
|
1513
|
-
const fetchUri = this.createUrl(
|
|
1616
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
1514
1617
|
return await this.apiClient(fetchUri);
|
|
1515
1618
|
}
|
|
1516
1619
|
/**
|
|
@@ -1518,32 +1621,44 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1518
1621
|
* When teamId is provided, returns a single team with its projects.
|
|
1519
1622
|
* When omitted, returns all accessible teams and their projects.
|
|
1520
1623
|
*/
|
|
1521
|
-
async
|
|
1522
|
-
const fetchUri = this.createUrl(
|
|
1624
|
+
async list(options) {
|
|
1625
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1523
1626
|
return await this.apiClient(fetchUri);
|
|
1524
1627
|
}
|
|
1628
|
+
/** @deprecated Use {@link list} instead. */
|
|
1629
|
+
async getProjects(options) {
|
|
1630
|
+
return this.list(options);
|
|
1631
|
+
}
|
|
1525
1632
|
/** Updates or creates (based on id) a Project */
|
|
1526
|
-
async
|
|
1527
|
-
const fetchUri = this.createUrl(
|
|
1633
|
+
async save(body) {
|
|
1634
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1528
1635
|
return await this.apiClient(fetchUri, {
|
|
1529
1636
|
method: "PUT",
|
|
1530
1637
|
body: JSON.stringify({ ...body })
|
|
1531
1638
|
});
|
|
1532
1639
|
}
|
|
1640
|
+
/** @deprecated Use {@link save} instead. */
|
|
1641
|
+
async upsert(body) {
|
|
1642
|
+
return this.save(body);
|
|
1643
|
+
}
|
|
1533
1644
|
/** Deletes a Project */
|
|
1534
|
-
async
|
|
1535
|
-
const fetchUri = this.createUrl(
|
|
1645
|
+
async remove(body) {
|
|
1646
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1536
1647
|
await this.apiClient(fetchUri, {
|
|
1537
1648
|
method: "DELETE",
|
|
1538
1649
|
body: JSON.stringify({ ...body }),
|
|
1539
1650
|
expectNoContent: true
|
|
1540
1651
|
});
|
|
1541
1652
|
}
|
|
1653
|
+
/** @deprecated Use {@link remove} instead. */
|
|
1654
|
+
async delete(body) {
|
|
1655
|
+
return this.remove(body);
|
|
1656
|
+
}
|
|
1542
1657
|
};
|
|
1543
1658
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1544
1659
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1545
|
-
|
|
1546
|
-
|
|
1660
|
+
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
1661
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1547
1662
|
var isAllowedReferrer = (referrer) => {
|
|
1548
1663
|
return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
|
|
1549
1664
|
};
|
|
@@ -1940,7 +2055,7 @@ function createLimiter(concurrency) {
|
|
|
1940
2055
|
});
|
|
1941
2056
|
};
|
|
1942
2057
|
}
|
|
1943
|
-
async function
|
|
2058
|
+
async function retry2(fn, options) {
|
|
1944
2059
|
let lastError;
|
|
1945
2060
|
let delay = 1e3;
|
|
1946
2061
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -1980,7 +2095,7 @@ function createLimitPolicy2({
|
|
|
1980
2095
|
}
|
|
1981
2096
|
if (retryOptions) {
|
|
1982
2097
|
const retryFunc = currentFunc;
|
|
1983
|
-
currentFunc = () =>
|
|
2098
|
+
currentFunc = () => retry2(retryFunc, {
|
|
1984
2099
|
...retryOptions,
|
|
1985
2100
|
onFailedAttempt: async (error) => {
|
|
1986
2101
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -1999,7 +2114,7 @@ function createLimitPolicy2({
|
|
|
1999
2114
|
// src/clients/canvas.ts
|
|
2000
2115
|
var getCanvasClient = (options) => {
|
|
2001
2116
|
const cache = resolveCanvasCache(options);
|
|
2002
|
-
return new
|
|
2117
|
+
return new CompositionDeliveryClient({
|
|
2003
2118
|
projectId: env.getProjectId(),
|
|
2004
2119
|
apiHost: env.getApiHost(),
|
|
2005
2120
|
apiKey: env.getApiKey(),
|
|
@@ -2054,14 +2169,14 @@ var getCanvasClient = (options) => {
|
|
|
2054
2169
|
var import_server_only2 = require("server-only");
|
|
2055
2170
|
|
|
2056
2171
|
// ../project-map/dist/index.mjs
|
|
2057
|
-
var
|
|
2172
|
+
var __typeError4 = (msg) => {
|
|
2058
2173
|
throw TypeError(msg);
|
|
2059
2174
|
};
|
|
2060
|
-
var
|
|
2061
|
-
var
|
|
2062
|
-
var
|
|
2063
|
-
var
|
|
2064
|
-
var __privateMethod = (obj, member, method) => (
|
|
2175
|
+
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
2176
|
+
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2177
|
+
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);
|
|
2178
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2179
|
+
var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
|
|
2065
2180
|
var ProjectMapClient = class extends ApiClient {
|
|
2066
2181
|
constructor(options) {
|
|
2067
2182
|
super(options);
|
|
@@ -2208,12 +2323,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2208
2323
|
var _Route = class _Route2 {
|
|
2209
2324
|
constructor(route) {
|
|
2210
2325
|
this.route = route;
|
|
2211
|
-
|
|
2326
|
+
__privateAdd4(this, _routeInfo);
|
|
2212
2327
|
var _a;
|
|
2213
|
-
|
|
2328
|
+
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2214
2329
|
}
|
|
2215
2330
|
get dynamicSegmentCount() {
|
|
2216
|
-
return
|
|
2331
|
+
return __privateGet4(this, _routeInfo).segments.reduce(
|
|
2217
2332
|
(count, segment) => {
|
|
2218
2333
|
var _a;
|
|
2219
2334
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2225,7 +2340,7 @@ var _Route = class _Route2 {
|
|
|
2225
2340
|
matches(path) {
|
|
2226
2341
|
var _a, _b;
|
|
2227
2342
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2228
|
-
const { segments: routeSegments } =
|
|
2343
|
+
const { segments: routeSegments } = __privateGet4(this, _routeInfo);
|
|
2229
2344
|
if (pathSegments.length !== routeSegments.length) {
|
|
2230
2345
|
return { match: false };
|
|
2231
2346
|
}
|
|
@@ -2246,7 +2361,7 @@ var _Route = class _Route2 {
|
|
|
2246
2361
|
return { match: false };
|
|
2247
2362
|
}
|
|
2248
2363
|
}
|
|
2249
|
-
for (const [key, value] of
|
|
2364
|
+
for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
|
|
2250
2365
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2251
2366
|
}
|
|
2252
2367
|
return possibleMatch;
|
|
@@ -2256,7 +2371,7 @@ var _Route = class _Route2 {
|
|
|
2256
2371
|
*/
|
|
2257
2372
|
expand(options) {
|
|
2258
2373
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2259
|
-
const path =
|
|
2374
|
+
const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
|
|
2260
2375
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2261
2376
|
if (!dynamicSegmentName) {
|
|
2262
2377
|
return segment;
|
|
@@ -2307,7 +2422,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2307
2422
|
}
|
|
2308
2423
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2309
2424
|
};
|
|
2310
|
-
|
|
2425
|
+
__privateAdd4(_Route, _Route_static);
|
|
2311
2426
|
_Route.dynamicSegmentPrefix = ":";
|
|
2312
2427
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2313
2428
|
if (!doNotEscapeVariables) {
|
|
@@ -2420,7 +2535,7 @@ var getComposition = async ({ compositionId }) => {
|
|
|
2420
2535
|
}
|
|
2421
2536
|
});
|
|
2422
2537
|
try {
|
|
2423
|
-
const composition = await canvasClient.
|
|
2538
|
+
const composition = await canvasClient.get({
|
|
2424
2539
|
compositionId
|
|
2425
2540
|
});
|
|
2426
2541
|
return composition;
|