@fern-api/fdr-sdk 1.2.42-080b4f1d94 → 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.
Files changed (54) 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 +14 -100
  10. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  11. package/dist/js/navigation/ledger-root-builder.mjs +14 -100
  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.skipSlugSiblingSection.test.js +1 -105
  18. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -1
  19. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  20. package/dist/navigation/ledger-root-builder.js +23 -153
  21. package/dist/navigation/ledger-root-builder.js.map +1 -1
  22. package/dist/orpc-client/docs-ledger/contract.d.ts +0 -9
  23. package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  24. package/dist/orpc-client/docs-ledger/contract.js +0 -1
  25. package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  28. package/dist/types/orpc-client/docs-ledger/contract.d.ts +0 -9
  29. package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  32. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  33. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  34. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  35. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  36. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  37. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  38. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  39. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  40. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  41. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  42. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  43. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  44. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  45. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js +0 -234
  46. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js.map +0 -1
  47. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  48. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  49. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  50. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  51. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  52. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  53. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  54. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
@@ -1300,30 +1300,6 @@ function stripLeadingScopePrefix(section, scopePrefix) {
1300
1300
  }
1301
1301
  return section;
1302
1302
  }
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
1303
  function mergeChildrenByPosition(ctx, nav, sectionChildren) {
1328
1304
  const leafNodes = [];
1329
1305
  for (let i = 0; i < nav.length; i++) {
@@ -1378,15 +1354,12 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1378
1354
  children: mergeChildrenByPosition(ctx, nav, sectionChildren)
1379
1355
  };
1380
1356
  }
1381
- function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1357
+ function directChildApiPackages(parentSection, scopeSegs) {
1382
1358
  const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1383
1359
  return scopeSegs.filter((s) => {
1384
1360
  if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
1385
1361
  return false;
1386
1362
  }
1387
- if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
1388
- return false;
1389
- }
1390
1363
  const parent = parentSectionPath(s.seg.section);
1391
1364
  if (parent === parentSection) {
1392
1365
  return true;
@@ -1400,17 +1373,7 @@ function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1400
1373
  function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
1401
1374
  const { seg, nav } = scoped;
1402
1375
  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
- }
1376
+ const childPackages = directChildApiPackages(seg.section, scopeSegs);
1414
1377
  const packageNodes = childPackages.map((child) => ({
1415
1378
  node: apiPackageChildNode(
1416
1379
  ctx,
@@ -1421,9 +1384,6 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
1421
1384
  ),
1422
1385
  childIndex: metaNum(child.seg.metadata, "childIndex")
1423
1386
  }));
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
1387
  const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
1428
1388
  if (!hasChildIndex) {
1429
1389
  return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
@@ -1554,7 +1514,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1554
1514
  availability: metaAvailability(seg.metadata),
1555
1515
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1556
1516
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1557
- paginated: metaBool(seg.metadata, "paginated"),
1517
+ paginated: true,
1558
1518
  showErrors: metaBool(seg.metadata, "showErrors"),
1559
1519
  hideTitle: metaBool(seg.metadata, "hideTitle"),
1560
1520
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1572,10 +1532,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
1572
1532
  }
1573
1533
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1574
1534
  });
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);
1535
+ const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? candidates[0];
1579
1536
  return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
1580
1537
  }
1581
1538
  function hasOwningApiReference(scoped, scopeSegs) {
@@ -1583,13 +1540,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
1583
1540
  if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
1584
1541
  return false;
1585
1542
  }
1586
- const candidates = scopeSegs.filter((candidate) => {
1543
+ return scopeSegs.some((candidate) => {
1587
1544
  if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
1588
1545
  return false;
1589
1546
  }
1590
1547
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1591
1548
  });
1592
- return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
1593
1549
  }
1594
1550
  function isNestedApiPackage(scoped, scopeSegs) {
1595
1551
  if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
@@ -1735,10 +1691,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1735
1691
  if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1736
1692
  return false;
1737
1693
  }
1738
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1739
- if (depth === 0) {
1740
- return false;
1741
- }
1742
1694
  const parent = parentSectionPath(sec);
1743
1695
  if (parent === parentPath) {
1744
1696
  return true;
@@ -1748,7 +1700,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1748
1700
  }
1749
1701
  return false;
1750
1702
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1751
- const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
1752
1703
  return direct.map((s) => {
1753
1704
  const type = metaStr(s.seg.metadata, "type");
1754
1705
  const childIndex = metaNum(s.seg.metadata, "childIndex");
@@ -1758,14 +1709,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1758
1709
  } else if (type === "changelog") {
1759
1710
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
1760
1711
  } 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
1712
  node = sectionNode(
1766
1713
  ctx,
1767
1714
  s,
1768
- buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1715
+ buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1769
1716
  scopePrefix
1770
1717
  );
1771
1718
  }
@@ -1786,9 +1733,8 @@ function computeSiblingSortBoundaries(ordered) {
1786
1733
  rootSections.push(s);
1787
1734
  continue;
1788
1735
  }
1789
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1790
1736
  const parent = parentSectionPath(sec);
1791
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1737
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1792
1738
  if (isRootLevel) {
1793
1739
  rootSections.push(s);
1794
1740
  }
@@ -1825,14 +1771,6 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1825
1771
  if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1826
1772
  continue;
1827
1773
  }
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
1774
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
1837
1775
  continue;
1838
1776
  }
@@ -1853,10 +1791,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1853
1791
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1854
1792
  continue;
1855
1793
  }
1856
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1857
1794
  const parent = parentSectionPath(sec);
1858
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1859
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1795
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1796
+ if (isRootLevel && hasRootSection && sec !== "") {
1860
1797
  continue;
1861
1798
  }
1862
1799
  if (isRootLevel) {
@@ -1908,6 +1845,10 @@ function groupSidebarRootChildren(ctx, children) {
1908
1845
  } else if (child.type === "section" && !child.collapsible) {
1909
1846
  flushRun();
1910
1847
  out.push(child);
1848
+ } else if (child.type === "changelog") {
1849
+ flushRun();
1850
+ run.push(child);
1851
+ flushRun();
1911
1852
  } else {
1912
1853
  run.push(child);
1913
1854
  }
@@ -2022,7 +1963,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
2022
1963
  const variantIndividualSlug = detailSlug(variant);
2023
1964
  const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
2024
1965
  const metaPointsTo = metaStr(variant.metadata, "pointsTo");
2025
- const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
1966
+ const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
2026
1967
  return {
2027
1968
  type: "variant",
2028
1969
  ...withMetadataDefaults({
@@ -2424,7 +2365,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2424
2365
  };
2425
2366
  return node;
2426
2367
  });
2427
- markCrossProductCanonicalSlugs(children);
2428
2368
  return {
2429
2369
  type: "productgroup",
2430
2370
  id: ctx.nodeId("productgroup"),
@@ -2436,32 +2376,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2436
2376
  children
2437
2377
  };
2438
2378
  }
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
2379
  // Annotate the CommonJS export names for ESM import in node:
2466
2380
  0 && (module.exports = {
2467
2381
  apiLeafNodeFromNavRoute,