@uniformdev/next-app-router 20.63.0 → 20.63.1-alpha.17
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 +53 -4
- package/dist/cache.mjs +53 -4
- 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 +50 -3
- package/dist/component.mjs +50 -3
- package/dist/handler.js +60 -6
- package/dist/handler.mjs +60 -6
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +103 -44
- package/dist/index.js +103 -44
- package/dist/index.mjs +103 -44
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +103 -44
- package/dist/middleware.mjs +103 -44
- 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 +9 -9
package/dist/middleware.mjs
CHANGED
|
@@ -1312,6 +1312,47 @@ function createLimitPolicy({
|
|
|
1312
1312
|
return currentFunc();
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1316
|
+
function appendCsv(out, key, values) {
|
|
1317
|
+
if (values === void 0) {
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
out[key] = values.join(",");
|
|
1321
|
+
}
|
|
1322
|
+
function projectionToQuery(spec) {
|
|
1323
|
+
const out = {};
|
|
1324
|
+
if (!spec) {
|
|
1325
|
+
return out;
|
|
1326
|
+
}
|
|
1327
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1328
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1329
|
+
if (fields) {
|
|
1330
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1331
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1332
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1333
|
+
}
|
|
1334
|
+
if (fieldTypes) {
|
|
1335
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1336
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1337
|
+
}
|
|
1338
|
+
if (slots) {
|
|
1339
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1340
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1341
|
+
if (typeof slots.depth === "number") {
|
|
1342
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1343
|
+
}
|
|
1344
|
+
if (slots.named) {
|
|
1345
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1346
|
+
for (const slotName of slotNames) {
|
|
1347
|
+
const named = slots.named[slotName];
|
|
1348
|
+
if (named && typeof named.depth === "number") {
|
|
1349
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
return out;
|
|
1355
|
+
}
|
|
1315
1356
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1316
1357
|
var CanvasClient = class extends ApiClient {
|
|
1317
1358
|
constructor(options) {
|
|
@@ -1326,17 +1367,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1326
1367
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1327
1368
|
async getCompositionList(params = {}) {
|
|
1328
1369
|
const { projectId } = this.options;
|
|
1329
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1370
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1330
1371
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1372
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1331
1373
|
if (!resolveData) {
|
|
1332
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1374
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1375
|
+
...originParams,
|
|
1376
|
+
projectId,
|
|
1377
|
+
...rewrittenFilters,
|
|
1378
|
+
...rewrittenSelect
|
|
1379
|
+
});
|
|
1333
1380
|
return this.apiClient(fetchUri);
|
|
1334
1381
|
}
|
|
1335
1382
|
const edgeParams = {
|
|
1336
1383
|
...originParams,
|
|
1337
1384
|
projectId,
|
|
1338
1385
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1339
|
-
...rewrittenFilters
|
|
1386
|
+
...rewrittenFilters,
|
|
1387
|
+
...rewrittenSelect
|
|
1340
1388
|
};
|
|
1341
1389
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1342
1390
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1446,15 +1494,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1446
1494
|
}
|
|
1447
1495
|
getEntries(options) {
|
|
1448
1496
|
const { projectId } = this.options;
|
|
1449
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1497
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1450
1498
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1499
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1451
1500
|
if (skipDataResolution) {
|
|
1452
|
-
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1501
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1502
|
+
...params,
|
|
1503
|
+
...rewrittenFilters,
|
|
1504
|
+
...rewrittenSelect,
|
|
1505
|
+
projectId
|
|
1506
|
+
});
|
|
1453
1507
|
return this.apiClient(url);
|
|
1454
1508
|
}
|
|
1455
1509
|
const edgeUrl = this.createUrl(
|
|
1456
1510
|
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1457
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1511
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1458
1512
|
this.edgeApiHost
|
|
1459
1513
|
);
|
|
1460
1514
|
return this.apiClient(
|
|
@@ -1694,7 +1748,7 @@ function hasReferencedVariables(value) {
|
|
|
1694
1748
|
return variableTokenCount;
|
|
1695
1749
|
}
|
|
1696
1750
|
function walkNodeTree(node, visitor, options) {
|
|
1697
|
-
var _a, _b;
|
|
1751
|
+
var _a, _b, _c;
|
|
1698
1752
|
const componentQueue = [
|
|
1699
1753
|
{
|
|
1700
1754
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1702,12 +1756,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1702
1756
|
}
|
|
1703
1757
|
];
|
|
1704
1758
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1759
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1760
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1705
1761
|
do {
|
|
1706
|
-
const currentQueueEntry =
|
|
1762
|
+
const currentQueueEntry = takeNext();
|
|
1707
1763
|
if (!currentQueueEntry) continue;
|
|
1708
1764
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1709
1765
|
let visitDescendants = true;
|
|
1710
|
-
let descendantContext = (
|
|
1766
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1711
1767
|
let visitorInfo;
|
|
1712
1768
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1713
1769
|
visitorInfo = {
|
|
@@ -1894,39 +1950,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1894
1950
|
continue;
|
|
1895
1951
|
}
|
|
1896
1952
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1897
|
-
|
|
1898
|
-
const slotKeys = Object.keys(slots);
|
|
1899
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1900
|
-
const slotKey = slotKeys[slotIndex];
|
|
1901
|
-
const components = slots[slotKey];
|
|
1902
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1903
|
-
const enqueueingComponent = components[componentIndex];
|
|
1904
|
-
const parentSlotIndexFn = () => {
|
|
1905
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1906
|
-
(x) => x === enqueueingComponent
|
|
1907
|
-
);
|
|
1908
|
-
return result;
|
|
1909
|
-
};
|
|
1910
|
-
componentQueue.push({
|
|
1911
|
-
ancestorsAndSelf: [
|
|
1912
|
-
{
|
|
1913
|
-
type: "slot",
|
|
1914
|
-
node: enqueueingComponent,
|
|
1915
|
-
parentSlot: slotKey,
|
|
1916
|
-
parentSlotIndexFn
|
|
1917
|
-
},
|
|
1918
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1919
|
-
],
|
|
1920
|
-
context: descendantContext
|
|
1921
|
-
});
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1953
|
+
const childEntries = [];
|
|
1925
1954
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1926
1955
|
if (properties) {
|
|
1927
1956
|
const propertyEntries = Object.entries(properties);
|
|
1928
|
-
for (
|
|
1929
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1957
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1930
1958
|
if (!isNestedNodeType(propObject.type)) {
|
|
1931
1959
|
continue;
|
|
1932
1960
|
}
|
|
@@ -1946,13 +1974,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1946
1974
|
continue;
|
|
1947
1975
|
}
|
|
1948
1976
|
}
|
|
1949
|
-
const blocks = (
|
|
1950
|
-
for (
|
|
1951
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1977
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1978
|
+
for (const enqueueingBlock of blocks) {
|
|
1952
1979
|
const blockIndexFn = () => {
|
|
1953
1980
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1954
1981
|
};
|
|
1955
|
-
|
|
1982
|
+
childEntries.push({
|
|
1956
1983
|
ancestorsAndSelf: [
|
|
1957
1984
|
{
|
|
1958
1985
|
type: "block",
|
|
@@ -1967,6 +1994,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1967
1994
|
}
|
|
1968
1995
|
}
|
|
1969
1996
|
}
|
|
1997
|
+
if (slots) {
|
|
1998
|
+
const slotKeys = Object.keys(slots);
|
|
1999
|
+
for (const slotKey of slotKeys) {
|
|
2000
|
+
const components = slots[slotKey];
|
|
2001
|
+
for (const enqueueingComponent of components) {
|
|
2002
|
+
const parentSlotIndexFn = () => {
|
|
2003
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
2004
|
+
(x) => x === enqueueingComponent
|
|
2005
|
+
);
|
|
2006
|
+
return result;
|
|
2007
|
+
};
|
|
2008
|
+
childEntries.push({
|
|
2009
|
+
ancestorsAndSelf: [
|
|
2010
|
+
{
|
|
2011
|
+
type: "slot",
|
|
2012
|
+
node: enqueueingComponent,
|
|
2013
|
+
parentSlot: slotKey,
|
|
2014
|
+
parentSlotIndexFn
|
|
2015
|
+
},
|
|
2016
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
2017
|
+
],
|
|
2018
|
+
context: descendantContext
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
if (order === "dfs") {
|
|
2024
|
+
childEntries.reverse();
|
|
2025
|
+
}
|
|
2026
|
+
componentQueue.push(...childEntries);
|
|
1970
2027
|
} while (componentQueue.length > 0);
|
|
1971
2028
|
}
|
|
1972
2029
|
function isNestedNodeType(type) {
|
|
@@ -2236,7 +2293,9 @@ var RouteClient = class extends ApiClient {
|
|
|
2236
2293
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
2237
2294
|
async getRoute(options) {
|
|
2238
2295
|
const { projectId } = this.options;
|
|
2239
|
-
const
|
|
2296
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2297
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2298
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2240
2299
|
return await this.apiClient(
|
|
2241
2300
|
fetchUri,
|
|
2242
2301
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RouteGetResponseEdgehancedComposition } from '@uniformdev/canvas';
|
|
2
2
|
import { PageState } from '@uniformdev/next-app-router-shared';
|
|
3
|
-
import { D as DataClient } from './client-
|
|
3
|
+
import { D as DataClient } from './client-BlKZeE6C.js';
|
|
4
4
|
|
|
5
5
|
type ResolvedRouteResult = {
|
|
6
6
|
pageState: PageState;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RouteGetResponseEdgehancedComposition } from '@uniformdev/canvas';
|
|
2
2
|
import { PageState } from '@uniformdev/next-app-router-shared';
|
|
3
|
-
import { D as DataClient } from './client-
|
|
3
|
+
import { D as DataClient } from './client-BlKZeE6C.mjs';
|
|
4
4
|
|
|
5
5
|
type ResolvedRouteResult = {
|
|
6
6
|
pageState: PageState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.63.
|
|
3
|
+
"version": "20.63.1-alpha.17+cd7eca3818",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@types/node": "20.19.25",
|
|
92
92
|
"@types/react": "19.0.8",
|
|
93
93
|
"@types/react-dom": "19.0.3",
|
|
94
|
-
"next": "16.
|
|
94
|
+
"next": "16.2.3",
|
|
95
95
|
"react": "19.2.0",
|
|
96
96
|
"react-dom": "19.2.0",
|
|
97
97
|
"typescript": "5.9.2",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"vitest": "3.2.4"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@uniformdev/canvas-react": "20.63.
|
|
103
|
-
"@uniformdev/next-app-router-client": "20.63.
|
|
104
|
-
"@uniformdev/next-app-router-shared": "20.63.
|
|
105
|
-
"@uniformdev/redirect": "20.63.
|
|
106
|
-
"@uniformdev/richtext": "20.63.
|
|
107
|
-
"@uniformdev/webhooks": "20.63.
|
|
102
|
+
"@uniformdev/canvas-react": "20.63.1-alpha.17+cd7eca3818",
|
|
103
|
+
"@uniformdev/next-app-router-client": "20.63.1-alpha.17+cd7eca3818",
|
|
104
|
+
"@uniformdev/next-app-router-shared": "20.63.1-alpha.17+cd7eca3818",
|
|
105
|
+
"@uniformdev/redirect": "20.63.1-alpha.17+cd7eca3818",
|
|
106
|
+
"@uniformdev/richtext": "20.63.1-alpha.17+cd7eca3818",
|
|
107
|
+
"@uniformdev/webhooks": "20.63.1-alpha.17+cd7eca3818",
|
|
108
108
|
"@vercel/functions": "^2.2.2",
|
|
109
109
|
"encoding": "^0.1.13",
|
|
110
110
|
"server-only": "^0.0.1",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"publishConfig": {
|
|
122
122
|
"access": "public"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "cd7eca38189533a6ba5899bf872b72e1331c4aa3"
|
|
125
125
|
}
|