@fern-api/fdr-sdk 1.2.39-bf608e8e3c → 1.2.39-d0fa0d2c40

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 (28) hide show
  1. package/dist/js/converters/index.js +1 -6
  2. package/dist/js/converters/index.js.map +1 -1
  3. package/dist/js/converters/index.mjs +1 -6
  4. package/dist/js/converters/index.mjs.map +1 -1
  5. package/dist/js/index.js +1 -6
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +1 -6
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/index.js +1 -6
  10. package/dist/js/navigation/index.js.map +1 -1
  11. package/dist/js/navigation/index.mjs +1 -6
  12. package/dist/js/navigation/index.mjs.map +1 -1
  13. package/dist/js/navigation/ledger-root-builder.js +30 -8
  14. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  15. package/dist/js/navigation/ledger-root-builder.mjs +30 -8
  16. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  17. package/dist/tsconfig.tsbuildinfo +1 -1
  18. package/dist/types/navigation/__test__/ledger-root-builder.collapsedDeterminism.test.d.ts +2 -0
  19. package/dist/types/navigation/__test__/ledger-root-builder.collapsedDeterminism.test.d.ts.map +1 -0
  20. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.d.ts +2 -0
  21. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.d.ts.map +1 -0
  22. package/dist/types/navigation/__test__/ledger-root-builder.variantSharedSegments.test.d.ts +2 -0
  23. package/dist/types/navigation/__test__/ledger-root-builder.variantSharedSegments.test.d.ts.map +1 -0
  24. package/dist/types/navigation/ledger-root-builder.d.ts +5 -1
  25. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  26. package/dist/types/navigation/utils/findNode.d.ts.map +1 -1
  27. package/dist/types/navigation/utils/followRedirect.d.ts.map +1 -1
  28. package/package.json +3 -3
@@ -805,6 +805,14 @@ function traverseDF(node, visit) {
805
805
  }
806
806
 
807
807
  // src/navigation/ledger-root-builder.ts
808
+ var STRUCTURAL_SEGMENT_TYPES = /* @__PURE__ */ new Set([
809
+ "section",
810
+ "apiReference",
811
+ "apiPackage",
812
+ "changelog"
813
+ ]);
814
+ var API_NODE_SEGMENT_TYPES = /* @__PURE__ */ new Set(["apiReference", "apiPackage"]);
815
+ var INFRA_SEGMENT_TYPES = /* @__PURE__ */ new Set(["files", "redirects"]);
808
816
  function createBuildContext(basePath) {
809
817
  const seen = /* @__PURE__ */ new Map();
810
818
  const basePrefix = basePath.replace(/^\/+|\/+$/g, "");
@@ -882,7 +890,7 @@ function toViewers(viewers) {
882
890
  return viewers.map((v) => RoleId(v));
883
891
  }
884
892
  function mergeVariantViewers(seg) {
885
- const segViewers = seg.metadata.type === "section" || seg.metadata.type === "apiReference" || seg.metadata.type === "apiPackage" || seg.metadata.type === "changelog" ? seg.metadata.viewers : void 0;
893
+ const segViewers = STRUCTURAL_SEGMENT_TYPES.has(seg.metadata.type) ? seg.metadata.viewers : void 0;
886
894
  const variantViewers = seg.variant?.viewers;
887
895
  if ((segViewers == null || segViewers.length === 0) && (variantViewers == null || variantViewers.length === 0)) {
888
896
  return void 0;
@@ -1570,7 +1578,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1570
1578
  const type = metaStr(s.seg.metadata, "type");
1571
1579
  const childIndex = metaNum(s.seg.metadata, "childIndex");
1572
1580
  let node;
1573
- if (type === "apiReference" || type === "apiPackage") {
1581
+ if (API_NODE_SEGMENT_TYPES.has(type ?? "")) {
1574
1582
  node = apiReferenceNode(ctx, s, scopeSegs, scopePrefix);
1575
1583
  } else if (type === "changelog") {
1576
1584
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
@@ -1634,7 +1642,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1634
1642
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
1635
1643
  continue;
1636
1644
  }
1637
- if (type === "tabRoot" || sec === "" && type !== "section") {
1645
+ if (type === "tabRoot" || sec === "" && !STRUCTURAL_SEGMENT_TYPES.has(type ?? "")) {
1638
1646
  for (const r of s.nav) {
1639
1647
  const node = artifactToNode(ctx, r);
1640
1648
  if (node != null) {
@@ -1651,12 +1659,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1651
1659
  }
1652
1660
  const parent = parentSectionPath(sec);
1653
1661
  const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1654
- if (isRootLevel && hasRootSection) {
1662
+ if (isRootLevel && hasRootSection && sec !== "") {
1655
1663
  continue;
1656
1664
  }
1657
1665
  if (isRootLevel) {
1658
1666
  let node;
1659
- if (type === "apiReference" || type === "apiPackage") {
1667
+ if (API_NODE_SEGMENT_TYPES.has(type ?? "")) {
1660
1668
  node = apiReferenceNode(ctx, s, scopeSegs, scopePrefix);
1661
1669
  } else if (type === "changelog") {
1662
1670
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
@@ -1731,7 +1739,7 @@ function buildFullRootFromSegments(options) {
1731
1739
  const ctx = createBuildContext(basePath);
1732
1740
  const scoped = segments.filter((seg) => {
1733
1741
  const t = metaStr(seg.metadata, "type");
1734
- return t !== "files" && t !== "redirects";
1742
+ return !INFRA_SEGMENT_TYPES.has(t ?? "");
1735
1743
  }).map((seg) => ({ seg, nav: navBySegment.get(seg.segmentHash) ?? [] }));
1736
1744
  const rootSlug = asSlug(sourceRootSlug ?? basePath);
1737
1745
  const scopesByKey = /* @__PURE__ */ new Map();
@@ -1855,20 +1863,34 @@ function buildSidebarRootWithVariants(ctx, scopeSegs, scopePrefix, changelogScop
1855
1863
  if (variants.length <= 1) {
1856
1864
  return buildSidebarRoot(ctx, scopeSegs, scopePrefix, changelogScopePrefix);
1857
1865
  }
1866
+ const sharedSegs = scopeSegs.filter((s) => s.seg.variant == null);
1858
1867
  const variantedNode = buildVariantedNode(ctx, variants, scopeSegs, scopePrefix);
1868
+ const sharedChildren = sharedSegs.length > 0 ? buildSidebarRootChildren(ctx, sharedSegs, scopePrefix, changelogScopePrefix) : [];
1859
1869
  const first = scopeSegs[0];
1860
1870
  return {
1861
1871
  type: "sidebarRoot",
1862
1872
  id: ctx.nodeId(`sidebar:${first != null ? scopeKey(first.seg) : "root"}`),
1863
1873
  collapsed: void 0,
1864
- children: [variantedNode]
1874
+ children: [...sharedChildren, variantedNode]
1865
1875
  };
1866
1876
  }
1867
1877
  function buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent, scopePrefix) {
1868
1878
  if (!tabsPresent) {
1869
1879
  const variants = uniqueDetails(scopeSegs, "variant");
1870
1880
  if (variants.length > 1) {
1871
- return buildVariantedNode(ctx, variants, scopeSegs, scopePrefix);
1881
+ const sharedSegs = scopeSegs.filter((s) => s.seg.variant == null);
1882
+ const variantedNode = buildVariantedNode(ctx, variants, scopeSegs, scopePrefix);
1883
+ if (sharedSegs.length > 0) {
1884
+ const sharedChildren = buildSidebarRootChildren(ctx, sharedSegs, scopePrefix);
1885
+ const first2 = scopeSegs[0];
1886
+ return {
1887
+ type: "sidebarRoot",
1888
+ id: ctx.nodeId(`sidebar:${first2 != null ? scopeKey(first2.seg) : "root"}`),
1889
+ collapsed: void 0,
1890
+ children: [...sharedChildren, variantedNode]
1891
+ };
1892
+ }
1893
+ return variantedNode;
1872
1894
  }
1873
1895
  return buildSidebarRoot(ctx, scopeSegs, scopePrefix);
1874
1896
  }