@fern-api/fdr-sdk 1.2.42-304ea6b285 → 1.2.42-5d054efb73
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 +36 -3
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +36 -3
- 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.sidebarDepth.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +273 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +70 -11
- 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.sidebarDepth.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1681,6 +1681,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1681
1681
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1682
1682
|
return false;
|
|
1683
1683
|
}
|
|
1684
|
+
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1685
|
+
if (depth === 0) {
|
|
1686
|
+
return false;
|
|
1687
|
+
}
|
|
1684
1688
|
const parent = parentSectionPath(sec);
|
|
1685
1689
|
if (parent === parentPath) {
|
|
1686
1690
|
return true;
|
|
@@ -1728,8 +1732,9 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1728
1732
|
rootSections.push(s);
|
|
1729
1733
|
continue;
|
|
1730
1734
|
}
|
|
1735
|
+
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1731
1736
|
const parent = parentSectionPath(sec);
|
|
1732
|
-
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1737
|
+
const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1733
1738
|
if (isRootLevel) {
|
|
1734
1739
|
rootSections.push(s);
|
|
1735
1740
|
}
|
|
@@ -1786,9 +1791,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1786
1791
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1787
1792
|
continue;
|
|
1788
1793
|
}
|
|
1794
|
+
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1789
1795
|
const parent = parentSectionPath(sec);
|
|
1790
|
-
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1791
|
-
if (isRootLevel && hasRootSection && sec !== "") {
|
|
1796
|
+
const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1797
|
+
if (isRootLevel && hasRootSection && sec !== "" && depth == null) {
|
|
1792
1798
|
continue;
|
|
1793
1799
|
}
|
|
1794
1800
|
if (isRootLevel) {
|
|
@@ -2356,6 +2362,7 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2356
2362
|
};
|
|
2357
2363
|
return node;
|
|
2358
2364
|
});
|
|
2365
|
+
markCrossProductCanonicalSlugs(children);
|
|
2359
2366
|
return {
|
|
2360
2367
|
type: "productgroup",
|
|
2361
2368
|
id: ctx.nodeId("productgroup"),
|
|
@@ -2367,6 +2374,32 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2367
2374
|
children
|
|
2368
2375
|
};
|
|
2369
2376
|
}
|
|
2377
|
+
function markCrossProductCanonicalSlugs(productNodes) {
|
|
2378
|
+
const pageIdToCanonical = /* @__PURE__ */ new Map();
|
|
2379
|
+
const sorted = [...productNodes].sort((a, b) => {
|
|
2380
|
+
if (a.default !== b.default) {
|
|
2381
|
+
return a.default ? -1 : 1;
|
|
2382
|
+
}
|
|
2383
|
+
return 0;
|
|
2384
|
+
});
|
|
2385
|
+
for (const product of sorted) {
|
|
2386
|
+
traverseDF(product, (child) => {
|
|
2387
|
+
if (hasMetadata(child) && isPage(child)) {
|
|
2388
|
+
const pid = getPageId(child);
|
|
2389
|
+
if (pid == null) {
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
const key = `pid:${pid}`;
|
|
2393
|
+
const canonical = pageIdToCanonical.get(key);
|
|
2394
|
+
if (canonical != null && !product.default) {
|
|
2395
|
+
child.canonicalSlug = canonical;
|
|
2396
|
+
} else if (canonical == null) {
|
|
2397
|
+
pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2370
2403
|
export {
|
|
2371
2404
|
apiLeafNodeFromNavRoute,
|
|
2372
2405
|
buildFullRootFromSegments,
|