@fern-api/fdr-sdk 1.2.44-2a040afc4c → 1.2.44-dd364964d5
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 +18 -3
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +18 -3
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.js +308 -0
- package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +5 -5
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +86 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -1
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +33 -5
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1813,6 +1813,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1813
1813
|
const hasRootSection = ordered.some(
|
|
1814
1814
|
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1815
1815
|
);
|
|
1816
|
+
const hasTrueRootWrapper = ordered.some(
|
|
1817
|
+
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && metaNum(s.seg.metadata, "childIndex") == null
|
|
1818
|
+
);
|
|
1816
1819
|
const depth0SectionPaths = /* @__PURE__ */ new Set();
|
|
1817
1820
|
for (const s of ordered) {
|
|
1818
1821
|
if (metaStr(s.seg.metadata, "type") === "section" && metaNum(s.seg.metadata, "sidebarDepth") === 0) {
|
|
@@ -1847,7 +1850,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1847
1850
|
}
|
|
1848
1851
|
if (type === "section" && sec === "" && hasRootSection) {
|
|
1849
1852
|
const bounds = siblingBoundaries.get(s);
|
|
1850
|
-
|
|
1853
|
+
let ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1854
|
+
if (!hasTrueRootWrapper) {
|
|
1855
|
+
ownedSegs = ownedSegs.filter((o) => {
|
|
1856
|
+
if (o.seg.section === "") {
|
|
1857
|
+
return true;
|
|
1858
|
+
}
|
|
1859
|
+
return metaNum(o.seg.metadata, "sidebarDepth") != null;
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1851
1862
|
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1852
1863
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1853
1864
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
@@ -1856,7 +1867,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1856
1867
|
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1857
1868
|
const parent = parentSectionPath(sec);
|
|
1858
1869
|
const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1859
|
-
if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
|
|
1870
|
+
if (isRootLevel && hasRootSection && sec !== "" && (depth != null ? depth !== 0 : hasTrueRootWrapper)) {
|
|
1860
1871
|
continue;
|
|
1861
1872
|
}
|
|
1862
1873
|
if (isRootLevel && depth != null && depth > 0 && depth0SectionPaths.has(sec)) {
|
|
@@ -1890,7 +1901,11 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1890
1901
|
const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
|
|
1891
1902
|
const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
|
|
1892
1903
|
const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
|
|
1893
|
-
(x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) ||
|
|
1904
|
+
(x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || // When positions tie, prefer structural nodes (sections) over
|
|
1905
|
+
// leaves (pages). This handles stale tabRoot nav entries whose
|
|
1906
|
+
// displaySortOrder wasn't updated due to content-addressing
|
|
1907
|
+
// (the segment hash doesn't include childPosition).
|
|
1908
|
+
(x.isLeaf === y.isLeaf ? 0 : x.isLeaf ? 1 : -1) || x.seq - y.seq
|
|
1894
1909
|
).map((a) => a.node) : annotated.map((a) => a.node);
|
|
1895
1910
|
return groupSidebarRootChildren(ctx, flat);
|
|
1896
1911
|
}
|