@fern-api/fdr-sdk 1.2.42-5d054efb73 → 1.2.42-6d01f91096

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 (70) hide show
  1. package/dist/js/converters/index.js +0 -9
  2. package/dist/js/converters/index.js.map +1 -1
  3. package/dist/js/converters/index.mjs +0 -9
  4. package/dist/js/converters/index.mjs.map +1 -1
  5. package/dist/js/index.js +0 -9
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +0 -9
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/index.js +0 -9
  10. package/dist/js/navigation/index.js.map +1 -1
  11. package/dist/js/navigation/index.mjs +0 -9
  12. package/dist/js/navigation/index.mjs.map +1 -1
  13. package/dist/js/navigation/ledger-root-builder.js +36 -191
  14. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  15. package/dist/js/navigation/ledger-root-builder.mjs +36 -191
  16. package/dist/js/navigation/ledger-root-builder.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/__test__/ledger-root-builder.skipSlugApiReference.test.js +0 -276
  22. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
  23. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  24. package/dist/navigation/ledger-root-builder.js +47 -275
  25. package/dist/navigation/ledger-root-builder.js.map +1 -1
  26. package/dist/navigation/utils/index.d.ts +0 -1
  27. package/dist/navigation/utils/index.d.ts.map +1 -1
  28. package/dist/navigation/utils/index.js +0 -1
  29. package/dist/navigation/utils/index.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  32. package/dist/types/navigation/utils/index.d.ts +0 -1
  33. package/dist/types/navigation/utils/index.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  36. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  37. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  38. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  39. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  40. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  41. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  42. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  43. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  44. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  45. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  46. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  47. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  48. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  49. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -256
  50. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +0 -1
  51. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  52. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  53. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +0 -29
  54. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +0 -1
  55. package/dist/navigation/utils/syntheticSectionPath.d.ts +0 -13
  56. package/dist/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
  57. package/dist/navigation/utils/syntheticSectionPath.js +0 -20
  58. package/dist/navigation/utils/syntheticSectionPath.js.map +0 -1
  59. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  60. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  61. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  62. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  63. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  64. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  65. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  66. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  67. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  68. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  69. package/dist/types/navigation/utils/syntheticSectionPath.d.ts +0 -13
  70. package/dist/types/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
@@ -51,17 +51,6 @@ var VersionIdSchema = z.string();
51
51
  function VersionId(value) {
52
52
  return value;
53
53
  }
54
- var Availability = {
55
- Alpha: "Alpha",
56
- Stable: "Stable",
57
- GenerallyAvailable: "GenerallyAvailable",
58
- InDevelopment: "InDevelopment",
59
- PreRelease: "PreRelease",
60
- Deprecated: "Deprecated",
61
- Beta: "Beta",
62
- Preview: "Preview",
63
- Legacy: "Legacy"
64
- };
65
54
  var SnippetsByEndpointMethodSchema = z.record(
66
55
  HttpMethodSchema,
67
56
  z.array(z.unknown())
@@ -815,12 +804,6 @@ function traverseDF(node, visit) {
815
804
  return dfs(node, visit, getChildren);
816
805
  }
817
806
 
818
- // src/navigation/utils/syntheticSectionPath.ts
819
- var SYNTHETIC_SEGMENT_RE = /^~\d+$/;
820
- function stripSyntheticSegments(section) {
821
- return section.split("/").filter((part) => !SYNTHETIC_SEGMENT_RE.test(part)).join("/");
822
- }
823
-
824
807
  // src/navigation/ledger-root-builder.ts
825
808
  var STRUCTURAL_SEGMENT_TYPES = /* @__PURE__ */ new Set([
826
809
  "section",
@@ -858,35 +841,6 @@ function metaStr(metadata, key) {
858
841
  }
859
842
  return void 0;
860
843
  }
861
- var AVAILABILITY_LOOKUP = {
862
- // V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
863
- alpha: Availability.Alpha,
864
- stable: Availability.Stable,
865
- "generally-available": Availability.GenerallyAvailable,
866
- "in-development": Availability.InDevelopment,
867
- "pre-release": Availability.PreRelease,
868
- deprecated: Availability.Deprecated,
869
- beta: Availability.Beta,
870
- preview: Availability.Preview,
871
- legacy: Availability.Legacy,
872
- // Latest PascalCase values (pass-through)
873
- Alpha: Availability.Alpha,
874
- Stable: Availability.Stable,
875
- GenerallyAvailable: Availability.GenerallyAvailable,
876
- InDevelopment: Availability.InDevelopment,
877
- PreRelease: Availability.PreRelease,
878
- Deprecated: Availability.Deprecated,
879
- Beta: Availability.Beta,
880
- Preview: Availability.Preview,
881
- Legacy: Availability.Legacy
882
- };
883
- function metaAvailability(metadata) {
884
- const raw = metaStr(metadata, "availability");
885
- if (raw == null) {
886
- return void 0;
887
- }
888
- return AVAILABILITY_LOOKUP[raw];
889
- }
890
844
  function metaBool(metadata, key) {
891
845
  if (metadata != null && typeof metadata === "object" && key in metadata) {
892
846
  const v = metadata[key];
@@ -1004,7 +958,7 @@ function artifactToNode(ctx, route) {
1004
958
  }),
1005
959
  pageId: PageId(pageId),
1006
960
  noindex: metaBool(md, "noindex"),
1007
- availability: metaAvailability(md)
961
+ availability: metaStr(md, "availability")
1008
962
  };
1009
963
  return node;
1010
964
  }
@@ -1069,7 +1023,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1069
1023
  endpointId: EndpointId(endpointId),
1070
1024
  apiDefinitionId,
1071
1025
  isResponseStream: metaBool(md, "isResponseStream"),
1072
- availability: metaAvailability(md),
1026
+ availability: metaStr(md, "availability"),
1073
1027
  playground: void 0
1074
1028
  };
1075
1029
  }
@@ -1085,7 +1039,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1085
1039
  method,
1086
1040
  webhookId: WebhookId(webhookId),
1087
1041
  apiDefinitionId,
1088
- availability: metaAvailability(md)
1042
+ availability: metaStr(md, "availability")
1089
1043
  };
1090
1044
  }
1091
1045
  if (route.type === "asyncapi") {
@@ -1098,7 +1052,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1098
1052
  ...meta,
1099
1053
  webSocketId: WebSocketId(webSocketId),
1100
1054
  apiDefinitionId,
1101
- availability: metaAvailability(md),
1055
+ availability: metaStr(md, "availability"),
1102
1056
  playground: void 0
1103
1057
  };
1104
1058
  }
@@ -1114,7 +1068,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1114
1068
  method,
1115
1069
  grpcId: GrpcId(grpcId),
1116
1070
  apiDefinitionId,
1117
- availability: metaAvailability(md)
1071
+ availability: metaStr(md, "availability")
1118
1072
  };
1119
1073
  }
1120
1074
  if (route.type === "graphql") {
@@ -1130,7 +1084,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1130
1084
  graphqlOperationId: GraphQlOperationId(graphqlOperationId),
1131
1085
  graphqlOperationIds: void 0,
1132
1086
  apiDefinitionId,
1133
- availability: metaAvailability(md),
1087
+ availability: metaStr(md, "availability"),
1134
1088
  playground: void 0
1135
1089
  };
1136
1090
  }
@@ -1243,8 +1197,7 @@ function structuralNodeSlug(ctx, overviewFullPath, section, scopePrefix) {
1243
1197
  if (overviewFullPath != null) {
1244
1198
  return ctx.contentSlug(overviewFullPath);
1245
1199
  }
1246
- const cleanSection = stripSyntheticSegments(section);
1247
- return cleanSection !== "" ? slugjoin(scopePrefix, cleanSection) : scopePrefix;
1200
+ return section !== "" ? slugjoin(scopePrefix, section) : scopePrefix;
1248
1201
  }
1249
1202
  function stripLeadingScopePrefix(section, scopePrefix) {
1250
1203
  const prefix = scopePrefix;
@@ -1259,30 +1212,6 @@ function stripLeadingScopePrefix(section, scopePrefix) {
1259
1212
  }
1260
1213
  return section;
1261
1214
  }
1262
- function computeDuplicateSiblingSortBoundaries(siblings) {
1263
- const result = /* @__PURE__ */ new Map();
1264
- const byPath = /* @__PURE__ */ new Map();
1265
- for (const sibling of siblings) {
1266
- if (metaStr(sibling.seg.metadata, "type") !== "section") {
1267
- continue;
1268
- }
1269
- const group = byPath.get(sibling.seg.section) ?? [];
1270
- group.push(sibling);
1271
- byPath.set(sibling.seg.section, group);
1272
- }
1273
- for (const [, group] of byPath) {
1274
- if (group.length <= 1) {
1275
- continue;
1276
- }
1277
- for (let i = 0; i < group.length; i++) {
1278
- result.set(group[i], {
1279
- lo: group[i].seg.sortOrder,
1280
- hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
1281
- });
1282
- }
1283
- }
1284
- return result;
1285
- }
1286
1215
  function mergeChildrenByPosition(ctx, nav, sectionChildren) {
1287
1216
  const leafNodes = [];
1288
1217
  for (let i = 0; i < nav.length; i++) {
@@ -1332,20 +1261,17 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1332
1261
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1333
1262
  collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1334
1263
  collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1335
- availability: metaAvailability(seg.metadata),
1264
+ availability: metaStr(seg.metadata, "availability"),
1336
1265
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
1337
1266
  children: mergeChildrenByPosition(ctx, nav, sectionChildren)
1338
1267
  };
1339
1268
  }
1340
- function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1269
+ function directChildApiPackages(parentSection, scopeSegs) {
1341
1270
  const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1342
1271
  return scopeSegs.filter((s) => {
1343
1272
  if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
1344
1273
  return false;
1345
1274
  }
1346
- if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
1347
- return false;
1348
- }
1349
1275
  const parent = parentSectionPath(s.seg.section);
1350
1276
  if (parent === parentSection) {
1351
1277
  return true;
@@ -1359,7 +1285,7 @@ function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1359
1285
  function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
1360
1286
  const { seg, nav } = scoped;
1361
1287
  const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
1362
- const childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
1288
+ const childPackages = directChildApiPackages(seg.section, scopeSegs);
1363
1289
  const packageNodes = childPackages.map((child) => ({
1364
1290
  node: apiPackageChildNode(
1365
1291
  ctx,
@@ -1409,7 +1335,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1409
1335
  featureFlags: metaFeatureFlags(seg.metadata)
1410
1336
  }),
1411
1337
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1412
- availability: metaAvailability(seg.metadata),
1338
+ availability: metaStr(seg.metadata, "availability"),
1413
1339
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1414
1340
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1415
1341
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1497,10 +1423,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1497
1423
  featureFlags: metaFeatureFlags(seg.metadata)
1498
1424
  }),
1499
1425
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1500
- availability: metaAvailability(seg.metadata),
1426
+ availability: metaStr(seg.metadata, "availability"),
1501
1427
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1502
1428
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1503
- paginated: metaBool(seg.metadata, "paginated"),
1429
+ paginated: true,
1504
1430
  showErrors: metaBool(seg.metadata, "showErrors"),
1505
1431
  hideTitle: metaBool(seg.metadata, "hideTitle"),
1506
1432
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1518,10 +1444,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
1518
1444
  }
1519
1445
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1520
1446
  });
1521
- const apiReferenceCount = scopeSegs.filter((candidate) => {
1522
- return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1523
- }).length;
1524
- const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? (apiReferenceCount === 1 ? candidates[0] : void 0);
1447
+ const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? candidates[0];
1525
1448
  return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
1526
1449
  }
1527
1450
  function hasOwningApiReference(scoped, scopeSegs) {
@@ -1529,51 +1452,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
1529
1452
  if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
1530
1453
  return false;
1531
1454
  }
1532
- const candidates = scopeSegs.filter((candidate) => {
1455
+ return scopeSegs.some((candidate) => {
1533
1456
  if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
1534
1457
  return false;
1535
1458
  }
1536
1459
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1537
1460
  });
1538
- return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
1539
- }
1540
- function isNestedApiPackage(scoped, scopeSegs) {
1541
- if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
1542
- return false;
1543
- }
1544
- const apiDefinitionId = metaStr(scoped.seg.metadata, "apiDefinitionId");
1545
- if (apiDefinitionId == null) {
1546
- return false;
1547
- }
1548
- const apiReferenceSections = new Set(
1549
- scopeSegs.filter(
1550
- (s) => metaStr(s.seg.metadata, "type") === "apiReference" && metaStr(s.seg.metadata, "apiDefinitionId") === apiDefinitionId
1551
- ).map((s) => s.seg.section)
1552
- );
1553
- if (apiReferenceSections.size === 0) {
1554
- return false;
1555
- }
1556
- const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1557
- const resolveParent = (section) => {
1558
- const parent = parentSectionPath(section);
1559
- if (parent === "" || sectionPaths.has(parent)) {
1560
- return parent;
1561
- }
1562
- return nearestExistingAncestor(section, sectionPaths);
1563
- };
1564
- let current = scoped.seg.section;
1565
- const seen = /* @__PURE__ */ new Set([current]);
1566
- for (; ; ) {
1567
- const parent = resolveParent(current);
1568
- if (apiReferenceSections.has(parent)) {
1569
- return true;
1570
- }
1571
- if (parent === "" || seen.has(parent)) {
1572
- return false;
1573
- }
1574
- seen.add(parent);
1575
- current = parent;
1576
- }
1577
1461
  }
1578
1462
  function changelogNode(ctx, scoped, scopePrefix) {
1579
1463
  const { seg, nav } = scoped;
@@ -1678,11 +1562,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1678
1562
  if (sec === "" || type === "tabRoot") {
1679
1563
  return false;
1680
1564
  }
1681
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1682
- return false;
1683
- }
1684
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1685
- if (depth === 0) {
1565
+ if (hasOwningApiReference(s, scopeSegs)) {
1686
1566
  return false;
1687
1567
  }
1688
1568
  const parent = parentSectionPath(sec);
@@ -1694,7 +1574,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1694
1574
  }
1695
1575
  return false;
1696
1576
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1697
- const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
1698
1577
  return direct.map((s) => {
1699
1578
  const type = metaStr(s.seg.metadata, "type");
1700
1579
  const childIndex = metaNum(s.seg.metadata, "childIndex");
@@ -1704,14 +1583,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1704
1583
  } else if (type === "changelog") {
1705
1584
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
1706
1585
  } else {
1707
- const boundary = siblingBoundaries.get(s);
1708
- const childScopeSegs = boundary != null ? scopeSegs.filter(
1709
- (candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
1710
- ) : scopeSegs;
1711
1586
  node = sectionNode(
1712
1587
  ctx,
1713
1588
  s,
1714
- buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1589
+ buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1715
1590
  scopePrefix
1716
1591
  );
1717
1592
  }
@@ -1725,16 +1600,11 @@ function computeSiblingSortBoundaries(ordered) {
1725
1600
  for (const s of ordered) {
1726
1601
  const type = metaStr(s.seg.metadata, "type");
1727
1602
  const sec = s.seg.section;
1728
- if (type !== "section") {
1603
+ if (type !== "section" || sec === "") {
1729
1604
  continue;
1730
1605
  }
1731
- if (sec === "") {
1732
- rootSections.push(s);
1733
- continue;
1734
- }
1735
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1736
1606
  const parent = parentSectionPath(sec);
1737
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1607
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1738
1608
  if (isRootLevel) {
1739
1609
  rootSections.push(s);
1740
1610
  }
@@ -1761,14 +1631,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1761
1631
  const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1762
1632
  const sectionPaths = new Set(ordered.map((s) => s.seg.section));
1763
1633
  const annotated = [];
1634
+ const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
1764
1635
  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
- );
1768
1636
  for (const s of ordered) {
1769
1637
  const type = metaStr(s.seg.metadata, "type");
1770
1638
  const sec = s.seg.section;
1771
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1639
+ if (hasOwningApiReference(s, scopeSegs)) {
1772
1640
  continue;
1773
1641
  }
1774
1642
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
@@ -1783,18 +1651,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1783
1651
  }
1784
1652
  continue;
1785
1653
  }
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);
1654
+ if (type === "section" && sec === "") {
1655
+ const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
1790
1656
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1791
1657
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1792
1658
  continue;
1793
1659
  }
1794
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1795
1660
  const parent = parentSectionPath(sec);
1796
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1797
- if (isRootLevel && hasRootSection && sec !== "" && depth == null) {
1661
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1662
+ if (isRootLevel && hasRootSection && sec !== "") {
1798
1663
  continue;
1799
1664
  }
1800
1665
  if (isRootLevel) {
@@ -1806,9 +1671,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1806
1671
  } else {
1807
1672
  const bounds = siblingBoundaries.get(s);
1808
1673
  const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1809
- const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
1810
- const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1811
- node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1674
+ node = sectionNode(
1675
+ ctx,
1676
+ s,
1677
+ buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
1678
+ scopePrefix
1679
+ );
1812
1680
  }
1813
1681
  const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1814
1682
  annotated.push({
@@ -1846,6 +1714,10 @@ function groupSidebarRootChildren(ctx, children) {
1846
1714
  } else if (child.type === "section" && !child.collapsible) {
1847
1715
  flushRun();
1848
1716
  out.push(child);
1717
+ } else if (child.type === "changelog") {
1718
+ flushRun();
1719
+ run.push(child);
1720
+ flushRun();
1849
1721
  } else {
1850
1722
  run.push(child);
1851
1723
  }
@@ -1960,7 +1832,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
1960
1832
  const variantIndividualSlug = detailSlug(variant);
1961
1833
  const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
1962
1834
  const metaPointsTo = metaStr(variant.metadata, "pointsTo");
1963
- const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
1835
+ const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
1964
1836
  return {
1965
1837
  type: "variant",
1966
1838
  ...withMetadataDefaults({
@@ -2362,7 +2234,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2362
2234
  };
2363
2235
  return node;
2364
2236
  });
2365
- markCrossProductCanonicalSlugs(children);
2366
2237
  return {
2367
2238
  type: "productgroup",
2368
2239
  id: ctx.nodeId("productgroup"),
@@ -2374,32 +2245,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2374
2245
  children
2375
2246
  };
2376
2247
  }
2377
- function markCrossProductCanonicalSlugs(productNodes) {
2378
- const pageIdToCanonical = /* @__PURE__ */ new Map();
2379
- const sorted = [...productNodes].sort((a, b) => {
2380
- if (a.default !== b.default) {
2381
- return a.default ? -1 : 1;
2382
- }
2383
- return 0;
2384
- });
2385
- for (const product of sorted) {
2386
- traverseDF(product, (child) => {
2387
- if (hasMetadata(child) && isPage(child)) {
2388
- const pid = getPageId(child);
2389
- if (pid == null) {
2390
- return;
2391
- }
2392
- const key = `pid:${pid}`;
2393
- const canonical = pageIdToCanonical.get(key);
2394
- if (canonical != null && !product.default) {
2395
- child.canonicalSlug = canonical;
2396
- } else if (canonical == null) {
2397
- pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
2398
- }
2399
- }
2400
- });
2401
- }
2402
- }
2403
2248
  export {
2404
2249
  apiLeafNodeFromNavRoute,
2405
2250
  buildFullRootFromSegments,