@fern-api/fdr-sdk 1.2.42-0c024f5b0d → 1.2.42-23647d2912
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/js/navigation/ledger-root-builder.js +134 -30
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +134 -30
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +267 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +306 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +109 -4
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +102 -0
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +256 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +192 -33
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -51,6 +51,17 @@ var VersionIdSchema = z.string();
|
|
|
51
51
|
function VersionId(value) {
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
|
+
var Availability = {
|
|
55
|
+
Alpha: "Alpha",
|
|
56
|
+
Stable: "Stable",
|
|
57
|
+
GenerallyAvailable: "GenerallyAvailable",
|
|
58
|
+
InDevelopment: "InDevelopment",
|
|
59
|
+
PreRelease: "PreRelease",
|
|
60
|
+
Deprecated: "Deprecated",
|
|
61
|
+
Beta: "Beta",
|
|
62
|
+
Preview: "Preview",
|
|
63
|
+
Legacy: "Legacy"
|
|
64
|
+
};
|
|
54
65
|
var SnippetsByEndpointMethodSchema = z.record(
|
|
55
66
|
HttpMethodSchema,
|
|
56
67
|
z.array(z.unknown())
|
|
@@ -847,6 +858,35 @@ function metaStr(metadata, key) {
|
|
|
847
858
|
}
|
|
848
859
|
return void 0;
|
|
849
860
|
}
|
|
861
|
+
var AVAILABILITY_LOOKUP = {
|
|
862
|
+
// V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
|
|
863
|
+
alpha: Availability.Alpha,
|
|
864
|
+
stable: Availability.Stable,
|
|
865
|
+
"generally-available": Availability.GenerallyAvailable,
|
|
866
|
+
"in-development": Availability.InDevelopment,
|
|
867
|
+
"pre-release": Availability.PreRelease,
|
|
868
|
+
deprecated: Availability.Deprecated,
|
|
869
|
+
beta: Availability.Beta,
|
|
870
|
+
preview: Availability.Preview,
|
|
871
|
+
legacy: Availability.Legacy,
|
|
872
|
+
// Latest PascalCase values (pass-through)
|
|
873
|
+
Alpha: Availability.Alpha,
|
|
874
|
+
Stable: Availability.Stable,
|
|
875
|
+
GenerallyAvailable: Availability.GenerallyAvailable,
|
|
876
|
+
InDevelopment: Availability.InDevelopment,
|
|
877
|
+
PreRelease: Availability.PreRelease,
|
|
878
|
+
Deprecated: Availability.Deprecated,
|
|
879
|
+
Beta: Availability.Beta,
|
|
880
|
+
Preview: Availability.Preview,
|
|
881
|
+
Legacy: Availability.Legacy
|
|
882
|
+
};
|
|
883
|
+
function metaAvailability(metadata) {
|
|
884
|
+
const raw = metaStr(metadata, "availability");
|
|
885
|
+
if (raw == null) {
|
|
886
|
+
return void 0;
|
|
887
|
+
}
|
|
888
|
+
return AVAILABILITY_LOOKUP[raw];
|
|
889
|
+
}
|
|
850
890
|
function metaBool(metadata, key) {
|
|
851
891
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
852
892
|
const v = metadata[key];
|
|
@@ -964,7 +1004,7 @@ function artifactToNode(ctx, route) {
|
|
|
964
1004
|
}),
|
|
965
1005
|
pageId: PageId(pageId),
|
|
966
1006
|
noindex: metaBool(md, "noindex"),
|
|
967
|
-
availability:
|
|
1007
|
+
availability: metaAvailability(md)
|
|
968
1008
|
};
|
|
969
1009
|
return node;
|
|
970
1010
|
}
|
|
@@ -1029,7 +1069,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1029
1069
|
endpointId: EndpointId(endpointId),
|
|
1030
1070
|
apiDefinitionId,
|
|
1031
1071
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
1032
|
-
availability:
|
|
1072
|
+
availability: metaAvailability(md),
|
|
1033
1073
|
playground: void 0
|
|
1034
1074
|
};
|
|
1035
1075
|
}
|
|
@@ -1045,7 +1085,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1045
1085
|
method,
|
|
1046
1086
|
webhookId: WebhookId(webhookId),
|
|
1047
1087
|
apiDefinitionId,
|
|
1048
|
-
availability:
|
|
1088
|
+
availability: metaAvailability(md)
|
|
1049
1089
|
};
|
|
1050
1090
|
}
|
|
1051
1091
|
if (route.type === "asyncapi") {
|
|
@@ -1058,7 +1098,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1058
1098
|
...meta,
|
|
1059
1099
|
webSocketId: WebSocketId(webSocketId),
|
|
1060
1100
|
apiDefinitionId,
|
|
1061
|
-
availability:
|
|
1101
|
+
availability: metaAvailability(md),
|
|
1062
1102
|
playground: void 0
|
|
1063
1103
|
};
|
|
1064
1104
|
}
|
|
@@ -1074,7 +1114,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1074
1114
|
method,
|
|
1075
1115
|
grpcId: GrpcId(grpcId),
|
|
1076
1116
|
apiDefinitionId,
|
|
1077
|
-
availability:
|
|
1117
|
+
availability: metaAvailability(md)
|
|
1078
1118
|
};
|
|
1079
1119
|
}
|
|
1080
1120
|
if (route.type === "graphql") {
|
|
@@ -1090,7 +1130,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1090
1130
|
graphqlOperationId: GraphQlOperationId(graphqlOperationId),
|
|
1091
1131
|
graphqlOperationIds: void 0,
|
|
1092
1132
|
apiDefinitionId,
|
|
1093
|
-
availability:
|
|
1133
|
+
availability: metaAvailability(md),
|
|
1094
1134
|
playground: void 0
|
|
1095
1135
|
};
|
|
1096
1136
|
}
|
|
@@ -1219,6 +1259,30 @@ function stripLeadingScopePrefix(section, scopePrefix) {
|
|
|
1219
1259
|
}
|
|
1220
1260
|
return section;
|
|
1221
1261
|
}
|
|
1262
|
+
function computeDuplicateSiblingSortBoundaries(siblings) {
|
|
1263
|
+
const result = /* @__PURE__ */ new Map();
|
|
1264
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
1265
|
+
for (const sibling of siblings) {
|
|
1266
|
+
if (metaStr(sibling.seg.metadata, "type") !== "section") {
|
|
1267
|
+
continue;
|
|
1268
|
+
}
|
|
1269
|
+
const group = byPath.get(sibling.seg.section) ?? [];
|
|
1270
|
+
group.push(sibling);
|
|
1271
|
+
byPath.set(sibling.seg.section, group);
|
|
1272
|
+
}
|
|
1273
|
+
for (const [, group] of byPath) {
|
|
1274
|
+
if (group.length <= 1) {
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
1277
|
+
for (let i = 0; i < group.length; i++) {
|
|
1278
|
+
result.set(group[i], {
|
|
1279
|
+
lo: group[i].seg.sortOrder,
|
|
1280
|
+
hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
return result;
|
|
1285
|
+
}
|
|
1222
1286
|
function mergeChildrenByPosition(ctx, nav, sectionChildren) {
|
|
1223
1287
|
const leafNodes = [];
|
|
1224
1288
|
for (let i = 0; i < nav.length; i++) {
|
|
@@ -1268,17 +1332,20 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1268
1332
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1269
1333
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1270
1334
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1271
|
-
availability:
|
|
1335
|
+
availability: metaAvailability(seg.metadata),
|
|
1272
1336
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
1273
1337
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1274
1338
|
};
|
|
1275
1339
|
}
|
|
1276
|
-
function directChildApiPackages(parentSection, scopeSegs) {
|
|
1340
|
+
function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
1277
1341
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1278
1342
|
return scopeSegs.filter((s) => {
|
|
1279
1343
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
1280
1344
|
return false;
|
|
1281
1345
|
}
|
|
1346
|
+
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
1347
|
+
return false;
|
|
1348
|
+
}
|
|
1282
1349
|
const parent = parentSectionPath(s.seg.section);
|
|
1283
1350
|
if (parent === parentSection) {
|
|
1284
1351
|
return true;
|
|
@@ -1292,7 +1359,7 @@ function directChildApiPackages(parentSection, scopeSegs) {
|
|
|
1292
1359
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1293
1360
|
const { seg, nav } = scoped;
|
|
1294
1361
|
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1295
|
-
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1362
|
+
const childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
|
|
1296
1363
|
const packageNodes = childPackages.map((child) => ({
|
|
1297
1364
|
node: apiPackageChildNode(
|
|
1298
1365
|
ctx,
|
|
@@ -1342,7 +1409,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1342
1409
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1343
1410
|
}),
|
|
1344
1411
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1345
|
-
availability:
|
|
1412
|
+
availability: metaAvailability(seg.metadata),
|
|
1346
1413
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1347
1414
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1348
1415
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1430,10 +1497,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1430
1497
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1431
1498
|
}),
|
|
1432
1499
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1433
|
-
availability:
|
|
1500
|
+
availability: metaAvailability(seg.metadata),
|
|
1434
1501
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1435
1502
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1436
|
-
paginated:
|
|
1503
|
+
paginated: metaBool(seg.metadata, "paginated"),
|
|
1437
1504
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
1438
1505
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
1439
1506
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1451,7 +1518,10 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
1451
1518
|
}
|
|
1452
1519
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1453
1520
|
});
|
|
1454
|
-
const
|
|
1521
|
+
const apiReferenceCount = scopeSegs.filter((candidate) => {
|
|
1522
|
+
return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1523
|
+
}).length;
|
|
1524
|
+
const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? (apiReferenceCount === 1 ? candidates[0] : void 0);
|
|
1455
1525
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
|
|
1456
1526
|
}
|
|
1457
1527
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -1459,12 +1529,13 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1459
1529
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
1460
1530
|
return false;
|
|
1461
1531
|
}
|
|
1462
|
-
|
|
1532
|
+
const candidates = scopeSegs.filter((candidate) => {
|
|
1463
1533
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
1464
1534
|
return false;
|
|
1465
1535
|
}
|
|
1466
1536
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1467
1537
|
});
|
|
1538
|
+
return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
|
|
1468
1539
|
}
|
|
1469
1540
|
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1470
1541
|
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
@@ -1619,6 +1690,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1619
1690
|
}
|
|
1620
1691
|
return false;
|
|
1621
1692
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1693
|
+
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1622
1694
|
return direct.map((s) => {
|
|
1623
1695
|
const type = metaStr(s.seg.metadata, "type");
|
|
1624
1696
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1628,10 +1700,14 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1628
1700
|
} else if (type === "changelog") {
|
|
1629
1701
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1630
1702
|
} else {
|
|
1703
|
+
const boundary = siblingBoundaries.get(s);
|
|
1704
|
+
const childScopeSegs = boundary != null ? scopeSegs.filter(
|
|
1705
|
+
(candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
|
|
1706
|
+
) : scopeSegs;
|
|
1631
1707
|
node = sectionNode(
|
|
1632
1708
|
ctx,
|
|
1633
1709
|
s,
|
|
1634
|
-
buildSectionTree(ctx,
|
|
1710
|
+
buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
|
|
1635
1711
|
scopePrefix
|
|
1636
1712
|
);
|
|
1637
1713
|
}
|
|
@@ -1645,7 +1721,11 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1645
1721
|
for (const s of ordered) {
|
|
1646
1722
|
const type = metaStr(s.seg.metadata, "type");
|
|
1647
1723
|
const sec = s.seg.section;
|
|
1648
|
-
if (type !== "section"
|
|
1724
|
+
if (type !== "section") {
|
|
1725
|
+
continue;
|
|
1726
|
+
}
|
|
1727
|
+
if (sec === "") {
|
|
1728
|
+
rootSections.push(s);
|
|
1649
1729
|
continue;
|
|
1650
1730
|
}
|
|
1651
1731
|
const parent = parentSectionPath(sec);
|
|
@@ -1676,8 +1756,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1676
1756
|
const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1677
1757
|
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1678
1758
|
const annotated = [];
|
|
1679
|
-
const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
|
|
1680
1759
|
const siblingBoundaries = computeSiblingSortBoundaries(ordered);
|
|
1760
|
+
const hasRootSection = ordered.some(
|
|
1761
|
+
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1762
|
+
);
|
|
1681
1763
|
for (const s of ordered) {
|
|
1682
1764
|
const type = metaStr(s.seg.metadata, "type");
|
|
1683
1765
|
const sec = s.seg.section;
|
|
@@ -1696,8 +1778,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1696
1778
|
}
|
|
1697
1779
|
continue;
|
|
1698
1780
|
}
|
|
1699
|
-
if (type === "section" && sec === "") {
|
|
1700
|
-
const
|
|
1781
|
+
if (type === "section" && sec === "" && hasRootSection) {
|
|
1782
|
+
const bounds = siblingBoundaries.get(s);
|
|
1783
|
+
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1784
|
+
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1701
1785
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1702
1786
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1703
1787
|
continue;
|
|
@@ -1716,12 +1800,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1716
1800
|
} else {
|
|
1717
1801
|
const bounds = siblingBoundaries.get(s);
|
|
1718
1802
|
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
|
|
1723
|
-
scopePrefix
|
|
1724
|
-
);
|
|
1803
|
+
const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
|
|
1804
|
+
const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
|
|
1805
|
+
node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1725
1806
|
}
|
|
1726
1807
|
const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
|
|
1727
1808
|
annotated.push({
|
|
@@ -1759,10 +1840,6 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1759
1840
|
} else if (child.type === "section" && !child.collapsible) {
|
|
1760
1841
|
flushRun();
|
|
1761
1842
|
out.push(child);
|
|
1762
|
-
} else if (child.type === "changelog") {
|
|
1763
|
-
flushRun();
|
|
1764
|
-
run.push(child);
|
|
1765
|
-
flushRun();
|
|
1766
1843
|
} else {
|
|
1767
1844
|
run.push(child);
|
|
1768
1845
|
}
|
|
@@ -1877,7 +1954,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1877
1954
|
const variantIndividualSlug = detailSlug(variant);
|
|
1878
1955
|
const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
|
|
1879
1956
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1880
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
1957
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
|
|
1881
1958
|
return {
|
|
1882
1959
|
type: "variant",
|
|
1883
1960
|
...withMetadataDefaults({
|
|
@@ -2279,6 +2356,7 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2279
2356
|
};
|
|
2280
2357
|
return node;
|
|
2281
2358
|
});
|
|
2359
|
+
markCrossProductCanonicalSlugs(children);
|
|
2282
2360
|
return {
|
|
2283
2361
|
type: "productgroup",
|
|
2284
2362
|
id: ctx.nodeId("productgroup"),
|
|
@@ -2290,6 +2368,32 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2290
2368
|
children
|
|
2291
2369
|
};
|
|
2292
2370
|
}
|
|
2371
|
+
function markCrossProductCanonicalSlugs(productNodes) {
|
|
2372
|
+
const pageIdToCanonical = /* @__PURE__ */ new Map();
|
|
2373
|
+
const sorted = [...productNodes].sort((a, b) => {
|
|
2374
|
+
if (a.default !== b.default) {
|
|
2375
|
+
return a.default ? -1 : 1;
|
|
2376
|
+
}
|
|
2377
|
+
return 0;
|
|
2378
|
+
});
|
|
2379
|
+
for (const product of sorted) {
|
|
2380
|
+
traverseDF(product, (child) => {
|
|
2381
|
+
if (hasMetadata(child) && isPage(child)) {
|
|
2382
|
+
const pid = getPageId(child);
|
|
2383
|
+
if (pid == null) {
|
|
2384
|
+
return;
|
|
2385
|
+
}
|
|
2386
|
+
const key = `pid:${pid}`;
|
|
2387
|
+
const canonical = pageIdToCanonical.get(key);
|
|
2388
|
+
if (canonical != null && !product.default) {
|
|
2389
|
+
child.canonicalSlug = canonical;
|
|
2390
|
+
} else if (canonical == null) {
|
|
2391
|
+
pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2293
2397
|
export {
|
|
2294
2398
|
apiLeafNodeFromNavRoute,
|
|
2295
2399
|
buildFullRootFromSegments,
|