@uniformdev/next-app-router 20.49.2 → 20.49.3-alpha.47
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/{UniformComposition-d7_93l3F.d.ts → UniformComposition-BWxMuY7i.d.ts} +2 -2
- package/dist/{UniformComposition-hhRIBHmn.d.mts → UniformComposition-Bo6UsTDC.d.mts} +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +768 -582
- package/dist/cache.mjs +768 -582
- package/dist/{client-BCGVjYM-.d.mts → client-DRMp2gpi.d.mts} +2 -1
- package/dist/{client-BCGVjYM-.d.ts → client-DRMp2gpi.d.ts} +2 -1
- package/dist/compat.d.mts +3 -3
- package/dist/compat.d.ts +3 -3
- package/dist/component.js +100 -387
- package/dist/component.mjs +101 -388
- package/dist/handler.js +797 -587
- package/dist/handler.mjs +797 -587
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +838 -596
- package/dist/index.js +845 -603
- package/dist/index.mjs +838 -596
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +790 -569
- package/dist/middleware.mjs +790 -569
- package/dist/{resolveRouteFromCode-DgTsfMK8.d.ts → resolveRouteFromCode-Bhz8EJBu.d.ts} +1 -1
- package/dist/{resolveRouteFromCode-CKaYNXte.d.mts → resolveRouteFromCode-C0dkUV2T.d.mts} +1 -1
- package/package.json +22 -21
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,33 +408,40 @@ 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);
|
|
420
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
172
421
|
var ApiClientError = class _ApiClientError extends Error {
|
|
173
422
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
174
423
|
super(
|
|
175
424
|
`${errorMessage}
|
|
176
425
|
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
177
426
|
);
|
|
178
|
-
this
|
|
179
|
-
this
|
|
180
|
-
this
|
|
181
|
-
this
|
|
182
|
-
this
|
|
183
|
-
this
|
|
427
|
+
__publicField2(this, "errorMessage", errorMessage);
|
|
428
|
+
__publicField2(this, "fetchMethod", fetchMethod);
|
|
429
|
+
__publicField2(this, "fetchUri", fetchUri);
|
|
430
|
+
__publicField2(this, "statusCode", statusCode);
|
|
431
|
+
__publicField2(this, "statusText", statusText);
|
|
432
|
+
__publicField2(this, "requestId", requestId);
|
|
184
433
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
185
434
|
}
|
|
186
435
|
};
|
|
436
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
437
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
438
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
439
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
187
442
|
var ApiClient = class _ApiClient {
|
|
188
443
|
constructor(options) {
|
|
189
|
-
|
|
444
|
+
__publicField2(this, "options");
|
|
190
445
|
var _a, _b, _c, _d, _e;
|
|
191
446
|
if (!options.apiKey && !options.bearerToken) {
|
|
192
447
|
throw new Error("You must provide an API key or a bearer token");
|
|
@@ -217,7 +472,7 @@ var ApiClient = class _ApiClient {
|
|
|
217
472
|
}
|
|
218
473
|
async apiClientWithResponse(fetchUri, options) {
|
|
219
474
|
return this.options.limitPolicy(async () => {
|
|
220
|
-
var _a;
|
|
475
|
+
var _a, _b;
|
|
221
476
|
const coreHeaders = this.options.apiKey ? {
|
|
222
477
|
"x-api-key": this.options.apiKey
|
|
223
478
|
} : {
|
|
@@ -253,9 +508,19 @@ var ApiClient = class _ApiClient {
|
|
|
253
508
|
} catch (e) {
|
|
254
509
|
message = `General error`;
|
|
255
510
|
}
|
|
511
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
512
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
513
|
+
message,
|
|
514
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
515
|
+
fetchUri.toString(),
|
|
516
|
+
apiResponse.status,
|
|
517
|
+
apiResponse.statusText,
|
|
518
|
+
_ApiClient.getRequestId(apiResponse)
|
|
519
|
+
);
|
|
520
|
+
}
|
|
256
521
|
throw new ApiClientError(
|
|
257
522
|
message,
|
|
258
|
-
(
|
|
523
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
259
524
|
fetchUri.toString(),
|
|
260
525
|
apiResponse.status,
|
|
261
526
|
apiResponse.statusText,
|
|
@@ -329,25 +594,39 @@ async function handleRateLimits(callApi) {
|
|
|
329
594
|
}
|
|
330
595
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
331
596
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
332
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
597
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
333
598
|
backoffRetriesLeft -= 1;
|
|
334
599
|
}
|
|
335
600
|
return response;
|
|
336
601
|
}
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
602
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
603
|
+
function rewriteFiltersForApi(filters) {
|
|
604
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
605
|
+
(acc, [key, value]) => {
|
|
606
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
607
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
608
|
+
return {
|
|
609
|
+
...acc,
|
|
610
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
611
|
+
};
|
|
612
|
+
},
|
|
613
|
+
{}
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
var _url;
|
|
617
|
+
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
618
|
+
constructor(options) {
|
|
619
|
+
super(options);
|
|
620
|
+
}
|
|
621
|
+
/** Fetches all aggregates for a project */
|
|
622
|
+
async get(options) {
|
|
344
623
|
const { projectId } = this.options;
|
|
345
|
-
const fetchUri = this.createUrl(
|
|
624
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
346
625
|
return await this.apiClient(fetchUri);
|
|
347
626
|
}
|
|
348
627
|
/** Updates or creates (based on id) an Aggregate */
|
|
349
628
|
async upsert(body) {
|
|
350
|
-
const fetchUri = this.createUrl(
|
|
629
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
351
630
|
await this.apiClient(fetchUri, {
|
|
352
631
|
method: "PUT",
|
|
353
632
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -356,7 +635,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
356
635
|
}
|
|
357
636
|
/** Deletes an Aggregate */
|
|
358
637
|
async remove(body) {
|
|
359
|
-
const fetchUri = this.createUrl(
|
|
638
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
360
639
|
await this.apiClient(fetchUri, {
|
|
361
640
|
method: "DELETE",
|
|
362
641
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -365,7 +644,7 @@ var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
|
365
644
|
}
|
|
366
645
|
};
|
|
367
646
|
_url = /* @__PURE__ */ new WeakMap();
|
|
368
|
-
|
|
647
|
+
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
369
648
|
var _url2;
|
|
370
649
|
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
371
650
|
constructor(options) {
|
|
@@ -374,12 +653,12 @@ var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
|
374
653
|
/** Fetches the known score dimensions for a project */
|
|
375
654
|
async get(options) {
|
|
376
655
|
const { projectId } = this.options;
|
|
377
|
-
const fetchUri = this.createUrl(
|
|
656
|
+
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
378
657
|
return await this.apiClient(fetchUri);
|
|
379
658
|
}
|
|
380
659
|
};
|
|
381
660
|
_url2 = /* @__PURE__ */ new WeakMap();
|
|
382
|
-
|
|
661
|
+
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
383
662
|
var _url3;
|
|
384
663
|
var _valueUrl;
|
|
385
664
|
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
@@ -389,12 +668,12 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
389
668
|
/** Fetches all enrichments and values for a project, grouped by category */
|
|
390
669
|
async get(options) {
|
|
391
670
|
const { projectId } = this.options;
|
|
392
|
-
const fetchUri = this.createUrl(
|
|
671
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
393
672
|
return await this.apiClient(fetchUri);
|
|
394
673
|
}
|
|
395
674
|
/** Updates or creates (based on id) an enrichment category */
|
|
396
675
|
async upsertCategory(body) {
|
|
397
|
-
const fetchUri = this.createUrl(
|
|
676
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
398
677
|
await this.apiClient(fetchUri, {
|
|
399
678
|
method: "PUT",
|
|
400
679
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -403,7 +682,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
403
682
|
}
|
|
404
683
|
/** Deletes an enrichment category */
|
|
405
684
|
async removeCategory(body) {
|
|
406
|
-
const fetchUri = this.createUrl(
|
|
685
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
407
686
|
await this.apiClient(fetchUri, {
|
|
408
687
|
method: "DELETE",
|
|
409
688
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -412,7 +691,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
412
691
|
}
|
|
413
692
|
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
414
693
|
async upsertValue(body) {
|
|
415
|
-
const fetchUri = this.createUrl(
|
|
694
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
416
695
|
await this.apiClient(fetchUri, {
|
|
417
696
|
method: "PUT",
|
|
418
697
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -421,7 +700,7 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
421
700
|
}
|
|
422
701
|
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
423
702
|
async removeValue(body) {
|
|
424
|
-
const fetchUri = this.createUrl(
|
|
703
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
425
704
|
await this.apiClient(fetchUri, {
|
|
426
705
|
method: "DELETE",
|
|
427
706
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -431,8 +710,8 @@ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
|
431
710
|
};
|
|
432
711
|
_url3 = /* @__PURE__ */ new WeakMap();
|
|
433
712
|
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
434
|
-
|
|
435
|
-
|
|
713
|
+
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
714
|
+
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
436
715
|
var _url4;
|
|
437
716
|
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
438
717
|
constructor(options) {
|
|
@@ -441,7 +720,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
441
720
|
/** Fetches the Context manifest for a project */
|
|
442
721
|
async get(options) {
|
|
443
722
|
const { projectId } = this.options;
|
|
444
|
-
const fetchUri = this.createUrl(
|
|
723
|
+
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
445
724
|
return await this.apiClient(fetchUri);
|
|
446
725
|
}
|
|
447
726
|
/** Publishes the Context manifest for a project */
|
|
@@ -455,7 +734,7 @@ var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
|
455
734
|
}
|
|
456
735
|
};
|
|
457
736
|
_url4 = /* @__PURE__ */ new WeakMap();
|
|
458
|
-
|
|
737
|
+
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
459
738
|
var _url5;
|
|
460
739
|
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
461
740
|
constructor(options) {
|
|
@@ -464,12 +743,12 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
464
743
|
/** Fetches all Quirks for a project */
|
|
465
744
|
async get(options) {
|
|
466
745
|
const { projectId } = this.options;
|
|
467
|
-
const fetchUri = this.createUrl(
|
|
746
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
468
747
|
return await this.apiClient(fetchUri);
|
|
469
748
|
}
|
|
470
749
|
/** Updates or creates (based on id) a Quirk */
|
|
471
750
|
async upsert(body) {
|
|
472
|
-
const fetchUri = this.createUrl(
|
|
751
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
473
752
|
await this.apiClient(fetchUri, {
|
|
474
753
|
method: "PUT",
|
|
475
754
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -478,7 +757,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
478
757
|
}
|
|
479
758
|
/** Deletes a Quirk */
|
|
480
759
|
async remove(body) {
|
|
481
|
-
const fetchUri = this.createUrl(
|
|
760
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
482
761
|
await this.apiClient(fetchUri, {
|
|
483
762
|
method: "DELETE",
|
|
484
763
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -487,7 +766,7 @@ var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
|
487
766
|
}
|
|
488
767
|
};
|
|
489
768
|
_url5 = /* @__PURE__ */ new WeakMap();
|
|
490
|
-
|
|
769
|
+
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
491
770
|
var _url6;
|
|
492
771
|
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
493
772
|
constructor(options) {
|
|
@@ -496,12 +775,12 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
496
775
|
/** Fetches all Signals for a project */
|
|
497
776
|
async get(options) {
|
|
498
777
|
const { projectId } = this.options;
|
|
499
|
-
const fetchUri = this.createUrl(
|
|
778
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
500
779
|
return await this.apiClient(fetchUri);
|
|
501
780
|
}
|
|
502
781
|
/** Updates or creates (based on id) a Signal */
|
|
503
782
|
async upsert(body) {
|
|
504
|
-
const fetchUri = this.createUrl(
|
|
783
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
505
784
|
await this.apiClient(fetchUri, {
|
|
506
785
|
method: "PUT",
|
|
507
786
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -510,434 +789,235 @@ var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
|
510
789
|
}
|
|
511
790
|
/** Deletes a Signal */
|
|
512
791
|
async remove(body) {
|
|
513
|
-
const fetchUri = this.createUrl(
|
|
514
|
-
await this.apiClient(fetchUri, {
|
|
515
|
-
method: "DELETE",
|
|
516
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
517
|
-
expectNoContent: true
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
_url6 = /* @__PURE__ */ new WeakMap();
|
|
522
|
-
__privateAdd(_SignalClient, _url6, "/api/v2/signal");
|
|
523
|
-
var _url7;
|
|
524
|
-
var _TestClient = class _TestClient2 extends ApiClient {
|
|
525
|
-
constructor(options) {
|
|
526
|
-
super(options);
|
|
527
|
-
}
|
|
528
|
-
/** Fetches all Tests for a project */
|
|
529
|
-
async get(options) {
|
|
530
|
-
const { projectId } = this.options;
|
|
531
|
-
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
|
|
532
|
-
return await this.apiClient(fetchUri);
|
|
533
|
-
}
|
|
534
|
-
/** Updates or creates (based on id) a Test */
|
|
535
|
-
async upsert(body) {
|
|
536
|
-
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
537
|
-
await this.apiClient(fetchUri, {
|
|
538
|
-
method: "PUT",
|
|
539
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
540
|
-
expectNoContent: true
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
/** Deletes a Test */
|
|
544
|
-
async remove(body) {
|
|
545
|
-
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
792
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
546
793
|
await this.apiClient(fetchUri, {
|
|
547
|
-
method: "DELETE",
|
|
548
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
549
|
-
expectNoContent: true
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
_url7 = /* @__PURE__ */ new WeakMap();
|
|
554
|
-
__privateAdd(_TestClient, _url7, "/api/v2/test");
|
|
555
|
-
|
|
556
|
-
// ../canvas/dist/index.mjs
|
|
557
|
-
var __create2 = Object.create;
|
|
558
|
-
var __defProp3 = Object.defineProperty;
|
|
559
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
560
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
561
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
562
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
563
|
-
var __typeError2 = (msg) => {
|
|
564
|
-
throw TypeError(msg);
|
|
565
|
-
};
|
|
566
|
-
var __commonJS2 = (cb, mod) => function __require() {
|
|
567
|
-
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
568
|
-
};
|
|
569
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
570
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
571
|
-
for (let key of __getOwnPropNames2(from))
|
|
572
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
573
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
574
|
-
}
|
|
575
|
-
return to;
|
|
576
|
-
};
|
|
577
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
578
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
579
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
580
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
581
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
582
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
583
|
-
mod
|
|
584
|
-
));
|
|
585
|
-
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
586
|
-
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
587
|
-
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);
|
|
588
|
-
var require_yocto_queue2 = __commonJS2({
|
|
589
|
-
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
590
|
-
"use strict";
|
|
591
|
-
var Node = class {
|
|
592
|
-
/// value;
|
|
593
|
-
/// next;
|
|
594
|
-
constructor(value) {
|
|
595
|
-
this.value = value;
|
|
596
|
-
this.next = void 0;
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
var Queue = class {
|
|
600
|
-
// TODO: Use private class fields when targeting Node.js 12.
|
|
601
|
-
// #_head;
|
|
602
|
-
// #_tail;
|
|
603
|
-
// #_size;
|
|
604
|
-
constructor() {
|
|
605
|
-
this.clear();
|
|
606
|
-
}
|
|
607
|
-
enqueue(value) {
|
|
608
|
-
const node = new Node(value);
|
|
609
|
-
if (this._head) {
|
|
610
|
-
this._tail.next = node;
|
|
611
|
-
this._tail = node;
|
|
612
|
-
} else {
|
|
613
|
-
this._head = node;
|
|
614
|
-
this._tail = node;
|
|
615
|
-
}
|
|
616
|
-
this._size++;
|
|
617
|
-
}
|
|
618
|
-
dequeue() {
|
|
619
|
-
const current = this._head;
|
|
620
|
-
if (!current) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
this._head = this._head.next;
|
|
624
|
-
this._size--;
|
|
625
|
-
return current.value;
|
|
626
|
-
}
|
|
627
|
-
clear() {
|
|
628
|
-
this._head = void 0;
|
|
629
|
-
this._tail = void 0;
|
|
630
|
-
this._size = 0;
|
|
631
|
-
}
|
|
632
|
-
get size() {
|
|
633
|
-
return this._size;
|
|
634
|
-
}
|
|
635
|
-
*[Symbol.iterator]() {
|
|
636
|
-
let current = this._head;
|
|
637
|
-
while (current) {
|
|
638
|
-
yield current.value;
|
|
639
|
-
current = current.next;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
module2.exports = Queue;
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
|
-
var require_p_limit2 = __commonJS2({
|
|
647
|
-
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
648
|
-
"use strict";
|
|
649
|
-
var Queue = require_yocto_queue2();
|
|
650
|
-
var pLimit2 = (concurrency) => {
|
|
651
|
-
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
652
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
653
|
-
}
|
|
654
|
-
const queue = new Queue();
|
|
655
|
-
let activeCount = 0;
|
|
656
|
-
const next = () => {
|
|
657
|
-
activeCount--;
|
|
658
|
-
if (queue.size > 0) {
|
|
659
|
-
queue.dequeue()();
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
const run = async (fn, resolve, ...args) => {
|
|
663
|
-
activeCount++;
|
|
664
|
-
const result = (async () => fn(...args))();
|
|
665
|
-
resolve(result);
|
|
666
|
-
try {
|
|
667
|
-
await result;
|
|
668
|
-
} catch (e) {
|
|
669
|
-
}
|
|
670
|
-
next();
|
|
671
|
-
};
|
|
672
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
673
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
674
|
-
(async () => {
|
|
675
|
-
await Promise.resolve();
|
|
676
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
677
|
-
queue.dequeue()();
|
|
678
|
-
}
|
|
679
|
-
})();
|
|
680
|
-
};
|
|
681
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
682
|
-
enqueue(fn, resolve, ...args);
|
|
683
|
-
});
|
|
684
|
-
Object.defineProperties(generator, {
|
|
685
|
-
activeCount: {
|
|
686
|
-
get: () => activeCount
|
|
687
|
-
},
|
|
688
|
-
pendingCount: {
|
|
689
|
-
get: () => queue.size
|
|
690
|
-
},
|
|
691
|
-
clearQueue: {
|
|
692
|
-
value: () => {
|
|
693
|
-
queue.clear();
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
return generator;
|
|
698
|
-
};
|
|
699
|
-
module2.exports = pLimit2;
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
var require_retry_operation = __commonJS2({
|
|
703
|
-
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
704
|
-
"use strict";
|
|
705
|
-
function RetryOperation(timeouts, options) {
|
|
706
|
-
if (typeof options === "boolean") {
|
|
707
|
-
options = { forever: options };
|
|
708
|
-
}
|
|
709
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
710
|
-
this._timeouts = timeouts;
|
|
711
|
-
this._options = options || {};
|
|
712
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
713
|
-
this._fn = null;
|
|
714
|
-
this._errors = [];
|
|
715
|
-
this._attempts = 1;
|
|
716
|
-
this._operationTimeout = null;
|
|
717
|
-
this._operationTimeoutCb = null;
|
|
718
|
-
this._timeout = null;
|
|
719
|
-
this._operationStart = null;
|
|
720
|
-
this._timer = null;
|
|
721
|
-
if (this._options.forever) {
|
|
722
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
module2.exports = RetryOperation;
|
|
726
|
-
RetryOperation.prototype.reset = function() {
|
|
727
|
-
this._attempts = 1;
|
|
728
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
729
|
-
};
|
|
730
|
-
RetryOperation.prototype.stop = function() {
|
|
731
|
-
if (this._timeout) {
|
|
732
|
-
clearTimeout(this._timeout);
|
|
733
|
-
}
|
|
734
|
-
if (this._timer) {
|
|
735
|
-
clearTimeout(this._timer);
|
|
736
|
-
}
|
|
737
|
-
this._timeouts = [];
|
|
738
|
-
this._cachedTimeouts = null;
|
|
739
|
-
};
|
|
740
|
-
RetryOperation.prototype.retry = function(err) {
|
|
741
|
-
if (this._timeout) {
|
|
742
|
-
clearTimeout(this._timeout);
|
|
743
|
-
}
|
|
744
|
-
if (!err) {
|
|
745
|
-
return false;
|
|
746
|
-
}
|
|
747
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
748
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
749
|
-
this._errors.push(err);
|
|
750
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
|
-
this._errors.push(err);
|
|
754
|
-
var timeout = this._timeouts.shift();
|
|
755
|
-
if (timeout === void 0) {
|
|
756
|
-
if (this._cachedTimeouts) {
|
|
757
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
758
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
759
|
-
} else {
|
|
760
|
-
return false;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
var self = this;
|
|
764
|
-
this._timer = setTimeout(function() {
|
|
765
|
-
self._attempts++;
|
|
766
|
-
if (self._operationTimeoutCb) {
|
|
767
|
-
self._timeout = setTimeout(function() {
|
|
768
|
-
self._operationTimeoutCb(self._attempts);
|
|
769
|
-
}, self._operationTimeout);
|
|
770
|
-
if (self._options.unref) {
|
|
771
|
-
self._timeout.unref();
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
self._fn(self._attempts);
|
|
775
|
-
}, timeout);
|
|
776
|
-
if (this._options.unref) {
|
|
777
|
-
this._timer.unref();
|
|
778
|
-
}
|
|
779
|
-
return true;
|
|
780
|
-
};
|
|
781
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
782
|
-
this._fn = fn;
|
|
783
|
-
if (timeoutOps) {
|
|
784
|
-
if (timeoutOps.timeout) {
|
|
785
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
786
|
-
}
|
|
787
|
-
if (timeoutOps.cb) {
|
|
788
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
var self = this;
|
|
792
|
-
if (this._operationTimeoutCb) {
|
|
793
|
-
this._timeout = setTimeout(function() {
|
|
794
|
-
self._operationTimeoutCb();
|
|
795
|
-
}, self._operationTimeout);
|
|
796
|
-
}
|
|
797
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
798
|
-
this._fn(this._attempts);
|
|
799
|
-
};
|
|
800
|
-
RetryOperation.prototype.try = function(fn) {
|
|
801
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
802
|
-
this.attempt(fn);
|
|
803
|
-
};
|
|
804
|
-
RetryOperation.prototype.start = function(fn) {
|
|
805
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
806
|
-
this.attempt(fn);
|
|
807
|
-
};
|
|
808
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
809
|
-
RetryOperation.prototype.errors = function() {
|
|
810
|
-
return this._errors;
|
|
811
|
-
};
|
|
812
|
-
RetryOperation.prototype.attempts = function() {
|
|
813
|
-
return this._attempts;
|
|
814
|
-
};
|
|
815
|
-
RetryOperation.prototype.mainError = function() {
|
|
816
|
-
if (this._errors.length === 0) {
|
|
817
|
-
return null;
|
|
818
|
-
}
|
|
819
|
-
var counts = {};
|
|
820
|
-
var mainError = null;
|
|
821
|
-
var mainErrorCount = 0;
|
|
822
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
823
|
-
var error = this._errors[i];
|
|
824
|
-
var message = error.message;
|
|
825
|
-
var count = (counts[message] || 0) + 1;
|
|
826
|
-
counts[message] = count;
|
|
827
|
-
if (count >= mainErrorCount) {
|
|
828
|
-
mainError = error;
|
|
829
|
-
mainErrorCount = count;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return mainError;
|
|
833
|
-
};
|
|
794
|
+
method: "DELETE",
|
|
795
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
796
|
+
expectNoContent: true
|
|
797
|
+
});
|
|
834
798
|
}
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
799
|
+
};
|
|
800
|
+
_url6 = /* @__PURE__ */ new WeakMap();
|
|
801
|
+
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
802
|
+
var _url7;
|
|
803
|
+
var _TestClient = class _TestClient2 extends ApiClient {
|
|
804
|
+
constructor(options) {
|
|
805
|
+
super(options);
|
|
806
|
+
}
|
|
807
|
+
/** Fetches all Tests for a project */
|
|
808
|
+
async get(options) {
|
|
809
|
+
const { projectId } = this.options;
|
|
810
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
811
|
+
return await this.apiClient(fetchUri);
|
|
812
|
+
}
|
|
813
|
+
/** Updates or creates (based on id) a Test */
|
|
814
|
+
async upsert(body) {
|
|
815
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
816
|
+
await this.apiClient(fetchUri, {
|
|
817
|
+
method: "PUT",
|
|
818
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
819
|
+
expectNoContent: true
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
/** Deletes a Test */
|
|
823
|
+
async remove(body) {
|
|
824
|
+
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
825
|
+
await this.apiClient(fetchUri, {
|
|
826
|
+
method: "DELETE",
|
|
827
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
828
|
+
expectNoContent: true
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
_url7 = /* @__PURE__ */ new WeakMap();
|
|
833
|
+
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
834
|
+
|
|
835
|
+
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
836
|
+
var Node = class {
|
|
837
|
+
constructor(value) {
|
|
838
|
+
__publicField(this, "value");
|
|
839
|
+
__publicField(this, "next");
|
|
840
|
+
this.value = value;
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
var _head, _tail, _size;
|
|
844
|
+
var Queue = class {
|
|
845
|
+
constructor() {
|
|
846
|
+
__privateAdd(this, _head);
|
|
847
|
+
__privateAdd(this, _tail);
|
|
848
|
+
__privateAdd(this, _size);
|
|
849
|
+
this.clear();
|
|
850
|
+
}
|
|
851
|
+
enqueue(value) {
|
|
852
|
+
const node = new Node(value);
|
|
853
|
+
if (__privateGet(this, _head)) {
|
|
854
|
+
__privateGet(this, _tail).next = node;
|
|
855
|
+
__privateSet(this, _tail, node);
|
|
856
|
+
} else {
|
|
857
|
+
__privateSet(this, _head, node);
|
|
858
|
+
__privateSet(this, _tail, node);
|
|
859
|
+
}
|
|
860
|
+
__privateWrapper(this, _size)._++;
|
|
861
|
+
}
|
|
862
|
+
dequeue() {
|
|
863
|
+
const current = __privateGet(this, _head);
|
|
864
|
+
if (!current) {
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
868
|
+
__privateWrapper(this, _size)._--;
|
|
869
|
+
if (!__privateGet(this, _head)) {
|
|
870
|
+
__privateSet(this, _tail, void 0);
|
|
871
|
+
}
|
|
872
|
+
return current.value;
|
|
873
|
+
}
|
|
874
|
+
peek() {
|
|
875
|
+
if (!__privateGet(this, _head)) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
return __privateGet(this, _head).value;
|
|
879
|
+
}
|
|
880
|
+
clear() {
|
|
881
|
+
__privateSet(this, _head, void 0);
|
|
882
|
+
__privateSet(this, _tail, void 0);
|
|
883
|
+
__privateSet(this, _size, 0);
|
|
884
|
+
}
|
|
885
|
+
get size() {
|
|
886
|
+
return __privateGet(this, _size);
|
|
887
|
+
}
|
|
888
|
+
*[Symbol.iterator]() {
|
|
889
|
+
let current = __privateGet(this, _head);
|
|
890
|
+
while (current) {
|
|
891
|
+
yield current.value;
|
|
892
|
+
current = current.next;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
*drain() {
|
|
896
|
+
while (__privateGet(this, _head)) {
|
|
897
|
+
yield this.dequeue();
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
_head = new WeakMap();
|
|
902
|
+
_tail = new WeakMap();
|
|
903
|
+
_size = new WeakMap();
|
|
904
|
+
|
|
905
|
+
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
906
|
+
function pLimit2(concurrency) {
|
|
907
|
+
validateConcurrency(concurrency);
|
|
908
|
+
const queue = new Queue();
|
|
909
|
+
let activeCount = 0;
|
|
910
|
+
const resumeNext = () => {
|
|
911
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
912
|
+
queue.dequeue()();
|
|
913
|
+
activeCount++;
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
const next = () => {
|
|
917
|
+
activeCount--;
|
|
918
|
+
resumeNext();
|
|
919
|
+
};
|
|
920
|
+
const run = async (function_, resolve, arguments_) => {
|
|
921
|
+
const result = (async () => function_(...arguments_))();
|
|
922
|
+
resolve(result);
|
|
923
|
+
try {
|
|
924
|
+
await result;
|
|
925
|
+
} catch (e) {
|
|
926
|
+
}
|
|
927
|
+
next();
|
|
928
|
+
};
|
|
929
|
+
const enqueue = (function_, resolve, arguments_) => {
|
|
930
|
+
new Promise((internalResolve) => {
|
|
931
|
+
queue.enqueue(internalResolve);
|
|
932
|
+
}).then(
|
|
933
|
+
run.bind(void 0, function_, resolve, arguments_)
|
|
934
|
+
);
|
|
935
|
+
(async () => {
|
|
936
|
+
await Promise.resolve();
|
|
937
|
+
if (activeCount < concurrency) {
|
|
938
|
+
resumeNext();
|
|
871
939
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
940
|
+
})();
|
|
941
|
+
};
|
|
942
|
+
const generator = (function_, ...arguments_) => new Promise((resolve) => {
|
|
943
|
+
enqueue(function_, resolve, arguments_);
|
|
944
|
+
});
|
|
945
|
+
Object.defineProperties(generator, {
|
|
946
|
+
activeCount: {
|
|
947
|
+
get: () => activeCount
|
|
948
|
+
},
|
|
949
|
+
pendingCount: {
|
|
950
|
+
get: () => queue.size
|
|
951
|
+
},
|
|
952
|
+
clearQueue: {
|
|
953
|
+
value() {
|
|
954
|
+
queue.clear();
|
|
887
955
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
956
|
+
},
|
|
957
|
+
concurrency: {
|
|
958
|
+
get: () => concurrency,
|
|
959
|
+
set(newConcurrency) {
|
|
960
|
+
validateConcurrency(newConcurrency);
|
|
961
|
+
concurrency = newConcurrency;
|
|
962
|
+
queueMicrotask(() => {
|
|
963
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
964
|
+
resumeNext();
|
|
893
965
|
}
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
for (var i = 0; i < methods.length; i++) {
|
|
897
|
-
var method = methods[i];
|
|
898
|
-
var original = obj[method];
|
|
899
|
-
obj[method] = function retryWrapper(original2) {
|
|
900
|
-
var op = exports2.operation(options);
|
|
901
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
902
|
-
var callback = args.pop();
|
|
903
|
-
args.push(function(err) {
|
|
904
|
-
if (op.retry(err)) {
|
|
905
|
-
return;
|
|
906
|
-
}
|
|
907
|
-
if (err) {
|
|
908
|
-
arguments[0] = op.mainError();
|
|
909
|
-
}
|
|
910
|
-
callback.apply(this, arguments);
|
|
911
|
-
});
|
|
912
|
-
op.attempt(function() {
|
|
913
|
-
original2.apply(obj, args);
|
|
914
|
-
});
|
|
915
|
-
}.bind(obj, original);
|
|
916
|
-
obj[method].options = options;
|
|
966
|
+
});
|
|
917
967
|
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
return generator;
|
|
971
|
+
}
|
|
972
|
+
function validateConcurrency(concurrency) {
|
|
973
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
974
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
925
975
|
}
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
var
|
|
930
|
-
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
979
|
+
var import_retry = __toESM(require_retry2(), 1);
|
|
980
|
+
|
|
981
|
+
// ../../node_modules/.pnpm/is-network-error@1.3.2/node_modules/is-network-error/index.js
|
|
982
|
+
var objectToString = Object.prototype.toString;
|
|
983
|
+
var isError = (value) => objectToString.call(value) === "[object Error]";
|
|
984
|
+
var errorMessages = /* @__PURE__ */ new Set([
|
|
985
|
+
"network error",
|
|
931
986
|
// Chrome
|
|
932
987
|
"NetworkError when attempting to fetch resource.",
|
|
933
988
|
// Firefox
|
|
934
989
|
"The Internet connection appears to be offline.",
|
|
935
|
-
// Safari
|
|
990
|
+
// Safari 16
|
|
936
991
|
"Network request failed",
|
|
937
992
|
// `cross-fetch`
|
|
938
|
-
"fetch failed"
|
|
993
|
+
"fetch failed",
|
|
994
|
+
// Undici (Node.js)
|
|
995
|
+
"terminated",
|
|
939
996
|
// Undici (Node.js)
|
|
997
|
+
" A network error occurred.",
|
|
998
|
+
// Bun (WebKit)
|
|
999
|
+
"Network connection lost"
|
|
1000
|
+
// Cloudflare Workers (fetch)
|
|
940
1001
|
]);
|
|
1002
|
+
function isNetworkError(error) {
|
|
1003
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
1004
|
+
if (!isValid) {
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
const { message, stack } = error;
|
|
1008
|
+
if (message === "Load failed" || message.startsWith("Load failed (") && message.endsWith(")")) {
|
|
1009
|
+
return stack === void 0 || "__sentry_captured__" in error;
|
|
1010
|
+
}
|
|
1011
|
+
if (message.startsWith("error sending request for url")) {
|
|
1012
|
+
return true;
|
|
1013
|
+
}
|
|
1014
|
+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
return errorMessages.has(message);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// ../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
941
1021
|
var AbortError = class extends Error {
|
|
942
1022
|
constructor(message) {
|
|
943
1023
|
super();
|
|
@@ -958,63 +1038,71 @@ var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
|
958
1038
|
error.retriesLeft = retriesLeft;
|
|
959
1039
|
return error;
|
|
960
1040
|
};
|
|
961
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.has(errorMessage);
|
|
962
|
-
var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new Error(errorMessage) : new DOMException(errorMessage);
|
|
963
1041
|
async function pRetry(input, options) {
|
|
964
1042
|
return new Promise((resolve, reject) => {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
retries: 10,
|
|
969
|
-
...options
|
|
1043
|
+
var _a, _b, _c;
|
|
1044
|
+
options = { ...options };
|
|
1045
|
+
(_a = options.onFailedAttempt) != null ? _a : options.onFailedAttempt = () => {
|
|
970
1046
|
};
|
|
1047
|
+
(_b = options.shouldRetry) != null ? _b : options.shouldRetry = () => true;
|
|
1048
|
+
(_c = options.retries) != null ? _c : options.retries = 10;
|
|
971
1049
|
const operation = import_retry.default.operation(options);
|
|
1050
|
+
const abortHandler = () => {
|
|
1051
|
+
var _a2;
|
|
1052
|
+
operation.stop();
|
|
1053
|
+
reject((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
1054
|
+
};
|
|
1055
|
+
if (options.signal && !options.signal.aborted) {
|
|
1056
|
+
options.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1057
|
+
}
|
|
1058
|
+
const cleanUp = () => {
|
|
1059
|
+
var _a2;
|
|
1060
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortHandler);
|
|
1061
|
+
operation.stop();
|
|
1062
|
+
};
|
|
972
1063
|
operation.attempt(async (attemptNumber) => {
|
|
973
1064
|
try {
|
|
974
|
-
|
|
1065
|
+
const result = await input(attemptNumber);
|
|
1066
|
+
cleanUp();
|
|
1067
|
+
resolve(result);
|
|
975
1068
|
} catch (error) {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
} else {
|
|
1069
|
+
try {
|
|
1070
|
+
if (!(error instanceof Error)) {
|
|
1071
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
1072
|
+
}
|
|
1073
|
+
if (error instanceof AbortError) {
|
|
1074
|
+
throw error.originalError;
|
|
1075
|
+
}
|
|
1076
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
1077
|
+
throw error;
|
|
1078
|
+
}
|
|
987
1079
|
decorateErrorWithCounts(error, attemptNumber, options);
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
reject(error2);
|
|
992
|
-
return;
|
|
1080
|
+
if (!await options.shouldRetry(error)) {
|
|
1081
|
+
operation.stop();
|
|
1082
|
+
reject(error);
|
|
993
1083
|
}
|
|
1084
|
+
await options.onFailedAttempt(error);
|
|
994
1085
|
if (!operation.retry(error)) {
|
|
995
|
-
|
|
1086
|
+
throw operation.mainError();
|
|
996
1087
|
}
|
|
1088
|
+
} catch (finalError) {
|
|
1089
|
+
decorateErrorWithCounts(finalError, attemptNumber, options);
|
|
1090
|
+
cleanUp();
|
|
1091
|
+
reject(finalError);
|
|
997
1092
|
}
|
|
998
1093
|
}
|
|
999
1094
|
});
|
|
1000
|
-
if (options.signal && !options.signal.aborted) {
|
|
1001
|
-
options.signal.addEventListener("abort", () => {
|
|
1002
|
-
operation.stop();
|
|
1003
|
-
const reason = options.signal.reason === void 0 ? getDOMException("The operation was aborted.") : options.signal.reason;
|
|
1004
|
-
reject(reason instanceof Error ? reason : getDOMException(reason));
|
|
1005
|
-
}, {
|
|
1006
|
-
once: true
|
|
1007
|
-
});
|
|
1008
|
-
}
|
|
1009
1095
|
});
|
|
1010
1096
|
}
|
|
1097
|
+
|
|
1098
|
+
// ../../node_modules/.pnpm/p-throttle@6.2.0/node_modules/p-throttle/index.js
|
|
1011
1099
|
var AbortError2 = class extends Error {
|
|
1012
1100
|
constructor() {
|
|
1013
1101
|
super("Throttled function aborted");
|
|
1014
1102
|
this.name = "AbortError";
|
|
1015
1103
|
}
|
|
1016
1104
|
};
|
|
1017
|
-
function pThrottle({ limit, interval, strict }) {
|
|
1105
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
1018
1106
|
if (!Number.isFinite(limit)) {
|
|
1019
1107
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1020
1108
|
}
|
|
@@ -1042,32 +1130,38 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1042
1130
|
const strictTicks = [];
|
|
1043
1131
|
function strictDelay() {
|
|
1044
1132
|
const now = Date.now();
|
|
1045
|
-
if (strictTicks.length
|
|
1046
|
-
strictTicks.
|
|
1047
|
-
return 0;
|
|
1133
|
+
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
1134
|
+
strictTicks.length = 0;
|
|
1048
1135
|
}
|
|
1049
|
-
|
|
1050
|
-
if (now >= earliestTime) {
|
|
1136
|
+
if (strictTicks.length < limit) {
|
|
1051
1137
|
strictTicks.push(now);
|
|
1052
1138
|
return 0;
|
|
1053
1139
|
}
|
|
1054
|
-
strictTicks
|
|
1055
|
-
|
|
1140
|
+
const nextExecutionTime = strictTicks[0] + interval;
|
|
1141
|
+
strictTicks.shift();
|
|
1142
|
+
strictTicks.push(nextExecutionTime);
|
|
1143
|
+
return Math.max(0, nextExecutionTime - now);
|
|
1056
1144
|
}
|
|
1057
1145
|
const getDelay = strict ? strictDelay : windowedDelay;
|
|
1058
1146
|
return (function_) => {
|
|
1059
|
-
const throttled = function(...
|
|
1147
|
+
const throttled = function(...arguments_) {
|
|
1060
1148
|
if (!throttled.isEnabled) {
|
|
1061
|
-
return (async () => function_.apply(this,
|
|
1149
|
+
return (async () => function_.apply(this, arguments_))();
|
|
1062
1150
|
}
|
|
1063
|
-
let
|
|
1151
|
+
let timeoutId;
|
|
1064
1152
|
return new Promise((resolve, reject) => {
|
|
1065
1153
|
const execute = () => {
|
|
1066
|
-
resolve(function_.apply(this,
|
|
1067
|
-
queue.delete(
|
|
1154
|
+
resolve(function_.apply(this, arguments_));
|
|
1155
|
+
queue.delete(timeoutId);
|
|
1068
1156
|
};
|
|
1069
|
-
|
|
1070
|
-
|
|
1157
|
+
const delay = getDelay();
|
|
1158
|
+
if (delay > 0) {
|
|
1159
|
+
timeoutId = setTimeout(execute, delay);
|
|
1160
|
+
queue.set(timeoutId, reject);
|
|
1161
|
+
onDelay == null ? void 0 : onDelay(...arguments_);
|
|
1162
|
+
} else {
|
|
1163
|
+
execute();
|
|
1164
|
+
}
|
|
1071
1165
|
});
|
|
1072
1166
|
};
|
|
1073
1167
|
throttled.abort = () => {
|
|
@@ -1079,16 +1173,29 @@ function pThrottle({ limit, interval, strict }) {
|
|
|
1079
1173
|
strictTicks.splice(0, strictTicks.length);
|
|
1080
1174
|
};
|
|
1081
1175
|
throttled.isEnabled = true;
|
|
1176
|
+
Object.defineProperty(throttled, "queueSize", {
|
|
1177
|
+
get() {
|
|
1178
|
+
return queue.size;
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1082
1181
|
return throttled;
|
|
1083
1182
|
};
|
|
1084
1183
|
}
|
|
1184
|
+
|
|
1185
|
+
// ../canvas/dist/index.mjs
|
|
1186
|
+
var __typeError3 = (msg) => {
|
|
1187
|
+
throw TypeError(msg);
|
|
1188
|
+
};
|
|
1189
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1190
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1191
|
+
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);
|
|
1085
1192
|
function createLimitPolicy({
|
|
1086
1193
|
throttle = { interval: 1e3, limit: 10 },
|
|
1087
|
-
retry:
|
|
1194
|
+
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1088
1195
|
limit = 10
|
|
1089
1196
|
}) {
|
|
1090
1197
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1091
|
-
const limiter = limit ? (
|
|
1198
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
1092
1199
|
return function limitPolicy(func) {
|
|
1093
1200
|
let currentFunc = async () => await func();
|
|
1094
1201
|
if (throttler) {
|
|
@@ -1099,13 +1206,13 @@ function createLimitPolicy({
|
|
|
1099
1206
|
const limitFunc = currentFunc;
|
|
1100
1207
|
currentFunc = () => limiter(limitFunc);
|
|
1101
1208
|
}
|
|
1102
|
-
if (
|
|
1209
|
+
if (retry3) {
|
|
1103
1210
|
const retryFunc = currentFunc;
|
|
1104
1211
|
currentFunc = () => pRetry(retryFunc, {
|
|
1105
|
-
...
|
|
1212
|
+
...retry3,
|
|
1106
1213
|
onFailedAttempt: async (error) => {
|
|
1107
|
-
if (
|
|
1108
|
-
await
|
|
1214
|
+
if (retry3.onFailedAttempt) {
|
|
1215
|
+
await retry3.onFailedAttempt(error);
|
|
1109
1216
|
}
|
|
1110
1217
|
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1111
1218
|
throw error;
|
|
@@ -1116,19 +1223,49 @@ function createLimitPolicy({
|
|
|
1116
1223
|
return currentFunc();
|
|
1117
1224
|
};
|
|
1118
1225
|
}
|
|
1119
|
-
var
|
|
1120
|
-
function
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1226
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1227
|
+
function appendCsv(out, key, values) {
|
|
1228
|
+
if (values === void 0) {
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
out[key] = values.join(",");
|
|
1232
|
+
}
|
|
1233
|
+
function projectionToQuery(spec) {
|
|
1234
|
+
const out = {};
|
|
1235
|
+
if (!spec) {
|
|
1236
|
+
return out;
|
|
1237
|
+
}
|
|
1238
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1239
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1240
|
+
if (fields) {
|
|
1241
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1242
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1243
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1244
|
+
if (fields.blockDepth === "preserveAll" || typeof fields.blockDepth === "number") {
|
|
1245
|
+
out[`${p}fields[blockDepth]`] = String(fields.blockDepth);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
if (fieldTypes) {
|
|
1249
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1250
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1251
|
+
}
|
|
1252
|
+
if (slots) {
|
|
1253
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1254
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1255
|
+
if (typeof slots.depth === "number") {
|
|
1256
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1257
|
+
}
|
|
1258
|
+
if (slots.named) {
|
|
1259
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1260
|
+
for (const slotName of slotNames) {
|
|
1261
|
+
const named = slots.named[slotName];
|
|
1262
|
+
if (named && typeof named.depth === "number") {
|
|
1263
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return out;
|
|
1132
1269
|
}
|
|
1133
1270
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1134
1271
|
var CanvasClient = class extends ApiClient {
|
|
@@ -1144,17 +1281,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1144
1281
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1145
1282
|
async getCompositionList(params = {}) {
|
|
1146
1283
|
const { projectId } = this.options;
|
|
1147
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1148
|
-
const rewrittenFilters =
|
|
1284
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1285
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1286
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1149
1287
|
if (!resolveData) {
|
|
1150
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1288
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1289
|
+
...originParams,
|
|
1290
|
+
projectId,
|
|
1291
|
+
...rewrittenFilters,
|
|
1292
|
+
...rewrittenSelect
|
|
1293
|
+
});
|
|
1151
1294
|
return this.apiClient(fetchUri);
|
|
1152
1295
|
}
|
|
1153
1296
|
const edgeParams = {
|
|
1154
1297
|
...originParams,
|
|
1155
1298
|
projectId,
|
|
1156
1299
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1157
|
-
...rewrittenFilters
|
|
1300
|
+
...rewrittenFilters,
|
|
1301
|
+
...rewrittenSelect
|
|
1158
1302
|
};
|
|
1159
1303
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1160
1304
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1259,20 +1403,26 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1259
1403
|
}
|
|
1260
1404
|
getContentTypes(options) {
|
|
1261
1405
|
const { projectId } = this.options;
|
|
1262
|
-
const fetchUri = this.createUrl(
|
|
1406
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1263
1407
|
return this.apiClient(fetchUri);
|
|
1264
1408
|
}
|
|
1265
1409
|
getEntries(options) {
|
|
1266
1410
|
const { projectId } = this.options;
|
|
1267
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1268
|
-
const rewrittenFilters =
|
|
1411
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1412
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1413
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1269
1414
|
if (skipDataResolution) {
|
|
1270
|
-
const url = this.createUrl(
|
|
1415
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1416
|
+
...params,
|
|
1417
|
+
...rewrittenFilters,
|
|
1418
|
+
...rewrittenSelect,
|
|
1419
|
+
projectId
|
|
1420
|
+
});
|
|
1271
1421
|
return this.apiClient(url);
|
|
1272
1422
|
}
|
|
1273
1423
|
const edgeUrl = this.createUrl(
|
|
1274
|
-
|
|
1275
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1424
|
+
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1425
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1276
1426
|
this.edgeApiHost
|
|
1277
1427
|
);
|
|
1278
1428
|
return this.apiClient(
|
|
@@ -1289,7 +1439,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1289
1439
|
return this.apiClient(historyUrl);
|
|
1290
1440
|
}
|
|
1291
1441
|
async upsertContentType(body, opts = {}) {
|
|
1292
|
-
const fetchUri = this.createUrl(
|
|
1442
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1293
1443
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1294
1444
|
delete body.contentType.slugSettings;
|
|
1295
1445
|
}
|
|
@@ -1301,7 +1451,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1301
1451
|
});
|
|
1302
1452
|
}
|
|
1303
1453
|
async upsertEntry(body, options) {
|
|
1304
|
-
const fetchUri = this.createUrl(
|
|
1454
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1305
1455
|
const headers = {};
|
|
1306
1456
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1307
1457
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1315,7 +1465,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1315
1465
|
return { modified: response.headers.get("x-modified-at") };
|
|
1316
1466
|
}
|
|
1317
1467
|
async deleteContentType(body) {
|
|
1318
|
-
const fetchUri = this.createUrl(
|
|
1468
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
1319
1469
|
await this.apiClient(fetchUri, {
|
|
1320
1470
|
method: "DELETE",
|
|
1321
1471
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1323,7 +1473,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1323
1473
|
});
|
|
1324
1474
|
}
|
|
1325
1475
|
async deleteEntry(body) {
|
|
1326
|
-
const fetchUri = this.createUrl(
|
|
1476
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
1327
1477
|
await this.apiClient(fetchUri, {
|
|
1328
1478
|
method: "DELETE",
|
|
1329
1479
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1342,8 +1492,8 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1342
1492
|
};
|
|
1343
1493
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1344
1494
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1345
|
-
|
|
1346
|
-
|
|
1495
|
+
__privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1496
|
+
__privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1347
1497
|
var _url8;
|
|
1348
1498
|
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
1349
1499
|
constructor(options) {
|
|
@@ -1352,12 +1502,12 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1352
1502
|
/** Fetches all DataTypes for a project */
|
|
1353
1503
|
async get(options) {
|
|
1354
1504
|
const { projectId } = this.options;
|
|
1355
|
-
const fetchUri = this.createUrl(
|
|
1505
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1356
1506
|
return await this.apiClient(fetchUri);
|
|
1357
1507
|
}
|
|
1358
1508
|
/** Updates or creates (based on id) a DataType */
|
|
1359
1509
|
async upsert(body) {
|
|
1360
|
-
const fetchUri = this.createUrl(
|
|
1510
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1361
1511
|
await this.apiClient(fetchUri, {
|
|
1362
1512
|
method: "PUT",
|
|
1363
1513
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1366,7 +1516,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1366
1516
|
}
|
|
1367
1517
|
/** Deletes a DataType */
|
|
1368
1518
|
async remove(body) {
|
|
1369
|
-
const fetchUri = this.createUrl(
|
|
1519
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1370
1520
|
await this.apiClient(fetchUri, {
|
|
1371
1521
|
method: "DELETE",
|
|
1372
1522
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1375,7 +1525,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1375
1525
|
}
|
|
1376
1526
|
};
|
|
1377
1527
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1378
|
-
|
|
1528
|
+
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1379
1529
|
var CANVAS_DRAFT_STATE = 0;
|
|
1380
1530
|
var CANVAS_EDITOR_STATE = 63;
|
|
1381
1531
|
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
@@ -1395,9 +1545,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1395
1545
|
let bufferStartIndex = 0;
|
|
1396
1546
|
let bufferEndIndex = 0;
|
|
1397
1547
|
let tokenCount = 0;
|
|
1398
|
-
const handleToken = (token, type) => {
|
|
1548
|
+
const handleToken = (token, type, offset) => {
|
|
1399
1549
|
tokenCount++;
|
|
1400
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1550
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
1401
1551
|
};
|
|
1402
1552
|
let state = "text";
|
|
1403
1553
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -1408,7 +1558,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1408
1558
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
1409
1559
|
if (serialized[index - 1] === escapeCharacter) {
|
|
1410
1560
|
bufferEndIndex -= escapeCharacter.length;
|
|
1411
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1561
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1412
1562
|
return tokenCount;
|
|
1413
1563
|
}
|
|
1414
1564
|
bufferStartIndex = index;
|
|
@@ -1417,12 +1567,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1417
1567
|
}
|
|
1418
1568
|
if (state === "variable") {
|
|
1419
1569
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1420
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1570
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
1421
1571
|
return tokenCount;
|
|
1422
1572
|
}
|
|
1423
1573
|
bufferStartIndex = bufferEndIndex;
|
|
1424
1574
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1425
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1575
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1426
1576
|
return tokenCount;
|
|
1427
1577
|
}
|
|
1428
1578
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -1440,7 +1590,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1440
1590
|
state = "text";
|
|
1441
1591
|
if (bufferEndIndex > bufferStartIndex) {
|
|
1442
1592
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
1443
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1593
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
1444
1594
|
return tokenCount;
|
|
1445
1595
|
}
|
|
1446
1596
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -1454,7 +1604,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1454
1604
|
bufferStartIndex -= variablePrefix.length;
|
|
1455
1605
|
}
|
|
1456
1606
|
if (bufferStartIndex < serialized.length) {
|
|
1457
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1607
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
1458
1608
|
}
|
|
1459
1609
|
return tokenCount;
|
|
1460
1610
|
}
|
|
@@ -1471,7 +1621,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1471
1621
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1472
1622
|
*/
|
|
1473
1623
|
get(options) {
|
|
1474
|
-
const fetchUri = this.createUrl(
|
|
1624
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1475
1625
|
...options,
|
|
1476
1626
|
teamId: this.teamId
|
|
1477
1627
|
});
|
|
@@ -1481,7 +1631,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1481
1631
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1482
1632
|
*/
|
|
1483
1633
|
async deploy(body) {
|
|
1484
|
-
const fetchUri = this.createUrl(
|
|
1634
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1485
1635
|
await this.apiClient(fetchUri, {
|
|
1486
1636
|
method: "PUT",
|
|
1487
1637
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1492,7 +1642,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1492
1642
|
* Removes a custom AI property editor from a Mesh app.
|
|
1493
1643
|
*/
|
|
1494
1644
|
async delete(body) {
|
|
1495
|
-
const fetchUri = this.createUrl(
|
|
1645
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1496
1646
|
await this.apiClient(fetchUri, {
|
|
1497
1647
|
method: "DELETE",
|
|
1498
1648
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1501,20 +1651,30 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1501
1651
|
}
|
|
1502
1652
|
};
|
|
1503
1653
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1504
|
-
|
|
1654
|
+
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1505
1655
|
var _url22;
|
|
1656
|
+
var _projectsUrl;
|
|
1506
1657
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1507
1658
|
constructor(options) {
|
|
1508
1659
|
super({ ...options, bypassCache: true });
|
|
1509
1660
|
}
|
|
1510
1661
|
/** Fetches single Project */
|
|
1511
1662
|
async get(options) {
|
|
1512
|
-
const fetchUri = this.createUrl(
|
|
1663
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
1664
|
+
return await this.apiClient(fetchUri);
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Fetches projects grouped by team.
|
|
1668
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1669
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1670
|
+
*/
|
|
1671
|
+
async getProjects(options) {
|
|
1672
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1513
1673
|
return await this.apiClient(fetchUri);
|
|
1514
1674
|
}
|
|
1515
1675
|
/** Updates or creates (based on id) a Project */
|
|
1516
1676
|
async upsert(body) {
|
|
1517
|
-
const fetchUri = this.createUrl(
|
|
1677
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1518
1678
|
return await this.apiClient(fetchUri, {
|
|
1519
1679
|
method: "PUT",
|
|
1520
1680
|
body: JSON.stringify({ ...body })
|
|
@@ -1522,7 +1682,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1522
1682
|
}
|
|
1523
1683
|
/** Deletes a Project */
|
|
1524
1684
|
async delete(body) {
|
|
1525
|
-
const fetchUri = this.createUrl(
|
|
1685
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1526
1686
|
await this.apiClient(fetchUri, {
|
|
1527
1687
|
method: "DELETE",
|
|
1528
1688
|
body: JSON.stringify({ ...body }),
|
|
@@ -1531,9 +1691,13 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1531
1691
|
}
|
|
1532
1692
|
};
|
|
1533
1693
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1534
|
-
|
|
1694
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1695
|
+
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
1696
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1535
1697
|
var isAllowedReferrer = (referrer) => {
|
|
1536
|
-
return Boolean(
|
|
1698
|
+
return Boolean(
|
|
1699
|
+
referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|uniformcode.ai|localhost:\d{4})\//)
|
|
1700
|
+
);
|
|
1537
1701
|
};
|
|
1538
1702
|
|
|
1539
1703
|
// src/handler/createPreviewGETRouteHandler.ts
|
|
@@ -1544,6 +1708,9 @@ var import_server = require("next/server");
|
|
|
1544
1708
|
// src/config/helpers.ts
|
|
1545
1709
|
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1546
1710
|
var getMiddlewareRuntimeCache = () => {
|
|
1711
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1712
|
+
return false;
|
|
1713
|
+
}
|
|
1547
1714
|
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1548
1715
|
return import_resolved.default.middlewareRuntimeCache;
|
|
1549
1716
|
}
|
|
@@ -1673,8 +1840,17 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
1673
1840
|
};
|
|
1674
1841
|
};
|
|
1675
1842
|
function validateLocalRedirectUrl(pathToRedirectTo) {
|
|
1676
|
-
if (pathToRedirectTo
|
|
1677
|
-
|
|
1843
|
+
if (!pathToRedirectTo) {
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
let resolved;
|
|
1847
|
+
try {
|
|
1848
|
+
resolved = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
1849
|
+
} catch (e) {
|
|
1850
|
+
throw new Error("Invalid redirect path. Disallowing open redirect.");
|
|
1851
|
+
}
|
|
1852
|
+
if (resolved.origin !== BASE_URL_EXAMPLE) {
|
|
1853
|
+
throw new Error("Tried to redirect off-origin. Disallowing open redirect.");
|
|
1678
1854
|
}
|
|
1679
1855
|
}
|
|
1680
1856
|
var resolveFullPathDefault = ({ slug, path }) => {
|
|
@@ -1771,6 +1947,9 @@ var isDevelopmentEnvironment = () => {
|
|
|
1771
1947
|
};
|
|
1772
1948
|
|
|
1773
1949
|
// src/clients/cache.ts
|
|
1950
|
+
var isSpecificCacheMode = (options) => {
|
|
1951
|
+
return "cache" in options;
|
|
1952
|
+
};
|
|
1774
1953
|
var isStateCacheMode = (options) => {
|
|
1775
1954
|
return "state" in options;
|
|
1776
1955
|
};
|
|
@@ -1792,7 +1971,9 @@ var resolveCache = ({
|
|
|
1792
1971
|
}) => {
|
|
1793
1972
|
let cache = void 0;
|
|
1794
1973
|
if (options) {
|
|
1795
|
-
if (
|
|
1974
|
+
if (isSpecificCacheMode(options)) {
|
|
1975
|
+
cache = options.cache;
|
|
1976
|
+
} else if (isStateCacheMode(options)) {
|
|
1796
1977
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1797
1978
|
cache = {
|
|
1798
1979
|
type: "no-cache",
|
|
@@ -1911,7 +2092,7 @@ function createLimiter(concurrency) {
|
|
|
1911
2092
|
});
|
|
1912
2093
|
};
|
|
1913
2094
|
}
|
|
1914
|
-
async function
|
|
2095
|
+
async function retry2(fn, options) {
|
|
1915
2096
|
let lastError;
|
|
1916
2097
|
let delay = 1e3;
|
|
1917
2098
|
for (let attempt = 1; attempt <= options.retries + 1; attempt++) {
|
|
@@ -1951,7 +2132,7 @@ function createLimitPolicy2({
|
|
|
1951
2132
|
}
|
|
1952
2133
|
if (retryOptions) {
|
|
1953
2134
|
const retryFunc = currentFunc;
|
|
1954
|
-
currentFunc = () =>
|
|
2135
|
+
currentFunc = () => retry2(retryFunc, {
|
|
1955
2136
|
...retryOptions,
|
|
1956
2137
|
onFailedAttempt: async (error) => {
|
|
1957
2138
|
if (retryOptions.onFailedAttempt) {
|
|
@@ -2025,14 +2206,14 @@ var getCanvasClient = (options) => {
|
|
|
2025
2206
|
var import_server_only2 = require("server-only");
|
|
2026
2207
|
|
|
2027
2208
|
// ../project-map/dist/index.mjs
|
|
2028
|
-
var
|
|
2209
|
+
var __typeError4 = (msg) => {
|
|
2029
2210
|
throw TypeError(msg);
|
|
2030
2211
|
};
|
|
2031
|
-
var
|
|
2032
|
-
var
|
|
2033
|
-
var
|
|
2034
|
-
var
|
|
2035
|
-
var __privateMethod = (obj, member, method) => (
|
|
2212
|
+
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
2213
|
+
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2214
|
+
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);
|
|
2215
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2216
|
+
var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
|
|
2036
2217
|
var ProjectMapClient = class extends ApiClient {
|
|
2037
2218
|
constructor(options) {
|
|
2038
2219
|
super(options);
|
|
@@ -2179,12 +2360,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2179
2360
|
var _Route = class _Route2 {
|
|
2180
2361
|
constructor(route) {
|
|
2181
2362
|
this.route = route;
|
|
2182
|
-
|
|
2363
|
+
__privateAdd4(this, _routeInfo);
|
|
2183
2364
|
var _a;
|
|
2184
|
-
|
|
2365
|
+
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2185
2366
|
}
|
|
2186
2367
|
get dynamicSegmentCount() {
|
|
2187
|
-
return
|
|
2368
|
+
return __privateGet4(this, _routeInfo).segments.reduce(
|
|
2188
2369
|
(count, segment) => {
|
|
2189
2370
|
var _a;
|
|
2190
2371
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2196,7 +2377,7 @@ var _Route = class _Route2 {
|
|
|
2196
2377
|
matches(path) {
|
|
2197
2378
|
var _a, _b;
|
|
2198
2379
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2199
|
-
const { segments: routeSegments } =
|
|
2380
|
+
const { segments: routeSegments } = __privateGet4(this, _routeInfo);
|
|
2200
2381
|
if (pathSegments.length !== routeSegments.length) {
|
|
2201
2382
|
return { match: false };
|
|
2202
2383
|
}
|
|
@@ -2217,7 +2398,7 @@ var _Route = class _Route2 {
|
|
|
2217
2398
|
return { match: false };
|
|
2218
2399
|
}
|
|
2219
2400
|
}
|
|
2220
|
-
for (const [key, value] of
|
|
2401
|
+
for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
|
|
2221
2402
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2222
2403
|
}
|
|
2223
2404
|
return possibleMatch;
|
|
@@ -2227,7 +2408,7 @@ var _Route = class _Route2 {
|
|
|
2227
2408
|
*/
|
|
2228
2409
|
expand(options) {
|
|
2229
2410
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2230
|
-
const path =
|
|
2411
|
+
const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
|
|
2231
2412
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2232
2413
|
if (!dynamicSegmentName) {
|
|
2233
2414
|
return segment;
|
|
@@ -2257,6 +2438,35 @@ var _Route = class _Route2 {
|
|
|
2257
2438
|
}
|
|
2258
2439
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2259
2440
|
}
|
|
2441
|
+
/**
|
|
2442
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2443
|
+
* (everything after the first `#`).
|
|
2444
|
+
*
|
|
2445
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2446
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2447
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2448
|
+
*/
|
|
2449
|
+
static splitFragment(path) {
|
|
2450
|
+
let fragmentIndex = -1;
|
|
2451
|
+
parseVariableExpression(path, (token, type, offset) => {
|
|
2452
|
+
if (type === "variable") {
|
|
2453
|
+
return;
|
|
2454
|
+
}
|
|
2455
|
+
const hashOffset = token.indexOf("#");
|
|
2456
|
+
if (hashOffset === -1) {
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
fragmentIndex = offset + hashOffset;
|
|
2460
|
+
return false;
|
|
2461
|
+
});
|
|
2462
|
+
if (fragmentIndex === -1) {
|
|
2463
|
+
return { path, fragment: void 0 };
|
|
2464
|
+
}
|
|
2465
|
+
return {
|
|
2466
|
+
path: path.slice(0, fragmentIndex),
|
|
2467
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2260
2470
|
};
|
|
2261
2471
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2262
2472
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
|
@@ -2278,7 +2488,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2278
2488
|
}
|
|
2279
2489
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2280
2490
|
};
|
|
2281
|
-
|
|
2491
|
+
__privateAdd4(_Route, _Route_static);
|
|
2282
2492
|
_Route.dynamicSegmentPrefix = ":";
|
|
2283
2493
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2284
2494
|
if (!doNotEscapeVariables) {
|