@fern-api/fdr-sdk 1.2.42-0c024f5b0d → 1.2.42-1fb0ba4870

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.
@@ -92,6 +92,17 @@ var VersionIdSchema = z.string();
92
92
  function VersionId(value) {
93
93
  return value;
94
94
  }
95
+ var Availability = {
96
+ Alpha: "Alpha",
97
+ Stable: "Stable",
98
+ GenerallyAvailable: "GenerallyAvailable",
99
+ InDevelopment: "InDevelopment",
100
+ PreRelease: "PreRelease",
101
+ Deprecated: "Deprecated",
102
+ Beta: "Beta",
103
+ Preview: "Preview",
104
+ Legacy: "Legacy"
105
+ };
95
106
  var SnippetsByEndpointMethodSchema = z.record(
96
107
  HttpMethodSchema,
97
108
  z.array(z.unknown())
@@ -888,6 +899,35 @@ function metaStr(metadata, key) {
888
899
  }
889
900
  return void 0;
890
901
  }
902
+ var AVAILABILITY_LOOKUP = {
903
+ // V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
904
+ alpha: Availability.Alpha,
905
+ stable: Availability.Stable,
906
+ "generally-available": Availability.GenerallyAvailable,
907
+ "in-development": Availability.InDevelopment,
908
+ "pre-release": Availability.PreRelease,
909
+ deprecated: Availability.Deprecated,
910
+ beta: Availability.Beta,
911
+ preview: Availability.Preview,
912
+ legacy: Availability.Legacy,
913
+ // Latest PascalCase values (pass-through)
914
+ Alpha: Availability.Alpha,
915
+ Stable: Availability.Stable,
916
+ GenerallyAvailable: Availability.GenerallyAvailable,
917
+ InDevelopment: Availability.InDevelopment,
918
+ PreRelease: Availability.PreRelease,
919
+ Deprecated: Availability.Deprecated,
920
+ Beta: Availability.Beta,
921
+ Preview: Availability.Preview,
922
+ Legacy: Availability.Legacy
923
+ };
924
+ function metaAvailability(metadata) {
925
+ const raw = metaStr(metadata, "availability");
926
+ if (raw == null) {
927
+ return void 0;
928
+ }
929
+ return AVAILABILITY_LOOKUP[raw];
930
+ }
891
931
  function metaBool(metadata, key) {
892
932
  if (metadata != null && typeof metadata === "object" && key in metadata) {
893
933
  const v = metadata[key];
@@ -1005,7 +1045,7 @@ function artifactToNode(ctx, route) {
1005
1045
  }),
1006
1046
  pageId: PageId(pageId),
1007
1047
  noindex: metaBool(md, "noindex"),
1008
- availability: metaStr(md, "availability")
1048
+ availability: metaAvailability(md)
1009
1049
  };
1010
1050
  return node;
1011
1051
  }
@@ -1070,7 +1110,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1070
1110
  endpointId: EndpointId(endpointId),
1071
1111
  apiDefinitionId,
1072
1112
  isResponseStream: metaBool(md, "isResponseStream"),
1073
- availability: metaStr(md, "availability"),
1113
+ availability: metaAvailability(md),
1074
1114
  playground: void 0
1075
1115
  };
1076
1116
  }
@@ -1086,7 +1126,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1086
1126
  method,
1087
1127
  webhookId: WebhookId(webhookId),
1088
1128
  apiDefinitionId,
1089
- availability: metaStr(md, "availability")
1129
+ availability: metaAvailability(md)
1090
1130
  };
1091
1131
  }
1092
1132
  if (route.type === "asyncapi") {
@@ -1099,7 +1139,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1099
1139
  ...meta,
1100
1140
  webSocketId: WebSocketId(webSocketId),
1101
1141
  apiDefinitionId,
1102
- availability: metaStr(md, "availability"),
1142
+ availability: metaAvailability(md),
1103
1143
  playground: void 0
1104
1144
  };
1105
1145
  }
@@ -1115,7 +1155,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1115
1155
  method,
1116
1156
  grpcId: GrpcId(grpcId),
1117
1157
  apiDefinitionId,
1118
- availability: metaStr(md, "availability")
1158
+ availability: metaAvailability(md)
1119
1159
  };
1120
1160
  }
1121
1161
  if (route.type === "graphql") {
@@ -1131,7 +1171,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1131
1171
  graphqlOperationId: GraphQlOperationId(graphqlOperationId),
1132
1172
  graphqlOperationIds: void 0,
1133
1173
  apiDefinitionId,
1134
- availability: metaStr(md, "availability"),
1174
+ availability: metaAvailability(md),
1135
1175
  playground: void 0
1136
1176
  };
1137
1177
  }
@@ -1309,7 +1349,7 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1309
1349
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1310
1350
  collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1311
1351
  collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1312
- availability: metaStr(seg.metadata, "availability"),
1352
+ availability: metaAvailability(seg.metadata),
1313
1353
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
1314
1354
  children: mergeChildrenByPosition(ctx, nav, sectionChildren)
1315
1355
  };
@@ -1383,7 +1423,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1383
1423
  featureFlags: metaFeatureFlags(seg.metadata)
1384
1424
  }),
1385
1425
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1386
- availability: metaStr(seg.metadata, "availability"),
1426
+ availability: metaAvailability(seg.metadata),
1387
1427
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1388
1428
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1389
1429
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1471,7 +1511,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1471
1511
  featureFlags: metaFeatureFlags(seg.metadata)
1472
1512
  }),
1473
1513
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1474
- availability: metaStr(seg.metadata, "availability"),
1514
+ availability: metaAvailability(seg.metadata),
1475
1515
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1476
1516
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1477
1517
  paginated: true,
@@ -1686,7 +1726,11 @@ function computeSiblingSortBoundaries(ordered) {
1686
1726
  for (const s of ordered) {
1687
1727
  const type = metaStr(s.seg.metadata, "type");
1688
1728
  const sec = s.seg.section;
1689
- if (type !== "section" || sec === "") {
1729
+ if (type !== "section") {
1730
+ continue;
1731
+ }
1732
+ if (sec === "") {
1733
+ rootSections.push(s);
1690
1734
  continue;
1691
1735
  }
1692
1736
  const parent = parentSectionPath(sec);
@@ -1717,8 +1761,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1717
1761
  const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1718
1762
  const sectionPaths = new Set(ordered.map((s) => s.seg.section));
1719
1763
  const annotated = [];
1720
- const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
1721
1764
  const siblingBoundaries = computeSiblingSortBoundaries(ordered);
1765
+ const hasRootSection = ordered.some(
1766
+ (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1767
+ );
1722
1768
  for (const s of ordered) {
1723
1769
  const type = metaStr(s.seg.metadata, "type");
1724
1770
  const sec = s.seg.section;
@@ -1737,8 +1783,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1737
1783
  }
1738
1784
  continue;
1739
1785
  }
1740
- if (type === "section" && sec === "") {
1741
- const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
1786
+ if (type === "section" && sec === "" && hasRootSection) {
1787
+ const bounds = siblingBoundaries.get(s);
1788
+ const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1789
+ const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1742
1790
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1743
1791
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1744
1792
  continue;
@@ -1757,12 +1805,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1757
1805
  } else {
1758
1806
  const bounds = siblingBoundaries.get(s);
1759
1807
  const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1760
- node = sectionNode(
1761
- ctx,
1762
- s,
1763
- buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
1764
- scopePrefix
1765
- );
1808
+ const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
1809
+ const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1810
+ node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1766
1811
  }
1767
1812
  const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1768
1813
  annotated.push({