@uniformdev/next-app-router 20.80.2 → 20.81.1-alpha.4.sha-de16ebeee7
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-DBO-oo7J.d.ts → UniformComposition-T7CRvU1H.d.ts} +2 -8
- package/dist/{UniformComposition-le6UEB_r.d.mts → UniformComposition-fq7Qfhvp.d.mts} +2 -8
- package/dist/cache.d.mts +1 -3
- package/dist/cache.d.ts +1 -3
- package/dist/cache.js +127 -811
- package/dist/cache.mjs +126 -810
- package/dist/compat.d.mts +2 -4
- package/dist/compat.d.ts +2 -4
- package/dist/component.d.mts +10 -1
- package/dist/component.d.ts +10 -1
- package/dist/component.js +113 -617
- package/dist/component.mjs +112 -640
- package/dist/config/default.js +0 -1
- package/dist/config/default.mjs +0 -1
- package/dist/edge.d.mts +44 -0
- package/dist/edge.d.ts +44 -0
- package/dist/edge.js +751 -0
- package/dist/edge.mjs +720 -0
- package/dist/handler.js +87 -616
- package/dist/handler.mjs +85 -614
- package/dist/index.d.mts +15 -36
- package/dist/index.d.ts +15 -36
- package/dist/index.esm.js +1935 -5585
- package/dist/index.js +1929 -5579
- package/dist/index.mjs +1935 -5585
- package/dist/middleware.d.mts +52 -13
- package/dist/middleware.d.ts +52 -13
- package/dist/middleware.js +410 -5746
- package/dist/middleware.mjs +417 -5776
- package/dist/resolveRouteFromCode-CId7aItt.d.mts +48 -0
- package/dist/resolveRouteFromCode-CId7aItt.d.ts +48 -0
- package/package.json +24 -9
- package/dist/client-BElN_CWD.d.mts +0 -786
- package/dist/client-BElN_CWD.d.ts +0 -786
- package/dist/resolveRouteFromCode-BOvjIvM2.d.ts +0 -18
- package/dist/resolveRouteFromCode-CuJ4JHeb.d.mts +0 -18
package/dist/handler.mjs
CHANGED
|
@@ -41,124 +41,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
|
|
45
|
-
var require_yocto_queue = __commonJS({
|
|
46
|
-
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
|
|
47
|
-
"use strict";
|
|
48
|
-
var Node2 = class {
|
|
49
|
-
/// value;
|
|
50
|
-
/// next;
|
|
51
|
-
constructor(value) {
|
|
52
|
-
this.value = value;
|
|
53
|
-
this.next = void 0;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var Queue2 = class {
|
|
57
|
-
// TODO: Use private class fields when targeting Node.js 12.
|
|
58
|
-
// #_head;
|
|
59
|
-
// #_tail;
|
|
60
|
-
// #_size;
|
|
61
|
-
constructor() {
|
|
62
|
-
this.clear();
|
|
63
|
-
}
|
|
64
|
-
enqueue(value) {
|
|
65
|
-
const node = new Node2(value);
|
|
66
|
-
if (this._head) {
|
|
67
|
-
this._tail.next = node;
|
|
68
|
-
this._tail = node;
|
|
69
|
-
} else {
|
|
70
|
-
this._head = node;
|
|
71
|
-
this._tail = node;
|
|
72
|
-
}
|
|
73
|
-
this._size++;
|
|
74
|
-
}
|
|
75
|
-
dequeue() {
|
|
76
|
-
const current = this._head;
|
|
77
|
-
if (!current) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this._head = this._head.next;
|
|
81
|
-
this._size--;
|
|
82
|
-
return current.value;
|
|
83
|
-
}
|
|
84
|
-
clear() {
|
|
85
|
-
this._head = void 0;
|
|
86
|
-
this._tail = void 0;
|
|
87
|
-
this._size = 0;
|
|
88
|
-
}
|
|
89
|
-
get size() {
|
|
90
|
-
return this._size;
|
|
91
|
-
}
|
|
92
|
-
*[Symbol.iterator]() {
|
|
93
|
-
let current = this._head;
|
|
94
|
-
while (current) {
|
|
95
|
-
yield current.value;
|
|
96
|
-
current = current.next;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
module.exports = Queue2;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
|
|
105
|
-
var require_p_limit = __commonJS({
|
|
106
|
-
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
|
|
107
|
-
"use strict";
|
|
108
|
-
var Queue2 = require_yocto_queue();
|
|
109
|
-
var pLimit3 = (concurrency) => {
|
|
110
|
-
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
111
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
112
|
-
}
|
|
113
|
-
const queue = new Queue2();
|
|
114
|
-
let activeCount = 0;
|
|
115
|
-
const next = () => {
|
|
116
|
-
activeCount--;
|
|
117
|
-
if (queue.size > 0) {
|
|
118
|
-
queue.dequeue()();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const run = async (fn, resolve, ...args) => {
|
|
122
|
-
activeCount++;
|
|
123
|
-
const result = (async () => fn(...args))();
|
|
124
|
-
resolve(result);
|
|
125
|
-
try {
|
|
126
|
-
await result;
|
|
127
|
-
} catch (e) {
|
|
128
|
-
}
|
|
129
|
-
next();
|
|
130
|
-
};
|
|
131
|
-
const enqueue = (fn, resolve, ...args) => {
|
|
132
|
-
queue.enqueue(run.bind(null, fn, resolve, ...args));
|
|
133
|
-
(async () => {
|
|
134
|
-
await Promise.resolve();
|
|
135
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
136
|
-
queue.dequeue()();
|
|
137
|
-
}
|
|
138
|
-
})();
|
|
139
|
-
};
|
|
140
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
141
|
-
enqueue(fn, resolve, ...args);
|
|
142
|
-
});
|
|
143
|
-
Object.defineProperties(generator, {
|
|
144
|
-
activeCount: {
|
|
145
|
-
get: () => activeCount
|
|
146
|
-
},
|
|
147
|
-
pendingCount: {
|
|
148
|
-
get: () => queue.size
|
|
149
|
-
},
|
|
150
|
-
clearQueue: {
|
|
151
|
-
value: () => {
|
|
152
|
-
queue.clear();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
return generator;
|
|
157
|
-
};
|
|
158
|
-
module.exports = pLimit3;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
44
|
// ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
163
45
|
var require_retry_operation = __commonJS({
|
|
164
46
|
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module) {
|
|
@@ -390,432 +272,9 @@ var require_retry2 = __commonJS({
|
|
|
390
272
|
}
|
|
391
273
|
});
|
|
392
274
|
|
|
393
|
-
// ../
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
var __typeError2 = (msg) => {
|
|
397
|
-
throw TypeError(msg);
|
|
398
|
-
};
|
|
399
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
400
|
-
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
401
|
-
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
402
|
-
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
403
|
-
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
404
|
-
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
405
|
-
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
406
|
-
var ApiClientError = class _ApiClientError extends Error {
|
|
407
|
-
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
408
|
-
super(
|
|
409
|
-
`${errorMessage}
|
|
410
|
-
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
411
|
-
);
|
|
412
|
-
__publicField2(this, "errorMessage", errorMessage);
|
|
413
|
-
__publicField2(this, "fetchMethod", fetchMethod);
|
|
414
|
-
__publicField2(this, "fetchUri", fetchUri);
|
|
415
|
-
__publicField2(this, "statusCode", statusCode);
|
|
416
|
-
__publicField2(this, "statusText", statusText);
|
|
417
|
-
__publicField2(this, "requestId", requestId);
|
|
418
|
-
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
422
|
-
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
423
|
-
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
424
|
-
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
var ApiClient = class _ApiClient {
|
|
428
|
-
constructor(options) {
|
|
429
|
-
__publicField2(this, "options");
|
|
430
|
-
var _a, _b, _c, _d, _e;
|
|
431
|
-
if (!options.apiKey && !options.bearerToken) {
|
|
432
|
-
throw new Error("You must provide an API key or a bearer token");
|
|
433
|
-
}
|
|
434
|
-
let leFetch = options.fetch;
|
|
435
|
-
if (!leFetch) {
|
|
436
|
-
if (typeof window !== "undefined") {
|
|
437
|
-
leFetch = window.fetch.bind(window);
|
|
438
|
-
} else if (typeof fetch !== "undefined") {
|
|
439
|
-
leFetch = fetch;
|
|
440
|
-
} else {
|
|
441
|
-
throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
this.options = {
|
|
445
|
-
...options,
|
|
446
|
-
fetch: leFetch,
|
|
447
|
-
apiHost: this.ensureApiHost(options.apiHost),
|
|
448
|
-
apiKey: (_a = options.apiKey) != null ? _a : null,
|
|
449
|
-
projectId: (_b = options.projectId) != null ? _b : null,
|
|
450
|
-
bearerToken: (_c = options.bearerToken) != null ? _c : null,
|
|
451
|
-
limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
|
|
452
|
-
bypassCache: (_e = options.bypassCache) != null ? _e : false
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
async apiClient(fetchUri, options) {
|
|
456
|
-
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
|
457
|
-
}
|
|
458
|
-
async apiClientWithResponse(fetchUri, options) {
|
|
459
|
-
return this.options.limitPolicy(async () => {
|
|
460
|
-
var _a, _b;
|
|
461
|
-
const coreHeaders = this.options.apiKey ? {
|
|
462
|
-
"x-api-key": this.options.apiKey
|
|
463
|
-
} : {
|
|
464
|
-
Authorization: `Bearer ${this.options.bearerToken}`
|
|
465
|
-
};
|
|
466
|
-
if (this.options.bypassCache) {
|
|
467
|
-
coreHeaders["x-bypass-cache"] = "true";
|
|
468
|
-
}
|
|
469
|
-
const { fetch: fetch2, signal } = this.options;
|
|
470
|
-
const callApi = () => fetch2(fetchUri.toString(), {
|
|
471
|
-
...options,
|
|
472
|
-
signal,
|
|
473
|
-
headers: {
|
|
474
|
-
...options == null ? void 0 : options.headers,
|
|
475
|
-
...coreHeaders
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
const apiResponse = await handleRateLimits(callApi);
|
|
479
|
-
if (!apiResponse.ok) {
|
|
480
|
-
let message = "";
|
|
481
|
-
try {
|
|
482
|
-
const responseText = await apiResponse.text();
|
|
483
|
-
try {
|
|
484
|
-
const parsed = JSON.parse(responseText);
|
|
485
|
-
if (parsed.errorMessage) {
|
|
486
|
-
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
487
|
-
} else {
|
|
488
|
-
message = responseText;
|
|
489
|
-
}
|
|
490
|
-
} catch (e) {
|
|
491
|
-
message = responseText;
|
|
492
|
-
}
|
|
493
|
-
} catch (e) {
|
|
494
|
-
message = `General error`;
|
|
495
|
-
}
|
|
496
|
-
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
497
|
-
throw new BearerTokenNotValidOrExpiredError(
|
|
498
|
-
message,
|
|
499
|
-
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
500
|
-
fetchUri.toString(),
|
|
501
|
-
apiResponse.status,
|
|
502
|
-
apiResponse.statusText,
|
|
503
|
-
_ApiClient.getRequestId(apiResponse)
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
throw new ApiClientError(
|
|
507
|
-
message,
|
|
508
|
-
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
509
|
-
fetchUri.toString(),
|
|
510
|
-
apiResponse.status,
|
|
511
|
-
apiResponse.statusText,
|
|
512
|
-
_ApiClient.getRequestId(apiResponse)
|
|
513
|
-
);
|
|
514
|
-
}
|
|
515
|
-
if (options == null ? void 0 : options.expectNoContent) {
|
|
516
|
-
return { response: apiResponse, body: null };
|
|
517
|
-
}
|
|
518
|
-
return {
|
|
519
|
-
response: apiResponse,
|
|
520
|
-
body: await apiResponse.json()
|
|
521
|
-
};
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
createUrl(path, queryParams, hostOverride) {
|
|
525
|
-
const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
|
|
526
|
-
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
|
527
|
-
var _a;
|
|
528
|
-
if (typeof value !== "undefined" && value !== null) {
|
|
529
|
-
url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
return url;
|
|
533
|
-
}
|
|
534
|
-
ensureApiHost(apiHost) {
|
|
535
|
-
if (!apiHost) return "https://uniform.app";
|
|
536
|
-
if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
|
|
537
|
-
throw new Error('Your apiHost must start with "http"');
|
|
538
|
-
}
|
|
539
|
-
if (apiHost.indexOf("/", 8) > -1) {
|
|
540
|
-
throw new Error("Your apiHost must not contain a path element after the domain");
|
|
541
|
-
}
|
|
542
|
-
if (apiHost.indexOf("?") > -1) {
|
|
543
|
-
throw new Error("Your apiHost must not contain a query string");
|
|
544
|
-
}
|
|
545
|
-
if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
|
|
546
|
-
apiHost = apiHost.substring(0, apiHost.length - 1);
|
|
547
|
-
}
|
|
548
|
-
return apiHost;
|
|
549
|
-
}
|
|
550
|
-
static getRequestId(response) {
|
|
551
|
-
const apigRequestId = response.headers.get("apigw-requestid");
|
|
552
|
-
if (apigRequestId) {
|
|
553
|
-
return apigRequestId;
|
|
554
|
-
}
|
|
555
|
-
return void 0;
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
async function handleRateLimits(callApi) {
|
|
559
|
-
var _a;
|
|
560
|
-
const backoffRetries = 5;
|
|
561
|
-
let backoffRetriesLeft = backoffRetries;
|
|
562
|
-
let response;
|
|
563
|
-
while (backoffRetriesLeft > 0) {
|
|
564
|
-
response = await callApi();
|
|
565
|
-
if (response.status !== 429) {
|
|
566
|
-
break;
|
|
567
|
-
}
|
|
568
|
-
let resetWait = 0;
|
|
569
|
-
try {
|
|
570
|
-
const responseClone = response.clone();
|
|
571
|
-
const dateHeader = responseClone.headers.get("date");
|
|
572
|
-
const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
|
|
573
|
-
const body = await responseClone.json();
|
|
574
|
-
const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
|
|
575
|
-
if (typeof serverTime === "number" && typeof resetTime === "number") {
|
|
576
|
-
resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
|
|
577
|
-
}
|
|
578
|
-
} catch (e) {
|
|
579
|
-
}
|
|
580
|
-
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
581
|
-
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
582
|
-
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
583
|
-
backoffRetriesLeft -= 1;
|
|
584
|
-
}
|
|
585
|
-
return response;
|
|
586
|
-
}
|
|
587
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
588
|
-
function rewriteFiltersForApi(filters) {
|
|
589
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
590
|
-
(acc, [key, value]) => {
|
|
591
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
592
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
593
|
-
return {
|
|
594
|
-
...acc,
|
|
595
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
596
|
-
};
|
|
597
|
-
},
|
|
598
|
-
{}
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
var _url;
|
|
602
|
-
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
603
|
-
constructor(options) {
|
|
604
|
-
super(options);
|
|
605
|
-
}
|
|
606
|
-
/** Fetches all aggregates for a project */
|
|
607
|
-
async get(options) {
|
|
608
|
-
const { projectId } = this.options;
|
|
609
|
-
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
610
|
-
return await this.apiClient(fetchUri);
|
|
611
|
-
}
|
|
612
|
-
/** Updates or creates (based on id) an Aggregate */
|
|
613
|
-
async upsert(body) {
|
|
614
|
-
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
615
|
-
await this.apiClient(fetchUri, {
|
|
616
|
-
method: "PUT",
|
|
617
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
618
|
-
expectNoContent: true
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
/** Deletes an Aggregate */
|
|
622
|
-
async remove(body) {
|
|
623
|
-
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
624
|
-
await this.apiClient(fetchUri, {
|
|
625
|
-
method: "DELETE",
|
|
626
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
627
|
-
expectNoContent: true
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
};
|
|
631
|
-
_url = /* @__PURE__ */ new WeakMap();
|
|
632
|
-
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
633
|
-
var _url2;
|
|
634
|
-
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
635
|
-
constructor(options) {
|
|
636
|
-
super(options);
|
|
637
|
-
}
|
|
638
|
-
/** Fetches the known score dimensions for a project */
|
|
639
|
-
async get(options) {
|
|
640
|
-
const { projectId } = this.options;
|
|
641
|
-
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
642
|
-
return await this.apiClient(fetchUri);
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
_url2 = /* @__PURE__ */ new WeakMap();
|
|
646
|
-
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
647
|
-
var _url3;
|
|
648
|
-
var _valueUrl;
|
|
649
|
-
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
650
|
-
constructor(options) {
|
|
651
|
-
super(options);
|
|
652
|
-
}
|
|
653
|
-
/** Fetches all enrichments and values for a project, grouped by category */
|
|
654
|
-
async get(options) {
|
|
655
|
-
const { projectId } = this.options;
|
|
656
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
657
|
-
return await this.apiClient(fetchUri);
|
|
658
|
-
}
|
|
659
|
-
/** Updates or creates (based on id) an enrichment category */
|
|
660
|
-
async upsertCategory(body) {
|
|
661
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
662
|
-
await this.apiClient(fetchUri, {
|
|
663
|
-
method: "PUT",
|
|
664
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
665
|
-
expectNoContent: true
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
/** Deletes an enrichment category */
|
|
669
|
-
async removeCategory(body) {
|
|
670
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
671
|
-
await this.apiClient(fetchUri, {
|
|
672
|
-
method: "DELETE",
|
|
673
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
674
|
-
expectNoContent: true
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
678
|
-
async upsertValue(body) {
|
|
679
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
680
|
-
await this.apiClient(fetchUri, {
|
|
681
|
-
method: "PUT",
|
|
682
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
683
|
-
expectNoContent: true
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
687
|
-
async removeValue(body) {
|
|
688
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
689
|
-
await this.apiClient(fetchUri, {
|
|
690
|
-
method: "DELETE",
|
|
691
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
692
|
-
expectNoContent: true
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
_url3 = /* @__PURE__ */ new WeakMap();
|
|
697
|
-
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
698
|
-
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
699
|
-
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
700
|
-
var _url4;
|
|
701
|
-
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
702
|
-
constructor(options) {
|
|
703
|
-
super(options);
|
|
704
|
-
}
|
|
705
|
-
/** Fetches the Context manifest for a project */
|
|
706
|
-
async get(options) {
|
|
707
|
-
const { projectId } = this.options;
|
|
708
|
-
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
709
|
-
return await this.apiClient(fetchUri);
|
|
710
|
-
}
|
|
711
|
-
/** Publishes the Context manifest for a project */
|
|
712
|
-
async publish() {
|
|
713
|
-
const { projectId } = this.options;
|
|
714
|
-
const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
|
|
715
|
-
await this.apiClient(fetchUri, {
|
|
716
|
-
method: "POST",
|
|
717
|
-
expectNoContent: true
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
_url4 = /* @__PURE__ */ new WeakMap();
|
|
722
|
-
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
723
|
-
var _url5;
|
|
724
|
-
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
725
|
-
constructor(options) {
|
|
726
|
-
super(options);
|
|
727
|
-
}
|
|
728
|
-
/** Fetches all Quirks for a project */
|
|
729
|
-
async get(options) {
|
|
730
|
-
const { projectId } = this.options;
|
|
731
|
-
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
732
|
-
return await this.apiClient(fetchUri);
|
|
733
|
-
}
|
|
734
|
-
/** Updates or creates (based on id) a Quirk */
|
|
735
|
-
async upsert(body) {
|
|
736
|
-
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
737
|
-
await this.apiClient(fetchUri, {
|
|
738
|
-
method: "PUT",
|
|
739
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
740
|
-
expectNoContent: true
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
/** Deletes a Quirk */
|
|
744
|
-
async remove(body) {
|
|
745
|
-
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
746
|
-
await this.apiClient(fetchUri, {
|
|
747
|
-
method: "DELETE",
|
|
748
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
749
|
-
expectNoContent: true
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
_url5 = /* @__PURE__ */ new WeakMap();
|
|
754
|
-
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
755
|
-
var _url6;
|
|
756
|
-
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
757
|
-
constructor(options) {
|
|
758
|
-
super(options);
|
|
759
|
-
}
|
|
760
|
-
/** Fetches all Signals for a project */
|
|
761
|
-
async get(options) {
|
|
762
|
-
const { projectId } = this.options;
|
|
763
|
-
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
764
|
-
return await this.apiClient(fetchUri);
|
|
765
|
-
}
|
|
766
|
-
/** Updates or creates (based on id) a Signal */
|
|
767
|
-
async upsert(body) {
|
|
768
|
-
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
769
|
-
await this.apiClient(fetchUri, {
|
|
770
|
-
method: "PUT",
|
|
771
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
772
|
-
expectNoContent: true
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
/** Deletes a Signal */
|
|
776
|
-
async remove(body) {
|
|
777
|
-
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
778
|
-
await this.apiClient(fetchUri, {
|
|
779
|
-
method: "DELETE",
|
|
780
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
781
|
-
expectNoContent: true
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
_url6 = /* @__PURE__ */ new WeakMap();
|
|
786
|
-
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
787
|
-
var _url7;
|
|
788
|
-
var _TestClient = class _TestClient2 extends ApiClient {
|
|
789
|
-
constructor(options) {
|
|
790
|
-
super(options);
|
|
791
|
-
}
|
|
792
|
-
/** Fetches all Tests for a project */
|
|
793
|
-
async get(options) {
|
|
794
|
-
const { projectId } = this.options;
|
|
795
|
-
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
796
|
-
return await this.apiClient(fetchUri);
|
|
797
|
-
}
|
|
798
|
-
/** Updates or creates (based on id) a Test */
|
|
799
|
-
async upsert(body) {
|
|
800
|
-
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
801
|
-
await this.apiClient(fetchUri, {
|
|
802
|
-
method: "PUT",
|
|
803
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
804
|
-
expectNoContent: true
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
/** Deletes a Test */
|
|
808
|
-
async remove(body) {
|
|
809
|
-
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
810
|
-
await this.apiClient(fetchUri, {
|
|
811
|
-
method: "DELETE",
|
|
812
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
813
|
-
expectNoContent: true
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
_url7 = /* @__PURE__ */ new WeakMap();
|
|
818
|
-
__privateAdd2(_TestClient, _url7, "/api/v2/test");
|
|
275
|
+
// ../canvas/dist/index.mjs
|
|
276
|
+
import { ApiClient } from "@uniformdev/context/api";
|
|
277
|
+
import { ApiClientError } from "@uniformdev/context/api";
|
|
819
278
|
|
|
820
279
|
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
821
280
|
var Node = class {
|
|
@@ -888,7 +347,7 @@ _tail = new WeakMap();
|
|
|
888
347
|
_size = new WeakMap();
|
|
889
348
|
|
|
890
349
|
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
891
|
-
function
|
|
350
|
+
function pLimit(concurrency) {
|
|
892
351
|
validateConcurrency(concurrency);
|
|
893
352
|
const queue = new Queue();
|
|
894
353
|
let activeCount = 0;
|
|
@@ -1168,19 +627,44 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1168
627
|
}
|
|
1169
628
|
|
|
1170
629
|
// ../canvas/dist/index.mjs
|
|
1171
|
-
|
|
630
|
+
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
631
|
+
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
|
632
|
+
import { rewriteFiltersForApi } from "@uniformdev/context/api";
|
|
633
|
+
import { rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
634
|
+
import { ApiClientError as ApiClientError3 } from "@uniformdev/context/api";
|
|
635
|
+
import { rewriteFiltersForApi as rewriteFiltersForApi3 } from "@uniformdev/context/api";
|
|
636
|
+
import { ApiClientError as ApiClientError4 } from "@uniformdev/context/api";
|
|
637
|
+
import { rewriteFiltersForApi as rewriteFiltersForApi4 } from "@uniformdev/context/api";
|
|
638
|
+
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi5 } from "@uniformdev/context/api";
|
|
639
|
+
import { ApiClient as ApiClient4, rewriteFiltersForApi as rewriteFiltersForApi6 } from "@uniformdev/context/api";
|
|
640
|
+
import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
|
|
641
|
+
import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
|
|
642
|
+
import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
|
|
643
|
+
import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
|
|
644
|
+
import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
|
|
645
|
+
import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
|
|
646
|
+
import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
|
|
647
|
+
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
648
|
+
import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
|
|
649
|
+
import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
|
|
650
|
+
import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
|
|
651
|
+
import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
|
|
652
|
+
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
653
|
+
import { ApiClientError as ApiClientError5 } from "@uniformdev/context/api";
|
|
654
|
+
import { ApiClient as ApiClient18 } from "@uniformdev/context/api";
|
|
655
|
+
var __typeError2 = (msg) => {
|
|
1172
656
|
throw TypeError(msg);
|
|
1173
657
|
};
|
|
1174
|
-
var
|
|
1175
|
-
var
|
|
1176
|
-
var
|
|
658
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
659
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
660
|
+
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);
|
|
1177
661
|
function createLimitPolicy({
|
|
1178
662
|
throttle = { interval: 1e3, limit: 10 },
|
|
1179
663
|
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1180
664
|
limit = 10
|
|
1181
665
|
}) {
|
|
1182
666
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1183
|
-
const limiter = limit ?
|
|
667
|
+
const limiter = limit ? pLimit(limit) : null;
|
|
1184
668
|
return function limitPolicy(func) {
|
|
1185
669
|
let currentFunc = async () => await func();
|
|
1186
670
|
if (throttler) {
|
|
@@ -1208,7 +692,7 @@ function createLimitPolicy({
|
|
|
1208
692
|
return currentFunc();
|
|
1209
693
|
};
|
|
1210
694
|
}
|
|
1211
|
-
var ContentClientBase = class extends
|
|
695
|
+
var ContentClientBase = class extends ApiClient2 {
|
|
1212
696
|
constructor(options, defaultBypassCache) {
|
|
1213
697
|
var _a, _b;
|
|
1214
698
|
super({
|
|
@@ -1354,7 +838,7 @@ var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
|
1354
838
|
};
|
|
1355
839
|
var _contentTypesUrl;
|
|
1356
840
|
var _entriesUrl;
|
|
1357
|
-
var _ContentClient = class _ContentClient2 extends
|
|
841
|
+
var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
1358
842
|
constructor(options) {
|
|
1359
843
|
var _a;
|
|
1360
844
|
super(options);
|
|
@@ -1362,16 +846,16 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1362
846
|
}
|
|
1363
847
|
getContentTypes(options) {
|
|
1364
848
|
const { projectId } = this.options;
|
|
1365
|
-
const fetchUri = this.createUrl(
|
|
849
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1366
850
|
return this.apiClient(fetchUri);
|
|
1367
851
|
}
|
|
1368
852
|
getEntries(options) {
|
|
1369
853
|
const { projectId } = this.options;
|
|
1370
854
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
1371
|
-
const rewrittenFilters =
|
|
855
|
+
const rewrittenFilters = rewriteFiltersForApi6(filters);
|
|
1372
856
|
const rewrittenSelect = projectionToQuery(select);
|
|
1373
857
|
if (skipDataResolution) {
|
|
1374
|
-
const url = this.createUrl(
|
|
858
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1375
859
|
...params,
|
|
1376
860
|
...rewrittenFilters,
|
|
1377
861
|
...rewrittenSelect,
|
|
@@ -1380,7 +864,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1380
864
|
return this.apiClient(url);
|
|
1381
865
|
}
|
|
1382
866
|
const edgeUrl = this.createUrl(
|
|
1383
|
-
|
|
867
|
+
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1384
868
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1385
869
|
this.edgeApiHost
|
|
1386
870
|
);
|
|
@@ -1398,7 +882,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1398
882
|
return this.apiClient(historyUrl);
|
|
1399
883
|
}
|
|
1400
884
|
async upsertContentType(body, opts = {}) {
|
|
1401
|
-
const fetchUri = this.createUrl(
|
|
885
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1402
886
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1403
887
|
delete body.contentType.slugSettings;
|
|
1404
888
|
}
|
|
@@ -1410,7 +894,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1410
894
|
});
|
|
1411
895
|
}
|
|
1412
896
|
async upsertEntry(body, options) {
|
|
1413
|
-
const fetchUri = this.createUrl(
|
|
897
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1414
898
|
const headers = {};
|
|
1415
899
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1416
900
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1424,7 +908,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1424
908
|
return { modified: response.headers.get("x-modified-at") };
|
|
1425
909
|
}
|
|
1426
910
|
async deleteContentType(body) {
|
|
1427
|
-
const fetchUri = this.createUrl(
|
|
911
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1428
912
|
await this.apiClient(fetchUri, {
|
|
1429
913
|
method: "DELETE",
|
|
1430
914
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1432,7 +916,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1432
916
|
});
|
|
1433
917
|
}
|
|
1434
918
|
async deleteEntry(body) {
|
|
1435
|
-
const fetchUri = this.createUrl(
|
|
919
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1436
920
|
await this.apiClient(fetchUri, {
|
|
1437
921
|
method: "DELETE",
|
|
1438
922
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1451,17 +935,17 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1451
935
|
};
|
|
1452
936
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1453
937
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
var
|
|
1457
|
-
var _DataTypeClient = class _DataTypeClient2 extends
|
|
938
|
+
__privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
939
|
+
__privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
940
|
+
var _url;
|
|
941
|
+
var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
|
|
1458
942
|
constructor(options) {
|
|
1459
943
|
super(options);
|
|
1460
944
|
}
|
|
1461
945
|
/** Fetches a list of DataTypes for a project */
|
|
1462
946
|
async list(options) {
|
|
1463
947
|
const { projectId } = this.options;
|
|
1464
|
-
const fetchUri = this.createUrl(
|
|
948
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url), { ...options, projectId });
|
|
1465
949
|
return await this.apiClient(fetchUri);
|
|
1466
950
|
}
|
|
1467
951
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -1470,7 +954,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1470
954
|
}
|
|
1471
955
|
/** Updates or creates (based on id) a DataType */
|
|
1472
956
|
async save(body) {
|
|
1473
|
-
const fetchUri = this.createUrl(
|
|
957
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
|
|
1474
958
|
await this.apiClient(fetchUri, {
|
|
1475
959
|
method: "PUT",
|
|
1476
960
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1483,7 +967,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1483
967
|
}
|
|
1484
968
|
/** Deletes a DataType */
|
|
1485
969
|
async remove(body) {
|
|
1486
|
-
const fetchUri = this.createUrl(
|
|
970
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
|
|
1487
971
|
await this.apiClient(fetchUri, {
|
|
1488
972
|
method: "DELETE",
|
|
1489
973
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1491,8 +975,8 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1491
975
|
});
|
|
1492
976
|
}
|
|
1493
977
|
};
|
|
1494
|
-
|
|
1495
|
-
|
|
978
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
979
|
+
__privateAdd2(_DataTypeClient, _url, "/api/v1/data-types");
|
|
1496
980
|
var variablePrefix = "${";
|
|
1497
981
|
var variableSuffix = "}";
|
|
1498
982
|
var escapeCharacter = "\\";
|
|
@@ -1570,7 +1054,7 @@ function createVariableReference(variableName) {
|
|
|
1570
1054
|
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
|
1571
1055
|
}
|
|
1572
1056
|
var _baseUrl;
|
|
1573
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends
|
|
1057
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient8 {
|
|
1574
1058
|
constructor(options) {
|
|
1575
1059
|
super(options);
|
|
1576
1060
|
this.teamId = options.teamId;
|
|
@@ -1579,7 +1063,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1579
1063
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1580
1064
|
*/
|
|
1581
1065
|
get(options) {
|
|
1582
|
-
const fetchUri = this.createUrl(
|
|
1066
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1583
1067
|
...options,
|
|
1584
1068
|
teamId: this.teamId
|
|
1585
1069
|
});
|
|
@@ -1589,7 +1073,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1589
1073
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1590
1074
|
*/
|
|
1591
1075
|
async deploy(body) {
|
|
1592
|
-
const fetchUri = this.createUrl(
|
|
1076
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1593
1077
|
await this.apiClient(fetchUri, {
|
|
1594
1078
|
method: "PUT",
|
|
1595
1079
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1600,7 +1084,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1600
1084
|
* Removes a custom AI property editor from a Mesh app.
|
|
1601
1085
|
*/
|
|
1602
1086
|
async delete(body) {
|
|
1603
|
-
const fetchUri = this.createUrl(
|
|
1087
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1604
1088
|
await this.apiClient(fetchUri, {
|
|
1605
1089
|
method: "DELETE",
|
|
1606
1090
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1609,16 +1093,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1609
1093
|
}
|
|
1610
1094
|
};
|
|
1611
1095
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1612
|
-
|
|
1613
|
-
var
|
|
1096
|
+
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1097
|
+
var _url2;
|
|
1614
1098
|
var _projectsUrl;
|
|
1615
|
-
var _ProjectClient = class _ProjectClient2 extends
|
|
1099
|
+
var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
|
|
1616
1100
|
constructor(options) {
|
|
1617
1101
|
super({ ...options, bypassCache: true });
|
|
1618
1102
|
}
|
|
1619
1103
|
/** Fetches single Project */
|
|
1620
1104
|
async get(options) {
|
|
1621
|
-
const fetchUri = this.createUrl(
|
|
1105
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2), { ...options });
|
|
1622
1106
|
return await this.apiClient(fetchUri);
|
|
1623
1107
|
}
|
|
1624
1108
|
/**
|
|
@@ -1627,7 +1111,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1627
1111
|
* When omitted, returns all accessible teams and their projects.
|
|
1628
1112
|
*/
|
|
1629
1113
|
async list(options) {
|
|
1630
|
-
const fetchUri = this.createUrl(
|
|
1114
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1631
1115
|
return await this.apiClient(fetchUri);
|
|
1632
1116
|
}
|
|
1633
1117
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -1636,7 +1120,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1636
1120
|
}
|
|
1637
1121
|
/** Updates or creates (based on id) a Project */
|
|
1638
1122
|
async save(body) {
|
|
1639
|
-
const fetchUri = this.createUrl(
|
|
1123
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
|
|
1640
1124
|
return await this.apiClient(fetchUri, {
|
|
1641
1125
|
method: "PUT",
|
|
1642
1126
|
body: JSON.stringify({ ...body })
|
|
@@ -1648,7 +1132,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1648
1132
|
}
|
|
1649
1133
|
/** Deletes a Project */
|
|
1650
1134
|
async remove(body) {
|
|
1651
|
-
const fetchUri = this.createUrl(
|
|
1135
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
|
|
1652
1136
|
await this.apiClient(fetchUri, {
|
|
1653
1137
|
method: "DELETE",
|
|
1654
1138
|
body: JSON.stringify({ ...body }),
|
|
@@ -1660,10 +1144,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1660
1144
|
return this.remove(body);
|
|
1661
1145
|
}
|
|
1662
1146
|
};
|
|
1663
|
-
|
|
1147
|
+
_url2 = /* @__PURE__ */ new WeakMap();
|
|
1664
1148
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1665
|
-
|
|
1666
|
-
|
|
1149
|
+
__privateAdd2(_ProjectClient, _url2, "/api/v1/project");
|
|
1150
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1667
1151
|
var ALLOWED_REFERRER_ORIGIN = /^https:\/\/([\w-]+\.)*(uniform\.(app|wtf)|uniformcode\.ai)$|^https?:\/\/localhost:\d{4}$/;
|
|
1668
1152
|
var isAllowedReferrer = (referrer) => {
|
|
1669
1153
|
try {
|
|
@@ -1680,15 +1164,6 @@ import { NextResponse } from "next/server";
|
|
|
1680
1164
|
|
|
1681
1165
|
// src/config/helpers.ts
|
|
1682
1166
|
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1683
|
-
var getMiddlewareRuntimeCache = () => {
|
|
1684
|
-
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1685
|
-
return false;
|
|
1686
|
-
}
|
|
1687
|
-
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1688
|
-
return config.middlewareRuntimeCache;
|
|
1689
|
-
}
|
|
1690
|
-
return true;
|
|
1691
|
-
};
|
|
1692
1167
|
var getPlaygroundPath = () => {
|
|
1693
1168
|
if (typeof config.playgroundPath === "string") {
|
|
1694
1169
|
return config.playgroundPath;
|
|
@@ -1865,7 +1340,6 @@ var createPreviewOPTIONSRouteHandler = () => {
|
|
|
1865
1340
|
};
|
|
1866
1341
|
|
|
1867
1342
|
// src/handler/createPreviewPOSTRouteHandler.ts
|
|
1868
|
-
import { getCache } from "@vercel/functions";
|
|
1869
1343
|
import { revalidatePath, revalidateTag } from "next/cache";
|
|
1870
1344
|
|
|
1871
1345
|
// src/handler/helpers.ts
|
|
@@ -2001,6 +1475,7 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
2001
1475
|
};
|
|
2002
1476
|
|
|
2003
1477
|
// src/clients/retry.ts
|
|
1478
|
+
import { ApiClientError as ApiClientError6 } from "@uniformdev/context/api";
|
|
2004
1479
|
function createThrottler(limit, interval) {
|
|
2005
1480
|
let available = limit;
|
|
2006
1481
|
let refillScheduled = false;
|
|
@@ -2111,7 +1586,7 @@ function createLimitPolicy2({
|
|
|
2111
1586
|
if (retryOptions.onFailedAttempt) {
|
|
2112
1587
|
await retryOptions.onFailedAttempt(error);
|
|
2113
1588
|
}
|
|
2114
|
-
if (error instanceof
|
|
1589
|
+
if (error instanceof ApiClientError6 && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
2115
1590
|
throw error;
|
|
2116
1591
|
}
|
|
2117
1592
|
}
|
|
@@ -2182,15 +1657,16 @@ var getCompositionDeliveryClient = (options) => {
|
|
|
2182
1657
|
import "server-only";
|
|
2183
1658
|
|
|
2184
1659
|
// ../project-map/dist/index.mjs
|
|
2185
|
-
|
|
1660
|
+
import { ApiClient as ApiClient19 } from "@uniformdev/context/api";
|
|
1661
|
+
var __typeError3 = (msg) => {
|
|
2186
1662
|
throw TypeError(msg);
|
|
2187
1663
|
};
|
|
2188
|
-
var
|
|
2189
|
-
var
|
|
2190
|
-
var
|
|
2191
|
-
var __privateSet2 = (obj, member, value, setter) => (
|
|
2192
|
-
var __privateMethod = (obj, member, method) => (
|
|
2193
|
-
var ProjectMapClient = class extends
|
|
1664
|
+
var __accessCheck3 = (obj, member, msg) => member.has(obj) || __typeError3("Cannot " + msg);
|
|
1665
|
+
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1666
|
+
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);
|
|
1667
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
1668
|
+
var __privateMethod = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
|
|
1669
|
+
var ProjectMapClient = class extends ApiClient19 {
|
|
2194
1670
|
constructor(options) {
|
|
2195
1671
|
super(options);
|
|
2196
1672
|
this.getProjectMapDefinitions = async () => {
|
|
@@ -2336,12 +1812,12 @@ var isDynamicRouteSegment_fn;
|
|
|
2336
1812
|
var _Route = class _Route2 {
|
|
2337
1813
|
constructor(route) {
|
|
2338
1814
|
this.route = route;
|
|
2339
|
-
|
|
1815
|
+
__privateAdd3(this, _routeInfo);
|
|
2340
1816
|
var _a;
|
|
2341
1817
|
__privateSet2(this, _routeInfo, __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, this.route));
|
|
2342
1818
|
}
|
|
2343
1819
|
get dynamicSegmentCount() {
|
|
2344
|
-
return
|
|
1820
|
+
return __privateGet3(this, _routeInfo).segments.reduce(
|
|
2345
1821
|
(count, segment) => {
|
|
2346
1822
|
var _a;
|
|
2347
1823
|
return __privateMethod(_a = _Route2, _Route_static, isDynamicRouteSegment_fn).call(_a, segment) ? count + 1 : count;
|
|
@@ -2353,7 +1829,7 @@ var _Route = class _Route2 {
|
|
|
2353
1829
|
matches(path) {
|
|
2354
1830
|
var _a, _b;
|
|
2355
1831
|
const { segments: pathSegments, queryParams: pathQuery } = __privateMethod(_a = _Route2, _Route_static, parseRouteOrPath_fn).call(_a, path);
|
|
2356
|
-
const { segments: routeSegments } =
|
|
1832
|
+
const { segments: routeSegments } = __privateGet3(this, _routeInfo);
|
|
2357
1833
|
if (pathSegments.length !== routeSegments.length) {
|
|
2358
1834
|
return { match: false };
|
|
2359
1835
|
}
|
|
@@ -2374,7 +1850,7 @@ var _Route = class _Route2 {
|
|
|
2374
1850
|
return { match: false };
|
|
2375
1851
|
}
|
|
2376
1852
|
}
|
|
2377
|
-
for (const [key, value] of
|
|
1853
|
+
for (const [key, value] of __privateGet3(this, _routeInfo).queryParams) {
|
|
2378
1854
|
possibleMatch.queryParams[key] = pathQuery.has(key) ? pathQuery.get(key) : value;
|
|
2379
1855
|
}
|
|
2380
1856
|
return possibleMatch;
|
|
@@ -2384,7 +1860,7 @@ var _Route = class _Route2 {
|
|
|
2384
1860
|
*/
|
|
2385
1861
|
expand(options) {
|
|
2386
1862
|
const { dynamicInputValues = {}, allowedQueryParams = [], doNotEscapeVariables = false } = options != null ? options : {};
|
|
2387
|
-
const path =
|
|
1863
|
+
const path = __privateGet3(this, _routeInfo).segments.map((segment) => {
|
|
2388
1864
|
const dynamicSegmentName = _Route2.getDynamicRouteSegmentName(segment);
|
|
2389
1865
|
if (!dynamicSegmentName) {
|
|
2390
1866
|
return segment;
|
|
@@ -2464,7 +1940,7 @@ isDynamicRouteSegment_fn = function(segment) {
|
|
|
2464
1940
|
}
|
|
2465
1941
|
return segment.startsWith(_Route.dynamicSegmentPrefix);
|
|
2466
1942
|
};
|
|
2467
|
-
|
|
1943
|
+
__privateAdd3(_Route, _Route_static);
|
|
2468
1944
|
_Route.dynamicSegmentPrefix = ":";
|
|
2469
1945
|
function encodeRouteComponent(value, doNotEscapeVariables) {
|
|
2470
1946
|
if (!doNotEscapeVariables) {
|
|
@@ -2582,7 +2058,7 @@ var getComposition = async ({ compositionId }) => {
|
|
|
2582
2058
|
});
|
|
2583
2059
|
return composition;
|
|
2584
2060
|
} catch (err) {
|
|
2585
|
-
if (err instanceof
|
|
2061
|
+
if (err instanceof ApiClientError5 && err.statusCode === 404) {
|
|
2586
2062
|
return null;
|
|
2587
2063
|
}
|
|
2588
2064
|
throw err;
|
|
@@ -2837,13 +2313,8 @@ var handleSvixMessage = async (request) => {
|
|
|
2837
2313
|
}
|
|
2838
2314
|
}
|
|
2839
2315
|
if (tags == null ? void 0 : tags.length) {
|
|
2840
|
-
const cache = getMiddlewareRuntimeCache() ? getCache() : void 0;
|
|
2841
2316
|
for (let i = 0; i < tags.length; i++) {
|
|
2842
|
-
|
|
2843
|
-
revalidateTag(tag, "max");
|
|
2844
|
-
if (cache) {
|
|
2845
|
-
await cache.expireTag(tag);
|
|
2846
|
-
}
|
|
2317
|
+
revalidateTag(tags[i], "max");
|
|
2847
2318
|
}
|
|
2848
2319
|
}
|
|
2849
2320
|
if (paths == null ? void 0 : paths.length) {
|