@fern-api/fdr-sdk 1.2.39-f82f6883d8 → 1.2.40-bcfd2ff480

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.
@@ -846,6 +846,14 @@ function traverseDF(node, visit) {
846
846
  }
847
847
 
848
848
  // src/navigation/ledger-root-builder.ts
849
+ var STRUCTURAL_SEGMENT_TYPES = /* @__PURE__ */ new Set([
850
+ "section",
851
+ "apiReference",
852
+ "apiPackage",
853
+ "changelog"
854
+ ]);
855
+ var API_NODE_SEGMENT_TYPES = /* @__PURE__ */ new Set(["apiReference", "apiPackage"]);
856
+ var INFRA_SEGMENT_TYPES = /* @__PURE__ */ new Set(["files", "redirects"]);
849
857
  function createBuildContext(basePath) {
850
858
  const seen = /* @__PURE__ */ new Map();
851
859
  const basePrefix = basePath.replace(/^\/+|\/+$/g, "");
@@ -923,7 +931,7 @@ function toViewers(viewers) {
923
931
  return viewers.map((v) => RoleId(v));
924
932
  }
925
933
  function mergeVariantViewers(seg) {
926
- const segViewers = seg.metadata.type === "section" || seg.metadata.type === "apiReference" || seg.metadata.type === "apiPackage" || seg.metadata.type === "changelog" ? seg.metadata.viewers : void 0;
934
+ const segViewers = STRUCTURAL_SEGMENT_TYPES.has(seg.metadata.type) ? seg.metadata.viewers : void 0;
927
935
  const variantViewers = seg.variant?.viewers;
928
936
  if ((segViewers == null || segViewers.length === 0) && (variantViewers == null || variantViewers.length === 0)) {
929
937
  return void 0;
@@ -1611,7 +1619,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1611
1619
  const type = metaStr(s.seg.metadata, "type");
1612
1620
  const childIndex = metaNum(s.seg.metadata, "childIndex");
1613
1621
  let node;
1614
- if (type === "apiReference" || type === "apiPackage") {
1622
+ if (API_NODE_SEGMENT_TYPES.has(type ?? "")) {
1615
1623
  node = apiReferenceNode(ctx, s, scopeSegs, scopePrefix);
1616
1624
  } else if (type === "changelog") {
1617
1625
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
@@ -1675,7 +1683,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1675
1683
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
1676
1684
  continue;
1677
1685
  }
1678
- if (type === "tabRoot" || sec === "" && type !== "section") {
1686
+ if (type === "tabRoot" || sec === "" && !STRUCTURAL_SEGMENT_TYPES.has(type ?? "")) {
1679
1687
  for (const r of s.nav) {
1680
1688
  const node = artifactToNode(ctx, r);
1681
1689
  if (node != null) {
@@ -1692,12 +1700,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1692
1700
  }
1693
1701
  const parent = parentSectionPath(sec);
1694
1702
  const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1695
- if (isRootLevel && hasRootSection) {
1703
+ if (isRootLevel && hasRootSection && sec !== "") {
1696
1704
  continue;
1697
1705
  }
1698
1706
  if (isRootLevel) {
1699
1707
  let node;
1700
- if (type === "apiReference" || type === "apiPackage") {
1708
+ if (API_NODE_SEGMENT_TYPES.has(type ?? "")) {
1701
1709
  node = apiReferenceNode(ctx, s, scopeSegs, scopePrefix);
1702
1710
  } else if (type === "changelog") {
1703
1711
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
@@ -1772,7 +1780,7 @@ function buildFullRootFromSegments(options) {
1772
1780
  const ctx = createBuildContext(basePath);
1773
1781
  const scoped = segments.filter((seg) => {
1774
1782
  const t = metaStr(seg.metadata, "type");
1775
- return t !== "files" && t !== "redirects";
1783
+ return !INFRA_SEGMENT_TYPES.has(t ?? "");
1776
1784
  }).map((seg) => ({ seg, nav: navBySegment.get(seg.segmentHash) ?? [] }));
1777
1785
  const rootSlug = asSlug(sourceRootSlug ?? basePath);
1778
1786
  const scopesByKey = /* @__PURE__ */ new Map();
@@ -1949,7 +1957,7 @@ function buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent, scopePrefix) {
1949
1957
  const tabSegs2 = scopeSegs.filter((s) => s.seg.tab?.id === tab.id);
1950
1958
  const changelogSeg = tabSegs2.find((s) => metaStr(s.seg.metadata, "type") === "changelog");
1951
1959
  if (changelogSeg != null) {
1952
- return changelogNode(ctx, changelogSeg, scopePrefix);
1960
+ return changelogNode(ctx, changelogSeg, tabSlug);
1953
1961
  }
1954
1962
  return {
1955
1963
  type: "changelog",