@fern-api/fdr-sdk 1.2.42-54880bfeac → 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 (90) 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/converters/index.js +0 -9
  6. package/dist/js/converters/index.js.map +1 -1
  7. package/dist/js/converters/index.mjs +0 -9
  8. package/dist/js/converters/index.mjs.map +1 -1
  9. package/dist/js/index.js +0 -10
  10. package/dist/js/index.js.map +1 -1
  11. package/dist/js/index.mjs +0 -10
  12. package/dist/js/index.mjs.map +1 -1
  13. package/dist/js/navigation/index.js +0 -9
  14. package/dist/js/navigation/index.js.map +1 -1
  15. package/dist/js/navigation/index.mjs +0 -9
  16. package/dist/js/navigation/index.mjs.map +1 -1
  17. package/dist/js/navigation/ledger-root-builder.js +36 -212
  18. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  19. package/dist/js/navigation/ledger-root-builder.mjs +36 -212
  20. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  21. package/dist/js/orpc-client.js +0 -1
  22. package/dist/js/orpc-client.js.map +1 -1
  23. package/dist/js/orpc-client.mjs +0 -1
  24. package/dist/js/orpc-client.mjs.map +1 -1
  25. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +4 -109
  26. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
  27. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +0 -102
  28. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  29. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js +0 -276
  30. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
  31. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  32. package/dist/navigation/ledger-root-builder.js +47 -312
  33. package/dist/navigation/ledger-root-builder.js.map +1 -1
  34. package/dist/navigation/utils/index.d.ts +0 -1
  35. package/dist/navigation/utils/index.d.ts.map +1 -1
  36. package/dist/navigation/utils/index.js +0 -1
  37. package/dist/navigation/utils/index.js.map +1 -1
  38. package/dist/orpc-client/docs-ledger/contract.d.ts +0 -9
  39. package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  40. package/dist/orpc-client/docs-ledger/contract.js +0 -1
  41. package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  44. package/dist/types/navigation/utils/index.d.ts +0 -1
  45. package/dist/types/navigation/utils/index.d.ts.map +1 -1
  46. package/dist/types/orpc-client/docs-ledger/contract.d.ts +0 -9
  47. package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  48. package/package.json +1 -1
  49. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  50. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  51. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  52. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  53. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  54. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  55. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  56. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  57. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  58. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  59. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  60. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  61. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  62. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  63. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js +0 -234
  64. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js.map +0 -1
  65. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  66. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  67. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -360
  68. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +0 -1
  69. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  70. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  71. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +0 -29
  72. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +0 -1
  73. package/dist/navigation/utils/syntheticSectionPath.d.ts +0 -13
  74. package/dist/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
  75. package/dist/navigation/utils/syntheticSectionPath.js +0 -20
  76. package/dist/navigation/utils/syntheticSectionPath.js.map +0 -1
  77. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  78. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  79. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  80. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  81. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  82. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  83. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  84. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  85. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  86. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  87. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  88. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  89. package/dist/types/navigation/utils/syntheticSectionPath.d.ts +0 -13
  90. 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,17 +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
- let childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
1363
- const samePathApiSiblings = scopeSegs.filter(
1364
- (s) => s.seg.section === seg.section && s.seg.sortOrder !== seg.sortOrder && API_NODE_SEGMENT_TYPES.has(metaStr(s.seg.metadata, "type") ?? "")
1365
- );
1366
- const hasCollapsedGroups = samePathApiSiblings.length > 0;
1367
- if (hasCollapsedGroups && metaStr(seg.metadata, "type") !== "apiReference") {
1368
- const nextSibling = samePathApiSiblings.filter((s) => s.seg.sortOrder > seg.sortOrder).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder)[0];
1369
- const lo = seg.sortOrder;
1370
- const hi = nextSibling?.seg.sortOrder ?? Number.MAX_SAFE_INTEGER;
1371
- childPackages = childPackages.filter((c) => c.seg.sortOrder > lo && c.seg.sortOrder < hi);
1372
- }
1288
+ const childPackages = directChildApiPackages(seg.section, scopeSegs);
1373
1289
  const packageNodes = childPackages.map((child) => ({
1374
1290
  node: apiPackageChildNode(
1375
1291
  ctx,
@@ -1380,9 +1296,6 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
1380
1296
  ),
1381
1297
  childIndex: metaNum(child.seg.metadata, "childIndex")
1382
1298
  }));
1383
- if (hasCollapsedGroups && metaStr(seg.metadata, "type") === "apiReference") {
1384
- return [...leafNodes, ...packageNodes.map((p, i) => ({ node: p.node, pos: leafNodes.length + i }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
1385
- }
1386
1299
  const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
1387
1300
  if (!hasChildIndex) {
1388
1301
  return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
@@ -1422,7 +1335,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1422
1335
  featureFlags: metaFeatureFlags(seg.metadata)
1423
1336
  }),
1424
1337
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1425
- availability: metaAvailability(seg.metadata),
1338
+ availability: metaStr(seg.metadata, "availability"),
1426
1339
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1427
1340
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1428
1341
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1510,10 +1423,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1510
1423
  featureFlags: metaFeatureFlags(seg.metadata)
1511
1424
  }),
1512
1425
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1513
- availability: metaAvailability(seg.metadata),
1426
+ availability: metaStr(seg.metadata, "availability"),
1514
1427
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1515
1428
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1516
- paginated: metaBool(seg.metadata, "paginated"),
1429
+ paginated: true,
1517
1430
  showErrors: metaBool(seg.metadata, "showErrors"),
1518
1431
  hideTitle: metaBool(seg.metadata, "hideTitle"),
1519
1432
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1531,10 +1444,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
1531
1444
  }
1532
1445
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1533
1446
  });
1534
- const apiReferenceCount = scopeSegs.filter((candidate) => {
1535
- return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1536
- }).length;
1537
- 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];
1538
1448
  return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
1539
1449
  }
1540
1450
  function hasOwningApiReference(scoped, scopeSegs) {
@@ -1542,51 +1452,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
1542
1452
  if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
1543
1453
  return false;
1544
1454
  }
1545
- const candidates = scopeSegs.filter((candidate) => {
1455
+ return scopeSegs.some((candidate) => {
1546
1456
  if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
1547
1457
  return false;
1548
1458
  }
1549
1459
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1550
1460
  });
1551
- return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
1552
- }
1553
- function isNestedApiPackage(scoped, scopeSegs) {
1554
- if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
1555
- return false;
1556
- }
1557
- const apiDefinitionId = metaStr(scoped.seg.metadata, "apiDefinitionId");
1558
- if (apiDefinitionId == null) {
1559
- return false;
1560
- }
1561
- const apiReferenceSections = new Set(
1562
- scopeSegs.filter(
1563
- (s) => metaStr(s.seg.metadata, "type") === "apiReference" && metaStr(s.seg.metadata, "apiDefinitionId") === apiDefinitionId
1564
- ).map((s) => s.seg.section)
1565
- );
1566
- if (apiReferenceSections.size === 0) {
1567
- return false;
1568
- }
1569
- const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1570
- const resolveParent = (section) => {
1571
- const parent = parentSectionPath(section);
1572
- if (parent === "" || sectionPaths.has(parent)) {
1573
- return parent;
1574
- }
1575
- return nearestExistingAncestor(section, sectionPaths);
1576
- };
1577
- let current = scoped.seg.section;
1578
- const seen = /* @__PURE__ */ new Set([current]);
1579
- for (; ; ) {
1580
- const parent = resolveParent(current);
1581
- if (apiReferenceSections.has(parent)) {
1582
- return true;
1583
- }
1584
- if (parent === "" || seen.has(parent)) {
1585
- return false;
1586
- }
1587
- seen.add(parent);
1588
- current = parent;
1589
- }
1590
1461
  }
1591
1462
  function changelogNode(ctx, scoped, scopePrefix) {
1592
1463
  const { seg, nav } = scoped;
@@ -1691,11 +1562,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1691
1562
  if (sec === "" || type === "tabRoot") {
1692
1563
  return false;
1693
1564
  }
1694
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1695
- return false;
1696
- }
1697
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1698
- if (depth === 0) {
1565
+ if (hasOwningApiReference(s, scopeSegs)) {
1699
1566
  return false;
1700
1567
  }
1701
1568
  const parent = parentSectionPath(sec);
@@ -1707,7 +1574,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1707
1574
  }
1708
1575
  return false;
1709
1576
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1710
- const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
1711
1577
  return direct.map((s) => {
1712
1578
  const type = metaStr(s.seg.metadata, "type");
1713
1579
  const childIndex = metaNum(s.seg.metadata, "childIndex");
@@ -1717,14 +1583,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1717
1583
  } else if (type === "changelog") {
1718
1584
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
1719
1585
  } else {
1720
- const boundary = siblingBoundaries.get(s);
1721
- const childScopeSegs = boundary != null ? scopeSegs.filter(
1722
- (candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
1723
- ) : scopeSegs;
1724
1586
  node = sectionNode(
1725
1587
  ctx,
1726
1588
  s,
1727
- buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1589
+ buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1728
1590
  scopePrefix
1729
1591
  );
1730
1592
  }
@@ -1738,16 +1600,11 @@ function computeSiblingSortBoundaries(ordered) {
1738
1600
  for (const s of ordered) {
1739
1601
  const type = metaStr(s.seg.metadata, "type");
1740
1602
  const sec = s.seg.section;
1741
- if (type !== "section") {
1742
- continue;
1743
- }
1744
- if (sec === "") {
1745
- rootSections.push(s);
1603
+ if (type !== "section" || sec === "") {
1746
1604
  continue;
1747
1605
  }
1748
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1749
1606
  const parent = parentSectionPath(sec);
1750
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1607
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1751
1608
  if (isRootLevel) {
1752
1609
  rootSections.push(s);
1753
1610
  }
@@ -1774,24 +1631,14 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1774
1631
  const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1775
1632
  const sectionPaths = new Set(ordered.map((s) => s.seg.section));
1776
1633
  const annotated = [];
1634
+ const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
1777
1635
  const siblingBoundaries = computeSiblingSortBoundaries(ordered);
1778
- const hasRootSection = ordered.some(
1779
- (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1780
- );
1781
1636
  for (const s of ordered) {
1782
1637
  const type = metaStr(s.seg.metadata, "type");
1783
1638
  const sec = s.seg.section;
1784
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1639
+ if (hasOwningApiReference(s, scopeSegs)) {
1785
1640
  continue;
1786
1641
  }
1787
- if (type === "apiPackage") {
1788
- const hasApiRefSibling = ordered.some(
1789
- (sib) => sib.seg.section === sec && metaStr(sib.seg.metadata, "type") === "apiReference"
1790
- );
1791
- if (hasApiRefSibling) {
1792
- continue;
1793
- }
1794
- }
1795
1642
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
1796
1643
  continue;
1797
1644
  }
@@ -1804,18 +1651,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1804
1651
  }
1805
1652
  continue;
1806
1653
  }
1807
- if (type === "section" && sec === "" && hasRootSection) {
1808
- const bounds = siblingBoundaries.get(s);
1809
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1810
- const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1654
+ if (type === "section" && sec === "") {
1655
+ const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
1811
1656
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1812
1657
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1813
1658
  continue;
1814
1659
  }
1815
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1816
1660
  const parent = parentSectionPath(sec);
1817
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1818
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1661
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1662
+ if (isRootLevel && hasRootSection && sec !== "") {
1819
1663
  continue;
1820
1664
  }
1821
1665
  if (isRootLevel) {
@@ -1827,9 +1671,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1827
1671
  } else {
1828
1672
  const bounds = siblingBoundaries.get(s);
1829
1673
  const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1830
- const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
1831
- const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1832
- node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1674
+ node = sectionNode(
1675
+ ctx,
1676
+ s,
1677
+ buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
1678
+ scopePrefix
1679
+ );
1833
1680
  }
1834
1681
  const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1835
1682
  annotated.push({
@@ -1867,6 +1714,10 @@ function groupSidebarRootChildren(ctx, children) {
1867
1714
  } else if (child.type === "section" && !child.collapsible) {
1868
1715
  flushRun();
1869
1716
  out.push(child);
1717
+ } else if (child.type === "changelog") {
1718
+ flushRun();
1719
+ run.push(child);
1720
+ flushRun();
1870
1721
  } else {
1871
1722
  run.push(child);
1872
1723
  }
@@ -1981,7 +1832,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
1981
1832
  const variantIndividualSlug = detailSlug(variant);
1982
1833
  const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
1983
1834
  const metaPointsTo = metaStr(variant.metadata, "pointsTo");
1984
- const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
1835
+ const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
1985
1836
  return {
1986
1837
  type: "variant",
1987
1838
  ...withMetadataDefaults({
@@ -2383,7 +2234,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2383
2234
  };
2384
2235
  return node;
2385
2236
  });
2386
- markCrossProductCanonicalSlugs(children);
2387
2237
  return {
2388
2238
  type: "productgroup",
2389
2239
  id: ctx.nodeId("productgroup"),
@@ -2395,32 +2245,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2395
2245
  children
2396
2246
  };
2397
2247
  }
2398
- function markCrossProductCanonicalSlugs(productNodes) {
2399
- const pageIdToCanonical = /* @__PURE__ */ new Map();
2400
- const sorted = [...productNodes].sort((a, b) => {
2401
- if (a.default !== b.default) {
2402
- return a.default ? -1 : 1;
2403
- }
2404
- return 0;
2405
- });
2406
- for (const product of sorted) {
2407
- traverseDF(product, (child) => {
2408
- if (hasMetadata(child) && isPage(child)) {
2409
- const pid = getPageId(child);
2410
- if (pid == null) {
2411
- return;
2412
- }
2413
- const key = `pid:${pid}`;
2414
- const canonical = pageIdToCanonical.get(key);
2415
- if (canonical != null && !product.default) {
2416
- child.canonicalSlug = canonical;
2417
- } else if (canonical == null) {
2418
- pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
2419
- }
2420
- }
2421
- });
2422
- }
2423
- }
2424
2248
  export {
2425
2249
  apiLeafNodeFromNavRoute,
2426
2250
  buildFullRootFromSegments,