@fern-api/fdr-sdk 1.2.44-345d4ef0ea → 1.2.44-3baf1aad54
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/converters/index.js +9 -2
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +9 -2
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +9 -2
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +9 -2
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +9 -2
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +9 -2
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +25 -3
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +25 -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.pointsTo.test.js +122 -10
- package/dist/navigation/__test__/ledger-root-builder.pointsTo.test.js.map +1 -1
- 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.sidebarDepth.test.js +194 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.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 +45 -5
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/navigation/utils/updatePointsTo.d.ts.map +1 -1
- package/dist/navigation/utils/updatePointsTo.js +12 -4
- package/dist/navigation/utils/updatePointsTo.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/dist/types/navigation/utils/updatePointsTo.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1759,6 +1759,13 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1759
1759
|
if (!sectionPaths.has(parent)) {
|
|
1760
1760
|
return nearestExistingAncestor(sec, sectionPaths) === parentPath;
|
|
1761
1761
|
}
|
|
1762
|
+
if (depth != null) {
|
|
1763
|
+
const pSeg = scopeSegs.find((c) => c.seg.section === parent);
|
|
1764
|
+
const pDepth = pSeg != null ? metaNum(pSeg.seg.metadata, "sidebarDepth") : void 0;
|
|
1765
|
+
if (pDepth != null && depth <= pDepth) {
|
|
1766
|
+
return nearestExistingAncestor(parent, sectionPaths) === parentPath;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1762
1769
|
return false;
|
|
1763
1770
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1764
1771
|
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
@@ -1847,6 +1854,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1847
1854
|
const hasRootSection = ordered.some(
|
|
1848
1855
|
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1849
1856
|
);
|
|
1857
|
+
const hasTrueRootWrapper = ordered.some(
|
|
1858
|
+
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && metaNum(s.seg.metadata, "childIndex") == null
|
|
1859
|
+
);
|
|
1850
1860
|
const depth0SectionPaths = /* @__PURE__ */ new Set();
|
|
1851
1861
|
for (const s of ordered) {
|
|
1852
1862
|
if (metaStr(s.seg.metadata, "type") === "section" && metaNum(s.seg.metadata, "sidebarDepth") === 0) {
|
|
@@ -1881,7 +1891,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1881
1891
|
}
|
|
1882
1892
|
if (type === "section" && sec === "" && hasRootSection) {
|
|
1883
1893
|
const bounds = siblingBoundaries.get(s);
|
|
1884
|
-
|
|
1894
|
+
let ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1895
|
+
if (!hasTrueRootWrapper) {
|
|
1896
|
+
ownedSegs = ownedSegs.filter((o) => {
|
|
1897
|
+
if (o.seg.section === "") {
|
|
1898
|
+
return true;
|
|
1899
|
+
}
|
|
1900
|
+
return metaNum(o.seg.metadata, "sidebarDepth") != null;
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1885
1903
|
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1886
1904
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1887
1905
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
@@ -1890,7 +1908,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1890
1908
|
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1891
1909
|
const parent = parentSectionPath(sec);
|
|
1892
1910
|
const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1893
|
-
if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
|
|
1911
|
+
if (isRootLevel && hasRootSection && sec !== "" && (depth != null ? depth !== 0 : hasTrueRootWrapper)) {
|
|
1894
1912
|
continue;
|
|
1895
1913
|
}
|
|
1896
1914
|
if (isRootLevel && depth != null && depth > 0 && depth0SectionPaths.has(sec)) {
|
|
@@ -1924,7 +1942,11 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1924
1942
|
const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
|
|
1925
1943
|
const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
|
|
1926
1944
|
const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
|
|
1927
|
-
(x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) ||
|
|
1945
|
+
(x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || // When positions tie, prefer structural nodes (sections) over
|
|
1946
|
+
// leaves (pages). This handles stale tabRoot nav entries whose
|
|
1947
|
+
// displaySortOrder wasn't updated due to content-addressing
|
|
1948
|
+
// (the segment hash doesn't include childPosition).
|
|
1949
|
+
(x.isLeaf === y.isLeaf ? 0 : x.isLeaf ? 1 : -1) || x.seq - y.seq
|
|
1928
1950
|
).map((a) => a.node) : annotated.map((a) => a.node);
|
|
1929
1951
|
return groupSidebarRootChildren(ctx, flat);
|
|
1930
1952
|
}
|