@uniformdev/next-app-router 20.81.1-alpha.4.sha-de16ebeee7 → 20.81.1
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-T7CRvU1H.d.ts → UniformComposition-DBO-oo7J.d.ts} +8 -2
- package/dist/{UniformComposition-fq7Qfhvp.d.mts → UniformComposition-le6UEB_r.d.mts} +8 -2
- package/dist/cache.d.mts +3 -1
- package/dist/cache.d.ts +3 -1
- package/dist/cache.js +811 -127
- package/dist/cache.mjs +810 -126
- package/dist/client-BElN_CWD.d.mts +786 -0
- package/dist/client-BElN_CWD.d.ts +786 -0
- package/dist/compat.d.mts +4 -2
- package/dist/compat.d.ts +4 -2
- package/dist/component.d.mts +1 -10
- package/dist/component.d.ts +1 -10
- package/dist/component.js +617 -113
- package/dist/component.mjs +640 -112
- package/dist/config/default.js +1 -0
- package/dist/config/default.mjs +1 -0
- package/dist/handler.js +616 -87
- package/dist/handler.mjs +614 -85
- package/dist/index.d.mts +36 -15
- package/dist/index.d.ts +36 -15
- package/dist/index.esm.js +5825 -2175
- package/dist/index.js +5839 -2189
- package/dist/index.mjs +5825 -2175
- package/dist/middleware.d.mts +13 -52
- package/dist/middleware.d.ts +13 -52
- package/dist/middleware.js +5741 -405
- package/dist/middleware.mjs +5774 -415
- package/dist/resolveRouteFromCode-BOvjIvM2.d.ts +18 -0
- package/dist/resolveRouteFromCode-CuJ4JHeb.d.mts +18 -0
- package/package.json +9 -24
- package/dist/edge.d.mts +0 -44
- package/dist/edge.d.ts +0 -44
- package/dist/edge.js +0 -751
- package/dist/edge.mjs +0 -720
- package/dist/resolveRouteFromCode-CId7aItt.d.mts +0 -48
- package/dist/resolveRouteFromCode-CId7aItt.d.ts +0 -48
package/dist/handler.js
CHANGED
|
@@ -47,6 +47,124 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
51
|
+
var require_yocto_queue = __commonJS({
|
|
52
|
+
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
|
|
53
|
+
"use strict";
|
|
54
|
+
var Node2 = class {
|
|
55
|
+
/// value;
|
|
56
|
+
/// next;
|
|
57
|
+
constructor(value) {
|
|
58
|
+
this.value = value;
|
|
59
|
+
this.next = void 0;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var Queue2 = class {
|
|
63
|
+
// TODO: Use private class fields when targeting Node.js 12.
|
|
64
|
+
// #_head;
|
|
65
|
+
// #_tail;
|
|
66
|
+
// #_size;
|
|
67
|
+
constructor() {
|
|
68
|
+
this.clear();
|
|
69
|
+
}
|
|
70
|
+
enqueue(value) {
|
|
71
|
+
const node = new Node2(value);
|
|
72
|
+
if (this._head) {
|
|
73
|
+
this._tail.next = node;
|
|
74
|
+
this._tail = node;
|
|
75
|
+
} else {
|
|
76
|
+
this._head = node;
|
|
77
|
+
this._tail = node;
|
|
78
|
+
}
|
|
79
|
+
this._size++;
|
|
80
|
+
}
|
|
81
|
+
dequeue() {
|
|
82
|
+
const current = this._head;
|
|
83
|
+
if (!current) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this._head = this._head.next;
|
|
87
|
+
this._size--;
|
|
88
|
+
return current.value;
|
|
89
|
+
}
|
|
90
|
+
clear() {
|
|
91
|
+
this._head = void 0;
|
|
92
|
+
this._tail = void 0;
|
|
93
|
+
this._size = 0;
|
|
94
|
+
}
|
|
95
|
+
get size() {
|
|
96
|
+
return this._size;
|
|
97
|
+
}
|
|
98
|
+
*[Symbol.iterator]() {
|
|
99
|
+
let current = this._head;
|
|
100
|
+
while (current) {
|
|
101
|
+
yield current.value;
|
|
102
|
+
current = current.next;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
module2.exports = Queue2;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
|
|
111
|
+
var require_p_limit = __commonJS({
|
|
112
|
+
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
|
|
113
|
+
"use strict";
|
|
114
|
+
var Queue2 = require_yocto_queue();
|
|
115
|
+
var pLimit3 = (concurrency) => {
|
|
116
|
+
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
117
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
118
|
+
}
|
|
119
|
+
const queue = new Queue2();
|
|
120
|
+
let activeCount = 0;
|
|
121
|
+
const next = () => {
|
|
122
|
+
activeCount--;
|
|
123
|
+
if (queue.size > 0) {
|
|
124
|
+
queue.dequeue()();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const run = async (fn, resolve, ...args) => {
|
|
128
|
+
activeCount++;
|
|
129
|
+
const result = (async () => fn(...args))();
|
|
130
|
+
resolve(result);
|
|
131
|
+
try {
|
|
132
|
+
await result;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
}
|
|
135
|
+
next();
|
|
136
|
+
};
|
|
137
|
+
const enqueue = (fn, resolve, ...args) => {
|
|
138
|
+
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
139
|
+
(async () => {
|
|
140
|
+
await Promise.resolve();
|
|
141
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
142
|
+
queue.dequeue()();
|
|
143
|
+
}
|
|
144
|
+
})();
|
|
145
|
+
};
|
|
146
|
+
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
147
|
+
enqueue(fn, resolve, ...args);
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperties(generator, {
|
|
150
|
+
activeCount: {
|
|
151
|
+
get: () => activeCount
|
|
152
|
+
},
|
|
153
|
+
pendingCount: {
|
|
154
|
+
get: () => queue.size
|
|
155
|
+
},
|
|
156
|
+
clearQueue: {
|
|
157
|
+
value: () => {
|
|
158
|
+
queue.clear();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return generator;
|
|
163
|
+
};
|
|
164
|
+
module2.exports = pLimit3;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
50
168
|
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
51
169
|
var require_retry_operation = __commonJS({
|
|
52
170
|
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
|
|
@@ -287,9 +405,432 @@ __export(handler_exports, {
|
|
|
287
405
|
});
|
|
288
406
|
module.exports = __toCommonJS(handler_exports);
|
|
289
407
|
|
|
290
|
-
// ../
|
|
291
|
-
var
|
|
292
|
-
var
|
|
408
|
+
// ../context/dist/api/api.mjs
|
|
409
|
+
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
410
|
+
var __defProp2 = Object.defineProperty;
|
|
411
|
+
var __typeError2 = (msg) => {
|
|
412
|
+
throw TypeError(msg);
|
|
413
|
+
};
|
|
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);
|
|
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";
|
|
421
|
+
var ApiClientError = class _ApiClientError extends Error {
|
|
422
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
423
|
+
super(
|
|
424
|
+
`${errorMessage}
|
|
425
|
+
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
426
|
+
);
|
|
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);
|
|
433
|
+
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
434
|
+
}
|
|
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
|
+
};
|
|
442
|
+
var ApiClient = class _ApiClient {
|
|
443
|
+
constructor(options) {
|
|
444
|
+
__publicField2(this, "options");
|
|
445
|
+
var _a, _b, _c, _d, _e;
|
|
446
|
+
if (!options.apiKey && !options.bearerToken) {
|
|
447
|
+
throw new Error("You must provide an API key or a bearer token");
|
|
448
|
+
}
|
|
449
|
+
let leFetch = options.fetch;
|
|
450
|
+
if (!leFetch) {
|
|
451
|
+
if (typeof window !== "undefined") {
|
|
452
|
+
leFetch = window.fetch.bind(window);
|
|
453
|
+
} else if (typeof fetch !== "undefined") {
|
|
454
|
+
leFetch = fetch;
|
|
455
|
+
} else {
|
|
456
|
+
throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
this.options = {
|
|
460
|
+
...options,
|
|
461
|
+
fetch: leFetch,
|
|
462
|
+
apiHost: this.ensureApiHost(options.apiHost),
|
|
463
|
+
apiKey: (_a = options.apiKey) != null ? _a : null,
|
|
464
|
+
projectId: (_b = options.projectId) != null ? _b : null,
|
|
465
|
+
bearerToken: (_c = options.bearerToken) != null ? _c : null,
|
|
466
|
+
limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
|
|
467
|
+
bypassCache: (_e = options.bypassCache) != null ? _e : false
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
async apiClient(fetchUri, options) {
|
|
471
|
+
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
|
472
|
+
}
|
|
473
|
+
async apiClientWithResponse(fetchUri, options) {
|
|
474
|
+
return this.options.limitPolicy(async () => {
|
|
475
|
+
var _a, _b;
|
|
476
|
+
const coreHeaders = this.options.apiKey ? {
|
|
477
|
+
"x-api-key": this.options.apiKey
|
|
478
|
+
} : {
|
|
479
|
+
Authorization: `Bearer ${this.options.bearerToken}`
|
|
480
|
+
};
|
|
481
|
+
if (this.options.bypassCache) {
|
|
482
|
+
coreHeaders["x-bypass-cache"] = "true";
|
|
483
|
+
}
|
|
484
|
+
const { fetch: fetch2, signal } = this.options;
|
|
485
|
+
const callApi = () => fetch2(fetchUri.toString(), {
|
|
486
|
+
...options,
|
|
487
|
+
signal,
|
|
488
|
+
headers: {
|
|
489
|
+
...options == null ? void 0 : options.headers,
|
|
490
|
+
...coreHeaders
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
const apiResponse = await handleRateLimits(callApi);
|
|
494
|
+
if (!apiResponse.ok) {
|
|
495
|
+
let message = "";
|
|
496
|
+
try {
|
|
497
|
+
const responseText = await apiResponse.text();
|
|
498
|
+
try {
|
|
499
|
+
const parsed = JSON.parse(responseText);
|
|
500
|
+
if (parsed.errorMessage) {
|
|
501
|
+
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
502
|
+
} else {
|
|
503
|
+
message = responseText;
|
|
504
|
+
}
|
|
505
|
+
} catch (e) {
|
|
506
|
+
message = responseText;
|
|
507
|
+
}
|
|
508
|
+
} catch (e) {
|
|
509
|
+
message = `General error`;
|
|
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
|
+
}
|
|
521
|
+
throw new ApiClientError(
|
|
522
|
+
message,
|
|
523
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
524
|
+
fetchUri.toString(),
|
|
525
|
+
apiResponse.status,
|
|
526
|
+
apiResponse.statusText,
|
|
527
|
+
_ApiClient.getRequestId(apiResponse)
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
if (options == null ? void 0 : options.expectNoContent) {
|
|
531
|
+
return { response: apiResponse, body: null };
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
response: apiResponse,
|
|
535
|
+
body: await apiResponse.json()
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
createUrl(path, queryParams, hostOverride) {
|
|
540
|
+
const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
|
|
541
|
+
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
|
542
|
+
var _a;
|
|
543
|
+
if (typeof value !== "undefined" && value !== null) {
|
|
544
|
+
url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
return url;
|
|
548
|
+
}
|
|
549
|
+
ensureApiHost(apiHost) {
|
|
550
|
+
if (!apiHost) return "https://uniform.app";
|
|
551
|
+
if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
|
|
552
|
+
throw new Error('Your apiHost must start with "http"');
|
|
553
|
+
}
|
|
554
|
+
if (apiHost.indexOf("/", 8) > -1) {
|
|
555
|
+
throw new Error("Your apiHost must not contain a path element after the domain");
|
|
556
|
+
}
|
|
557
|
+
if (apiHost.indexOf("?") > -1) {
|
|
558
|
+
throw new Error("Your apiHost must not contain a query string");
|
|
559
|
+
}
|
|
560
|
+
if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
|
|
561
|
+
apiHost = apiHost.substring(0, apiHost.length - 1);
|
|
562
|
+
}
|
|
563
|
+
return apiHost;
|
|
564
|
+
}
|
|
565
|
+
static getRequestId(response) {
|
|
566
|
+
const apigRequestId = response.headers.get("apigw-requestid");
|
|
567
|
+
if (apigRequestId) {
|
|
568
|
+
return apigRequestId;
|
|
569
|
+
}
|
|
570
|
+
return void 0;
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
async function handleRateLimits(callApi) {
|
|
574
|
+
var _a;
|
|
575
|
+
const backoffRetries = 5;
|
|
576
|
+
let backoffRetriesLeft = backoffRetries;
|
|
577
|
+
let response;
|
|
578
|
+
while (backoffRetriesLeft > 0) {
|
|
579
|
+
response = await callApi();
|
|
580
|
+
if (response.status !== 429) {
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
let resetWait = 0;
|
|
584
|
+
try {
|
|
585
|
+
const responseClone = response.clone();
|
|
586
|
+
const dateHeader = responseClone.headers.get("date");
|
|
587
|
+
const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
|
|
588
|
+
const body = await responseClone.json();
|
|
589
|
+
const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
|
|
590
|
+
if (typeof serverTime === "number" && typeof resetTime === "number") {
|
|
591
|
+
resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
|
|
592
|
+
}
|
|
593
|
+
} catch (e) {
|
|
594
|
+
}
|
|
595
|
+
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
596
|
+
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
597
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
598
|
+
backoffRetriesLeft -= 1;
|
|
599
|
+
}
|
|
600
|
+
return response;
|
|
601
|
+
}
|
|
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) {
|
|
623
|
+
const { projectId } = this.options;
|
|
624
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
625
|
+
return await this.apiClient(fetchUri);
|
|
626
|
+
}
|
|
627
|
+
/** Updates or creates (based on id) an Aggregate */
|
|
628
|
+
async upsert(body) {
|
|
629
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
630
|
+
await this.apiClient(fetchUri, {
|
|
631
|
+
method: "PUT",
|
|
632
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
633
|
+
expectNoContent: true
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
/** Deletes an Aggregate */
|
|
637
|
+
async remove(body) {
|
|
638
|
+
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
639
|
+
await this.apiClient(fetchUri, {
|
|
640
|
+
method: "DELETE",
|
|
641
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
642
|
+
expectNoContent: true
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
647
|
+
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
648
|
+
var _url2;
|
|
649
|
+
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
650
|
+
constructor(options) {
|
|
651
|
+
super(options);
|
|
652
|
+
}
|
|
653
|
+
/** Fetches the known score dimensions for a project */
|
|
654
|
+
async get(options) {
|
|
655
|
+
const { projectId } = this.options;
|
|
656
|
+
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
657
|
+
return await this.apiClient(fetchUri);
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
_url2 = /* @__PURE__ */ new WeakMap();
|
|
661
|
+
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
662
|
+
var _url3;
|
|
663
|
+
var _valueUrl;
|
|
664
|
+
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
665
|
+
constructor(options) {
|
|
666
|
+
super(options);
|
|
667
|
+
}
|
|
668
|
+
/** Fetches all enrichments and values for a project, grouped by category */
|
|
669
|
+
async get(options) {
|
|
670
|
+
const { projectId } = this.options;
|
|
671
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
672
|
+
return await this.apiClient(fetchUri);
|
|
673
|
+
}
|
|
674
|
+
/** Updates or creates (based on id) an enrichment category */
|
|
675
|
+
async upsertCategory(body) {
|
|
676
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
677
|
+
await this.apiClient(fetchUri, {
|
|
678
|
+
method: "PUT",
|
|
679
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
680
|
+
expectNoContent: true
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
/** Deletes an enrichment category */
|
|
684
|
+
async removeCategory(body) {
|
|
685
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
686
|
+
await this.apiClient(fetchUri, {
|
|
687
|
+
method: "DELETE",
|
|
688
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
689
|
+
expectNoContent: true
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
693
|
+
async upsertValue(body) {
|
|
694
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
695
|
+
await this.apiClient(fetchUri, {
|
|
696
|
+
method: "PUT",
|
|
697
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
698
|
+
expectNoContent: true
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
702
|
+
async removeValue(body) {
|
|
703
|
+
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
704
|
+
await this.apiClient(fetchUri, {
|
|
705
|
+
method: "DELETE",
|
|
706
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
707
|
+
expectNoContent: true
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
_url3 = /* @__PURE__ */ new WeakMap();
|
|
712
|
+
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
713
|
+
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
714
|
+
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
715
|
+
var _url4;
|
|
716
|
+
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
717
|
+
constructor(options) {
|
|
718
|
+
super(options);
|
|
719
|
+
}
|
|
720
|
+
/** Fetches the Context manifest for a project */
|
|
721
|
+
async get(options) {
|
|
722
|
+
const { projectId } = this.options;
|
|
723
|
+
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
724
|
+
return await this.apiClient(fetchUri);
|
|
725
|
+
}
|
|
726
|
+
/** Publishes the Context manifest for a project */
|
|
727
|
+
async publish() {
|
|
728
|
+
const { projectId } = this.options;
|
|
729
|
+
const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
|
|
730
|
+
await this.apiClient(fetchUri, {
|
|
731
|
+
method: "POST",
|
|
732
|
+
expectNoContent: true
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
_url4 = /* @__PURE__ */ new WeakMap();
|
|
737
|
+
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
738
|
+
var _url5;
|
|
739
|
+
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
740
|
+
constructor(options) {
|
|
741
|
+
super(options);
|
|
742
|
+
}
|
|
743
|
+
/** Fetches all Quirks for a project */
|
|
744
|
+
async get(options) {
|
|
745
|
+
const { projectId } = this.options;
|
|
746
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
747
|
+
return await this.apiClient(fetchUri);
|
|
748
|
+
}
|
|
749
|
+
/** Updates or creates (based on id) a Quirk */
|
|
750
|
+
async upsert(body) {
|
|
751
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
752
|
+
await this.apiClient(fetchUri, {
|
|
753
|
+
method: "PUT",
|
|
754
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
755
|
+
expectNoContent: true
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
/** Deletes a Quirk */
|
|
759
|
+
async remove(body) {
|
|
760
|
+
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
761
|
+
await this.apiClient(fetchUri, {
|
|
762
|
+
method: "DELETE",
|
|
763
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
764
|
+
expectNoContent: true
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
_url5 = /* @__PURE__ */ new WeakMap();
|
|
769
|
+
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
770
|
+
var _url6;
|
|
771
|
+
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
772
|
+
constructor(options) {
|
|
773
|
+
super(options);
|
|
774
|
+
}
|
|
775
|
+
/** Fetches all Signals for a project */
|
|
776
|
+
async get(options) {
|
|
777
|
+
const { projectId } = this.options;
|
|
778
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
779
|
+
return await this.apiClient(fetchUri);
|
|
780
|
+
}
|
|
781
|
+
/** Updates or creates (based on id) a Signal */
|
|
782
|
+
async upsert(body) {
|
|
783
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
784
|
+
await this.apiClient(fetchUri, {
|
|
785
|
+
method: "PUT",
|
|
786
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
787
|
+
expectNoContent: true
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
/** Deletes a Signal */
|
|
791
|
+
async remove(body) {
|
|
792
|
+
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
793
|
+
await this.apiClient(fetchUri, {
|
|
794
|
+
method: "DELETE",
|
|
795
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
796
|
+
expectNoContent: true
|
|
797
|
+
});
|
|
798
|
+
}
|
|
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");
|
|
293
834
|
|
|
294
835
|
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
295
836
|
var Node = class {
|
|
@@ -362,7 +903,7 @@ _tail = new WeakMap();
|
|
|
362
903
|
_size = new WeakMap();
|
|
363
904
|
|
|
364
905
|
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
365
|
-
function
|
|
906
|
+
function pLimit2(concurrency) {
|
|
366
907
|
validateConcurrency(concurrency);
|
|
367
908
|
const queue = new Queue();
|
|
368
909
|
let activeCount = 0;
|
|
@@ -642,44 +1183,19 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
642
1183
|
}
|
|
643
1184
|
|
|
644
1185
|
// ../canvas/dist/index.mjs
|
|
645
|
-
var
|
|
646
|
-
var import_api4 = require("@uniformdev/context/api");
|
|
647
|
-
var import_api5 = require("@uniformdev/context/api");
|
|
648
|
-
var import_api6 = require("@uniformdev/context/api");
|
|
649
|
-
var import_api7 = require("@uniformdev/context/api");
|
|
650
|
-
var import_api8 = require("@uniformdev/context/api");
|
|
651
|
-
var import_api9 = require("@uniformdev/context/api");
|
|
652
|
-
var import_api10 = require("@uniformdev/context/api");
|
|
653
|
-
var import_api11 = require("@uniformdev/context/api");
|
|
654
|
-
var import_api12 = require("@uniformdev/context/api");
|
|
655
|
-
var import_api13 = require("@uniformdev/context/api");
|
|
656
|
-
var import_api14 = require("@uniformdev/context/api");
|
|
657
|
-
var import_api15 = require("@uniformdev/context/api");
|
|
658
|
-
var import_api16 = require("@uniformdev/context/api");
|
|
659
|
-
var import_api17 = require("@uniformdev/context/api");
|
|
660
|
-
var import_api18 = require("@uniformdev/context/api");
|
|
661
|
-
var import_api19 = require("@uniformdev/context/api");
|
|
662
|
-
var import_api20 = require("@uniformdev/context/api");
|
|
663
|
-
var import_api21 = require("@uniformdev/context/api");
|
|
664
|
-
var import_api22 = require("@uniformdev/context/api");
|
|
665
|
-
var import_api23 = require("@uniformdev/context/api");
|
|
666
|
-
var import_api24 = require("@uniformdev/context/api");
|
|
667
|
-
var import_api25 = require("@uniformdev/context/api");
|
|
668
|
-
var import_api26 = require("@uniformdev/context/api");
|
|
669
|
-
var import_api27 = require("@uniformdev/context/api");
|
|
670
|
-
var __typeError2 = (msg) => {
|
|
1186
|
+
var __typeError3 = (msg) => {
|
|
671
1187
|
throw TypeError(msg);
|
|
672
1188
|
};
|
|
673
|
-
var
|
|
674
|
-
var
|
|
675
|
-
var
|
|
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);
|
|
676
1192
|
function createLimitPolicy({
|
|
677
1193
|
throttle = { interval: 1e3, limit: 10 },
|
|
678
1194
|
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
679
1195
|
limit = 10
|
|
680
1196
|
}) {
|
|
681
1197
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
682
|
-
const limiter = limit ?
|
|
1198
|
+
const limiter = limit ? pLimit2(limit) : null;
|
|
683
1199
|
return function limitPolicy(func) {
|
|
684
1200
|
let currentFunc = async () => await func();
|
|
685
1201
|
if (throttler) {
|
|
@@ -698,7 +1214,7 @@ function createLimitPolicy({
|
|
|
698
1214
|
if (retry3.onFailedAttempt) {
|
|
699
1215
|
await retry3.onFailedAttempt(error);
|
|
700
1216
|
}
|
|
701
|
-
if (error instanceof
|
|
1217
|
+
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
702
1218
|
throw error;
|
|
703
1219
|
}
|
|
704
1220
|
}
|
|
@@ -707,7 +1223,7 @@ function createLimitPolicy({
|
|
|
707
1223
|
return currentFunc();
|
|
708
1224
|
};
|
|
709
1225
|
}
|
|
710
|
-
var ContentClientBase = class extends
|
|
1226
|
+
var ContentClientBase = class extends ApiClient {
|
|
711
1227
|
constructor(options, defaultBypassCache) {
|
|
712
1228
|
var _a, _b;
|
|
713
1229
|
super({
|
|
@@ -840,7 +1356,7 @@ var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
|
840
1356
|
EDGE_LIST_URL,
|
|
841
1357
|
{
|
|
842
1358
|
...rest,
|
|
843
|
-
...
|
|
1359
|
+
...rewriteFiltersForApi(filters),
|
|
844
1360
|
...projectionToQuery(select),
|
|
845
1361
|
projectId: this.options.projectId,
|
|
846
1362
|
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
@@ -853,7 +1369,7 @@ var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
|
853
1369
|
};
|
|
854
1370
|
var _contentTypesUrl;
|
|
855
1371
|
var _entriesUrl;
|
|
856
|
-
var _ContentClient = class _ContentClient2 extends
|
|
1372
|
+
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
857
1373
|
constructor(options) {
|
|
858
1374
|
var _a;
|
|
859
1375
|
super(options);
|
|
@@ -861,16 +1377,16 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
861
1377
|
}
|
|
862
1378
|
getContentTypes(options) {
|
|
863
1379
|
const { projectId } = this.options;
|
|
864
|
-
const fetchUri = this.createUrl(
|
|
1380
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
865
1381
|
return this.apiClient(fetchUri);
|
|
866
1382
|
}
|
|
867
1383
|
getEntries(options) {
|
|
868
1384
|
const { projectId } = this.options;
|
|
869
1385
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
870
|
-
const rewrittenFilters =
|
|
1386
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
871
1387
|
const rewrittenSelect = projectionToQuery(select);
|
|
872
1388
|
if (skipDataResolution) {
|
|
873
|
-
const url = this.createUrl(
|
|
1389
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
874
1390
|
...params,
|
|
875
1391
|
...rewrittenFilters,
|
|
876
1392
|
...rewrittenSelect,
|
|
@@ -879,7 +1395,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
879
1395
|
return this.apiClient(url);
|
|
880
1396
|
}
|
|
881
1397
|
const edgeUrl = this.createUrl(
|
|
882
|
-
|
|
1398
|
+
__privateGet3(_ContentClient2, _entriesUrl),
|
|
883
1399
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
884
1400
|
this.edgeApiHost
|
|
885
1401
|
);
|
|
@@ -897,7 +1413,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
897
1413
|
return this.apiClient(historyUrl);
|
|
898
1414
|
}
|
|
899
1415
|
async upsertContentType(body, opts = {}) {
|
|
900
|
-
const fetchUri = this.createUrl(
|
|
1416
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
901
1417
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
902
1418
|
delete body.contentType.slugSettings;
|
|
903
1419
|
}
|
|
@@ -909,7 +1425,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
909
1425
|
});
|
|
910
1426
|
}
|
|
911
1427
|
async upsertEntry(body, options) {
|
|
912
|
-
const fetchUri = this.createUrl(
|
|
1428
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
913
1429
|
const headers = {};
|
|
914
1430
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
915
1431
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -923,7 +1439,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
923
1439
|
return { modified: response.headers.get("x-modified-at") };
|
|
924
1440
|
}
|
|
925
1441
|
async deleteContentType(body) {
|
|
926
|
-
const fetchUri = this.createUrl(
|
|
1442
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _contentTypesUrl));
|
|
927
1443
|
await this.apiClient(fetchUri, {
|
|
928
1444
|
method: "DELETE",
|
|
929
1445
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -931,7 +1447,7 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
931
1447
|
});
|
|
932
1448
|
}
|
|
933
1449
|
async deleteEntry(body) {
|
|
934
|
-
const fetchUri = this.createUrl(
|
|
1450
|
+
const fetchUri = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl));
|
|
935
1451
|
await this.apiClient(fetchUri, {
|
|
936
1452
|
method: "DELETE",
|
|
937
1453
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -950,17 +1466,17 @@ var _ContentClient = class _ContentClient2 extends import_api12.ApiClient {
|
|
|
950
1466
|
};
|
|
951
1467
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
952
1468
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
var
|
|
956
|
-
var _DataTypeClient = class _DataTypeClient2 extends
|
|
1469
|
+
__privateAdd3(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
1470
|
+
__privateAdd3(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
1471
|
+
var _url8;
|
|
1472
|
+
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
957
1473
|
constructor(options) {
|
|
958
1474
|
super(options);
|
|
959
1475
|
}
|
|
960
1476
|
/** Fetches a list of DataTypes for a project */
|
|
961
1477
|
async list(options) {
|
|
962
1478
|
const { projectId } = this.options;
|
|
963
|
-
const fetchUri = this.createUrl(
|
|
1479
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
964
1480
|
return await this.apiClient(fetchUri);
|
|
965
1481
|
}
|
|
966
1482
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -969,7 +1485,7 @@ var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
|
|
|
969
1485
|
}
|
|
970
1486
|
/** Updates or creates (based on id) a DataType */
|
|
971
1487
|
async save(body) {
|
|
972
|
-
const fetchUri = this.createUrl(
|
|
1488
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
973
1489
|
await this.apiClient(fetchUri, {
|
|
974
1490
|
method: "PUT",
|
|
975
1491
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -982,7 +1498,7 @@ var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
|
|
|
982
1498
|
}
|
|
983
1499
|
/** Deletes a DataType */
|
|
984
1500
|
async remove(body) {
|
|
985
|
-
const fetchUri = this.createUrl(
|
|
1501
|
+
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
986
1502
|
await this.apiClient(fetchUri, {
|
|
987
1503
|
method: "DELETE",
|
|
988
1504
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -990,8 +1506,8 @@ var _DataTypeClient = class _DataTypeClient2 extends import_api14.ApiClient {
|
|
|
990
1506
|
});
|
|
991
1507
|
}
|
|
992
1508
|
};
|
|
993
|
-
|
|
994
|
-
|
|
1509
|
+
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1510
|
+
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
995
1511
|
var variablePrefix = "${";
|
|
996
1512
|
var variableSuffix = "}";
|
|
997
1513
|
var escapeCharacter = "\\";
|
|
@@ -1069,7 +1585,7 @@ function createVariableReference(variableName) {
|
|
|
1069
1585
|
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
|
1070
1586
|
}
|
|
1071
1587
|
var _baseUrl;
|
|
1072
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends
|
|
1588
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
|
1073
1589
|
constructor(options) {
|
|
1074
1590
|
super(options);
|
|
1075
1591
|
this.teamId = options.teamId;
|
|
@@ -1078,7 +1594,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1078
1594
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1079
1595
|
*/
|
|
1080
1596
|
get(options) {
|
|
1081
|
-
const fetchUri = this.createUrl(
|
|
1597
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1082
1598
|
...options,
|
|
1083
1599
|
teamId: this.teamId
|
|
1084
1600
|
});
|
|
@@ -1088,7 +1604,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1088
1604
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1089
1605
|
*/
|
|
1090
1606
|
async deploy(body) {
|
|
1091
|
-
const fetchUri = this.createUrl(
|
|
1607
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1092
1608
|
await this.apiClient(fetchUri, {
|
|
1093
1609
|
method: "PUT",
|
|
1094
1610
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1099,7 +1615,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1099
1615
|
* Removes a custom AI property editor from a Mesh app.
|
|
1100
1616
|
*/
|
|
1101
1617
|
async delete(body) {
|
|
1102
|
-
const fetchUri = this.createUrl(
|
|
1618
|
+
const fetchUri = this.createUrl(__privateGet3(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1103
1619
|
await this.apiClient(fetchUri, {
|
|
1104
1620
|
method: "DELETE",
|
|
1105
1621
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1108,16 +1624,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1108
1624
|
}
|
|
1109
1625
|
};
|
|
1110
1626
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1111
|
-
|
|
1112
|
-
var
|
|
1627
|
+
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1628
|
+
var _url22;
|
|
1113
1629
|
var _projectsUrl;
|
|
1114
|
-
var _ProjectClient = class _ProjectClient2 extends
|
|
1630
|
+
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1115
1631
|
constructor(options) {
|
|
1116
1632
|
super({ ...options, bypassCache: true });
|
|
1117
1633
|
}
|
|
1118
1634
|
/** Fetches single Project */
|
|
1119
1635
|
async get(options) {
|
|
1120
|
-
const fetchUri = this.createUrl(
|
|
1636
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
|
|
1121
1637
|
return await this.apiClient(fetchUri);
|
|
1122
1638
|
}
|
|
1123
1639
|
/**
|
|
@@ -1126,7 +1642,7 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
|
|
|
1126
1642
|
* When omitted, returns all accessible teams and their projects.
|
|
1127
1643
|
*/
|
|
1128
1644
|
async list(options) {
|
|
1129
|
-
const fetchUri = this.createUrl(
|
|
1645
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1130
1646
|
return await this.apiClient(fetchUri);
|
|
1131
1647
|
}
|
|
1132
1648
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -1135,7 +1651,7 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
|
|
|
1135
1651
|
}
|
|
1136
1652
|
/** Updates or creates (based on id) a Project */
|
|
1137
1653
|
async save(body) {
|
|
1138
|
-
const fetchUri = this.createUrl(
|
|
1654
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1139
1655
|
return await this.apiClient(fetchUri, {
|
|
1140
1656
|
method: "PUT",
|
|
1141
1657
|
body: JSON.stringify({ ...body })
|
|
@@ -1147,7 +1663,7 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
|
|
|
1147
1663
|
}
|
|
1148
1664
|
/** Deletes a Project */
|
|
1149
1665
|
async remove(body) {
|
|
1150
|
-
const fetchUri = this.createUrl(
|
|
1666
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1151
1667
|
await this.apiClient(fetchUri, {
|
|
1152
1668
|
method: "DELETE",
|
|
1153
1669
|
body: JSON.stringify({ ...body }),
|
|
@@ -1159,10 +1675,10 @@ var _ProjectClient = class _ProjectClient2 extends import_api20.ApiClient {
|
|
|
1159
1675
|
return this.remove(body);
|
|
1160
1676
|
}
|
|
1161
1677
|
};
|
|
1162
|
-
|
|
1678
|
+
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1163
1679
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1164
|
-
|
|
1165
|
-
|
|
1680
|
+
__privateAdd3(_ProjectClient, _url22, "/api/v1/project");
|
|
1681
|
+
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1166
1682
|
var ALLOWED_REFERRER_ORIGIN = /^https:\/\/([\w-]+\.)*(uniform\.(app|wtf)|uniformcode\.ai)$|^https?:\/\/localhost:\d{4}$/;
|
|
1167
1683
|
var isAllowedReferrer = (referrer) => {
|
|
1168
1684
|
try {
|
|
@@ -1179,6 +1695,15 @@ var import_server = require("next/server");
|
|
|
1179
1695
|
|
|
1180
1696
|
// src/config/helpers.ts
|
|
1181
1697
|
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1698
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1699
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1700
|
+
return false;
|
|
1701
|
+
}
|
|
1702
|
+
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1703
|
+
return import_resolved.default.middlewareRuntimeCache;
|
|
1704
|
+
}
|
|
1705
|
+
return true;
|
|
1706
|
+
};
|
|
1182
1707
|
var getPlaygroundPath = () => {
|
|
1183
1708
|
if (typeof import_resolved.default.playgroundPath === "string") {
|
|
1184
1709
|
return import_resolved.default.playgroundPath;
|
|
@@ -1355,6 +1880,7 @@ var createPreviewOPTIONSRouteHandler = () => {
|
|
|
1355
1880
|
};
|
|
1356
1881
|
|
|
1357
1882
|
// src/handler/createPreviewPOSTRouteHandler.ts
|
|
1883
|
+
var import_functions = require("@vercel/functions");
|
|
1358
1884
|
var import_cache4 = require("next/cache");
|
|
1359
1885
|
|
|
1360
1886
|
// src/handler/helpers.ts
|
|
@@ -1490,7 +2016,6 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
1490
2016
|
};
|
|
1491
2017
|
|
|
1492
2018
|
// src/clients/retry.ts
|
|
1493
|
-
var import_api28 = require("@uniformdev/context/api");
|
|
1494
2019
|
function createThrottler(limit, interval) {
|
|
1495
2020
|
let available = limit;
|
|
1496
2021
|
let refillScheduled = false;
|
|
@@ -1601,7 +2126,7 @@ function createLimitPolicy2({
|
|
|
1601
2126
|
if (retryOptions.onFailedAttempt) {
|
|
1602
2127
|
await retryOptions.onFailedAttempt(error);
|
|
1603
2128
|
}
|
|
1604
|
-
if (error instanceof
|
|
2129
|
+
if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1605
2130
|
throw error;
|
|
1606
2131
|
}
|
|
1607
2132
|
}
|
|
@@ -1672,16 +2197,15 @@ var getCompositionDeliveryClient = (options) => {
|
|
|
1672
2197
|
var import_server_only2 = require("server-only");
|
|
1673
2198
|
|
|
1674
2199
|
// ../project-map/dist/index.mjs
|
|
1675
|
-
var
|
|
1676
|
-
var __typeError3 = (msg) => {
|
|
2200
|
+
var __typeError4 = (msg) => {
|
|
1677
2201
|
throw TypeError(msg);
|
|
1678
2202
|
};
|
|
1679
|
-
var
|
|
1680
|
-
var
|
|
1681
|
-
var
|
|
1682
|
-
var __privateSet2 = (obj, member, value, setter) => (
|
|
1683
|
-
var __privateMethod = (obj, member, method) => (
|
|
1684
|
-
var ProjectMapClient = class extends
|
|
2203
|
+
var __accessCheck4 = (obj, member, msg) => member.has(obj) || __typeError4("Cannot " + msg);
|
|
2204
|
+
var __privateGet4 = (obj, member, getter) => (__accessCheck4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2205
|
+
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);
|
|
2206
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2207
|
+
var __privateMethod = (obj, member, method) => (__accessCheck4(obj, member, "access private method"), method);
|
|
2208
|
+
var ProjectMapClient = class extends ApiClient {
|
|
1685
2209
|
constructor(options) {
|
|
1686
2210
|
super(options);
|
|
1687
2211
|
this.getProjectMapDefinitions = async () => {
|
|
@@ -1827,12 +2351,12 @@ var isDynamicRouteSegment_fn;
|
|
|
1827
2351
|
var _Route = class _Route2 {
|
|
1828
2352
|
constructor(route) {
|
|
1829
2353
|
this.route = route;
|
|
1830
|
-
|
|
2354
|
+
__privateAdd4(this, _routeInfo);
|
|
1831
2355
|
var _a;
|
|
1832
2356
|
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
1833
2357
|
}
|
|
1834
2358
|
get dynamicSegmentCount() {
|
|
1835
|
-
return
|
|
2359
|
+
return __privateGet4(this, _routeInfo).segments.reduce(
|
|
1836
2360
|
(count, segment) => {
|
|
1837
2361
|
var _a;
|
|
1838
2362
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -1844,7 +2368,7 @@ var _Route = class _Route2 {
|
|
|
1844
2368
|
matches(path) {
|
|
1845
2369
|
var _a, _b;
|
|
1846
2370
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
1847
|
-
const { segments: routeSegments } =
|
|
2371
|
+
const { segments: routeSegments } = __privateGet4(this, _routeInfo);
|
|
1848
2372
|
if (pathSegments.length !== routeSegments.length) {
|
|
1849
2373
|
return { match: false };
|
|
1850
2374
|
}
|
|
@@ -1865,7 +2389,7 @@ var _Route = class _Route2 {
|
|
|
1865
2389
|
return { match: false };
|
|
1866
2390
|
}
|
|
1867
2391
|
}
|
|
1868
|
-
for (const [key, value] of
|
|
2392
|
+
for (const [key, value] of __privateGet4(this, _routeInfo).queryParams) {
|
|
1869
2393
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
1870
2394
|
}
|
|
1871
2395
|
return possibleMatch;
|
|
@@ -1875,7 +2399,7 @@ var _Route = class _Route2 {
|
|
|
1875
2399
|
*/
|
|
1876
2400
|
expand(options) {
|
|
1877
2401
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
1878
|
-
const path =
|
|
2402
|
+
const path = __privateGet4(this, _routeInfo).segments.map((segment) => {
|
|
1879
2403
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
1880
2404
|
if (!dynamicSegmentName) {
|
|
1881
2405
|
return segment;
|
|
@@ -1955,7 +2479,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
1955
2479
|
}
|
|
1956
2480
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
1957
2481
|
};
|
|
1958
|
-
|
|
2482
|
+
__privateAdd4(_Route, _Route_static);
|
|
1959
2483
|
_Route.dynamicSegmentPrefix = ":";
|
|
1960
2484
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
1961
2485
|
if (!doNotEscapeVariables) {
|
|
@@ -2073,7 +2597,7 @@ var getComposition = async ({ compositionId }) => {
|
|
|
2073
2597
|
});
|
|
2074
2598
|
return composition;
|
|
2075
2599
|
} catch (err) {
|
|
2076
|
-
if (err instanceof
|
|
2600
|
+
if (err instanceof ApiClientError && err.statusCode === 404) {
|
|
2077
2601
|
return null;
|
|
2078
2602
|
}
|
|
2079
2603
|
throw err;
|
|
@@ -2328,8 +2852,13 @@ var handleSvixMessage = async (request) => {
|
|
|
2328
2852
|
}
|
|
2329
2853
|
}
|
|
2330
2854
|
if (tags == null ? void 0 : tags.length) {
|
|
2855
|
+
const cache = getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : void 0;
|
|
2331
2856
|
for (let i = 0; i < tags.length; i++) {
|
|
2332
|
-
|
|
2857
|
+
const tag = tags[i];
|
|
2858
|
+
(0, import_cache4.revalidateTag)(tag, "max");
|
|
2859
|
+
if (cache) {
|
|
2860
|
+
await cache.expireTag(tag);
|
|
2861
|
+
}
|
|
2333
2862
|
}
|
|
2334
2863
|
}
|
|
2335
2864
|
if (paths == null ? void 0 : paths.length) {
|