@fern-api/fdr-sdk 1.2.42-080b4f1d94 → 1.2.42-0c024f5b0d

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 (62) hide show
  1. package/dist/js/client/FdrClient.js +0 -1
  2. package/dist/js/client/FdrClient.js.map +1 -1
  3. package/dist/js/client/FdrClient.mjs +0 -1
  4. package/dist/js/client/FdrClient.mjs.map +1 -1
  5. package/dist/js/index.js +0 -1
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +0 -1
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/ledger-root-builder.js +33 -164
  10. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  11. package/dist/js/navigation/ledger-root-builder.mjs +33 -164
  12. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  13. package/dist/js/orpc-client.js +0 -1
  14. package/dist/js/orpc-client.js.map +1 -1
  15. package/dist/js/orpc-client.mjs +0 -1
  16. package/dist/js/orpc-client.mjs.map +1 -1
  17. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +4 -109
  18. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
  19. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +0 -102
  20. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  21. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  22. package/dist/navigation/ledger-root-builder.js +44 -253
  23. package/dist/navigation/ledger-root-builder.js.map +1 -1
  24. package/dist/orpc-client/docs-ledger/contract.d.ts +0 -9
  25. package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  26. package/dist/orpc-client/docs-ledger/contract.js +0 -1
  27. package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  30. package/dist/types/orpc-client/docs-ledger/contract.d.ts +0 -9
  31. package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  34. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  35. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  36. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  37. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  38. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  39. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  40. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  41. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  42. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  43. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  44. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  45. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  46. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  47. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js +0 -234
  48. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js.map +0 -1
  49. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  50. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  51. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -360
  52. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +0 -1
  53. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  54. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  55. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  56. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  57. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  58. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  59. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  60. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  61. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  62. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
@@ -92,17 +92,6 @@ 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
- };
106
95
  var SnippetsByEndpointMethodSchema = z.record(
107
96
  HttpMethodSchema,
108
97
  z.array(z.unknown())
@@ -899,35 +888,6 @@ function metaStr(metadata, key) {
899
888
  }
900
889
  return void 0;
901
890
  }
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
- }
931
891
  function metaBool(metadata, key) {
932
892
  if (metadata != null && typeof metadata === "object" && key in metadata) {
933
893
  const v = metadata[key];
@@ -1045,7 +1005,7 @@ function artifactToNode(ctx, route) {
1045
1005
  }),
1046
1006
  pageId: PageId(pageId),
1047
1007
  noindex: metaBool(md, "noindex"),
1048
- availability: metaAvailability(md)
1008
+ availability: metaStr(md, "availability")
1049
1009
  };
1050
1010
  return node;
1051
1011
  }
@@ -1110,7 +1070,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1110
1070
  endpointId: EndpointId(endpointId),
1111
1071
  apiDefinitionId,
1112
1072
  isResponseStream: metaBool(md, "isResponseStream"),
1113
- availability: metaAvailability(md),
1073
+ availability: metaStr(md, "availability"),
1114
1074
  playground: void 0
1115
1075
  };
1116
1076
  }
@@ -1126,7 +1086,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1126
1086
  method,
1127
1087
  webhookId: WebhookId(webhookId),
1128
1088
  apiDefinitionId,
1129
- availability: metaAvailability(md)
1089
+ availability: metaStr(md, "availability")
1130
1090
  };
1131
1091
  }
1132
1092
  if (route.type === "asyncapi") {
@@ -1139,7 +1099,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1139
1099
  ...meta,
1140
1100
  webSocketId: WebSocketId(webSocketId),
1141
1101
  apiDefinitionId,
1142
- availability: metaAvailability(md),
1102
+ availability: metaStr(md, "availability"),
1143
1103
  playground: void 0
1144
1104
  };
1145
1105
  }
@@ -1155,7 +1115,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1155
1115
  method,
1156
1116
  grpcId: GrpcId(grpcId),
1157
1117
  apiDefinitionId,
1158
- availability: metaAvailability(md)
1118
+ availability: metaStr(md, "availability")
1159
1119
  };
1160
1120
  }
1161
1121
  if (route.type === "graphql") {
@@ -1171,7 +1131,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1171
1131
  graphqlOperationId: GraphQlOperationId(graphqlOperationId),
1172
1132
  graphqlOperationIds: void 0,
1173
1133
  apiDefinitionId,
1174
- availability: metaAvailability(md),
1134
+ availability: metaStr(md, "availability"),
1175
1135
  playground: void 0
1176
1136
  };
1177
1137
  }
@@ -1300,30 +1260,6 @@ function stripLeadingScopePrefix(section, scopePrefix) {
1300
1260
  }
1301
1261
  return section;
1302
1262
  }
1303
- function computeDuplicateSiblingSortBoundaries(siblings) {
1304
- const result = /* @__PURE__ */ new Map();
1305
- const byPath = /* @__PURE__ */ new Map();
1306
- for (const sibling of siblings) {
1307
- if (metaStr(sibling.seg.metadata, "type") !== "section") {
1308
- continue;
1309
- }
1310
- const group = byPath.get(sibling.seg.section) ?? [];
1311
- group.push(sibling);
1312
- byPath.set(sibling.seg.section, group);
1313
- }
1314
- for (const [, group] of byPath) {
1315
- if (group.length <= 1) {
1316
- continue;
1317
- }
1318
- for (let i = 0; i < group.length; i++) {
1319
- result.set(group[i], {
1320
- lo: group[i].seg.sortOrder,
1321
- hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
1322
- });
1323
- }
1324
- }
1325
- return result;
1326
- }
1327
1263
  function mergeChildrenByPosition(ctx, nav, sectionChildren) {
1328
1264
  const leafNodes = [];
1329
1265
  for (let i = 0; i < nav.length; i++) {
@@ -1373,20 +1309,17 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1373
1309
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1374
1310
  collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1375
1311
  collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1376
- availability: metaAvailability(seg.metadata),
1312
+ availability: metaStr(seg.metadata, "availability"),
1377
1313
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
1378
1314
  children: mergeChildrenByPosition(ctx, nav, sectionChildren)
1379
1315
  };
1380
1316
  }
1381
- function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1317
+ function directChildApiPackages(parentSection, scopeSegs) {
1382
1318
  const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1383
1319
  return scopeSegs.filter((s) => {
1384
1320
  if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
1385
1321
  return false;
1386
1322
  }
1387
- if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
1388
- return false;
1389
- }
1390
1323
  const parent = parentSectionPath(s.seg.section);
1391
1324
  if (parent === parentSection) {
1392
1325
  return true;
@@ -1400,17 +1333,7 @@ function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1400
1333
  function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
1401
1334
  const { seg, nav } = scoped;
1402
1335
  const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
1403
- let childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
1404
- const samePathApiSiblings = scopeSegs.filter(
1405
- (s) => s.seg.section === seg.section && s.seg.sortOrder !== seg.sortOrder && API_NODE_SEGMENT_TYPES.has(metaStr(s.seg.metadata, "type") ?? "")
1406
- );
1407
- const hasCollapsedGroups = samePathApiSiblings.length > 0;
1408
- if (hasCollapsedGroups && metaStr(seg.metadata, "type") !== "apiReference") {
1409
- const nextSibling = samePathApiSiblings.filter((s) => s.seg.sortOrder > seg.sortOrder).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder)[0];
1410
- const lo = seg.sortOrder;
1411
- const hi = nextSibling?.seg.sortOrder ?? Number.MAX_SAFE_INTEGER;
1412
- childPackages = childPackages.filter((c) => c.seg.sortOrder > lo && c.seg.sortOrder < hi);
1413
- }
1336
+ const childPackages = directChildApiPackages(seg.section, scopeSegs);
1414
1337
  const packageNodes = childPackages.map((child) => ({
1415
1338
  node: apiPackageChildNode(
1416
1339
  ctx,
@@ -1421,9 +1344,6 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
1421
1344
  ),
1422
1345
  childIndex: metaNum(child.seg.metadata, "childIndex")
1423
1346
  }));
1424
- if (hasCollapsedGroups && metaStr(seg.metadata, "type") === "apiReference") {
1425
- return [...leafNodes, ...packageNodes.map((p, i) => ({ node: p.node, pos: leafNodes.length + i }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
1426
- }
1427
1347
  const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
1428
1348
  if (!hasChildIndex) {
1429
1349
  return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
@@ -1463,7 +1383,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1463
1383
  featureFlags: metaFeatureFlags(seg.metadata)
1464
1384
  }),
1465
1385
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1466
- availability: metaAvailability(seg.metadata),
1386
+ availability: metaStr(seg.metadata, "availability"),
1467
1387
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1468
1388
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1469
1389
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1551,10 +1471,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1551
1471
  featureFlags: metaFeatureFlags(seg.metadata)
1552
1472
  }),
1553
1473
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1554
- availability: metaAvailability(seg.metadata),
1474
+ availability: metaStr(seg.metadata, "availability"),
1555
1475
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1556
1476
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1557
- paginated: metaBool(seg.metadata, "paginated"),
1477
+ paginated: true,
1558
1478
  showErrors: metaBool(seg.metadata, "showErrors"),
1559
1479
  hideTitle: metaBool(seg.metadata, "hideTitle"),
1560
1480
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1572,10 +1492,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
1572
1492
  }
1573
1493
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1574
1494
  });
1575
- const apiReferenceCount = scopeSegs.filter((candidate) => {
1576
- return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1577
- }).length;
1578
- const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? (apiReferenceCount === 1 ? candidates[0] : void 0);
1495
+ const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? candidates[0];
1579
1496
  return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
1580
1497
  }
1581
1498
  function hasOwningApiReference(scoped, scopeSegs) {
@@ -1583,13 +1500,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
1583
1500
  if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
1584
1501
  return false;
1585
1502
  }
1586
- const candidates = scopeSegs.filter((candidate) => {
1503
+ return scopeSegs.some((candidate) => {
1587
1504
  if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
1588
1505
  return false;
1589
1506
  }
1590
1507
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1591
1508
  });
1592
- return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
1593
1509
  }
1594
1510
  function isNestedApiPackage(scoped, scopeSegs) {
1595
1511
  if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
@@ -1735,10 +1651,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1735
1651
  if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1736
1652
  return false;
1737
1653
  }
1738
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1739
- if (depth === 0) {
1740
- return false;
1741
- }
1742
1654
  const parent = parentSectionPath(sec);
1743
1655
  if (parent === parentPath) {
1744
1656
  return true;
@@ -1748,7 +1660,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1748
1660
  }
1749
1661
  return false;
1750
1662
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1751
- const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
1752
1663
  return direct.map((s) => {
1753
1664
  const type = metaStr(s.seg.metadata, "type");
1754
1665
  const childIndex = metaNum(s.seg.metadata, "childIndex");
@@ -1758,14 +1669,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1758
1669
  } else if (type === "changelog") {
1759
1670
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
1760
1671
  } else {
1761
- const boundary = siblingBoundaries.get(s);
1762
- const childScopeSegs = boundary != null ? scopeSegs.filter(
1763
- (candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
1764
- ) : scopeSegs;
1765
1672
  node = sectionNode(
1766
1673
  ctx,
1767
1674
  s,
1768
- buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1675
+ buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1769
1676
  scopePrefix
1770
1677
  );
1771
1678
  }
@@ -1779,16 +1686,11 @@ function computeSiblingSortBoundaries(ordered) {
1779
1686
  for (const s of ordered) {
1780
1687
  const type = metaStr(s.seg.metadata, "type");
1781
1688
  const sec = s.seg.section;
1782
- if (type !== "section") {
1783
- continue;
1784
- }
1785
- if (sec === "") {
1786
- rootSections.push(s);
1689
+ if (type !== "section" || sec === "") {
1787
1690
  continue;
1788
1691
  }
1789
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1790
1692
  const parent = parentSectionPath(sec);
1791
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1693
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1792
1694
  if (isRootLevel) {
1793
1695
  rootSections.push(s);
1794
1696
  }
@@ -1815,24 +1717,14 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1815
1717
  const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1816
1718
  const sectionPaths = new Set(ordered.map((s) => s.seg.section));
1817
1719
  const annotated = [];
1720
+ const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
1818
1721
  const siblingBoundaries = computeSiblingSortBoundaries(ordered);
1819
- const hasRootSection = ordered.some(
1820
- (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1821
- );
1822
1722
  for (const s of ordered) {
1823
1723
  const type = metaStr(s.seg.metadata, "type");
1824
1724
  const sec = s.seg.section;
1825
1725
  if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1826
1726
  continue;
1827
1727
  }
1828
- if (type === "apiPackage") {
1829
- const hasApiRefSibling = ordered.some(
1830
- (sib) => sib.seg.section === sec && metaStr(sib.seg.metadata, "type") === "apiReference"
1831
- );
1832
- if (hasApiRefSibling) {
1833
- continue;
1834
- }
1835
- }
1836
1728
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
1837
1729
  continue;
1838
1730
  }
@@ -1845,18 +1737,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1845
1737
  }
1846
1738
  continue;
1847
1739
  }
1848
- if (type === "section" && sec === "" && hasRootSection) {
1849
- const bounds = siblingBoundaries.get(s);
1850
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1851
- const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1740
+ if (type === "section" && sec === "") {
1741
+ const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
1852
1742
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1853
1743
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1854
1744
  continue;
1855
1745
  }
1856
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1857
1746
  const parent = parentSectionPath(sec);
1858
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1859
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1747
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1748
+ if (isRootLevel && hasRootSection && sec !== "") {
1860
1749
  continue;
1861
1750
  }
1862
1751
  if (isRootLevel) {
@@ -1868,9 +1757,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1868
1757
  } else {
1869
1758
  const bounds = siblingBoundaries.get(s);
1870
1759
  const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1871
- const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
1872
- const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1873
- node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1760
+ node = sectionNode(
1761
+ ctx,
1762
+ s,
1763
+ buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
1764
+ scopePrefix
1765
+ );
1874
1766
  }
1875
1767
  const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1876
1768
  annotated.push({
@@ -1908,6 +1800,10 @@ function groupSidebarRootChildren(ctx, children) {
1908
1800
  } else if (child.type === "section" && !child.collapsible) {
1909
1801
  flushRun();
1910
1802
  out.push(child);
1803
+ } else if (child.type === "changelog") {
1804
+ flushRun();
1805
+ run.push(child);
1806
+ flushRun();
1911
1807
  } else {
1912
1808
  run.push(child);
1913
1809
  }
@@ -2022,7 +1918,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
2022
1918
  const variantIndividualSlug = detailSlug(variant);
2023
1919
  const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
2024
1920
  const metaPointsTo = metaStr(variant.metadata, "pointsTo");
2025
- const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
1921
+ const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
2026
1922
  return {
2027
1923
  type: "variant",
2028
1924
  ...withMetadataDefaults({
@@ -2424,7 +2320,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2424
2320
  };
2425
2321
  return node;
2426
2322
  });
2427
- markCrossProductCanonicalSlugs(children);
2428
2323
  return {
2429
2324
  type: "productgroup",
2430
2325
  id: ctx.nodeId("productgroup"),
@@ -2436,32 +2331,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2436
2331
  children
2437
2332
  };
2438
2333
  }
2439
- function markCrossProductCanonicalSlugs(productNodes) {
2440
- const pageIdToCanonical = /* @__PURE__ */ new Map();
2441
- const sorted = [...productNodes].sort((a, b) => {
2442
- if (a.default !== b.default) {
2443
- return a.default ? -1 : 1;
2444
- }
2445
- return 0;
2446
- });
2447
- for (const product of sorted) {
2448
- traverseDF(product, (child) => {
2449
- if (hasMetadata(child) && isPage(child)) {
2450
- const pid = getPageId(child);
2451
- if (pid == null) {
2452
- return;
2453
- }
2454
- const key = `pid:${pid}`;
2455
- const canonical = pageIdToCanonical.get(key);
2456
- if (canonical != null && !product.default) {
2457
- child.canonicalSlug = canonical;
2458
- } else if (canonical == null) {
2459
- pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
2460
- }
2461
- }
2462
- });
2463
- }
2464
- }
2465
2334
  // Annotate the CommonJS export names for ESM import in node:
2466
2335
  0 && (module.exports = {
2467
2336
  apiLeafNodeFromNavRoute,