@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/index.mjs
CHANGED
|
@@ -1122,6 +1122,47 @@ function createLimitPolicy({
|
|
|
1122
1122
|
return currentFunc();
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1126
|
+
function appendCsv(out, key, values) {
|
|
1127
|
+
if (values === void 0) {
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
out[key] = values.join(",");
|
|
1131
|
+
}
|
|
1132
|
+
function projectionToQuery(spec) {
|
|
1133
|
+
const out = {};
|
|
1134
|
+
if (!spec) {
|
|
1135
|
+
return out;
|
|
1136
|
+
}
|
|
1137
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1138
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1139
|
+
if (fields) {
|
|
1140
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1141
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1142
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1143
|
+
}
|
|
1144
|
+
if (fieldTypes) {
|
|
1145
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1146
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1147
|
+
}
|
|
1148
|
+
if (slots) {
|
|
1149
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1150
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1151
|
+
if (typeof slots.depth === "number") {
|
|
1152
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1153
|
+
}
|
|
1154
|
+
if (slots.named) {
|
|
1155
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1156
|
+
for (const slotName of slotNames) {
|
|
1157
|
+
const named = slots.named[slotName];
|
|
1158
|
+
if (named && typeof named.depth === "number") {
|
|
1159
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
return out;
|
|
1165
|
+
}
|
|
1125
1166
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1126
1167
|
var CanvasClient = class extends ApiClient {
|
|
1127
1168
|
constructor(options) {
|
|
@@ -1136,17 +1177,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1136
1177
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1137
1178
|
async getCompositionList(params = {}) {
|
|
1138
1179
|
const { projectId } = this.options;
|
|
1139
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1180
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1140
1181
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1182
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1141
1183
|
if (!resolveData) {
|
|
1142
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1184
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1185
|
+
...originParams,
|
|
1186
|
+
projectId,
|
|
1187
|
+
...rewrittenFilters,
|
|
1188
|
+
...rewrittenSelect
|
|
1189
|
+
});
|
|
1143
1190
|
return this.apiClient(fetchUri);
|
|
1144
1191
|
}
|
|
1145
1192
|
const edgeParams = {
|
|
1146
1193
|
...originParams,
|
|
1147
1194
|
projectId,
|
|
1148
1195
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1149
|
-
...rewrittenFilters
|
|
1196
|
+
...rewrittenFilters,
|
|
1197
|
+
...rewrittenSelect
|
|
1150
1198
|
};
|
|
1151
1199
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1152
1200
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1256,15 +1304,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1256
1304
|
}
|
|
1257
1305
|
getEntries(options) {
|
|
1258
1306
|
const { projectId } = this.options;
|
|
1259
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1307
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1260
1308
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1309
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1261
1310
|
if (skipDataResolution) {
|
|
1262
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1311
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1312
|
+
...params,
|
|
1313
|
+
...rewrittenFilters,
|
|
1314
|
+
...rewrittenSelect,
|
|
1315
|
+
projectId
|
|
1316
|
+
});
|
|
1263
1317
|
return this.apiClient(url);
|
|
1264
1318
|
}
|
|
1265
1319
|
const edgeUrl = this.createUrl(
|
|
1266
1320
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1267
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1321
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1268
1322
|
this.edgeApiHost
|
|
1269
1323
|
);
|
|
1270
1324
|
return this.apiClient(
|
|
@@ -1506,7 +1560,7 @@ function hasReferencedVariables(value) {
|
|
|
1506
1560
|
return variableTokenCount;
|
|
1507
1561
|
}
|
|
1508
1562
|
function walkNodeTree(node, visitor, options) {
|
|
1509
|
-
var _a, _b;
|
|
1563
|
+
var _a, _b, _c;
|
|
1510
1564
|
const componentQueue = [
|
|
1511
1565
|
{
|
|
1512
1566
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1514,12 +1568,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1514
1568
|
}
|
|
1515
1569
|
];
|
|
1516
1570
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1571
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1572
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1517
1573
|
do {
|
|
1518
|
-
const currentQueueEntry =
|
|
1574
|
+
const currentQueueEntry = takeNext();
|
|
1519
1575
|
if (!currentQueueEntry) continue;
|
|
1520
1576
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1521
1577
|
let visitDescendants = true;
|
|
1522
|
-
let descendantContext = (
|
|
1578
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1523
1579
|
let visitorInfo;
|
|
1524
1580
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1525
1581
|
visitorInfo = {
|
|
@@ -1706,39 +1762,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1706
1762
|
continue;
|
|
1707
1763
|
}
|
|
1708
1764
|
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
|
-
}
|
|
1765
|
+
const childEntries = [];
|
|
1737
1766
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1738
1767
|
if (properties) {
|
|
1739
1768
|
const propertyEntries = Object.entries(properties);
|
|
1740
|
-
for (
|
|
1741
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1769
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1742
1770
|
if (!isNestedNodeType(propObject.type)) {
|
|
1743
1771
|
continue;
|
|
1744
1772
|
}
|
|
@@ -1758,13 +1786,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1758
1786
|
continue;
|
|
1759
1787
|
}
|
|
1760
1788
|
}
|
|
1761
|
-
const blocks = (
|
|
1762
|
-
for (
|
|
1763
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1789
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1790
|
+
for (const enqueueingBlock of blocks) {
|
|
1764
1791
|
const blockIndexFn = () => {
|
|
1765
1792
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1766
1793
|
};
|
|
1767
|
-
|
|
1794
|
+
childEntries.push({
|
|
1768
1795
|
ancestorsAndSelf: [
|
|
1769
1796
|
{
|
|
1770
1797
|
type: "block",
|
|
@@ -1779,6 +1806,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1779
1806
|
}
|
|
1780
1807
|
}
|
|
1781
1808
|
}
|
|
1809
|
+
if (slots) {
|
|
1810
|
+
const slotKeys = Object.keys(slots);
|
|
1811
|
+
for (const slotKey of slotKeys) {
|
|
1812
|
+
const components = slots[slotKey];
|
|
1813
|
+
for (const enqueueingComponent of components) {
|
|
1814
|
+
const parentSlotIndexFn = () => {
|
|
1815
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1816
|
+
(x) => x === enqueueingComponent
|
|
1817
|
+
);
|
|
1818
|
+
return result;
|
|
1819
|
+
};
|
|
1820
|
+
childEntries.push({
|
|
1821
|
+
ancestorsAndSelf: [
|
|
1822
|
+
{
|
|
1823
|
+
type: "slot",
|
|
1824
|
+
node: enqueueingComponent,
|
|
1825
|
+
parentSlot: slotKey,
|
|
1826
|
+
parentSlotIndexFn
|
|
1827
|
+
},
|
|
1828
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1829
|
+
],
|
|
1830
|
+
context: descendantContext
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
if (order === "dfs") {
|
|
1836
|
+
childEntries.reverse();
|
|
1837
|
+
}
|
|
1838
|
+
componentQueue.push(...childEntries);
|
|
1782
1839
|
} while (componentQueue.length > 0);
|
|
1783
1840
|
}
|
|
1784
1841
|
function isNestedNodeType(type) {
|
|
@@ -1903,7 +1960,9 @@ var RouteClient = class extends ApiClient {
|
|
|
1903
1960
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1904
1961
|
async getRoute(options) {
|
|
1905
1962
|
const { projectId } = this.options;
|
|
1906
|
-
const
|
|
1963
|
+
const { select, ...rest } = options != null ? options : {};
|
|
1964
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1965
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
1907
1966
|
return await this.apiClient(
|
|
1908
1967
|
fetchUri,
|
|
1909
1968
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
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 = {
|
package/dist/middleware.js
CHANGED
|
@@ -1327,6 +1327,47 @@ function createLimitPolicy({
|
|
|
1327
1327
|
return currentFunc();
|
|
1328
1328
|
};
|
|
1329
1329
|
}
|
|
1330
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1331
|
+
function appendCsv(out, key, values) {
|
|
1332
|
+
if (values === void 0) {
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
out[key] = values.join(",");
|
|
1336
|
+
}
|
|
1337
|
+
function projectionToQuery(spec) {
|
|
1338
|
+
const out = {};
|
|
1339
|
+
if (!spec) {
|
|
1340
|
+
return out;
|
|
1341
|
+
}
|
|
1342
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1343
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1344
|
+
if (fields) {
|
|
1345
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1346
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1347
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1348
|
+
}
|
|
1349
|
+
if (fieldTypes) {
|
|
1350
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1351
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1352
|
+
}
|
|
1353
|
+
if (slots) {
|
|
1354
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1355
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1356
|
+
if (typeof slots.depth === "number") {
|
|
1357
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1358
|
+
}
|
|
1359
|
+
if (slots.named) {
|
|
1360
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1361
|
+
for (const slotName of slotNames) {
|
|
1362
|
+
const named = slots.named[slotName];
|
|
1363
|
+
if (named && typeof named.depth === "number") {
|
|
1364
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return out;
|
|
1370
|
+
}
|
|
1330
1371
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1331
1372
|
var CanvasClient = class extends ApiClient {
|
|
1332
1373
|
constructor(options) {
|
|
@@ -1341,17 +1382,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1341
1382
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1342
1383
|
async getCompositionList(params = {}) {
|
|
1343
1384
|
const { projectId } = this.options;
|
|
1344
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1385
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1345
1386
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1387
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1346
1388
|
if (!resolveData) {
|
|
1347
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1389
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1390
|
+
...originParams,
|
|
1391
|
+
projectId,
|
|
1392
|
+
...rewrittenFilters,
|
|
1393
|
+
...rewrittenSelect
|
|
1394
|
+
});
|
|
1348
1395
|
return this.apiClient(fetchUri);
|
|
1349
1396
|
}
|
|
1350
1397
|
const edgeParams = {
|
|
1351
1398
|
...originParams,
|
|
1352
1399
|
projectId,
|
|
1353
1400
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1354
|
-
...rewrittenFilters
|
|
1401
|
+
...rewrittenFilters,
|
|
1402
|
+
...rewrittenSelect
|
|
1355
1403
|
};
|
|
1356
1404
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1357
1405
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1461,15 +1509,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1461
1509
|
}
|
|
1462
1510
|
getEntries(options) {
|
|
1463
1511
|
const { projectId } = this.options;
|
|
1464
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1512
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1465
1513
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1514
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1466
1515
|
if (skipDataResolution) {
|
|
1467
|
-
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1516
|
+
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
|
|
1517
|
+
...params,
|
|
1518
|
+
...rewrittenFilters,
|
|
1519
|
+
...rewrittenSelect,
|
|
1520
|
+
projectId
|
|
1521
|
+
});
|
|
1468
1522
|
return this.apiClient(url);
|
|
1469
1523
|
}
|
|
1470
1524
|
const edgeUrl = this.createUrl(
|
|
1471
1525
|
__privateGet3(_ContentClient2, _entriesUrl),
|
|
1472
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1526
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1473
1527
|
this.edgeApiHost
|
|
1474
1528
|
);
|
|
1475
1529
|
return this.apiClient(
|
|
@@ -1709,7 +1763,7 @@ function hasReferencedVariables(value) {
|
|
|
1709
1763
|
return variableTokenCount;
|
|
1710
1764
|
}
|
|
1711
1765
|
function walkNodeTree(node, visitor, options) {
|
|
1712
|
-
var _a, _b;
|
|
1766
|
+
var _a, _b, _c;
|
|
1713
1767
|
const componentQueue = [
|
|
1714
1768
|
{
|
|
1715
1769
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1717,12 +1771,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1717
1771
|
}
|
|
1718
1772
|
];
|
|
1719
1773
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1774
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1775
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1720
1776
|
do {
|
|
1721
|
-
const currentQueueEntry =
|
|
1777
|
+
const currentQueueEntry = takeNext();
|
|
1722
1778
|
if (!currentQueueEntry) continue;
|
|
1723
1779
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1724
1780
|
let visitDescendants = true;
|
|
1725
|
-
let descendantContext = (
|
|
1781
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1726
1782
|
let visitorInfo;
|
|
1727
1783
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1728
1784
|
visitorInfo = {
|
|
@@ -1909,39 +1965,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1909
1965
|
continue;
|
|
1910
1966
|
}
|
|
1911
1967
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1912
|
-
|
|
1913
|
-
const slotKeys = Object.keys(slots);
|
|
1914
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1915
|
-
const slotKey = slotKeys[slotIndex];
|
|
1916
|
-
const components = slots[slotKey];
|
|
1917
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1918
|
-
const enqueueingComponent = components[componentIndex];
|
|
1919
|
-
const parentSlotIndexFn = () => {
|
|
1920
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1921
|
-
(x) => x === enqueueingComponent
|
|
1922
|
-
);
|
|
1923
|
-
return result;
|
|
1924
|
-
};
|
|
1925
|
-
componentQueue.push({
|
|
1926
|
-
ancestorsAndSelf: [
|
|
1927
|
-
{
|
|
1928
|
-
type: "slot",
|
|
1929
|
-
node: enqueueingComponent,
|
|
1930
|
-
parentSlot: slotKey,
|
|
1931
|
-
parentSlotIndexFn
|
|
1932
|
-
},
|
|
1933
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1934
|
-
],
|
|
1935
|
-
context: descendantContext
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1968
|
+
const childEntries = [];
|
|
1940
1969
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1941
1970
|
if (properties) {
|
|
1942
1971
|
const propertyEntries = Object.entries(properties);
|
|
1943
|
-
for (
|
|
1944
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1972
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1945
1973
|
if (!isNestedNodeType(propObject.type)) {
|
|
1946
1974
|
continue;
|
|
1947
1975
|
}
|
|
@@ -1961,13 +1989,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1961
1989
|
continue;
|
|
1962
1990
|
}
|
|
1963
1991
|
}
|
|
1964
|
-
const blocks = (
|
|
1965
|
-
for (
|
|
1966
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1992
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1993
|
+
for (const enqueueingBlock of blocks) {
|
|
1967
1994
|
const blockIndexFn = () => {
|
|
1968
1995
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1969
1996
|
};
|
|
1970
|
-
|
|
1997
|
+
childEntries.push({
|
|
1971
1998
|
ancestorsAndSelf: [
|
|
1972
1999
|
{
|
|
1973
2000
|
type: "block",
|
|
@@ -1982,6 +2009,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1982
2009
|
}
|
|
1983
2010
|
}
|
|
1984
2011
|
}
|
|
2012
|
+
if (slots) {
|
|
2013
|
+
const slotKeys = Object.keys(slots);
|
|
2014
|
+
for (const slotKey of slotKeys) {
|
|
2015
|
+
const components = slots[slotKey];
|
|
2016
|
+
for (const enqueueingComponent of components) {
|
|
2017
|
+
const parentSlotIndexFn = () => {
|
|
2018
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
2019
|
+
(x) => x === enqueueingComponent
|
|
2020
|
+
);
|
|
2021
|
+
return result;
|
|
2022
|
+
};
|
|
2023
|
+
childEntries.push({
|
|
2024
|
+
ancestorsAndSelf: [
|
|
2025
|
+
{
|
|
2026
|
+
type: "slot",
|
|
2027
|
+
node: enqueueingComponent,
|
|
2028
|
+
parentSlot: slotKey,
|
|
2029
|
+
parentSlotIndexFn
|
|
2030
|
+
},
|
|
2031
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
2032
|
+
],
|
|
2033
|
+
context: descendantContext
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
if (order === "dfs") {
|
|
2039
|
+
childEntries.reverse();
|
|
2040
|
+
}
|
|
2041
|
+
componentQueue.push(...childEntries);
|
|
1985
2042
|
} while (componentQueue.length > 0);
|
|
1986
2043
|
}
|
|
1987
2044
|
function isNestedNodeType(type) {
|
|
@@ -2251,7 +2308,9 @@ var RouteClient = class extends ApiClient {
|
|
|
2251
2308
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
2252
2309
|
async getRoute(options) {
|
|
2253
2310
|
const { projectId } = this.options;
|
|
2254
|
-
const
|
|
2311
|
+
const { select, ...rest } = options != null ? options : {};
|
|
2312
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
2313
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
2255
2314
|
return await this.apiClient(
|
|
2256
2315
|
fetchUri,
|
|
2257
2316
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|