@fern-api/fdr-sdk 1.2.44-2a040afc4c → 1.2.44-72dfb6b83c

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.
Files changed (38) hide show
  1. package/dist/js/converters/index.js +9 -2
  2. package/dist/js/converters/index.js.map +1 -1
  3. package/dist/js/converters/index.mjs +9 -2
  4. package/dist/js/converters/index.mjs.map +1 -1
  5. package/dist/js/index.js +9 -2
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +9 -2
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/index.js +9 -2
  10. package/dist/js/navigation/index.js.map +1 -1
  11. package/dist/js/navigation/index.mjs +9 -2
  12. package/dist/js/navigation/index.mjs.map +1 -1
  13. package/dist/js/navigation/ledger-root-builder.js +18 -3
  14. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  15. package/dist/js/navigation/ledger-root-builder.mjs +18 -3
  16. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  17. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts +2 -0
  18. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts.map +1 -0
  19. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.js +308 -0
  20. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.js.map +1 -0
  21. package/dist/navigation/__test__/ledger-root-builder.pointsTo.test.js +122 -10
  22. package/dist/navigation/__test__/ledger-root-builder.pointsTo.test.js.map +1 -1
  23. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +5 -5
  24. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  25. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +86 -0
  26. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -1
  27. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  28. package/dist/navigation/ledger-root-builder.js +33 -5
  29. package/dist/navigation/ledger-root-builder.js.map +1 -1
  30. package/dist/navigation/utils/updatePointsTo.d.ts.map +1 -1
  31. package/dist/navigation/utils/updatePointsTo.js +12 -4
  32. package/dist/navigation/utils/updatePointsTo.js.map +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/dist/types/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts +2 -0
  35. package/dist/types/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts.map +1 -0
  36. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  37. package/dist/types/navigation/utils/updatePointsTo.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -1854,6 +1854,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1854
1854
  const hasRootSection = ordered.some(
1855
1855
  (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1856
1856
  );
1857
+ const hasTrueRootWrapper = ordered.some(
1858
+ (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && metaNum(s.seg.metadata, "childIndex") == null
1859
+ );
1857
1860
  const depth0SectionPaths = /* @__PURE__ */ new Set();
1858
1861
  for (const s of ordered) {
1859
1862
  if (metaStr(s.seg.metadata, "type") === "section" && metaNum(s.seg.metadata, "sidebarDepth") === 0) {
@@ -1888,7 +1891,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1888
1891
  }
1889
1892
  if (type === "section" && sec === "" && hasRootSection) {
1890
1893
  const bounds = siblingBoundaries.get(s);
1891
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
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
+ }
1892
1903
  const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1893
1904
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1894
1905
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
@@ -1897,7 +1908,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1897
1908
  const depth = metaNum(s.seg.metadata, "sidebarDepth");
1898
1909
  const parent = parentSectionPath(sec);
1899
1910
  const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1900
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1911
+ if (isRootLevel && hasRootSection && sec !== "" && (depth != null ? depth !== 0 : hasTrueRootWrapper)) {
1901
1912
  continue;
1902
1913
  }
1903
1914
  if (isRootLevel && depth != null && depth > 0 && depth0SectionPaths.has(sec)) {
@@ -1931,7 +1942,11 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1931
1942
  const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
1932
1943
  const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
1933
1944
  const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
1934
- (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || x.seq - y.seq
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
1935
1950
  ).map((a) => a.node) : annotated.map((a) => a.node);
1936
1951
  return groupSidebarRootChildren(ctx, flat);
1937
1952
  }