@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.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,21 +155,252 @@ 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
|
|
|
145
393
|
// ../context/dist/api/api.mjs
|
|
146
394
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
147
395
|
var __defProp2 = Object.defineProperty;
|
|
148
|
-
var
|
|
396
|
+
var __typeError2 = (msg) => {
|
|
149
397
|
throw TypeError(msg);
|
|
150
398
|
};
|
|
151
|
-
var
|
|
152
|
-
var
|
|
153
|
-
var
|
|
154
|
-
var
|
|
155
|
-
var
|
|
399
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
400
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
401
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
402
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
403
|
+
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);
|
|
156
404
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
157
405
|
var ApiClientError = class _ApiClientError extends Error {
|
|
158
406
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
@@ -160,18 +408,18 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
160
408
|
`${errorMessage}
|
|
161
409
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
162
410
|
);
|
|
163
|
-
this
|
|
164
|
-
this
|
|
165
|
-
this
|
|
166
|
-
this
|
|
167
|
-
this
|
|
168
|
-
this
|
|
411
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
412
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
413
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
414
|
+
__publicField2(this, "statusCode", statusCode);
|
|
415
|
+
__publicField2(this, "statusText", statusText);
|
|
416
|
+
__publicField2(this, "requestId", requestId);
|
|
169
417
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
170
418
|
}
|
|
171
419
|
};
|
|
172
420
|
var ApiClient = class _ApiClient {
|
|
173
421
|
constructor(options) {
|
|
174
|
-
|
|
422
|
+
__publicField2(this, "options");
|
|
175
423
|
var _a, _b, _c, _d, _e;
|
|
176
424
|
if (!options.apiKey && !options.bearerToken) {
|
|
177
425
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -341,12 +589,12 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
341
589
|
/** Fetches all aggregates for a project */
|
|
342
590
|
async get(options) {
|
|
343
591
|
const { projectId } = this.options;
|
|
344
|
-
const fetchUri = this.createUrl(
|
|
592
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
345
593
|
return await this.apiClient(fetchUri);
|
|
346
594
|
}
|
|
347
595
|
/** Updates or creates (based on id) an Aggregate */
|
|
348
596
|
async upsert(body) {
|
|
349
|
-
const fetchUri = this.createUrl(
|
|
597
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
350
598
|
await this.apiClient(fetchUri, {
|
|
351
599
|
method: "PUT",
|
|
352
600
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -355,7 +603,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
355
603
|
}
|
|
356
604
|
/** Deletes an Aggregate */
|
|
357
605
|
async remove(body) {
|
|
358
|
-
const fetchUri = this.createUrl(
|
|
606
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
359
607
|
await this.apiClient(fetchUri, {
|
|
360
608
|
method: "DELETE",
|
|
361
609
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -364,7 +612,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
364
612
|
}
|
|
365
613
|
};
|
|
366
614
|
_url = /* @__PURE__ */ new WeakMap();
|
|
367
|
-
|
|
615
|
+
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
368
616
|
var _url2;
|
|
369
617
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
370
618
|
constructor(options) {
|
|
@@ -373,12 +621,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
373
621
|
/** Fetches the known score dimensions for a project */
|
|
374
622
|
async get(options) {
|
|
375
623
|
const { projectId } = this.options;
|
|
376
|
-
const fetchUri = this.createUrl(
|
|
624
|
+
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
377
625
|
return await this.apiClient(fetchUri);
|
|
378
626
|
}
|
|
379
627
|
};
|
|
380
628
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
381
|
-
|
|
629
|
+
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
382
630
|
var _url3;
|
|
383
631
|
var _valueUrl;
|
|
384
632
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -388,12 +636,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
388
636
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
389
637
|
async get(options) {
|
|
390
638
|
const { projectId } = this.options;
|
|
391
|
-
const fetchUri = this.createUrl(
|
|
639
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
392
640
|
return await this.apiClient(fetchUri);
|
|
393
641
|
}
|
|
394
642
|
/** Updates or creates (based on id) an enrichment category */
|
|
395
643
|
async upsertCategory(body) {
|
|
396
|
-
const fetchUri = this.createUrl(
|
|
644
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
397
645
|
await this.apiClient(fetchUri, {
|
|
398
646
|
method: "PUT",
|
|
399
647
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -402,7 +650,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
402
650
|
}
|
|
403
651
|
/** Deletes an enrichment category */
|
|
404
652
|
async removeCategory(body) {
|
|
405
|
-
const fetchUri = this.createUrl(
|
|
653
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
406
654
|
await this.apiClient(fetchUri, {
|
|
407
655
|
method: "DELETE",
|
|
408
656
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -411,7 +659,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
411
659
|
}
|
|
412
660
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
413
661
|
async upsertValue(body) {
|
|
414
|
-
const fetchUri = this.createUrl(
|
|
662
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
415
663
|
await this.apiClient(fetchUri, {
|
|
416
664
|
method: "PUT",
|
|
417
665
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -420,7 +668,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
420
668
|
}
|
|
421
669
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
422
670
|
async removeValue(body) {
|
|
423
|
-
const fetchUri = this.createUrl(
|
|
671
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
424
672
|
await this.apiClient(fetchUri, {
|
|
425
673
|
method: "DELETE",
|
|
426
674
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -430,8 +678,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
430
678
|
};
|
|
431
679
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
432
680
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
433
|
-
|
|
434
|
-
|
|
681
|
+
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
682
|
+
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
435
683
|
var _url4;
|
|
436
684
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
437
685
|
constructor(options) {
|
|
@@ -440,7 +688,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
440
688
|
/** Fetches the Context manifest for a project */
|
|
441
689
|
async get(options) {
|
|
442
690
|
const { projectId } = this.options;
|
|
443
|
-
const fetchUri = this.createUrl(
|
|
691
|
+
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
444
692
|
return await this.apiClient(fetchUri);
|
|
445
693
|
}
|
|
446
694
|
/** Publishes the Context manifest for a project */
|
|
@@ -454,7 +702,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
454
702
|
}
|
|
455
703
|
};
|
|
456
704
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
457
|
-
|
|
705
|
+
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
458
706
|
var _url5;
|
|
459
707
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
460
708
|
constructor(options) {
|
|
@@ -463,12 +711,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
463
711
|
/** Fetches all Quirks for a project */
|
|
464
712
|
async get(options) {
|
|
465
713
|
const { projectId } = this.options;
|
|
466
|
-
const fetchUri = this.createUrl(
|
|
714
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
467
715
|
return await this.apiClient(fetchUri);
|
|
468
716
|
}
|
|
469
717
|
/** Updates or creates (based on id) a Quirk */
|
|
470
718
|
async upsert(body) {
|
|
471
|
-
const fetchUri = this.createUrl(
|
|
719
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
472
720
|
await this.apiClient(fetchUri, {
|
|
473
721
|
method: "PUT",
|
|
474
722
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -477,7 +725,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
477
725
|
}
|
|
478
726
|
/** Deletes a Quirk */
|
|
479
727
|
async remove(body) {
|
|
480
|
-
const fetchUri = this.createUrl(
|
|
728
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
481
729
|
await this.apiClient(fetchUri, {
|
|
482
730
|
method: "DELETE",
|
|
483
731
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -486,7 +734,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
486
734
|
}
|
|
487
735
|
};
|
|
488
736
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
489
|
-
|
|
737
|
+
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
490
738
|
var _url6;
|
|
491
739
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
492
740
|
constructor(options) {
|
|
@@ -495,12 +743,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
495
743
|
/** Fetches all Signals for a project */
|
|
496
744
|
async get(options) {
|
|
497
745
|
const { projectId } = this.options;
|
|
498
|
-
const fetchUri = this.createUrl(
|
|
746
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
499
747
|
return await this.apiClient(fetchUri);
|
|
500
748
|
}
|
|
501
749
|
/** Updates or creates (based on id) a Signal */
|
|
502
750
|
async upsert(body) {
|
|
503
|
-
const fetchUri = this.createUrl(
|
|
751
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
504
752
|
await this.apiClient(fetchUri, {
|
|
505
753
|
method: "PUT",
|
|
506
754
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -509,7 +757,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
509
757
|
}
|
|
510
758
|
/** Deletes a Signal */
|
|
511
759
|
async remove(body) {
|
|
512
|
-
const fetchUri = this.createUrl(
|
|
760
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
513
761
|
await this.apiClient(fetchUri, {
|
|
514
762
|
method: "DELETE",
|
|
515
763
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -518,7 +766,7 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
518
766
|
}
|
|
519
767
|
};
|
|
520
768
|
_url6 = /* @__PURE__ */ new WeakMap();
|
|
521
|
-
|
|
769
|
+
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
522
770
|
var _url7;
|
|
523
771
|
var _TestClient = class _TestClient2 extends ApiClient {
|
|
524
772
|
constructor(options) {
|
|
@@ -527,12 +775,12 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
527
775
|
/** Fetches all Tests for a project */
|
|
528
776
|
async get(options) {
|
|
529
777
|
const { projectId } = this.options;
|
|
530
|
-
const fetchUri = this.createUrl(
|
|
778
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
531
779
|
return await this.apiClient(fetchUri);
|
|
532
780
|
}
|
|
533
781
|
/** Updates or creates (based on id) a Test */
|
|
534
782
|
async upsert(body) {
|
|
535
|
-
const fetchUri = this.createUrl(
|
|
783
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
536
784
|
await this.apiClient(fetchUri, {
|
|
537
785
|
method: "PUT",
|
|
538
786
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -541,7 +789,7 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
541
789
|
}
|
|
542
790
|
/** Deletes a Test */
|
|
543
791
|
async remove(body) {
|
|
544
|
-
const fetchUri = this.createUrl(
|
|
792
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
545
793
|
await this.apiClient(fetchUri, {
|
|
546
794
|
method: "DELETE",
|
|
547
795
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -550,393 +798,194 @@ var _TestClient = class _TestClient2 extends ApiClient {
|
|
|
550
798
|
}
|
|
551
799
|
};
|
|
552
800
|
_url7 = /* @__PURE__ */ new WeakMap();
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
//
|
|
556
|
-
var
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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
|
-
dequeue()
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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
|
-
const run = async (fn, resolve, ...args) => {
|
|
662
|
-
activeCount++;
|
|
663
|
-
const result = (async () => fn(...args))();
|
|
664
|
-
resolve(result);
|
|
665
|
-
try {
|
|
666
|
-
await result;
|
|
667
|
-
} catch (e) {
|
|
668
|
-
}
|
|
669
|
-
next();
|
|
670
|
-
};
|
|
671
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
672
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
673
|
-
(async () => {
|
|
674
|
-
await Promise.resolve();
|
|
675
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
676
|
-
queue.dequeue()();
|
|
677
|
-
}
|
|
678
|
-
})();
|
|
679
|
-
};
|
|
680
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
681
|
-
enqueue(fn, resolve, ...args);
|
|
682
|
-
});
|
|
683
|
-
Object.defineProperties(generator, {
|
|
684
|
-
activeCount: {
|
|
685
|
-
get: () => activeCount
|
|
686
|
-
},
|
|
687
|
-
pendingCount: {
|
|
688
|
-
get: () => queue.size
|
|
689
|
-
},
|
|
690
|
-
clearQueue: {
|
|
691
|
-
value: () => {
|
|
692
|
-
queue.clear();
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
return generator;
|
|
697
|
-
};
|
|
698
|
-
module.exports = pLimit2;
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
var require_retry_operation = __commonJS2({
|
|
702
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
703
|
-
"use strict";
|
|
704
|
-
function RetryOperation(timeouts, options) {
|
|
705
|
-
if (typeof options === "boolean") {
|
|
706
|
-
options = { forever: options };
|
|
707
|
-
}
|
|
708
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
709
|
-
this._timeouts = timeouts;
|
|
710
|
-
this._options = options || {};
|
|
711
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
712
|
-
this._fn = null;
|
|
713
|
-
this._errors = [];
|
|
714
|
-
this._attempts = 1;
|
|
715
|
-
this._operationTimeout = null;
|
|
716
|
-
this._operationTimeoutCb = null;
|
|
717
|
-
this._timeout = null;
|
|
718
|
-
this._operationStart = null;
|
|
719
|
-
this._timer = null;
|
|
720
|
-
if (this._options.forever) {
|
|
721
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
module.exports = RetryOperation;
|
|
725
|
-
RetryOperation.prototype.reset = function() {
|
|
726
|
-
this._attempts = 1;
|
|
727
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
728
|
-
};
|
|
729
|
-
RetryOperation.prototype.stop = function() {
|
|
730
|
-
if (this._timeout) {
|
|
731
|
-
clearTimeout(this._timeout);
|
|
732
|
-
}
|
|
733
|
-
if (this._timer) {
|
|
734
|
-
clearTimeout(this._timer);
|
|
735
|
-
}
|
|
736
|
-
this._timeouts = [];
|
|
737
|
-
this._cachedTimeouts = null;
|
|
738
|
-
};
|
|
739
|
-
RetryOperation.prototype.retry = function(err) {
|
|
740
|
-
if (this._timeout) {
|
|
741
|
-
clearTimeout(this._timeout);
|
|
742
|
-
}
|
|
743
|
-
if (!err) {
|
|
744
|
-
return false;
|
|
745
|
-
}
|
|
746
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
747
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
748
|
-
this._errors.push(err);
|
|
749
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
750
|
-
return false;
|
|
751
|
-
}
|
|
752
|
-
this._errors.push(err);
|
|
753
|
-
var timeout = this._timeouts.shift();
|
|
754
|
-
if (timeout === void 0) {
|
|
755
|
-
if (this._cachedTimeouts) {
|
|
756
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
757
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
758
|
-
} else {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
var self = this;
|
|
763
|
-
this._timer = setTimeout(function() {
|
|
764
|
-
self._attempts++;
|
|
765
|
-
if (self._operationTimeoutCb) {
|
|
766
|
-
self._timeout = setTimeout(function() {
|
|
767
|
-
self._operationTimeoutCb(self._attempts);
|
|
768
|
-
}, self._operationTimeout);
|
|
769
|
-
if (self._options.unref) {
|
|
770
|
-
self._timeout.unref();
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
self._fn(self._attempts);
|
|
774
|
-
}, timeout);
|
|
775
|
-
if (this._options.unref) {
|
|
776
|
-
this._timer.unref();
|
|
777
|
-
}
|
|
778
|
-
return true;
|
|
779
|
-
};
|
|
780
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
781
|
-
this._fn = fn;
|
|
782
|
-
if (timeoutOps) {
|
|
783
|
-
if (timeoutOps.timeout) {
|
|
784
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
785
|
-
}
|
|
786
|
-
if (timeoutOps.cb) {
|
|
787
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
var self = this;
|
|
791
|
-
if (this._operationTimeoutCb) {
|
|
792
|
-
this._timeout = setTimeout(function() {
|
|
793
|
-
self._operationTimeoutCb();
|
|
794
|
-
}, self._operationTimeout);
|
|
795
|
-
}
|
|
796
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
797
|
-
this._fn(this._attempts);
|
|
798
|
-
};
|
|
799
|
-
RetryOperation.prototype.try = function(fn) {
|
|
800
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
801
|
-
this.attempt(fn);
|
|
802
|
-
};
|
|
803
|
-
RetryOperation.prototype.start = function(fn) {
|
|
804
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
805
|
-
this.attempt(fn);
|
|
806
|
-
};
|
|
807
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
808
|
-
RetryOperation.prototype.errors = function() {
|
|
809
|
-
return this._errors;
|
|
810
|
-
};
|
|
811
|
-
RetryOperation.prototype.attempts = function() {
|
|
812
|
-
return this._attempts;
|
|
813
|
-
};
|
|
814
|
-
RetryOperation.prototype.mainError = function() {
|
|
815
|
-
if (this._errors.length === 0) {
|
|
816
|
-
return null;
|
|
817
|
-
}
|
|
818
|
-
var counts = {};
|
|
819
|
-
var mainError = null;
|
|
820
|
-
var mainErrorCount = 0;
|
|
821
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
822
|
-
var error = this._errors[i];
|
|
823
|
-
var message = error.message;
|
|
824
|
-
var count = (counts[message] || 0) + 1;
|
|
825
|
-
counts[message] = count;
|
|
826
|
-
if (count >= mainErrorCount) {
|
|
827
|
-
mainError = error;
|
|
828
|
-
mainErrorCount = count;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
return mainError;
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
});
|
|
835
|
-
var require_retry = __commonJS2({
|
|
836
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
|
|
837
|
-
"use strict";
|
|
838
|
-
var RetryOperation = require_retry_operation();
|
|
839
|
-
exports.operation = function(options) {
|
|
840
|
-
var timeouts = exports.timeouts(options);
|
|
841
|
-
return new RetryOperation(timeouts, {
|
|
842
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
843
|
-
unref: options && options.unref,
|
|
844
|
-
maxRetryTime: options && options.maxRetryTime
|
|
845
|
-
});
|
|
846
|
-
};
|
|
847
|
-
exports.timeouts = function(options) {
|
|
848
|
-
if (options instanceof Array) {
|
|
849
|
-
return [].concat(options);
|
|
850
|
-
}
|
|
851
|
-
var opts = {
|
|
852
|
-
retries: 10,
|
|
853
|
-
factor: 2,
|
|
854
|
-
minTimeout: 1 * 1e3,
|
|
855
|
-
maxTimeout: Infinity,
|
|
856
|
-
randomize: false
|
|
857
|
-
};
|
|
858
|
-
for (var key in options) {
|
|
859
|
-
opts[key] = options[key];
|
|
860
|
-
}
|
|
861
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
862
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
863
|
-
}
|
|
864
|
-
var timeouts = [];
|
|
865
|
-
for (var i = 0; i < opts.retries; i++) {
|
|
866
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
867
|
-
}
|
|
868
|
-
if (options && options.forever && !timeouts.length) {
|
|
869
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
801
|
+
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
802
|
+
|
|
803
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
804
|
+
var Node = class {
|
|
805
|
+
constructor(value) {
|
|
806
|
+
__publicField(this, "value");
|
|
807
|
+
__publicField(this, "next");
|
|
808
|
+
this.value = value;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var _head, _tail, _size;
|
|
812
|
+
var Queue = class {
|
|
813
|
+
constructor() {
|
|
814
|
+
__privateAdd(this, _head);
|
|
815
|
+
__privateAdd(this, _tail);
|
|
816
|
+
__privateAdd(this, _size);
|
|
817
|
+
this.clear();
|
|
818
|
+
}
|
|
819
|
+
enqueue(value) {
|
|
820
|
+
const node = new Node(value);
|
|
821
|
+
if (__privateGet(this, _head)) {
|
|
822
|
+
__privateGet(this, _tail).next = node;
|
|
823
|
+
__privateSet(this, _tail, node);
|
|
824
|
+
} else {
|
|
825
|
+
__privateSet(this, _head, node);
|
|
826
|
+
__privateSet(this, _tail, node);
|
|
827
|
+
}
|
|
828
|
+
__privateWrapper(this, _size)._++;
|
|
829
|
+
}
|
|
830
|
+
dequeue() {
|
|
831
|
+
const current = __privateGet(this, _head);
|
|
832
|
+
if (!current) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
836
|
+
__privateWrapper(this, _size)._--;
|
|
837
|
+
if (!__privateGet(this, _head)) {
|
|
838
|
+
__privateSet(this, _tail, void 0);
|
|
839
|
+
}
|
|
840
|
+
return current.value;
|
|
841
|
+
}
|
|
842
|
+
peek() {
|
|
843
|
+
if (!__privateGet(this, _head)) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
return __privateGet(this, _head).value;
|
|
847
|
+
}
|
|
848
|
+
clear() {
|
|
849
|
+
__privateSet(this, _head, void 0);
|
|
850
|
+
__privateSet(this, _tail, void 0);
|
|
851
|
+
__privateSet(this, _size, 0);
|
|
852
|
+
}
|
|
853
|
+
get size() {
|
|
854
|
+
return __privateGet(this, _size);
|
|
855
|
+
}
|
|
856
|
+
*[Symbol.iterator]() {
|
|
857
|
+
let current = __privateGet(this, _head);
|
|
858
|
+
while (current) {
|
|
859
|
+
yield current.value;
|
|
860
|
+
current = current.next;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
*drain() {
|
|
864
|
+
while (__privateGet(this, _head)) {
|
|
865
|
+
yield this.dequeue();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
_head = new WeakMap();
|
|
870
|
+
_tail = new WeakMap();
|
|
871
|
+
_size = new WeakMap();
|
|
872
|
+
|
|
873
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
874
|
+
function pLimit2(concurrency) {
|
|
875
|
+
validateConcurrency(concurrency);
|
|
876
|
+
const queue = new Queue();
|
|
877
|
+
let activeCount = 0;
|
|
878
|
+
const resumeNext = () => {
|
|
879
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
880
|
+
queue.dequeue()();
|
|
881
|
+
activeCount++;
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
const next = () => {
|
|
885
|
+
activeCount--;
|
|
886
|
+
resumeNext();
|
|
887
|
+
};
|
|
888
|
+
const run = async (function_, resolve, arguments_) => {
|
|
889
|
+
const result = (async () => function_(...arguments_))();
|
|
890
|
+
resolve(result);
|
|
891
|
+
try {
|
|
892
|
+
await result;
|
|
893
|
+
} catch (e) {
|
|
894
|
+
}
|
|
895
|
+
next();
|
|
896
|
+
};
|
|
897
|
+
const enqueue = (function_, resolve, arguments_) => {
|
|
898
|
+
new Promise((internalResolve) => {
|
|
899
|
+
queue.enqueue(internalResolve);
|
|
900
|
+
}).then(
|
|
901
|
+
run.bind(void 0, function_, resolve, arguments_)
|
|
902
|
+
);
|
|
903
|
+
(async () => {
|
|
904
|
+
await Promise.resolve();
|
|
905
|
+
if (activeCount < concurrency) {
|
|
906
|
+
resumeNext();
|
|
870
907
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
908
|
+
})();
|
|
909
|
+
};
|
|
910
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
911
|
+
enqueue(function_, resolve, arguments_);
|
|
912
|
+
});
|
|
913
|
+
Object.defineProperties(generator, {
|
|
914
|
+
activeCount: {
|
|
915
|
+
get: () => activeCount
|
|
916
|
+
},
|
|
917
|
+
pendingCount: {
|
|
918
|
+
get: () => queue.size
|
|
919
|
+
},
|
|
920
|
+
clearQueue: {
|
|
921
|
+
value() {
|
|
922
|
+
queue.clear();
|
|
886
923
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
924
|
+
},
|
|
925
|
+
concurrency: {
|
|
926
|
+
get: () => concurrency,
|
|
927
|
+
set(newConcurrency) {
|
|
928
|
+
validateConcurrency(newConcurrency);
|
|
929
|
+
concurrency = newConcurrency;
|
|
930
|
+
queueMicrotask(() => {
|
|
931
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
932
|
+
resumeNext();
|
|
892
933
|
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
for (var i = 0; i < methods.length; i++) {
|
|
896
|
-
var method = methods[i];
|
|
897
|
-
var original = obj[method];
|
|
898
|
-
obj[method] = function retryWrapper(original2) {
|
|
899
|
-
var op = exports.operation(options);
|
|
900
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
901
|
-
var callback = args.pop();
|
|
902
|
-
args.push(function(err) {
|
|
903
|
-
if (op.retry(err)) {
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
if (err) {
|
|
907
|
-
arguments[0] = op.mainError();
|
|
908
|
-
}
|
|
909
|
-
callback.apply(this, arguments);
|
|
910
|
-
});
|
|
911
|
-
op.attempt(function() {
|
|
912
|
-
original2.apply(obj, args);
|
|
913
|
-
});
|
|
914
|
-
}.bind(obj, original);
|
|
915
|
-
obj[method].options = options;
|
|
934
|
+
});
|
|
916
935
|
}
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
return generator;
|
|
939
|
+
}
|
|
940
|
+
function validateConcurrency(concurrency) {
|
|
941
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
942
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
924
943
|
}
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
var
|
|
929
|
-
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
947
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
948
|
+
|
|
949
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
950
|
+
var objectToString = Object.prototype.toString;
|
|
951
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
952
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
953
|
+
"network error",
|
|
930
954
|
// Chrome
|
|
931
955
|
"NetworkError when attempting to fetch resource.",
|
|
932
956
|
// Firefox
|
|
933
957
|
"The Internet connection appears to be offline.",
|
|
934
|
-
// Safari
|
|
958
|
+
// Safari 16
|
|
935
959
|
"Network request failed",
|
|
936
960
|
// `cross-fetch`
|
|
937
|
-
"fetch failed"
|
|
961
|
+
"fetch failed",
|
|
938
962
|
// Undici (Node.js)
|
|
963
|
+
"terminated",
|
|
964
|
+
// Undici (Node.js)
|
|
965
|
+
" A network error occurred.",
|
|
966
|
+
// Bun (WebKit)
|
|
967
|
+
"Network connection lost"
|
|
968
|
+
// Cloudflare Workers (fetch)
|
|
939
969
|
]);
|
|
970
|
+
function isNetworkError(error) {
|
|
971
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
972
|
+
if (!isValid) {
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
const { message, stack } = error;
|
|
976
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
977
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
978
|
+
}
|
|
979
|
+
if (message.startsWith("error sending request for url")) {
|
|
980
|
+
return true;
|
|
981
|
+
}
|
|
982
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
983
|
+
return true;
|
|
984
|
+
}
|
|
985
|
+
return errorMessages.has(message);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
940
989
|
var AbortError = class extends Error {
|
|
941
990
|
constructor(message) {
|
|
942
991
|
super();
|
|
@@ -957,63 +1006,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
957
1006
|
error.retriesLeft = retriesLeft;
|
|
958
1007
|
return error;
|
|
959
1008
|
};
|
|
960
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
961
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
962
1009
|
async function pRetry(input, options) {
|
|
963
1010
|
return new Promise((resolve, reject) => {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
retries: 10,
|
|
968
|
-
...options
|
|
1011
|
+
var _a, _b, _c;
|
|
1012
|
+
options = { ...options };
|
|
1013
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
969
1014
|
};
|
|
1015
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1016
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
970
1017
|
const operation = import_retry.default.operation(options);
|
|
1018
|
+
const abortHandler = () => {
|
|
1019
|
+
var _a2;
|
|
1020
|
+
operation.stop();
|
|
1021
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1022
|
+
};
|
|
1023
|
+
if (options.signal && !options.signal.aborted) {
|
|
1024
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1025
|
+
}
|
|
1026
|
+
const cleanUp = () => {
|
|
1027
|
+
var _a2;
|
|
1028
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1029
|
+
operation.stop();
|
|
1030
|
+
};
|
|
971
1031
|
operation.attempt(async (attemptNumber) => {
|
|
972
1032
|
try {
|
|
973
|
-
|
|
1033
|
+
const result = await input(attemptNumber);
|
|
1034
|
+
cleanUp();
|
|
1035
|
+
resolve(result);
|
|
974
1036
|
} catch (error) {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
} else {
|
|
1037
|
+
try {
|
|
1038
|
+
if (!(error instanceof Error)) {
|
|
1039
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1040
|
+
}
|
|
1041
|
+
if (error instanceof AbortError) {
|
|
1042
|
+
throw error.originalError;
|
|
1043
|
+
}
|
|
1044
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1045
|
+
throw error;
|
|
1046
|
+
}
|
|
986
1047
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
reject(error2);
|
|
991
|
-
return;
|
|
1048
|
+
if (!await options.shouldRetry(error)) {
|
|
1049
|
+
operation.stop();
|
|
1050
|
+
reject(error);
|
|
992
1051
|
}
|
|
1052
|
+
await options.onFailedAttempt(error);
|
|
993
1053
|
if (!operation.retry(error)) {
|
|
994
|
-
|
|
1054
|
+
throw operation.mainError();
|
|
995
1055
|
}
|
|
1056
|
+
} catch (finalError) {
|
|
1057
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1058
|
+
cleanUp();
|
|
1059
|
+
reject(finalError);
|
|
996
1060
|
}
|
|
997
1061
|
}
|
|
998
1062
|
});
|
|
999
|
-
if (options.signal && !options.signal.aborted) {
|
|
1000
|
-
options.signal.addEventListener("abort", () => {
|
|
1001
|
-
operation.stop();
|
|
1002
|
-
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1003
|
-
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1004
|
-
}, {
|
|
1005
|
-
once: true
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
1063
|
});
|
|
1009
1064
|
}
|
|
1065
|
+
|
|
1066
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1010
1067
|
var AbortError2 = class extends Error {
|
|
1011
1068
|
constructor() {
|
|
1012
1069
|
super("Throttled function aborted");
|
|
1013
1070
|
this.name = "AbortError";
|
|
1014
1071
|
}
|
|
1015
1072
|
};
|
|
1016
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1073
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1017
1074
|
if (!Number.isFinite(limit)) {
|
|
1018
1075
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1019
1076
|
}
|
|
@@ -1041,32 +1098,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1041
1098
|
const strictTicks = [];
|
|
1042
1099
|
function strictDelay() {
|
|
1043
1100
|
const now = Date.now();
|
|
1044
|
-
if (strictTicks.length
|
|
1045
|
-
strictTicks.
|
|
1046
|
-
return 0;
|
|
1101
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1102
|
+
strictTicks.length = 0;
|
|
1047
1103
|
}
|
|
1048
|
-
|
|
1049
|
-
if (now >= earliestTime) {
|
|
1104
|
+
if (strictTicks.length < limit) {
|
|
1050
1105
|
strictTicks.push(now);
|
|
1051
1106
|
return 0;
|
|
1052
1107
|
}
|
|
1053
|
-
strictTicks
|
|
1054
|
-
|
|
1108
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1109
|
+
strictTicks.shift();
|
|
1110
|
+
strictTicks.push(nextExecutionTime);
|
|
1111
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1055
1112
|
}
|
|
1056
1113
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1057
1114
|
return (function_) => {
|
|
1058
|
-
const throttled = function(...
|
|
1115
|
+
const throttled = function(...arguments_) {
|
|
1059
1116
|
if (!throttled.isEnabled) {
|
|
1060
|
-
return (async () => function_.apply(this,
|
|
1117
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1061
1118
|
}
|
|
1062
|
-
let
|
|
1119
|
+
let timeoutId;
|
|
1063
1120
|
return new Promise((resolve, reject) => {
|
|
1064
1121
|
const execute = () => {
|
|
1065
|
-
resolve(function_.apply(this,
|
|
1066
|
-
queue.delete(
|
|
1122
|
+
resolve(function_.apply(this, arguments_));
|
|
1123
|
+
queue.delete(timeoutId);
|
|
1067
1124
|
};
|
|
1068
|
-
|
|
1069
|
-
|
|
1125
|
+
const delay = getDelay();
|
|
1126
|
+
if (delay > 0) {
|
|
1127
|
+
timeoutId = setTimeout(execute, delay);
|
|
1128
|
+
queue.set(timeoutId, reject);
|
|
1129
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1130
|
+
} else {
|
|
1131
|
+
execute();
|
|
1132
|
+
}
|
|
1070
1133
|
});
|
|
1071
1134
|
};
|
|
1072
1135
|
throttled.abort = () => {
|
|
@@ -1078,16 +1141,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1078
1141
|
strictTicks.splice(0, strictTicks.length);
|
|
1079
1142
|
};
|
|
1080
1143
|
throttled.isEnabled = true;
|
|
1144
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1145
|
+
get() {
|
|
1146
|
+
return queue.size;
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1081
1149
|
return throttled;
|
|
1082
1150
|
};
|
|
1083
1151
|
}
|
|
1152
|
+
|
|
1153
|
+
// ../canvas/dist/index.mjs
|
|
1154
|
+
var __typeError3 = (msg) => {
|
|
1155
|
+
throw TypeError(msg);
|
|
1156
|
+
};
|
|
1157
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1158
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1159
|
+
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);
|
|
1084
1160
|
function createLimitPolicy({
|
|
1085
1161
|
throttle = { interval: 1e3, limit: 10 },
|
|
1086
|
-
retry:
|
|
1162
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1087
1163
|
limit = 10
|
|
1088
1164
|
}) {
|
|
1089
1165
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1090
|
-
const limiter = limit ? (
|
|
1166
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1091
1167
|
return function limitPolicy(func) {
|
|
1092
1168
|
let currentFunc = async () => await func();
|
|
1093
1169
|
if (throttler) {
|
|
@@ -1098,13 +1174,13 @@ function createLimitPolicy({
|
|
|
1098
1174
|
const limitFunc = currentFunc;
|
|
1099
1175
|
currentFunc = () => limiter(limitFunc);
|
|
1100
1176
|
}
|
|
1101
|
-
if (
|
|
1177
|
+
if (retry3) {
|
|
1102
1178
|
const retryFunc = currentFunc;
|
|
1103
1179
|
currentFunc = () => pRetry(retryFunc, {
|
|
1104
|
-
...
|
|
1180
|
+
...retry3,
|
|
1105
1181
|
onFailedAttempt: async (error) => {
|
|
1106
|
-
if (
|
|
1107
|
-
await
|
|
1182
|
+
if (retry3.onFailedAttempt) {
|
|
1183
|
+
await retry3.onFailedAttempt(error);
|
|
1108
1184
|
}
|
|
1109
1185
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1110
1186
|
throw error;
|
|
@@ -1115,123 +1191,145 @@ function createLimitPolicy({
|
|
|
1115
1191
|
return currentFunc();
|
|
1116
1192
|
};
|
|
1117
1193
|
}
|
|
1118
|
-
var
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
if (!options.limitPolicy) {
|
|
1123
|
-
options.limitPolicy = createLimitPolicy({});
|
|
1124
|
-
}
|
|
1125
|
-
super(options);
|
|
1126
|
-
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1127
|
-
this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1128
|
-
}
|
|
1129
|
-
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1130
|
-
async getCompositionList(params = {}) {
|
|
1131
|
-
const { projectId } = this.options;
|
|
1132
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1133
|
-
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1134
|
-
if (!resolveData) {
|
|
1135
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1136
|
-
return this.apiClient(fetchUri);
|
|
1137
|
-
}
|
|
1138
|
-
const edgeParams = {
|
|
1139
|
-
...originParams,
|
|
1140
|
-
projectId,
|
|
1141
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1142
|
-
...rewrittenFilters
|
|
1143
|
-
};
|
|
1144
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1145
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1146
|
-
}
|
|
1147
|
-
getCompositionByNodePath(options) {
|
|
1148
|
-
return this.getOneComposition(options);
|
|
1149
|
-
}
|
|
1150
|
-
getCompositionByNodeId(options) {
|
|
1151
|
-
return this.getOneComposition(options);
|
|
1152
|
-
}
|
|
1153
|
-
getCompositionBySlug(options) {
|
|
1154
|
-
return this.getOneComposition(options);
|
|
1155
|
-
}
|
|
1156
|
-
getCompositionById(options) {
|
|
1157
|
-
return this.getOneComposition(options);
|
|
1158
|
-
}
|
|
1159
|
-
getCompositionDefaults(options) {
|
|
1160
|
-
return this.getOneComposition(options);
|
|
1161
|
-
}
|
|
1162
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1163
|
-
async getCompositionHistory(options) {
|
|
1164
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1194
|
+
var ContentClientBase = class extends ApiClient {
|
|
1195
|
+
constructor(options, defaultBypassCache) {
|
|
1196
|
+
var _a, _b;
|
|
1197
|
+
super({
|
|
1165
1198
|
...options,
|
|
1166
|
-
|
|
1199
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1200
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1167
1201
|
});
|
|
1168
|
-
return this.apiClient(historyUrl);
|
|
1169
1202
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1203
|
+
};
|
|
1204
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1205
|
+
function appendCsv(out, key, values) {
|
|
1206
|
+
if (values === void 0) {
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
out[key] = values.join(",");
|
|
1210
|
+
}
|
|
1211
|
+
function projectionToQuery(spec) {
|
|
1212
|
+
const out = {};
|
|
1213
|
+
if (!spec) {
|
|
1214
|
+
return out;
|
|
1215
|
+
}
|
|
1216
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1217
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1218
|
+
if (fields) {
|
|
1219
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1220
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1221
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1222
|
+
}
|
|
1223
|
+
if (fieldTypes) {
|
|
1224
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1225
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1226
|
+
}
|
|
1227
|
+
if (slots) {
|
|
1228
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1229
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1230
|
+
if (typeof slots.depth === "number") {
|
|
1231
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1232
|
+
}
|
|
1233
|
+
if (slots.named) {
|
|
1234
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1235
|
+
for (const slotName of slotNames) {
|
|
1236
|
+
const named = slots.named[slotName];
|
|
1237
|
+
if (named && typeof named.depth === "number") {
|
|
1238
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1178
1241
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1242
|
+
}
|
|
1243
|
+
return out;
|
|
1244
|
+
}
|
|
1245
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1246
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1247
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1248
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1249
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1250
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1251
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
1252
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1253
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
1254
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1255
|
+
function resolveCompositionSelector(args) {
|
|
1256
|
+
if ("compositionId" in args) {
|
|
1257
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1258
|
+
return {
|
|
1259
|
+
readOptions,
|
|
1260
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1261
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1262
|
+
versionId,
|
|
1263
|
+
hasCompositionId: true,
|
|
1264
|
+
pinnedEdition: editionId !== void 0
|
|
1183
1265
|
};
|
|
1184
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1185
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1186
1266
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1267
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1268
|
+
}
|
|
1269
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1270
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1271
|
+
constructor(options) {
|
|
1272
|
+
var _a;
|
|
1273
|
+
super(
|
|
1274
|
+
options,
|
|
1275
|
+
/* defaultBypassCache */
|
|
1276
|
+
false
|
|
1277
|
+
);
|
|
1278
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1279
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1201
1280
|
}
|
|
1202
|
-
/**
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
const { projectId } = this.options;
|
|
1206
|
-
await this.apiClient(fetchUri, {
|
|
1207
|
-
method: "DELETE",
|
|
1208
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1209
|
-
expectNoContent: true
|
|
1210
|
-
});
|
|
1281
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1282
|
+
coerceDiagnostics(diagnostics) {
|
|
1283
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1211
1284
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1285
|
+
};
|
|
1286
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1287
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1288
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1289
|
+
constructor(options) {
|
|
1290
|
+
super(options);
|
|
1217
1291
|
}
|
|
1218
|
-
/**
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1292
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1293
|
+
get(args) {
|
|
1294
|
+
var _a;
|
|
1295
|
+
const { diagnostics, select, ...rest } = args;
|
|
1296
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1297
|
+
const url = this.createUrl(
|
|
1298
|
+
EDGE_SINGLE_URL,
|
|
1299
|
+
{
|
|
1300
|
+
...readOptions,
|
|
1301
|
+
...projectionToQuery(select),
|
|
1302
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1303
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1304
|
+
compositionId,
|
|
1305
|
+
versionId,
|
|
1306
|
+
projectId: this.options.projectId,
|
|
1307
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1308
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1309
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1310
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1311
|
+
},
|
|
1312
|
+
this.edgeApiHost
|
|
1313
|
+
);
|
|
1314
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1226
1315
|
}
|
|
1227
|
-
/**
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1316
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1317
|
+
list(args = {}) {
|
|
1318
|
+
var _a;
|
|
1319
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1320
|
+
const url = this.createUrl(
|
|
1321
|
+
EDGE_LIST_URL,
|
|
1322
|
+
{
|
|
1323
|
+
...rest,
|
|
1324
|
+
...rewriteFiltersForApi(filters),
|
|
1325
|
+
...projectionToQuery(select),
|
|
1326
|
+
projectId: this.options.projectId,
|
|
1327
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1328
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1329
|
+
},
|
|
1330
|
+
this.edgeApiHost
|
|
1331
|
+
);
|
|
1332
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1235
1333
|
}
|
|
1236
1334
|
};
|
|
1237
1335
|
var _contentTypesUrl;
|
|
@@ -1244,20 +1342,26 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1244
1342
|
}
|
|
1245
1343
|
getContentTypes(options) {
|
|
1246
1344
|
const { projectId } = this.options;
|
|
1247
|
-
const fetchUri = this.createUrl(
|
|
1345
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1248
1346
|
return this.apiClient(fetchUri);
|
|
1249
1347
|
}
|
|
1250
1348
|
getEntries(options) {
|
|
1251
1349
|
const { projectId } = this.options;
|
|
1252
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1350
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1253
1351
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1352
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1254
1353
|
if (skipDataResolution) {
|
|
1255
|
-
const url = this.createUrl(
|
|
1354
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1355
|
+
...params,
|
|
1356
|
+
...rewrittenFilters,
|
|
1357
|
+
...rewrittenSelect,
|
|
1358
|
+
projectId
|
|
1359
|
+
});
|
|
1256
1360
|
return this.apiClient(url);
|
|
1257
1361
|
}
|
|
1258
1362
|
const edgeUrl = this.createUrl(
|
|
1259
|
-
|
|
1260
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1363
|
+
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1364
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1261
1365
|
this.edgeApiHost
|
|
1262
1366
|
);
|
|
1263
1367
|
return this.apiClient(
|
|
@@ -1274,7 +1378,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1274
1378
|
return this.apiClient(historyUrl);
|
|
1275
1379
|
}
|
|
1276
1380
|
async upsertContentType(body, opts = {}) {
|
|
1277
|
-
const fetchUri = this.createUrl(
|
|
1381
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1278
1382
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1279
1383
|
delete body.contentType.slugSettings;
|
|
1280
1384
|
}
|
|
@@ -1286,7 +1390,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1286
1390
|
});
|
|
1287
1391
|
}
|
|
1288
1392
|
async upsertEntry(body, options) {
|
|
1289
|
-
const fetchUri = this.createUrl(
|
|
1393
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1290
1394
|
const headers = {};
|
|
1291
1395
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1292
1396
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1300,7 +1404,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1300
1404
|
return { modified: response.headers.get("x-modified-at") };
|
|
1301
1405
|
}
|
|
1302
1406
|
async deleteContentType(body) {
|
|
1303
|
-
const fetchUri = this.createUrl(
|
|
1407
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1304
1408
|
await this.apiClient(fetchUri, {
|
|
1305
1409
|
method: "DELETE",
|
|
1306
1410
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1308,7 +1412,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1308
1412
|
});
|
|
1309
1413
|
}
|
|
1310
1414
|
async deleteEntry(body) {
|
|
1311
|
-
const fetchUri = this.createUrl(
|
|
1415
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1312
1416
|
await this.apiClient(fetchUri, {
|
|
1313
1417
|
method: "DELETE",
|
|
1314
1418
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1327,31 +1431,39 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1327
1431
|
};
|
|
1328
1432
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1329
1433
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1330
|
-
|
|
1331
|
-
|
|
1434
|
+
__privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1435
|
+
__privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1332
1436
|
var _url8;
|
|
1333
1437
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1334
1438
|
constructor(options) {
|
|
1335
1439
|
super(options);
|
|
1336
1440
|
}
|
|
1337
|
-
/** Fetches
|
|
1338
|
-
async
|
|
1441
|
+
/** Fetches a list of DataTypes for a project */
|
|
1442
|
+
async list(options) {
|
|
1339
1443
|
const { projectId } = this.options;
|
|
1340
|
-
const fetchUri = this.createUrl(
|
|
1444
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1341
1445
|
return await this.apiClient(fetchUri);
|
|
1342
1446
|
}
|
|
1447
|
+
/** @deprecated Use {@link list} instead. */
|
|
1448
|
+
async get(options) {
|
|
1449
|
+
return this.list(options);
|
|
1450
|
+
}
|
|
1343
1451
|
/** Updates or creates (based on id) a DataType */
|
|
1344
|
-
async
|
|
1345
|
-
const fetchUri = this.createUrl(
|
|
1452
|
+
async save(body) {
|
|
1453
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1346
1454
|
await this.apiClient(fetchUri, {
|
|
1347
1455
|
method: "PUT",
|
|
1348
1456
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1349
1457
|
expectNoContent: true
|
|
1350
1458
|
});
|
|
1351
1459
|
}
|
|
1460
|
+
/** @deprecated Use {@link save} instead. */
|
|
1461
|
+
async upsert(body) {
|
|
1462
|
+
return this.save(body);
|
|
1463
|
+
}
|
|
1352
1464
|
/** Deletes a DataType */
|
|
1353
1465
|
async remove(body) {
|
|
1354
|
-
const fetchUri = this.createUrl(
|
|
1466
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1355
1467
|
await this.apiClient(fetchUri, {
|
|
1356
1468
|
method: "DELETE",
|
|
1357
1469
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1360,16 +1472,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1360
1472
|
}
|
|
1361
1473
|
};
|
|
1362
1474
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1363
|
-
|
|
1364
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1365
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1366
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1367
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1368
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1369
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
1370
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1371
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
1372
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1475
|
+
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1373
1476
|
var escapeCharacter = "\\";
|
|
1374
1477
|
var variablePrefix = "${";
|
|
1375
1478
|
var variableSuffix = "}";
|
|
@@ -1456,7 +1559,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1456
1559
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1457
1560
|
*/
|
|
1458
1561
|
get(options) {
|
|
1459
|
-
const fetchUri = this.createUrl(
|
|
1562
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1460
1563
|
...options,
|
|
1461
1564
|
teamId: this.teamId
|
|
1462
1565
|
});
|
|
@@ -1466,7 +1569,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1466
1569
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1467
1570
|
*/
|
|
1468
1571
|
async deploy(body) {
|
|
1469
|
-
const fetchUri = this.createUrl(
|
|
1572
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1470
1573
|
await this.apiClient(fetchUri, {
|
|
1471
1574
|
method: "PUT",
|
|
1472
1575
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1477,7 +1580,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1477
1580
|
* Removes a custom AI property editor from a Mesh app.
|
|
1478
1581
|
*/
|
|
1479
1582
|
async delete(body) {
|
|
1480
|
-
const fetchUri = this.createUrl(
|
|
1583
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1481
1584
|
await this.apiClient(fetchUri, {
|
|
1482
1585
|
method: "DELETE",
|
|
1483
1586
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1486,7 +1589,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1486
1589
|
}
|
|
1487
1590
|
};
|
|
1488
1591
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1489
|
-
|
|
1592
|
+
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1490
1593
|
var _url22;
|
|
1491
1594
|
var _projectsUrl;
|
|
1492
1595
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
@@ -1495,7 +1598,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1495
1598
|
}
|
|
1496
1599
|
/** Fetches single Project */
|
|
1497
1600
|
async get(options) {
|
|
1498
|
-
const fetchUri = this.createUrl(
|
|
1601
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
1499
1602
|
return await this.apiClient(fetchUri);
|
|
1500
1603
|
}
|
|
1501
1604
|
/**
|
|
@@ -1503,32 +1606,44 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1503
1606
|
* When teamId is provided, returns a single team with its projects.
|
|
1504
1607
|
* When omitted, returns all accessible teams and their projects.
|
|
1505
1608
|
*/
|
|
1506
|
-
async
|
|
1507
|
-
const fetchUri = this.createUrl(
|
|
1609
|
+
async list(options) {
|
|
1610
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1508
1611
|
return await this.apiClient(fetchUri);
|
|
1509
1612
|
}
|
|
1613
|
+
/** @deprecated Use {@link list} instead. */
|
|
1614
|
+
async getProjects(options) {
|
|
1615
|
+
return this.list(options);
|
|
1616
|
+
}
|
|
1510
1617
|
/** Updates or creates (based on id) a Project */
|
|
1511
|
-
async
|
|
1512
|
-
const fetchUri = this.createUrl(
|
|
1618
|
+
async save(body) {
|
|
1619
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1513
1620
|
return await this.apiClient(fetchUri, {
|
|
1514
1621
|
method: "PUT",
|
|
1515
1622
|
body: JSON.stringify({ ...body })
|
|
1516
1623
|
});
|
|
1517
1624
|
}
|
|
1625
|
+
/** @deprecated Use {@link save} instead. */
|
|
1626
|
+
async upsert(body) {
|
|
1627
|
+
return this.save(body);
|
|
1628
|
+
}
|
|
1518
1629
|
/** Deletes a Project */
|
|
1519
|
-
async
|
|
1520
|
-
const fetchUri = this.createUrl(
|
|
1630
|
+
async remove(body) {
|
|
1631
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1521
1632
|
await this.apiClient(fetchUri, {
|
|
1522
1633
|
method: "DELETE",
|
|
1523
1634
|
body: JSON.stringify({ ...body }),
|
|
1524
1635
|
expectNoContent: true
|
|
1525
1636
|
});
|
|
1526
1637
|
}
|
|
1638
|
+
/** @deprecated Use {@link remove} instead. */
|
|
1639
|
+
async delete(body) {
|
|
1640
|
+
return this.remove(body);
|
|
1641
|
+
}
|
|
1527
1642
|
};
|
|
1528
1643
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1529
1644
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1530
|
-
|
|
1531
|
-
|
|
1645
|
+
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
1646
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1532
1647
|
var isAllowedReferrer = (referrer) => {
|
|
1533
1648
|
return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
|
|
1534
1649
|
};
|
|
@@ -1925,7 +2040,7 @@ function createLimiter(concurrency) {
|
|
|
1925
2040
|
});
|
|
1926
2041
|
};
|
|
1927
2042
|
}
|
|
1928
|
-
async function
|
|
2043
|
+
async function retry2(fn, options) {
|
|
1929
2044
|
let lastError;
|
|
1930
2045
|
let delay = 1e3;
|
|
1931
2046
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -1965,7 +2080,7 @@ function createLimitPolicy2({
|
|
|
1965
2080
|
}
|
|
1966
2081
|
if (retryOptions) {
|
|
1967
2082
|
const retryFunc = currentFunc;
|
|
1968
|
-
currentFunc = () =>
|
|
2083
|
+
currentFunc = () => retry2(retryFunc, {
|
|
1969
2084
|
...retryOptions,
|
|
1970
2085
|
onFailedAttempt: async (error) => {
|
|
1971
2086
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -1984,7 +2099,7 @@ function createLimitPolicy2({
|
|
|
1984
2099
|
// src/clients/canvas.ts
|
|
1985
2100
|
var getCanvasClient = (options) => {
|
|
1986
2101
|
const cache = resolveCanvasCache(options);
|
|
1987
|
-
return new
|
|
2102
|
+
return new CompositionDeliveryClient({
|
|
1988
2103
|
projectId: env.getProjectId(),
|
|
1989
2104
|
apiHost: env.getApiHost(),
|
|
1990
2105
|
apiKey: env.getApiKey(),
|
|
@@ -2039,14 +2154,14 @@ var getCanvasClient = (options) => {
|
|
|
2039
2154
|
import "server-only";
|
|
2040
2155
|
|
|
2041
2156
|
// ../project-map/dist/index.mjs
|
|
2042
|
-
var
|
|
2157
|
+
var __typeError4 = (msg) => {
|
|
2043
2158
|
throw TypeError(msg);
|
|
2044
2159
|
};
|
|
2045
|
-
var
|
|
2046
|
-
var
|
|
2047
|
-
var
|
|
2048
|
-
var
|
|
2049
|
-
var __privateMethod = (obj, member, method) => (
|
|
2160
|
+
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
2161
|
+
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2162
|
+
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);
|
|
2163
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2164
|
+
var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
|
|
2050
2165
|
var ProjectMapClient = class extends ApiClient {
|
|
2051
2166
|
constructor(options) {
|
|
2052
2167
|
super(options);
|
|
@@ -2193,12 +2308,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2193
2308
|
var _Route = class _Route2 {
|
|
2194
2309
|
constructor(route) {
|
|
2195
2310
|
this.route = route;
|
|
2196
|
-
|
|
2311
|
+
__privateAdd4(this, _routeInfo);
|
|
2197
2312
|
var _a;
|
|
2198
|
-
|
|
2313
|
+
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2199
2314
|
}
|
|
2200
2315
|
get dynamicSegmentCount() {
|
|
2201
|
-
return
|
|
2316
|
+
return __privateGet4(this, _routeInfo).segments.reduce(
|
|
2202
2317
|
(count, segment) => {
|
|
2203
2318
|
var _a;
|
|
2204
2319
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2210,7 +2325,7 @@ var _Route = class _Route2 {
|
|
|
2210
2325
|
matches(path) {
|
|
2211
2326
|
var _a, _b;
|
|
2212
2327
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2213
|
-
const { segments: routeSegments } =
|
|
2328
|
+
const { segments: routeSegments } = __privateGet4(this, _routeInfo);
|
|
2214
2329
|
if (pathSegments.length !== routeSegments.length) {
|
|
2215
2330
|
return { match: false };
|
|
2216
2331
|
}
|
|
@@ -2231,7 +2346,7 @@ var _Route = class _Route2 {
|
|
|
2231
2346
|
return { match: false };
|
|
2232
2347
|
}
|
|
2233
2348
|
}
|
|
2234
|
-
for (const [key, value] of
|
|
2349
|
+
for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
|
|
2235
2350
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2236
2351
|
}
|
|
2237
2352
|
return possibleMatch;
|
|
@@ -2241,7 +2356,7 @@ var _Route = class _Route2 {
|
|
|
2241
2356
|
*/
|
|
2242
2357
|
expand(options) {
|
|
2243
2358
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2244
|
-
const path =
|
|
2359
|
+
const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
|
|
2245
2360
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2246
2361
|
if (!dynamicSegmentName) {
|
|
2247
2362
|
return segment;
|
|
@@ -2292,7 +2407,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2292
2407
|
}
|
|
2293
2408
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2294
2409
|
};
|
|
2295
|
-
|
|
2410
|
+
__privateAdd4(_Route, _Route_static);
|
|
2296
2411
|
_Route.dynamicSegmentPrefix = ":";
|
|
2297
2412
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2298
2413
|
if (!doNotEscapeVariables) {
|
|
@@ -2405,7 +2520,7 @@ var getComposition = async ({ compositionId }) => {
|
|
|
2405
2520
|
}
|
|
2406
2521
|
});
|
|
2407
2522
|
try {
|
|
2408
|
-
const composition = await canvasClient.
|
|
2523
|
+
const composition = await canvasClient.get({
|
|
2409
2524
|
compositionId
|
|
2410
2525
|
});
|
|
2411
2526
|
return composition;
|