@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/cache.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,436 +272,9 @@ var require_retry2 = __commonJS({
|
|
|
390
272
|
}
|
|
391
273
|
});
|
|
392
274
|
|
|
393
|
-
//
|
|
394
|
-
import {
|
|
395
|
-
|
|
396
|
-
// ../context/dist/api/api.mjs
|
|
397
|
-
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
398
|
-
var __defProp2 = Object.defineProperty;
|
|
399
|
-
var __typeError2 = (msg) => {
|
|
400
|
-
throw TypeError(msg);
|
|
401
|
-
};
|
|
402
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
403
|
-
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
404
|
-
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
405
|
-
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
406
|
-
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);
|
|
407
|
-
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
408
|
-
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
409
|
-
var ApiClientError = class _ApiClientError extends Error {
|
|
410
|
-
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
411
|
-
super(
|
|
412
|
-
`${errorMessage}
|
|
413
|
-
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
414
|
-
);
|
|
415
|
-
__publicField2(this, "errorMessage", errorMessage);
|
|
416
|
-
__publicField2(this, "fetchMethod", fetchMethod);
|
|
417
|
-
__publicField2(this, "fetchUri", fetchUri);
|
|
418
|
-
__publicField2(this, "statusCode", statusCode);
|
|
419
|
-
__publicField2(this, "statusText", statusText);
|
|
420
|
-
__publicField2(this, "requestId", requestId);
|
|
421
|
-
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
425
|
-
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
426
|
-
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
427
|
-
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
var ApiClient = class _ApiClient {
|
|
431
|
-
constructor(options) {
|
|
432
|
-
__publicField2(this, "options");
|
|
433
|
-
var _a, _b, _c, _d, _e;
|
|
434
|
-
if (!options.apiKey && !options.bearerToken) {
|
|
435
|
-
throw new Error("You must provide an API key or a bearer token");
|
|
436
|
-
}
|
|
437
|
-
let leFetch = options.fetch;
|
|
438
|
-
if (!leFetch) {
|
|
439
|
-
if (typeof window !== "undefined") {
|
|
440
|
-
leFetch = window.fetch.bind(window);
|
|
441
|
-
} else if (typeof fetch !== "undefined") {
|
|
442
|
-
leFetch = fetch;
|
|
443
|
-
} else {
|
|
444
|
-
throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
this.options = {
|
|
448
|
-
...options,
|
|
449
|
-
fetch: leFetch,
|
|
450
|
-
apiHost: this.ensureApiHost(options.apiHost),
|
|
451
|
-
apiKey: (_a = options.apiKey) != null ? _a : null,
|
|
452
|
-
projectId: (_b = options.projectId) != null ? _b : null,
|
|
453
|
-
bearerToken: (_c = options.bearerToken) != null ? _c : null,
|
|
454
|
-
limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
|
|
455
|
-
bypassCache: (_e = options.bypassCache) != null ? _e : false
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
async apiClient(fetchUri, options) {
|
|
459
|
-
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
|
460
|
-
}
|
|
461
|
-
async apiClientWithResponse(fetchUri, options) {
|
|
462
|
-
return this.options.limitPolicy(async () => {
|
|
463
|
-
var _a, _b;
|
|
464
|
-
const coreHeaders = this.options.apiKey ? {
|
|
465
|
-
"x-api-key": this.options.apiKey
|
|
466
|
-
} : {
|
|
467
|
-
Authorization: `Bearer ${this.options.bearerToken}`
|
|
468
|
-
};
|
|
469
|
-
if (this.options.bypassCache) {
|
|
470
|
-
coreHeaders["x-bypass-cache"] = "true";
|
|
471
|
-
}
|
|
472
|
-
const { fetch: fetch2, signal } = this.options;
|
|
473
|
-
const callApi = () => fetch2(fetchUri.toString(), {
|
|
474
|
-
...options,
|
|
475
|
-
signal,
|
|
476
|
-
headers: {
|
|
477
|
-
...options == null ? void 0 : options.headers,
|
|
478
|
-
...coreHeaders
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
const apiResponse = await handleRateLimits(callApi);
|
|
482
|
-
if (!apiResponse.ok) {
|
|
483
|
-
let message = "";
|
|
484
|
-
try {
|
|
485
|
-
const responseText = await apiResponse.text();
|
|
486
|
-
try {
|
|
487
|
-
const parsed = JSON.parse(responseText);
|
|
488
|
-
if (parsed.errorMessage) {
|
|
489
|
-
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
490
|
-
} else {
|
|
491
|
-
message = responseText;
|
|
492
|
-
}
|
|
493
|
-
} catch (e) {
|
|
494
|
-
message = responseText;
|
|
495
|
-
}
|
|
496
|
-
} catch (e) {
|
|
497
|
-
message = `General error`;
|
|
498
|
-
}
|
|
499
|
-
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
500
|
-
throw new BearerTokenNotValidOrExpiredError(
|
|
501
|
-
message,
|
|
502
|
-
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
503
|
-
fetchUri.toString(),
|
|
504
|
-
apiResponse.status,
|
|
505
|
-
apiResponse.statusText,
|
|
506
|
-
_ApiClient.getRequestId(apiResponse)
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
throw new ApiClientError(
|
|
510
|
-
message,
|
|
511
|
-
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
512
|
-
fetchUri.toString(),
|
|
513
|
-
apiResponse.status,
|
|
514
|
-
apiResponse.statusText,
|
|
515
|
-
_ApiClient.getRequestId(apiResponse)
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
if (options == null ? void 0 : options.expectNoContent) {
|
|
519
|
-
return { response: apiResponse, body: null };
|
|
520
|
-
}
|
|
521
|
-
return {
|
|
522
|
-
response: apiResponse,
|
|
523
|
-
body: await apiResponse.json()
|
|
524
|
-
};
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
createUrl(path, queryParams, hostOverride) {
|
|
528
|
-
const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
|
|
529
|
-
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
|
530
|
-
var _a;
|
|
531
|
-
if (typeof value !== "undefined" && value !== null) {
|
|
532
|
-
url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
return url;
|
|
536
|
-
}
|
|
537
|
-
ensureApiHost(apiHost) {
|
|
538
|
-
if (!apiHost) return "https://uniform.app";
|
|
539
|
-
if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
|
|
540
|
-
throw new Error('Your apiHost must start with "http"');
|
|
541
|
-
}
|
|
542
|
-
if (apiHost.indexOf("/", 8) > -1) {
|
|
543
|
-
throw new Error("Your apiHost must not contain a path element after the domain");
|
|
544
|
-
}
|
|
545
|
-
if (apiHost.indexOf("?") > -1) {
|
|
546
|
-
throw new Error("Your apiHost must not contain a query string");
|
|
547
|
-
}
|
|
548
|
-
if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
|
|
549
|
-
apiHost = apiHost.substring(0, apiHost.length - 1);
|
|
550
|
-
}
|
|
551
|
-
return apiHost;
|
|
552
|
-
}
|
|
553
|
-
static getRequestId(response) {
|
|
554
|
-
const apigRequestId = response.headers.get("apigw-requestid");
|
|
555
|
-
if (apigRequestId) {
|
|
556
|
-
return apigRequestId;
|
|
557
|
-
}
|
|
558
|
-
return void 0;
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
async function handleRateLimits(callApi) {
|
|
562
|
-
var _a;
|
|
563
|
-
const backoffRetries = 5;
|
|
564
|
-
let backoffRetriesLeft = backoffRetries;
|
|
565
|
-
let response;
|
|
566
|
-
while (backoffRetriesLeft > 0) {
|
|
567
|
-
response = await callApi();
|
|
568
|
-
if (response.status !== 429) {
|
|
569
|
-
break;
|
|
570
|
-
}
|
|
571
|
-
let resetWait = 0;
|
|
572
|
-
try {
|
|
573
|
-
const responseClone = response.clone();
|
|
574
|
-
const dateHeader = responseClone.headers.get("date");
|
|
575
|
-
const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
|
|
576
|
-
const body = await responseClone.json();
|
|
577
|
-
const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
|
|
578
|
-
if (typeof serverTime === "number" && typeof resetTime === "number") {
|
|
579
|
-
resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
|
|
580
|
-
}
|
|
581
|
-
} catch (e) {
|
|
582
|
-
}
|
|
583
|
-
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
584
|
-
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
585
|
-
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
586
|
-
backoffRetriesLeft -= 1;
|
|
587
|
-
}
|
|
588
|
-
return response;
|
|
589
|
-
}
|
|
590
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
591
|
-
function rewriteFiltersForApi(filters) {
|
|
592
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
593
|
-
(acc, [key, value]) => {
|
|
594
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
595
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
596
|
-
return {
|
|
597
|
-
...acc,
|
|
598
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
599
|
-
};
|
|
600
|
-
},
|
|
601
|
-
{}
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
var _url;
|
|
605
|
-
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
606
|
-
constructor(options) {
|
|
607
|
-
super(options);
|
|
608
|
-
}
|
|
609
|
-
/** Fetches all aggregates for a project */
|
|
610
|
-
async get(options) {
|
|
611
|
-
const { projectId } = this.options;
|
|
612
|
-
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url), { ...options, projectId });
|
|
613
|
-
return await this.apiClient(fetchUri);
|
|
614
|
-
}
|
|
615
|
-
/** Updates or creates (based on id) an Aggregate */
|
|
616
|
-
async upsert(body) {
|
|
617
|
-
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
618
|
-
await this.apiClient(fetchUri, {
|
|
619
|
-
method: "PUT",
|
|
620
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
621
|
-
expectNoContent: true
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
/** Deletes an Aggregate */
|
|
625
|
-
async remove(body) {
|
|
626
|
-
const fetchUri = this.createUrl(__privateGet2(_AggregateClient2, _url));
|
|
627
|
-
await this.apiClient(fetchUri, {
|
|
628
|
-
method: "DELETE",
|
|
629
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
630
|
-
expectNoContent: true
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
_url = /* @__PURE__ */ new WeakMap();
|
|
635
|
-
__privateAdd2(_AggregateClient, _url, "/api/v2/aggregate");
|
|
636
|
-
var _url2;
|
|
637
|
-
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
638
|
-
constructor(options) {
|
|
639
|
-
super(options);
|
|
640
|
-
}
|
|
641
|
-
/** Fetches the known score dimensions for a project */
|
|
642
|
-
async get(options) {
|
|
643
|
-
const { projectId } = this.options;
|
|
644
|
-
const fetchUri = this.createUrl(__privateGet2(_DimensionClient2, _url2), { ...options, projectId });
|
|
645
|
-
return await this.apiClient(fetchUri);
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
_url2 = /* @__PURE__ */ new WeakMap();
|
|
649
|
-
__privateAdd2(_DimensionClient, _url2, "/api/v2/dimension");
|
|
650
|
-
var _url3;
|
|
651
|
-
var _valueUrl;
|
|
652
|
-
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
653
|
-
constructor(options) {
|
|
654
|
-
super(options);
|
|
655
|
-
}
|
|
656
|
-
/** Fetches all enrichments and values for a project, grouped by category */
|
|
657
|
-
async get(options) {
|
|
658
|
-
const { projectId } = this.options;
|
|
659
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
660
|
-
return await this.apiClient(fetchUri);
|
|
661
|
-
}
|
|
662
|
-
/** Updates or creates (based on id) an enrichment category */
|
|
663
|
-
async upsertCategory(body) {
|
|
664
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
665
|
-
await this.apiClient(fetchUri, {
|
|
666
|
-
method: "PUT",
|
|
667
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
668
|
-
expectNoContent: true
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
/** Deletes an enrichment category */
|
|
672
|
-
async removeCategory(body) {
|
|
673
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _url3));
|
|
674
|
-
await this.apiClient(fetchUri, {
|
|
675
|
-
method: "DELETE",
|
|
676
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
677
|
-
expectNoContent: true
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
681
|
-
async upsertValue(body) {
|
|
682
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
683
|
-
await this.apiClient(fetchUri, {
|
|
684
|
-
method: "PUT",
|
|
685
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
686
|
-
expectNoContent: true
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
690
|
-
async removeValue(body) {
|
|
691
|
-
const fetchUri = this.createUrl(__privateGet2(_EnrichmentClient2, _valueUrl));
|
|
692
|
-
await this.apiClient(fetchUri, {
|
|
693
|
-
method: "DELETE",
|
|
694
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
695
|
-
expectNoContent: true
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
_url3 = /* @__PURE__ */ new WeakMap();
|
|
700
|
-
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
701
|
-
__privateAdd2(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
702
|
-
__privateAdd2(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
703
|
-
var _url4;
|
|
704
|
-
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
705
|
-
constructor(options) {
|
|
706
|
-
super(options);
|
|
707
|
-
}
|
|
708
|
-
/** Fetches the Context manifest for a project */
|
|
709
|
-
async get(options) {
|
|
710
|
-
const { projectId } = this.options;
|
|
711
|
-
const fetchUri = this.createUrl(__privateGet2(_ManifestClient2, _url4), { ...options, projectId });
|
|
712
|
-
return await this.apiClient(fetchUri);
|
|
713
|
-
}
|
|
714
|
-
/** Publishes the Context manifest for a project */
|
|
715
|
-
async publish() {
|
|
716
|
-
const { projectId } = this.options;
|
|
717
|
-
const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
|
|
718
|
-
await this.apiClient(fetchUri, {
|
|
719
|
-
method: "POST",
|
|
720
|
-
expectNoContent: true
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
_url4 = /* @__PURE__ */ new WeakMap();
|
|
725
|
-
__privateAdd2(_ManifestClient, _url4, "/api/v2/manifest");
|
|
726
|
-
var ManifestClient = _ManifestClient;
|
|
727
|
-
var _url5;
|
|
728
|
-
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
729
|
-
constructor(options) {
|
|
730
|
-
super(options);
|
|
731
|
-
}
|
|
732
|
-
/** Fetches all Quirks for a project */
|
|
733
|
-
async get(options) {
|
|
734
|
-
const { projectId } = this.options;
|
|
735
|
-
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5), { ...options, projectId });
|
|
736
|
-
return await this.apiClient(fetchUri);
|
|
737
|
-
}
|
|
738
|
-
/** Updates or creates (based on id) a Quirk */
|
|
739
|
-
async upsert(body) {
|
|
740
|
-
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
741
|
-
await this.apiClient(fetchUri, {
|
|
742
|
-
method: "PUT",
|
|
743
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
744
|
-
expectNoContent: true
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
/** Deletes a Quirk */
|
|
748
|
-
async remove(body) {
|
|
749
|
-
const fetchUri = this.createUrl(__privateGet2(_QuirkClient2, _url5));
|
|
750
|
-
await this.apiClient(fetchUri, {
|
|
751
|
-
method: "DELETE",
|
|
752
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
753
|
-
expectNoContent: true
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
_url5 = /* @__PURE__ */ new WeakMap();
|
|
758
|
-
__privateAdd2(_QuirkClient, _url5, "/api/v2/quirk");
|
|
759
|
-
var _url6;
|
|
760
|
-
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
761
|
-
constructor(options) {
|
|
762
|
-
super(options);
|
|
763
|
-
}
|
|
764
|
-
/** Fetches all Signals for a project */
|
|
765
|
-
async get(options) {
|
|
766
|
-
const { projectId } = this.options;
|
|
767
|
-
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6), { ...options, projectId });
|
|
768
|
-
return await this.apiClient(fetchUri);
|
|
769
|
-
}
|
|
770
|
-
/** Updates or creates (based on id) a Signal */
|
|
771
|
-
async upsert(body) {
|
|
772
|
-
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
773
|
-
await this.apiClient(fetchUri, {
|
|
774
|
-
method: "PUT",
|
|
775
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
776
|
-
expectNoContent: true
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
/** Deletes a Signal */
|
|
780
|
-
async remove(body) {
|
|
781
|
-
const fetchUri = this.createUrl(__privateGet2(_SignalClient2, _url6));
|
|
782
|
-
await this.apiClient(fetchUri, {
|
|
783
|
-
method: "DELETE",
|
|
784
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
785
|
-
expectNoContent: true
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
_url6 = /* @__PURE__ */ new WeakMap();
|
|
790
|
-
__privateAdd2(_SignalClient, _url6, "/api/v2/signal");
|
|
791
|
-
var _url7;
|
|
792
|
-
var _TestClient = class _TestClient2 extends ApiClient {
|
|
793
|
-
constructor(options) {
|
|
794
|
-
super(options);
|
|
795
|
-
}
|
|
796
|
-
/** Fetches all Tests for a project */
|
|
797
|
-
async get(options) {
|
|
798
|
-
const { projectId } = this.options;
|
|
799
|
-
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7), { ...options, projectId });
|
|
800
|
-
return await this.apiClient(fetchUri);
|
|
801
|
-
}
|
|
802
|
-
/** Updates or creates (based on id) a Test */
|
|
803
|
-
async upsert(body) {
|
|
804
|
-
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
805
|
-
await this.apiClient(fetchUri, {
|
|
806
|
-
method: "PUT",
|
|
807
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
808
|
-
expectNoContent: true
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
/** Deletes a Test */
|
|
812
|
-
async remove(body) {
|
|
813
|
-
const fetchUri = this.createUrl(__privateGet2(_TestClient2, _url7));
|
|
814
|
-
await this.apiClient(fetchUri, {
|
|
815
|
-
method: "DELETE",
|
|
816
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
817
|
-
expectNoContent: true
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
_url7 = /* @__PURE__ */ new WeakMap();
|
|
822
|
-
__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";
|
|
823
278
|
|
|
824
279
|
// ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
825
280
|
var Node = class {
|
|
@@ -892,7 +347,7 @@ _tail = new WeakMap();
|
|
|
892
347
|
_size = new WeakMap();
|
|
893
348
|
|
|
894
349
|
// ../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js
|
|
895
|
-
function
|
|
350
|
+
function pLimit(concurrency) {
|
|
896
351
|
validateConcurrency(concurrency);
|
|
897
352
|
const queue = new Queue();
|
|
898
353
|
let activeCount = 0;
|
|
@@ -1172,19 +627,44 @@ function pThrottle({ limit, interval, strict, onDelay }) {
|
|
|
1172
627
|
}
|
|
1173
628
|
|
|
1174
629
|
// ../canvas/dist/index.mjs
|
|
1175
|
-
|
|
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) => {
|
|
1176
656
|
throw TypeError(msg);
|
|
1177
657
|
};
|
|
1178
|
-
var
|
|
1179
|
-
var
|
|
1180
|
-
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);
|
|
1181
661
|
function createLimitPolicy({
|
|
1182
662
|
throttle = { interval: 1e3, limit: 10 },
|
|
1183
663
|
retry: retry3 = { retries: 1, factor: 1.66 },
|
|
1184
664
|
limit = 10
|
|
1185
665
|
}) {
|
|
1186
666
|
const throttler = throttle ? pThrottle(throttle) : null;
|
|
1187
|
-
const limiter = limit ?
|
|
667
|
+
const limiter = limit ? pLimit(limit) : null;
|
|
1188
668
|
return function limitPolicy(func) {
|
|
1189
669
|
let currentFunc = async () => await func();
|
|
1190
670
|
if (throttler) {
|
|
@@ -1266,7 +746,7 @@ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
|
1266
746
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1267
747
|
var _contentTypesUrl;
|
|
1268
748
|
var _entriesUrl;
|
|
1269
|
-
var _ContentClient = class _ContentClient2 extends
|
|
749
|
+
var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
1270
750
|
constructor(options) {
|
|
1271
751
|
var _a;
|
|
1272
752
|
super(options);
|
|
@@ -1274,16 +754,16 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1274
754
|
}
|
|
1275
755
|
getContentTypes(options) {
|
|
1276
756
|
const { projectId } = this.options;
|
|
1277
|
-
const fetchUri = this.createUrl(
|
|
757
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
1278
758
|
return this.apiClient(fetchUri);
|
|
1279
759
|
}
|
|
1280
760
|
getEntries(options) {
|
|
1281
761
|
const { projectId } = this.options;
|
|
1282
762
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
1283
|
-
const rewrittenFilters =
|
|
763
|
+
const rewrittenFilters = rewriteFiltersForApi6(filters);
|
|
1284
764
|
const rewrittenSelect = projectionToQuery(select);
|
|
1285
765
|
if (skipDataResolution) {
|
|
1286
|
-
const url = this.createUrl(
|
|
766
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1287
767
|
...params,
|
|
1288
768
|
...rewrittenFilters,
|
|
1289
769
|
...rewrittenSelect,
|
|
@@ -1292,7 +772,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1292
772
|
return this.apiClient(url);
|
|
1293
773
|
}
|
|
1294
774
|
const edgeUrl = this.createUrl(
|
|
1295
|
-
|
|
775
|
+
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1296
776
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1297
777
|
this.edgeApiHost
|
|
1298
778
|
);
|
|
@@ -1310,7 +790,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1310
790
|
return this.apiClient(historyUrl);
|
|
1311
791
|
}
|
|
1312
792
|
async upsertContentType(body, opts = {}) {
|
|
1313
|
-
const fetchUri = this.createUrl(
|
|
793
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1314
794
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
1315
795
|
delete body.contentType.slugSettings;
|
|
1316
796
|
}
|
|
@@ -1322,7 +802,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1322
802
|
});
|
|
1323
803
|
}
|
|
1324
804
|
async upsertEntry(body, options) {
|
|
1325
|
-
const fetchUri = this.createUrl(
|
|
805
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1326
806
|
const headers = {};
|
|
1327
807
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
1328
808
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -1336,7 +816,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1336
816
|
return { modified: response.headers.get("x-modified-at") };
|
|
1337
817
|
}
|
|
1338
818
|
async deleteContentType(body) {
|
|
1339
|
-
const fetchUri = this.createUrl(
|
|
819
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
1340
820
|
await this.apiClient(fetchUri, {
|
|
1341
821
|
method: "DELETE",
|
|
1342
822
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1344,7 +824,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1344
824
|
});
|
|
1345
825
|
}
|
|
1346
826
|
async deleteEntry(body) {
|
|
1347
|
-
const fetchUri = this.createUrl(
|
|
827
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
1348
828
|
await this.apiClient(fetchUri, {
|
|
1349
829
|
method: "DELETE",
|
|
1350
830
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1363,17 +843,17 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1363
843
|
};
|
|
1364
844
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
1365
845
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
var
|
|
1369
|
-
var _DataTypeClient = class _DataTypeClient2 extends
|
|
846
|
+
__privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
847
|
+
__privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
848
|
+
var _url;
|
|
849
|
+
var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
|
|
1370
850
|
constructor(options) {
|
|
1371
851
|
super(options);
|
|
1372
852
|
}
|
|
1373
853
|
/** Fetches a list of DataTypes for a project */
|
|
1374
854
|
async list(options) {
|
|
1375
855
|
const { projectId } = this.options;
|
|
1376
|
-
const fetchUri = this.createUrl(
|
|
856
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url), { ...options, projectId });
|
|
1377
857
|
return await this.apiClient(fetchUri);
|
|
1378
858
|
}
|
|
1379
859
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -1382,7 +862,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1382
862
|
}
|
|
1383
863
|
/** Updates or creates (based on id) a DataType */
|
|
1384
864
|
async save(body) {
|
|
1385
|
-
const fetchUri = this.createUrl(
|
|
865
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
|
|
1386
866
|
await this.apiClient(fetchUri, {
|
|
1387
867
|
method: "PUT",
|
|
1388
868
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1395,7 +875,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1395
875
|
}
|
|
1396
876
|
/** Deletes a DataType */
|
|
1397
877
|
async remove(body) {
|
|
1398
|
-
const fetchUri = this.createUrl(
|
|
878
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url));
|
|
1399
879
|
await this.apiClient(fetchUri, {
|
|
1400
880
|
method: "DELETE",
|
|
1401
881
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -1403,10 +883,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1403
883
|
});
|
|
1404
884
|
}
|
|
1405
885
|
};
|
|
1406
|
-
|
|
1407
|
-
|
|
886
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
887
|
+
__privateAdd2(_DataTypeClient, _url, "/api/v1/data-types");
|
|
1408
888
|
var _baseUrl;
|
|
1409
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends
|
|
889
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient8 {
|
|
1410
890
|
constructor(options) {
|
|
1411
891
|
super(options);
|
|
1412
892
|
this.teamId = options.teamId;
|
|
@@ -1415,7 +895,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1415
895
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
1416
896
|
*/
|
|
1417
897
|
get(options) {
|
|
1418
|
-
const fetchUri = this.createUrl(
|
|
898
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
1419
899
|
...options,
|
|
1420
900
|
teamId: this.teamId
|
|
1421
901
|
});
|
|
@@ -1425,7 +905,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1425
905
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
1426
906
|
*/
|
|
1427
907
|
async deploy(body) {
|
|
1428
|
-
const fetchUri = this.createUrl(
|
|
908
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1429
909
|
await this.apiClient(fetchUri, {
|
|
1430
910
|
method: "PUT",
|
|
1431
911
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1436,7 +916,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1436
916
|
* Removes a custom AI property editor from a Mesh app.
|
|
1437
917
|
*/
|
|
1438
918
|
async delete(body) {
|
|
1439
|
-
const fetchUri = this.createUrl(
|
|
919
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
1440
920
|
await this.apiClient(fetchUri, {
|
|
1441
921
|
method: "DELETE",
|
|
1442
922
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -1445,16 +925,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1445
925
|
}
|
|
1446
926
|
};
|
|
1447
927
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1448
|
-
|
|
1449
|
-
var
|
|
928
|
+
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
929
|
+
var _url2;
|
|
1450
930
|
var _projectsUrl;
|
|
1451
|
-
var _ProjectClient = class _ProjectClient2 extends
|
|
931
|
+
var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
|
|
1452
932
|
constructor(options) {
|
|
1453
933
|
super({ ...options, bypassCache: true });
|
|
1454
934
|
}
|
|
1455
935
|
/** Fetches single Project */
|
|
1456
936
|
async get(options) {
|
|
1457
|
-
const fetchUri = this.createUrl(
|
|
937
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2), { ...options });
|
|
1458
938
|
return await this.apiClient(fetchUri);
|
|
1459
939
|
}
|
|
1460
940
|
/**
|
|
@@ -1463,7 +943,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1463
943
|
* When omitted, returns all accessible teams and their projects.
|
|
1464
944
|
*/
|
|
1465
945
|
async list(options) {
|
|
1466
|
-
const fetchUri = this.createUrl(
|
|
946
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1467
947
|
return await this.apiClient(fetchUri);
|
|
1468
948
|
}
|
|
1469
949
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -1472,7 +952,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1472
952
|
}
|
|
1473
953
|
/** Updates or creates (based on id) a Project */
|
|
1474
954
|
async save(body) {
|
|
1475
|
-
const fetchUri = this.createUrl(
|
|
955
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
|
|
1476
956
|
return await this.apiClient(fetchUri, {
|
|
1477
957
|
method: "PUT",
|
|
1478
958
|
body: JSON.stringify({ ...body })
|
|
@@ -1484,7 +964,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1484
964
|
}
|
|
1485
965
|
/** Deletes a Project */
|
|
1486
966
|
async remove(body) {
|
|
1487
|
-
const fetchUri = this.createUrl(
|
|
967
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url2));
|
|
1488
968
|
await this.apiClient(fetchUri, {
|
|
1489
969
|
method: "DELETE",
|
|
1490
970
|
body: JSON.stringify({ ...body }),
|
|
@@ -1496,12 +976,12 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1496
976
|
return this.remove(body);
|
|
1497
977
|
}
|
|
1498
978
|
};
|
|
1499
|
-
|
|
979
|
+
_url2 = /* @__PURE__ */ new WeakMap();
|
|
1500
980
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1501
|
-
|
|
1502
|
-
|
|
981
|
+
__privateAdd2(_ProjectClient, _url2, "/api/v1/project");
|
|
982
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1503
983
|
var ROUTE_URL = "/api/v1/route";
|
|
1504
|
-
var RouteClient = class extends
|
|
984
|
+
var RouteClient = class extends ApiClient17 {
|
|
1505
985
|
constructor(options) {
|
|
1506
986
|
var _a;
|
|
1507
987
|
if (!options.limitPolicy) {
|
|
@@ -1544,10 +1024,12 @@ var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
|
1544
1024
|
return dataSourceVariant;
|
|
1545
1025
|
};
|
|
1546
1026
|
|
|
1547
|
-
// src/data/
|
|
1548
|
-
import {
|
|
1027
|
+
// src/data/resolveRouteFromCode.ts
|
|
1028
|
+
import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
|
|
1029
|
+
import { getTargetVariableExpandedUrl } from "@uniformdev/redirect";
|
|
1030
|
+
import { permanentRedirect, redirect } from "next/navigation";
|
|
1549
1031
|
|
|
1550
|
-
// src/clients/
|
|
1032
|
+
// src/clients/route.ts
|
|
1551
1033
|
import "server-only";
|
|
1552
1034
|
|
|
1553
1035
|
// src/utils/env.ts
|
|
@@ -1600,11 +1082,6 @@ var isStateCacheMode = (options) => {
|
|
|
1600
1082
|
var isDetectCacheMode = (options) => {
|
|
1601
1083
|
return "searchParams" in options && "draftModeEnabled" in options;
|
|
1602
1084
|
};
|
|
1603
|
-
var resolveManifestCache = (options) => {
|
|
1604
|
-
return resolveCache({
|
|
1605
|
-
options
|
|
1606
|
-
});
|
|
1607
|
-
};
|
|
1608
1085
|
var resolveCanvasCache = (options) => {
|
|
1609
1086
|
return resolveCache({
|
|
1610
1087
|
options
|
|
@@ -1672,6 +1149,7 @@ var determineFetchCacheOptions = (mode) => {
|
|
|
1672
1149
|
};
|
|
1673
1150
|
|
|
1674
1151
|
// src/clients/retry.ts
|
|
1152
|
+
import { ApiClientError as ApiClientError6 } from "@uniformdev/context/api";
|
|
1675
1153
|
function createThrottler(limit, interval) {
|
|
1676
1154
|
let available = limit;
|
|
1677
1155
|
let refillScheduled = false;
|
|
@@ -1782,7 +1260,7 @@ function createLimitPolicy2({
|
|
|
1782
1260
|
if (retryOptions.onFailedAttempt) {
|
|
1783
1261
|
await retryOptions.onFailedAttempt(error);
|
|
1784
1262
|
}
|
|
1785
|
-
if (error instanceof
|
|
1263
|
+
if (error instanceof ApiClientError6 && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429 && error.statusCode !== 408) {
|
|
1786
1264
|
throw error;
|
|
1787
1265
|
}
|
|
1788
1266
|
}
|
|
@@ -1799,8 +1277,8 @@ var buildPathTag = (path) => {
|
|
|
1799
1277
|
};
|
|
1800
1278
|
|
|
1801
1279
|
// src/clients/tags.ts
|
|
1802
|
-
var generateRouteCacheTags = ({ path
|
|
1803
|
-
const tags =
|
|
1280
|
+
var generateRouteCacheTags = ({ path }) => {
|
|
1281
|
+
const tags = ["route"];
|
|
1804
1282
|
if (path) {
|
|
1805
1283
|
const pathWithoutQuery = path.split("?")[0];
|
|
1806
1284
|
const pieces = pathWithoutQuery.split("/");
|
|
@@ -1812,51 +1290,8 @@ var generateRouteCacheTags = ({ path, old }) => {
|
|
|
1812
1290
|
}
|
|
1813
1291
|
return tags;
|
|
1814
1292
|
};
|
|
1815
|
-
var generateManifestCacheTags = () => {
|
|
1816
|
-
return ["manifest"];
|
|
1817
|
-
};
|
|
1818
|
-
|
|
1819
|
-
// src/clients/manifest.ts
|
|
1820
|
-
var getManifestClient = (options) => {
|
|
1821
|
-
const cache = resolveManifestCache(options);
|
|
1822
|
-
const manifestClient = new ManifestClient({
|
|
1823
|
-
apiHost: env.getApiHost(),
|
|
1824
|
-
apiKey: env.getApiKey(),
|
|
1825
|
-
projectId: env.getProjectId(),
|
|
1826
|
-
limitPolicy: createLimitPolicy2({
|
|
1827
|
-
limit: 6
|
|
1828
|
-
}),
|
|
1829
|
-
fetch: (req, init) => {
|
|
1830
|
-
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1831
|
-
return fetch(req, {
|
|
1832
|
-
...init,
|
|
1833
|
-
headers: {
|
|
1834
|
-
...init == null ? void 0 : init.headers,
|
|
1835
|
-
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1836
|
-
},
|
|
1837
|
-
cache: fetchCache,
|
|
1838
|
-
next: {
|
|
1839
|
-
revalidate,
|
|
1840
|
-
tags: generateManifestCacheTags()
|
|
1841
|
-
}
|
|
1842
|
-
});
|
|
1843
|
-
}
|
|
1844
|
-
});
|
|
1845
|
-
return manifestClient;
|
|
1846
|
-
};
|
|
1847
|
-
var getManifest = async (options) => {
|
|
1848
|
-
let preview = false;
|
|
1849
|
-
if (options && isStateCacheMode(options)) {
|
|
1850
|
-
preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
|
|
1851
|
-
}
|
|
1852
|
-
const manifestClient = getManifestClient(options);
|
|
1853
|
-
return manifestClient.get({
|
|
1854
|
-
preview
|
|
1855
|
-
});
|
|
1856
|
-
};
|
|
1857
1293
|
|
|
1858
1294
|
// src/clients/route.ts
|
|
1859
|
-
import "server-only";
|
|
1860
1295
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1861
1296
|
const tags = ["route"];
|
|
1862
1297
|
if (requestedUrl) {
|
|
@@ -1906,146 +1341,10 @@ var getRouteClient = (options) => {
|
|
|
1906
1341
|
return client;
|
|
1907
1342
|
};
|
|
1908
1343
|
|
|
1909
|
-
// src/config/helpers.ts
|
|
1910
|
-
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1911
|
-
var getMiddlewareRuntimeCache = () => {
|
|
1912
|
-
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1913
|
-
return false;
|
|
1914
|
-
}
|
|
1915
|
-
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1916
|
-
return config.middlewareRuntimeCache;
|
|
1917
|
-
}
|
|
1918
|
-
return true;
|
|
1919
|
-
};
|
|
1920
|
-
var getDisableSwrMiddlewareCache = () => {
|
|
1921
|
-
var _a;
|
|
1922
|
-
if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
|
|
1923
|
-
return config.experimental.disableSwrMiddlewareCache;
|
|
1924
|
-
}
|
|
1925
|
-
return false;
|
|
1926
|
-
};
|
|
1927
|
-
|
|
1928
1344
|
// src/data/client.ts
|
|
1929
|
-
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
1930
1345
|
var DefaultDataClient = class {
|
|
1931
|
-
async
|
|
1932
|
-
const
|
|
1933
|
-
if (cache) {
|
|
1934
|
-
const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
|
|
1935
|
-
if (cachedManifest) {
|
|
1936
|
-
return cachedManifest;
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
const manifest = await getManifest({
|
|
1940
|
-
cache: isDevelopmentEnvironment() ? {
|
|
1941
|
-
type: "no-cache",
|
|
1942
|
-
bypassCache: true
|
|
1943
|
-
} : {
|
|
1944
|
-
type: "force-cache"
|
|
1945
|
-
}
|
|
1946
|
-
});
|
|
1947
|
-
if (cache) {
|
|
1948
|
-
waitUntil(
|
|
1949
|
-
(async () => {
|
|
1950
|
-
await cache.set(MANIFEST_CACHE_KEY, manifest, {
|
|
1951
|
-
tags: generateManifestCacheTags()
|
|
1952
|
-
});
|
|
1953
|
-
})()
|
|
1954
|
-
);
|
|
1955
|
-
}
|
|
1956
|
-
return manifest;
|
|
1957
|
-
}
|
|
1958
|
-
async getRouteFromApi({
|
|
1959
|
-
route,
|
|
1960
|
-
routeClient,
|
|
1961
|
-
enableRuntimeCache,
|
|
1962
|
-
disableSwrCache
|
|
1963
|
-
}) {
|
|
1964
|
-
const newCacheKey = `uniform-route-${route.state}-${route.releaseId}-${route.path}`;
|
|
1965
|
-
const oldCacheKey = `uniform-route-old-${route.state}-${route.releaseId}-${route.path}`;
|
|
1966
|
-
const cache = enableRuntimeCache ? getCache() : null;
|
|
1967
|
-
const cacheNewRoute = async (result2) => {
|
|
1968
|
-
if (cache && result2.type === "composition") {
|
|
1969
|
-
const tags = generateRouteCacheTags({ path: route.path });
|
|
1970
|
-
await cache.set(newCacheKey, result2, {
|
|
1971
|
-
tags
|
|
1972
|
-
});
|
|
1973
|
-
}
|
|
1974
|
-
};
|
|
1975
|
-
const cacheOldRoute = async (result2) => {
|
|
1976
|
-
if (cache && result2.type === "composition" && !disableSwrCache) {
|
|
1977
|
-
const tags = generateRouteCacheTags({ path: route.path, old: true });
|
|
1978
|
-
await cache.set(oldCacheKey, result2, {
|
|
1979
|
-
tags
|
|
1980
|
-
});
|
|
1981
|
-
}
|
|
1982
|
-
};
|
|
1983
|
-
if (cache) {
|
|
1984
|
-
const [cachedRoute, oldCachedRoute] = await Promise.all([
|
|
1985
|
-
cache.get(newCacheKey),
|
|
1986
|
-
disableSwrCache ? null : cache.get(oldCacheKey)
|
|
1987
|
-
]);
|
|
1988
|
-
if (cachedRoute) {
|
|
1989
|
-
return cachedRoute;
|
|
1990
|
-
}
|
|
1991
|
-
if (oldCachedRoute) {
|
|
1992
|
-
waitUntil(
|
|
1993
|
-
(async () => {
|
|
1994
|
-
const result2 = await routeClient.get(route);
|
|
1995
|
-
await cacheNewRoute(result2);
|
|
1996
|
-
})()
|
|
1997
|
-
);
|
|
1998
|
-
return oldCachedRoute;
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
const result = await routeClient.get(route);
|
|
2002
|
-
waitUntil(
|
|
2003
|
-
(async () => {
|
|
2004
|
-
await Promise.all([
|
|
2005
|
-
cacheNewRoute(result),
|
|
2006
|
-
disableSwrCache ? Promise.resolve() : cacheOldRoute(result)
|
|
2007
|
-
]);
|
|
2008
|
-
})()
|
|
2009
|
-
);
|
|
2010
|
-
return result;
|
|
2011
|
-
}
|
|
2012
|
-
async getRoute(options) {
|
|
2013
|
-
if (options.source === "middleware") {
|
|
2014
|
-
return this.getRouteMiddleware(options);
|
|
2015
|
-
}
|
|
2016
|
-
return this.getRoutePageState(options);
|
|
2017
|
-
}
|
|
2018
|
-
async enhanceRoute(_options) {
|
|
2019
|
-
}
|
|
2020
|
-
async getRouteMiddleware(options) {
|
|
2021
|
-
const routeClient = getRouteClient({
|
|
2022
|
-
searchParams: options.searchParams,
|
|
2023
|
-
draftModeEnabled: options.draftModeEnabled
|
|
2024
|
-
});
|
|
2025
|
-
const resolvedRoute = await this.getRouteFromApi({
|
|
2026
|
-
source: "middleware",
|
|
2027
|
-
route: options.route,
|
|
2028
|
-
routeClient,
|
|
2029
|
-
// The runtime cache is keyed on the route path. Development bypasses it so an author sees
|
|
2030
|
-
// an edit right away, the same way the fetch cache is bypassed for development.
|
|
2031
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache() && !isDevelopmentEnvironment(),
|
|
2032
|
-
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
2033
|
-
});
|
|
2034
|
-
if (resolvedRoute.type === "composition") {
|
|
2035
|
-
await this.enhanceRoute({
|
|
2036
|
-
source: "middleware",
|
|
2037
|
-
parameters: options.route,
|
|
2038
|
-
route: resolvedRoute,
|
|
2039
|
-
routeClient,
|
|
2040
|
-
keys: void 0
|
|
2041
|
-
});
|
|
2042
|
-
}
|
|
2043
|
-
return {
|
|
2044
|
-
route: resolvedRoute
|
|
2045
|
-
};
|
|
2046
|
-
}
|
|
2047
|
-
async getRoutePageState(options) {
|
|
2048
|
-
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
1346
|
+
async getRoute({ pageState }) {
|
|
1347
|
+
const shouldBypassCache = pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
2049
1348
|
const routeClient = getRouteClient({
|
|
2050
1349
|
cache: shouldBypassCache ? {
|
|
2051
1350
|
type: "no-cache",
|
|
@@ -2054,56 +1353,73 @@ var DefaultDataClient = class {
|
|
|
2054
1353
|
type: "force-cache"
|
|
2055
1354
|
}
|
|
2056
1355
|
});
|
|
2057
|
-
const
|
|
2058
|
-
path:
|
|
2059
|
-
state:
|
|
2060
|
-
dataSourceVariant: getDataSourceVariantFromRouteGetParams({},
|
|
1356
|
+
const parameters = {
|
|
1357
|
+
path: pageState.routePath,
|
|
1358
|
+
state: pageState.compositionState,
|
|
1359
|
+
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, pageState.compositionState),
|
|
2061
1360
|
withComponentIDs: true,
|
|
2062
|
-
releaseId:
|
|
2063
|
-
locale:
|
|
2064
|
-
ignoreRedirects: shouldIgnoreRedirects({ state:
|
|
1361
|
+
releaseId: pageState.releaseId,
|
|
1362
|
+
locale: pageState.locale,
|
|
1363
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: pageState.compositionState })
|
|
2065
1364
|
};
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
route: originalRoute,
|
|
2069
|
-
routeClient,
|
|
2070
|
-
enableRuntimeCache: false,
|
|
2071
|
-
disableSwrCache: false
|
|
2072
|
-
});
|
|
2073
|
-
if (resolvedRoute.type === "composition") {
|
|
1365
|
+
const route = await routeClient.get(parameters);
|
|
1366
|
+
if (route.type === "composition") {
|
|
2074
1367
|
await this.enhanceRoute({
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
route: resolvedRoute,
|
|
1368
|
+
parameters,
|
|
1369
|
+
route,
|
|
2078
1370
|
routeClient,
|
|
2079
|
-
keys:
|
|
1371
|
+
keys: pageState.keys
|
|
2080
1372
|
});
|
|
2081
1373
|
}
|
|
2082
1374
|
return {
|
|
2083
|
-
route
|
|
1375
|
+
route
|
|
2084
1376
|
};
|
|
2085
1377
|
}
|
|
1378
|
+
async enhanceRoute(_options) {
|
|
1379
|
+
}
|
|
2086
1380
|
};
|
|
2087
1381
|
|
|
2088
1382
|
// src/data/resolveRouteFromCode.ts
|
|
2089
|
-
var
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
}) => {
|
|
2093
|
-
const pageState = deserializeEvaluationResult({ input: code });
|
|
1383
|
+
var REDIRECT_ORIGIN_PLACEHOLDER = "http://uniform.local";
|
|
1384
|
+
var resolveRouteFromCode = async ({ code, dataClient: providedDataClient }) => {
|
|
1385
|
+
const codePageState = deserializeEvaluationResult({ input: code });
|
|
2094
1386
|
const dataClient = providedDataClient != null ? providedDataClient : new DefaultDataClient();
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
1387
|
+
const states = codePageState.compositionState === CANVAS_EDITOR_STATE ? [CANVAS_EDITOR_STATE, CANVAS_DRAFT_STATE] : [codePageState.compositionState];
|
|
1388
|
+
let pageState = codePageState;
|
|
1389
|
+
let route = null;
|
|
1390
|
+
for (const state of states) {
|
|
1391
|
+
pageState = { ...codePageState, compositionState: state };
|
|
1392
|
+
try {
|
|
1393
|
+
({ route } = await dataClient.getRoute({ pageState }));
|
|
1394
|
+
} catch (e) {
|
|
1395
|
+
console.warn(`Failed to retrieve route by path: ${pageState.routePath} with state ${state}`, e);
|
|
1396
|
+
}
|
|
1397
|
+
if (route && route.type !== "notFound") {
|
|
1398
|
+
break;
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
if ((route == null ? void 0 : route.type) === "redirect") {
|
|
1402
|
+
redirectToTarget({ route, routePath: pageState.routePath });
|
|
1403
|
+
}
|
|
2099
1404
|
return {
|
|
2100
1405
|
pageState,
|
|
2101
|
-
// suppress the route if it's not a composition
|
|
2102
1406
|
route: (route == null ? void 0 : route.type) === "composition" ? route : void 0,
|
|
2103
|
-
// the code that was used to resolve the route
|
|
2104
1407
|
code
|
|
2105
1408
|
};
|
|
2106
1409
|
};
|
|
1410
|
+
var redirectToTarget = ({ route, routePath }) => {
|
|
1411
|
+
const expanded = getTargetVariableExpandedUrl(
|
|
1412
|
+
new URL(routePath, REDIRECT_ORIGIN_PLACEHOLDER).toString(),
|
|
1413
|
+
route.redirect,
|
|
1414
|
+
(pathSegment) => pathSegment.startsWith(":")
|
|
1415
|
+
);
|
|
1416
|
+
const href = expanded.startsWith(REDIRECT_ORIGIN_PLACEHOLDER) ? expanded.slice(REDIRECT_ORIGIN_PLACEHOLDER.length) || "/" : expanded;
|
|
1417
|
+
const statusCode = route.redirect.targetStatusCode;
|
|
1418
|
+
if (statusCode === 301 || statusCode === 308) {
|
|
1419
|
+
permanentRedirect(href);
|
|
1420
|
+
}
|
|
1421
|
+
redirect(href);
|
|
1422
|
+
};
|
|
2107
1423
|
|
|
2108
1424
|
// src/cache.ts
|
|
2109
1425
|
var resolveRouteFromCode2 = async ({
|