@uniformdev/next-app-router 20.50.2-alpha.9 → 20.50.2-alpha.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{UniformComposition-d7_93l3F.d.ts → UniformComposition-BV6YnA2a.d.ts} +2 -2
- package/dist/{UniformComposition-hhRIBHmn.d.mts → UniformComposition-scIgVvIH.d.mts} +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +47 -21
- package/dist/cache.mjs +47 -21
- package/dist/{client-BCGVjYM-.d.mts → client-BlKZeE6C.d.mts} +1 -1
- package/dist/{client-BCGVjYM-.d.ts → client-BlKZeE6C.d.ts} +1 -1
- package/dist/compat.d.mts +3 -3
- package/dist/compat.d.ts +3 -3
- package/dist/component.js +27 -15
- package/dist/component.mjs +27 -15
- package/dist/handler.js +34 -17
- package/dist/handler.mjs +34 -17
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +91 -61
- package/dist/index.js +91 -61
- package/dist/index.mjs +91 -61
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +108 -75
- package/dist/middleware.mjs +108 -75
- package/dist/{resolveRouteFromCode-DgTsfMK8.d.ts → resolveRouteFromCode-3u61IwOW.d.ts} +1 -1
- package/dist/{resolveRouteFromCode-CKaYNXte.d.mts → resolveRouteFromCode-_CdAMtVM.d.mts} +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -352,6 +352,20 @@ async function handleRateLimits(callApi) {
|
|
|
352
352
|
}
|
|
353
353
|
return response;
|
|
354
354
|
}
|
|
355
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
356
|
+
function rewriteFiltersForApi(filters) {
|
|
357
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
358
|
+
(acc, [key, value]) => {
|
|
359
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
360
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
361
|
+
return {
|
|
362
|
+
...acc,
|
|
363
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
{}
|
|
367
|
+
);
|
|
368
|
+
}
|
|
355
369
|
var _url;
|
|
356
370
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
357
371
|
constructor(options) {
|
|
@@ -1135,20 +1149,6 @@ function createLimitPolicy({
|
|
|
1135
1149
|
return currentFunc();
|
|
1136
1150
|
};
|
|
1137
1151
|
}
|
|
1138
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1139
|
-
function rewriteFilters(filters) {
|
|
1140
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1141
|
-
(acc, [key, value]) => {
|
|
1142
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1143
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1144
|
-
return {
|
|
1145
|
-
...acc,
|
|
1146
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1147
|
-
};
|
|
1148
|
-
},
|
|
1149
|
-
{}
|
|
1150
|
-
);
|
|
1151
|
-
}
|
|
1152
1152
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1153
1153
|
var CanvasClient = class extends ApiClient {
|
|
1154
1154
|
constructor(options) {
|
|
@@ -1164,7 +1164,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1164
1164
|
async getCompositionList(params = {}) {
|
|
1165
1165
|
const { projectId } = this.options;
|
|
1166
1166
|
const { resolveData, filters, ...originParams } = params;
|
|
1167
|
-
const rewrittenFilters =
|
|
1167
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1168
1168
|
if (!resolveData) {
|
|
1169
1169
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1170
1170
|
return this.apiClient(fetchUri);
|
|
@@ -1284,7 +1284,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1284
1284
|
getEntries(options) {
|
|
1285
1285
|
const { projectId } = this.options;
|
|
1286
1286
|
const { skipDataResolution, filters, ...params } = options;
|
|
1287
|
-
const rewrittenFilters =
|
|
1287
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1288
1288
|
if (skipDataResolution) {
|
|
1289
1289
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1290
1290
|
return this.apiClient(url);
|
|
@@ -1533,7 +1533,7 @@ function hasReferencedVariables(value) {
|
|
|
1533
1533
|
return variableTokenCount;
|
|
1534
1534
|
}
|
|
1535
1535
|
function walkNodeTree(node, visitor, options) {
|
|
1536
|
-
var _a, _b;
|
|
1536
|
+
var _a, _b, _c;
|
|
1537
1537
|
const componentQueue = [
|
|
1538
1538
|
{
|
|
1539
1539
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1541,12 +1541,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1541
1541
|
}
|
|
1542
1542
|
];
|
|
1543
1543
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1544
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1545
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1544
1546
|
do {
|
|
1545
|
-
const currentQueueEntry =
|
|
1547
|
+
const currentQueueEntry = takeNext();
|
|
1546
1548
|
if (!currentQueueEntry) continue;
|
|
1547
1549
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1548
1550
|
let visitDescendants = true;
|
|
1549
|
-
let descendantContext = (
|
|
1551
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1550
1552
|
let visitorInfo;
|
|
1551
1553
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1552
1554
|
visitorInfo = {
|
|
@@ -1733,39 +1735,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1733
1735
|
continue;
|
|
1734
1736
|
}
|
|
1735
1737
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1736
|
-
|
|
1737
|
-
const slotKeys = Object.keys(slots);
|
|
1738
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1739
|
-
const slotKey = slotKeys[slotIndex];
|
|
1740
|
-
const components = slots[slotKey];
|
|
1741
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1742
|
-
const enqueueingComponent = components[componentIndex];
|
|
1743
|
-
const parentSlotIndexFn = () => {
|
|
1744
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1745
|
-
(x) => x === enqueueingComponent
|
|
1746
|
-
);
|
|
1747
|
-
return result;
|
|
1748
|
-
};
|
|
1749
|
-
componentQueue.push({
|
|
1750
|
-
ancestorsAndSelf: [
|
|
1751
|
-
{
|
|
1752
|
-
type: "slot",
|
|
1753
|
-
node: enqueueingComponent,
|
|
1754
|
-
parentSlot: slotKey,
|
|
1755
|
-
parentSlotIndexFn
|
|
1756
|
-
},
|
|
1757
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1758
|
-
],
|
|
1759
|
-
context: descendantContext
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1738
|
+
const childEntries = [];
|
|
1764
1739
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1765
1740
|
if (properties) {
|
|
1766
1741
|
const propertyEntries = Object.entries(properties);
|
|
1767
|
-
for (
|
|
1768
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1742
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1769
1743
|
if (!isNestedNodeType(propObject.type)) {
|
|
1770
1744
|
continue;
|
|
1771
1745
|
}
|
|
@@ -1785,13 +1759,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1785
1759
|
continue;
|
|
1786
1760
|
}
|
|
1787
1761
|
}
|
|
1788
|
-
const blocks = (
|
|
1789
|
-
for (
|
|
1790
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1762
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1763
|
+
for (const enqueueingBlock of blocks) {
|
|
1791
1764
|
const blockIndexFn = () => {
|
|
1792
1765
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1793
1766
|
};
|
|
1794
|
-
|
|
1767
|
+
childEntries.push({
|
|
1795
1768
|
ancestorsAndSelf: [
|
|
1796
1769
|
{
|
|
1797
1770
|
type: "block",
|
|
@@ -1806,6 +1779,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1806
1779
|
}
|
|
1807
1780
|
}
|
|
1808
1781
|
}
|
|
1782
|
+
if (slots) {
|
|
1783
|
+
const slotKeys = Object.keys(slots);
|
|
1784
|
+
for (const slotKey of slotKeys) {
|
|
1785
|
+
const components = slots[slotKey];
|
|
1786
|
+
for (const enqueueingComponent of components) {
|
|
1787
|
+
const parentSlotIndexFn = () => {
|
|
1788
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1789
|
+
(x) => x === enqueueingComponent
|
|
1790
|
+
);
|
|
1791
|
+
return result;
|
|
1792
|
+
};
|
|
1793
|
+
childEntries.push({
|
|
1794
|
+
ancestorsAndSelf: [
|
|
1795
|
+
{
|
|
1796
|
+
type: "slot",
|
|
1797
|
+
node: enqueueingComponent,
|
|
1798
|
+
parentSlot: slotKey,
|
|
1799
|
+
parentSlotIndexFn
|
|
1800
|
+
},
|
|
1801
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1802
|
+
],
|
|
1803
|
+
context: descendantContext
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
if (order === "dfs") {
|
|
1809
|
+
childEntries.reverse();
|
|
1810
|
+
}
|
|
1811
|
+
componentQueue.push(...childEntries);
|
|
1809
1812
|
} while (componentQueue.length > 0);
|
|
1810
1813
|
}
|
|
1811
1814
|
function isNestedNodeType(type) {
|
|
@@ -1876,6 +1879,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1876
1879
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1877
1880
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1878
1881
|
var _url22;
|
|
1882
|
+
var _projectsUrl;
|
|
1879
1883
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1880
1884
|
constructor(options) {
|
|
1881
1885
|
super({ ...options, bypassCache: true });
|
|
@@ -1885,6 +1889,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1885
1889
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1886
1890
|
return await this.apiClient(fetchUri);
|
|
1887
1891
|
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Fetches projects grouped by team.
|
|
1894
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1895
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1896
|
+
*/
|
|
1897
|
+
async getProjects(options) {
|
|
1898
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1899
|
+
return await this.apiClient(fetchUri);
|
|
1900
|
+
}
|
|
1888
1901
|
/** Updates or creates (based on id) a Project */
|
|
1889
1902
|
async upsert(body) {
|
|
1890
1903
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1904,7 +1917,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1904
1917
|
}
|
|
1905
1918
|
};
|
|
1906
1919
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1920
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1907
1921
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1922
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1908
1923
|
var ROUTE_URL = "/api/v1/route";
|
|
1909
1924
|
var RouteClient = class extends ApiClient {
|
|
1910
1925
|
constructor(options) {
|
|
@@ -2006,8 +2021,15 @@ var isIncontextEditingEnabled = ({
|
|
|
2006
2021
|
var isDevelopmentEnvironment = () => {
|
|
2007
2022
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
2008
2023
|
};
|
|
2024
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
2025
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
2026
|
+
return isNotPublished ? true : void 0;
|
|
2027
|
+
};
|
|
2009
2028
|
|
|
2010
2029
|
// src/clients/cache.ts
|
|
2030
|
+
var isSpecificCacheMode = (options) => {
|
|
2031
|
+
return "cache" in options;
|
|
2032
|
+
};
|
|
2011
2033
|
var isStateCacheMode = (options) => {
|
|
2012
2034
|
return "state" in options;
|
|
2013
2035
|
};
|
|
@@ -2034,7 +2056,9 @@ var resolveCache = ({
|
|
|
2034
2056
|
}) => {
|
|
2035
2057
|
let cache2 = void 0;
|
|
2036
2058
|
if (options) {
|
|
2037
|
-
if (
|
|
2059
|
+
if (isSpecificCacheMode(options)) {
|
|
2060
|
+
cache2 = options.cache;
|
|
2061
|
+
} else if (isStateCacheMode(options)) {
|
|
2038
2062
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2039
2063
|
cache2 = {
|
|
2040
2064
|
type: "no-cache",
|
|
@@ -2786,7 +2810,7 @@ var createTestComponentProps = ({
|
|
|
2786
2810
|
const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
|
|
2787
2811
|
return {
|
|
2788
2812
|
...common,
|
|
2789
|
-
index: testIndex
|
|
2813
|
+
index: testIndex,
|
|
2790
2814
|
test
|
|
2791
2815
|
};
|
|
2792
2816
|
};
|
|
@@ -3619,8 +3643,9 @@ var generatePossiblePageStates = ({
|
|
|
3619
3643
|
locale,
|
|
3620
3644
|
isPrefetch: void 0
|
|
3621
3645
|
};
|
|
3646
|
+
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3622
3647
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3623
|
-
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
|
|
3648
|
+
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload, allComponentIds }));
|
|
3624
3649
|
};
|
|
3625
3650
|
function permutationsWithoutRepetition(options, k) {
|
|
3626
3651
|
if (k === 0) return [[]];
|
|
@@ -3669,7 +3694,10 @@ var DefaultDataClient = class {
|
|
|
3669
3694
|
}
|
|
3670
3695
|
}
|
|
3671
3696
|
const manifest = await getManifest({
|
|
3672
|
-
cache: {
|
|
3697
|
+
cache: isDevelopmentEnvironment() ? {
|
|
3698
|
+
type: "no-cache",
|
|
3699
|
+
bypassCache: true
|
|
3700
|
+
} : {
|
|
3673
3701
|
type: "force-cache"
|
|
3674
3702
|
}
|
|
3675
3703
|
});
|
|
@@ -3772,12 +3800,13 @@ var DefaultDataClient = class {
|
|
|
3772
3800
|
};
|
|
3773
3801
|
}
|
|
3774
3802
|
async getRoutePageState(options) {
|
|
3803
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
3775
3804
|
const routeClient = getRouteClient({
|
|
3776
|
-
cache:
|
|
3777
|
-
type: "force-cache"
|
|
3778
|
-
} : {
|
|
3805
|
+
cache: shouldBypassCache ? {
|
|
3779
3806
|
type: "no-cache",
|
|
3780
3807
|
bypassCache: true
|
|
3808
|
+
} : {
|
|
3809
|
+
type: "force-cache"
|
|
3781
3810
|
}
|
|
3782
3811
|
});
|
|
3783
3812
|
const originalRoute = {
|
|
@@ -3785,7 +3814,8 @@ var DefaultDataClient = class {
|
|
|
3785
3814
|
state: options.pageState.compositionState,
|
|
3786
3815
|
withComponentIDs: true,
|
|
3787
3816
|
releaseId: options.pageState.releaseId,
|
|
3788
|
-
locale: options.pageState.locale
|
|
3817
|
+
locale: options.pageState.locale,
|
|
3818
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
3789
3819
|
};
|
|
3790
3820
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3791
3821
|
source: "pageState",
|
package/dist/index.mjs
CHANGED
|
@@ -325,6 +325,20 @@ async function handleRateLimits(callApi) {
|
|
|
325
325
|
}
|
|
326
326
|
return response;
|
|
327
327
|
}
|
|
328
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
329
|
+
function rewriteFiltersForApi(filters) {
|
|
330
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
331
|
+
(acc, [key, value]) => {
|
|
332
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
333
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
334
|
+
return {
|
|
335
|
+
...acc,
|
|
336
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
{}
|
|
340
|
+
);
|
|
341
|
+
}
|
|
328
342
|
var _url;
|
|
329
343
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
330
344
|
constructor(options) {
|
|
@@ -1108,20 +1122,6 @@ function createLimitPolicy({
|
|
|
1108
1122
|
return currentFunc();
|
|
1109
1123
|
};
|
|
1110
1124
|
}
|
|
1111
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1112
|
-
function rewriteFilters(filters) {
|
|
1113
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1114
|
-
(acc, [key, value]) => {
|
|
1115
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1116
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1117
|
-
return {
|
|
1118
|
-
...acc,
|
|
1119
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1120
|
-
};
|
|
1121
|
-
},
|
|
1122
|
-
{}
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
1125
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1126
1126
|
var CanvasClient = class extends ApiClient {
|
|
1127
1127
|
constructor(options) {
|
|
@@ -1137,7 +1137,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1137
1137
|
async getCompositionList(params = {}) {
|
|
1138
1138
|
const { projectId } = this.options;
|
|
1139
1139
|
const { resolveData, filters, ...originParams } = params;
|
|
1140
|
-
const rewrittenFilters =
|
|
1140
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1141
1141
|
if (!resolveData) {
|
|
1142
1142
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1143
1143
|
return this.apiClient(fetchUri);
|
|
@@ -1257,7 +1257,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1257
1257
|
getEntries(options) {
|
|
1258
1258
|
const { projectId } = this.options;
|
|
1259
1259
|
const { skipDataResolution, filters, ...params } = options;
|
|
1260
|
-
const rewrittenFilters =
|
|
1260
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1261
1261
|
if (skipDataResolution) {
|
|
1262
1262
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1263
1263
|
return this.apiClient(url);
|
|
@@ -1506,7 +1506,7 @@ function hasReferencedVariables(value) {
|
|
|
1506
1506
|
return variableTokenCount;
|
|
1507
1507
|
}
|
|
1508
1508
|
function walkNodeTree(node, visitor, options) {
|
|
1509
|
-
var _a, _b;
|
|
1509
|
+
var _a, _b, _c;
|
|
1510
1510
|
const componentQueue = [
|
|
1511
1511
|
{
|
|
1512
1512
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1514,12 +1514,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
];
|
|
1516
1516
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1517
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1518
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1517
1519
|
do {
|
|
1518
|
-
const currentQueueEntry =
|
|
1520
|
+
const currentQueueEntry = takeNext();
|
|
1519
1521
|
if (!currentQueueEntry) continue;
|
|
1520
1522
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1521
1523
|
let visitDescendants = true;
|
|
1522
|
-
let descendantContext = (
|
|
1524
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1523
1525
|
let visitorInfo;
|
|
1524
1526
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1525
1527
|
visitorInfo = {
|
|
@@ -1706,39 +1708,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1706
1708
|
continue;
|
|
1707
1709
|
}
|
|
1708
1710
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1709
|
-
|
|
1710
|
-
const slotKeys = Object.keys(slots);
|
|
1711
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1712
|
-
const slotKey = slotKeys[slotIndex];
|
|
1713
|
-
const components = slots[slotKey];
|
|
1714
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1715
|
-
const enqueueingComponent = components[componentIndex];
|
|
1716
|
-
const parentSlotIndexFn = () => {
|
|
1717
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1718
|
-
(x) => x === enqueueingComponent
|
|
1719
|
-
);
|
|
1720
|
-
return result;
|
|
1721
|
-
};
|
|
1722
|
-
componentQueue.push({
|
|
1723
|
-
ancestorsAndSelf: [
|
|
1724
|
-
{
|
|
1725
|
-
type: "slot",
|
|
1726
|
-
node: enqueueingComponent,
|
|
1727
|
-
parentSlot: slotKey,
|
|
1728
|
-
parentSlotIndexFn
|
|
1729
|
-
},
|
|
1730
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1731
|
-
],
|
|
1732
|
-
context: descendantContext
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1711
|
+
const childEntries = [];
|
|
1737
1712
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1738
1713
|
if (properties) {
|
|
1739
1714
|
const propertyEntries = Object.entries(properties);
|
|
1740
|
-
for (
|
|
1741
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1715
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1742
1716
|
if (!isNestedNodeType(propObject.type)) {
|
|
1743
1717
|
continue;
|
|
1744
1718
|
}
|
|
@@ -1758,13 +1732,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1758
1732
|
continue;
|
|
1759
1733
|
}
|
|
1760
1734
|
}
|
|
1761
|
-
const blocks = (
|
|
1762
|
-
for (
|
|
1763
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1735
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1736
|
+
for (const enqueueingBlock of blocks) {
|
|
1764
1737
|
const blockIndexFn = () => {
|
|
1765
1738
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1766
1739
|
};
|
|
1767
|
-
|
|
1740
|
+
childEntries.push({
|
|
1768
1741
|
ancestorsAndSelf: [
|
|
1769
1742
|
{
|
|
1770
1743
|
type: "block",
|
|
@@ -1779,6 +1752,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1779
1752
|
}
|
|
1780
1753
|
}
|
|
1781
1754
|
}
|
|
1755
|
+
if (slots) {
|
|
1756
|
+
const slotKeys = Object.keys(slots);
|
|
1757
|
+
for (const slotKey of slotKeys) {
|
|
1758
|
+
const components = slots[slotKey];
|
|
1759
|
+
for (const enqueueingComponent of components) {
|
|
1760
|
+
const parentSlotIndexFn = () => {
|
|
1761
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1762
|
+
(x) => x === enqueueingComponent
|
|
1763
|
+
);
|
|
1764
|
+
return result;
|
|
1765
|
+
};
|
|
1766
|
+
childEntries.push({
|
|
1767
|
+
ancestorsAndSelf: [
|
|
1768
|
+
{
|
|
1769
|
+
type: "slot",
|
|
1770
|
+
node: enqueueingComponent,
|
|
1771
|
+
parentSlot: slotKey,
|
|
1772
|
+
parentSlotIndexFn
|
|
1773
|
+
},
|
|
1774
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1775
|
+
],
|
|
1776
|
+
context: descendantContext
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
if (order === "dfs") {
|
|
1782
|
+
childEntries.reverse();
|
|
1783
|
+
}
|
|
1784
|
+
componentQueue.push(...childEntries);
|
|
1782
1785
|
} while (componentQueue.length > 0);
|
|
1783
1786
|
}
|
|
1784
1787
|
function isNestedNodeType(type) {
|
|
@@ -1849,6 +1852,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1849
1852
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1850
1853
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1851
1854
|
var _url22;
|
|
1855
|
+
var _projectsUrl;
|
|
1852
1856
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1853
1857
|
constructor(options) {
|
|
1854
1858
|
super({ ...options, bypassCache: true });
|
|
@@ -1858,6 +1862,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1858
1862
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1859
1863
|
return await this.apiClient(fetchUri);
|
|
1860
1864
|
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Fetches projects grouped by team.
|
|
1867
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1868
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1869
|
+
*/
|
|
1870
|
+
async getProjects(options) {
|
|
1871
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1872
|
+
return await this.apiClient(fetchUri);
|
|
1873
|
+
}
|
|
1861
1874
|
/** Updates or creates (based on id) a Project */
|
|
1862
1875
|
async upsert(body) {
|
|
1863
1876
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1877,7 +1890,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1877
1890
|
}
|
|
1878
1891
|
};
|
|
1879
1892
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1893
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1880
1894
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1895
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1881
1896
|
var ROUTE_URL = "/api/v1/route";
|
|
1882
1897
|
var RouteClient = class extends ApiClient {
|
|
1883
1898
|
constructor(options) {
|
|
@@ -1979,8 +1994,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1979
1994
|
var isDevelopmentEnvironment = () => {
|
|
1980
1995
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1981
1996
|
};
|
|
1997
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1998
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1999
|
+
return isNotPublished ? true : void 0;
|
|
2000
|
+
};
|
|
1982
2001
|
|
|
1983
2002
|
// src/clients/cache.ts
|
|
2003
|
+
var isSpecificCacheMode = (options) => {
|
|
2004
|
+
return "cache" in options;
|
|
2005
|
+
};
|
|
1984
2006
|
var isStateCacheMode = (options) => {
|
|
1985
2007
|
return "state" in options;
|
|
1986
2008
|
};
|
|
@@ -2007,7 +2029,9 @@ var resolveCache = ({
|
|
|
2007
2029
|
}) => {
|
|
2008
2030
|
let cache2 = void 0;
|
|
2009
2031
|
if (options) {
|
|
2010
|
-
if (
|
|
2032
|
+
if (isSpecificCacheMode(options)) {
|
|
2033
|
+
cache2 = options.cache;
|
|
2034
|
+
} else if (isStateCacheMode(options)) {
|
|
2011
2035
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2012
2036
|
cache2 = {
|
|
2013
2037
|
type: "no-cache",
|
|
@@ -2763,7 +2787,7 @@ var createTestComponentProps = ({
|
|
|
2763
2787
|
const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
|
|
2764
2788
|
return {
|
|
2765
2789
|
...common,
|
|
2766
|
-
index: testIndex
|
|
2790
|
+
index: testIndex,
|
|
2767
2791
|
test
|
|
2768
2792
|
};
|
|
2769
2793
|
};
|
|
@@ -3598,8 +3622,9 @@ var generatePossiblePageStates = ({
|
|
|
3598
3622
|
locale,
|
|
3599
3623
|
isPrefetch: void 0
|
|
3600
3624
|
};
|
|
3625
|
+
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3601
3626
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3602
|
-
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
|
3627
|
+
return allStates.map((payload) => serializeEvaluationResult({ payload, allComponentIds }));
|
|
3603
3628
|
};
|
|
3604
3629
|
function permutationsWithoutRepetition(options, k) {
|
|
3605
3630
|
if (k === 0) return [[]];
|
|
@@ -3648,7 +3673,10 @@ var DefaultDataClient = class {
|
|
|
3648
3673
|
}
|
|
3649
3674
|
}
|
|
3650
3675
|
const manifest = await getManifest({
|
|
3651
|
-
cache: {
|
|
3676
|
+
cache: isDevelopmentEnvironment() ? {
|
|
3677
|
+
type: "no-cache",
|
|
3678
|
+
bypassCache: true
|
|
3679
|
+
} : {
|
|
3652
3680
|
type: "force-cache"
|
|
3653
3681
|
}
|
|
3654
3682
|
});
|
|
@@ -3751,12 +3779,13 @@ var DefaultDataClient = class {
|
|
|
3751
3779
|
};
|
|
3752
3780
|
}
|
|
3753
3781
|
async getRoutePageState(options) {
|
|
3782
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
3754
3783
|
const routeClient = getRouteClient({
|
|
3755
|
-
cache:
|
|
3756
|
-
type: "force-cache"
|
|
3757
|
-
} : {
|
|
3784
|
+
cache: shouldBypassCache ? {
|
|
3758
3785
|
type: "no-cache",
|
|
3759
3786
|
bypassCache: true
|
|
3787
|
+
} : {
|
|
3788
|
+
type: "force-cache"
|
|
3760
3789
|
}
|
|
3761
3790
|
});
|
|
3762
3791
|
const originalRoute = {
|
|
@@ -3764,7 +3793,8 @@ var DefaultDataClient = class {
|
|
|
3764
3793
|
state: options.pageState.compositionState,
|
|
3765
3794
|
withComponentIDs: true,
|
|
3766
3795
|
releaseId: options.pageState.releaseId,
|
|
3767
|
-
locale: options.pageState.locale
|
|
3796
|
+
locale: options.pageState.locale,
|
|
3797
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
3768
3798
|
};
|
|
3769
3799
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3770
3800
|
source: "pageState",
|
package/dist/middleware.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Quirks } from '@uniformdev/context';
|
|
2
|
-
import {
|
|
2
|
+
import { RewriteRequestPathResult, PageState } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { NextRequest, NextResponse } from 'next/server';
|
|
4
|
-
import { D as DataClient } from './client-
|
|
4
|
+
import { D as DataClient } from './client-BlKZeE6C.mjs';
|
|
5
5
|
import '@uniformdev/canvas';
|
|
6
6
|
|
|
7
7
|
type RewriteOptions = {
|
package/dist/middleware.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Quirks } from '@uniformdev/context';
|
|
2
|
-
import {
|
|
2
|
+
import { RewriteRequestPathResult, PageState } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { NextRequest, NextResponse } from 'next/server';
|
|
4
|
-
import { D as DataClient } from './client-
|
|
4
|
+
import { D as DataClient } from './client-BlKZeE6C.js';
|
|
5
5
|
import '@uniformdev/canvas';
|
|
6
6
|
|
|
7
7
|
type RewriteOptions = {
|