@fern-api/fdr-sdk 1.2.19-2cc97d8bd7 → 1.2.19-72be327283

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.
@@ -57452,9 +57452,10 @@ function artifactToNode(ctx, route) {
57452
57452
  };
57453
57453
  return node;
57454
57454
  }
57455
- // Endpoints / websockets / webhooks / grpc / graphql are resolved via
57456
- // the paginated apiReference + on-demand API definition, not emitted as
57457
- // standalone sidebar children here.
57455
+ // API leaf types are handled by apiReferenceNode (which calls
57456
+ // apiLeafNodeFromNavRouteInternal), not by section-level artifact
57457
+ // conversion. Returning undefined here prevents them from appearing
57458
+ // as duplicate siblings alongside the apiReference node.
57458
57459
  case "rest":
57459
57460
  case "asyncapi":
57460
57461
  case "webhook":
@@ -57516,6 +57517,51 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
57516
57517
  availability: void 0
57517
57518
  };
57518
57519
  }
57520
+ if (route.type === "asyncapi") {
57521
+ const webSocketId = metaStr(md, "webSocketId");
57522
+ if (webSocketId == null) {
57523
+ return void 0;
57524
+ }
57525
+ return {
57526
+ type: "webSocket",
57527
+ ...meta,
57528
+ webSocketId: WebSocketId(webSocketId),
57529
+ apiDefinitionId,
57530
+ availability: void 0,
57531
+ playground: void 0
57532
+ };
57533
+ }
57534
+ if (route.type === "grpc") {
57535
+ const grpcId = metaStr(md, "grpcId");
57536
+ const method = metaStr(md, "method");
57537
+ if (grpcId == null || method == null) {
57538
+ return void 0;
57539
+ }
57540
+ return {
57541
+ type: "grpc",
57542
+ ...meta,
57543
+ method,
57544
+ grpcId: GrpcId(grpcId),
57545
+ apiDefinitionId,
57546
+ availability: void 0
57547
+ };
57548
+ }
57549
+ if (route.type === "graphql") {
57550
+ const graphqlOperationId = metaStr(md, "graphqlOperationId");
57551
+ const operationType = metaStr(md, "operationType");
57552
+ if (graphqlOperationId == null || operationType == null) {
57553
+ return void 0;
57554
+ }
57555
+ return {
57556
+ type: "graphql",
57557
+ ...meta,
57558
+ operationType,
57559
+ graphqlOperationId: GraphQlOperationId(graphqlOperationId),
57560
+ apiDefinitionId,
57561
+ availability: void 0,
57562
+ playground: void 0
57563
+ };
57564
+ }
57519
57565
  return void 0;
57520
57566
  }
57521
57567
  function collectApiLeafNodesFromNav(routes, basePath, segmentApiDefinitionId2) {
@@ -57553,12 +57599,32 @@ function sectionNode(ctx, scoped, sectionChildren) {
57553
57599
  children: [...leafChildren, ...sectionChildren]
57554
57600
  };
57555
57601
  }
57556
- function apiReferenceNode(ctx, scoped) {
57602
+ function collectDescendantApiNav(root, scopeSegs) {
57603
+ const rootSection = root.seg.section;
57604
+ const prefix = rootSection === "" ? "" : `${rootSection}/`;
57605
+ const routes = [...root.nav];
57606
+ for (const s6 of scopeSegs) {
57607
+ if (s6 === root) {
57608
+ continue;
57609
+ }
57610
+ const type = metaStr(s6.seg.metadata, "type");
57611
+ if (type !== "apiPackage") {
57612
+ continue;
57613
+ }
57614
+ if (s6.seg.section === rootSection || s6.seg.section.startsWith(prefix)) {
57615
+ routes.push(...s6.nav);
57616
+ }
57617
+ }
57618
+ return routes;
57619
+ }
57620
+ function apiReferenceNode(ctx, scoped, scopeSegs) {
57557
57621
  const { seg, nav } = scoped;
57558
57622
  const overview = overviewRoute(nav);
57559
57623
  const overviewPageId = overview != null ? metaStr(overview.metadata, "pageId") : void 0;
57560
57624
  const apiDefinitionId = metaStr(seg.metadata, "apiDefinitionId") ?? "";
57561
57625
  const slug = ctx.contentSlug(overview?.fullPath ?? nav[0]?.fullPath ?? seg.section);
57626
+ const allNav = collectDescendantApiNav(scoped, scopeSegs);
57627
+ const children = allNav.map((route) => apiLeafNodeFromNavRouteInternal(ctx, route, apiDefinitionId)).filter((node) => node != null);
57562
57628
  return {
57563
57629
  type: "apiReference",
57564
57630
  ...withMetadataDefaults({
@@ -57577,7 +57643,7 @@ function apiReferenceNode(ctx, scoped) {
57577
57643
  showErrors: metaBool(seg.metadata, "showErrors"),
57578
57644
  hideTitle: metaBool(seg.metadata, "hideTitle"),
57579
57645
  pointsTo: void 0,
57580
- children: [],
57646
+ children,
57581
57647
  changelog: void 0,
57582
57648
  playground: void 0,
57583
57649
  postmanCollectionUrl: void 0
@@ -57661,19 +57727,37 @@ function parentSectionPath(sectionPath) {
57661
57727
  const idx = sectionPath.lastIndexOf("/");
57662
57728
  return idx === -1 ? "" : sectionPath.slice(0, idx);
57663
57729
  }
57730
+ function nearestExistingAncestor(sectionPath, existing) {
57731
+ let current = parentSectionPath(sectionPath);
57732
+ while (current !== "") {
57733
+ if (existing.has(current)) {
57734
+ return current;
57735
+ }
57736
+ current = parentSectionPath(current);
57737
+ }
57738
+ return "";
57739
+ }
57664
57740
  function buildSectionTree(ctx, scopeSegs, parentPath) {
57741
+ const sectionPaths = new Set(scopeSegs.map((s6) => s6.seg.section));
57665
57742
  const direct = scopeSegs.filter((s6) => {
57666
57743
  const sec = s6.seg.section;
57667
57744
  const type = metaStr(s6.seg.metadata, "type");
57668
57745
  if (sec === "" || type === "tabRoot") {
57669
57746
  return false;
57670
57747
  }
57671
- return parentSectionPath(sec) === parentPath;
57748
+ const parent = parentSectionPath(sec);
57749
+ if (parent === parentPath) {
57750
+ return true;
57751
+ }
57752
+ if (!sectionPaths.has(parent)) {
57753
+ return nearestExistingAncestor(sec, sectionPaths) === parentPath;
57754
+ }
57755
+ return false;
57672
57756
  }).sort((a, b6) => a.seg.sortOrder - b6.seg.sortOrder);
57673
57757
  return direct.map((s6) => {
57674
57758
  const type = metaStr(s6.seg.metadata, "type");
57675
57759
  if (type === "apiReference" || type === "apiPackage") {
57676
- return apiReferenceNode(ctx, s6);
57760
+ return apiReferenceNode(ctx, s6, scopeSegs);
57677
57761
  }
57678
57762
  if (type === "changelog") {
57679
57763
  return changelogNode(ctx, s6);
@@ -57683,6 +57767,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath) {
57683
57767
  }
57684
57768
  function buildSidebarRootChildren(ctx, scopeSegs) {
57685
57769
  const ordered = [...scopeSegs].sort((a, b6) => a.seg.sortOrder - b6.seg.sortOrder);
57770
+ const sectionPaths = new Set(ordered.map((s6) => s6.seg.section));
57686
57771
  const flat = [];
57687
57772
  for (const s6 of ordered) {
57688
57773
  const type = metaStr(s6.seg.metadata, "type");
@@ -57696,9 +57781,11 @@ function buildSidebarRootChildren(ctx, scopeSegs) {
57696
57781
  }
57697
57782
  continue;
57698
57783
  }
57699
- if (parentSectionPath(sec) === "") {
57784
+ const parent = parentSectionPath(sec);
57785
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
57786
+ if (isRootLevel) {
57700
57787
  if (type === "apiReference" || type === "apiPackage") {
57701
- flat.push(apiReferenceNode(ctx, s6));
57788
+ flat.push(apiReferenceNode(ctx, s6, scopeSegs));
57702
57789
  } else if (type === "changelog") {
57703
57790
  flat.push(changelogNode(ctx, s6));
57704
57791
  } else {
@@ -57807,10 +57894,43 @@ function buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent) {
57807
57894
  }
57808
57895
  const tabDetails = uniqueDetails(scopeSegs, "tab");
57809
57896
  const children = tabDetails.map((tab) => {
57810
- const tabSegs = scopeSegs.filter((s6) => s6.seg.tab?.id === tab.id);
57897
+ const tabType = metaStr(tab.metadata, "tab_type");
57811
57898
  const tabSlug = asSlug(scopeSlugPrefix(Slug(""), tab));
57899
+ if (tabType === "link") {
57900
+ return {
57901
+ type: "link",
57902
+ id: ctx.nodeId(`link:${metaStr(tab.metadata, "url") ?? tabSlug}`),
57903
+ collapsed: void 0,
57904
+ title: tab.displayName,
57905
+ icon: tab.icon ?? void 0,
57906
+ url: Url(metaStr(tab.metadata, "url") ?? ""),
57907
+ target: void 0
57908
+ };
57909
+ }
57910
+ if (tabType === "changelog") {
57911
+ const tabSegs2 = scopeSegs.filter((s6) => s6.seg.tab?.id === tab.id);
57912
+ const changelogSeg = tabSegs2.find((s6) => metaStr(s6.seg.metadata, "type") === "changelog");
57913
+ if (changelogSeg != null) {
57914
+ return changelogNode(ctx, changelogSeg);
57915
+ }
57916
+ return {
57917
+ type: "changelog",
57918
+ ...withMetadataDefaults({
57919
+ id: ctx.nodeId(`changelog:${tabSlug}`),
57920
+ title: tab.displayName,
57921
+ slug: tabSlug,
57922
+ icon: tab.icon ?? void 0,
57923
+ hidden: tab.hidden,
57924
+ viewers: toViewers(tab.viewers)
57925
+ }),
57926
+ overviewPageId: void 0,
57927
+ noindex: void 0,
57928
+ children: []
57929
+ };
57930
+ }
57931
+ const tabSegs = scopeSegs.filter((s6) => s6.seg.tab?.id === tab.id);
57812
57932
  const metaPointsTo = metaStr(tab.metadata, "pointsTo");
57813
- const node = {
57933
+ return {
57814
57934
  type: "tab",
57815
57935
  ...withMetadataDefaults({
57816
57936
  id: ctx.nodeId(`tab:${tabSlug}`),
@@ -57823,7 +57943,6 @@ function buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent) {
57823
57943
  pointsTo: metaPointsTo != null ? ctx.contentSlug(metaPointsTo) : void 0,
57824
57944
  child: buildSidebarRoot(ctx, tabSegs)
57825
57945
  };
57826
- return node;
57827
57946
  });
57828
57947
  const first = scopeSegs[0];
57829
57948
  return {