@fern-api/fdr-sdk 1.2.42-1fb0ba4870 → 1.2.42-304ea6b285
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.
- package/dist/js/navigation/ledger-root-builder.js +43 -11
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +43 -11
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +306 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +46 -12
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1259,6 +1259,30 @@ function stripLeadingScopePrefix(section, scopePrefix) {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
return section;
|
|
1261
1261
|
}
|
|
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
|
+
}
|
|
1262
1286
|
function mergeChildrenByPosition(ctx, nav, sectionChildren) {
|
|
1263
1287
|
const leafNodes = [];
|
|
1264
1288
|
for (let i = 0; i < nav.length; i++) {
|
|
@@ -1313,12 +1337,15 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1313
1337
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1314
1338
|
};
|
|
1315
1339
|
}
|
|
1316
|
-
function directChildApiPackages(parentSection, scopeSegs) {
|
|
1340
|
+
function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
1317
1341
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1318
1342
|
return scopeSegs.filter((s) => {
|
|
1319
1343
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
1320
1344
|
return false;
|
|
1321
1345
|
}
|
|
1346
|
+
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
1347
|
+
return false;
|
|
1348
|
+
}
|
|
1322
1349
|
const parent = parentSectionPath(s.seg.section);
|
|
1323
1350
|
if (parent === parentSection) {
|
|
1324
1351
|
return true;
|
|
@@ -1332,7 +1359,7 @@ function directChildApiPackages(parentSection, scopeSegs) {
|
|
|
1332
1359
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1333
1360
|
const { seg, nav } = scoped;
|
|
1334
1361
|
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1335
|
-
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1362
|
+
const childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
|
|
1336
1363
|
const packageNodes = childPackages.map((child) => ({
|
|
1337
1364
|
node: apiPackageChildNode(
|
|
1338
1365
|
ctx,
|
|
@@ -1473,7 +1500,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1473
1500
|
availability: metaAvailability(seg.metadata),
|
|
1474
1501
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1475
1502
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1476
|
-
paginated:
|
|
1503
|
+
paginated: metaBool(seg.metadata, "paginated"),
|
|
1477
1504
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
1478
1505
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
1479
1506
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1491,7 +1518,10 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
1491
1518
|
}
|
|
1492
1519
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1493
1520
|
});
|
|
1494
|
-
const
|
|
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);
|
|
1495
1525
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
|
|
1496
1526
|
}
|
|
1497
1527
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -1499,12 +1529,13 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1499
1529
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
1500
1530
|
return false;
|
|
1501
1531
|
}
|
|
1502
|
-
|
|
1532
|
+
const candidates = scopeSegs.filter((candidate) => {
|
|
1503
1533
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
1504
1534
|
return false;
|
|
1505
1535
|
}
|
|
1506
1536
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1507
1537
|
});
|
|
1538
|
+
return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
|
|
1508
1539
|
}
|
|
1509
1540
|
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1510
1541
|
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
@@ -1659,6 +1690,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1659
1690
|
}
|
|
1660
1691
|
return false;
|
|
1661
1692
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1693
|
+
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1662
1694
|
return direct.map((s) => {
|
|
1663
1695
|
const type = metaStr(s.seg.metadata, "type");
|
|
1664
1696
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1668,10 +1700,14 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1668
1700
|
} else if (type === "changelog") {
|
|
1669
1701
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1670
1702
|
} else {
|
|
1703
|
+
const boundary = siblingBoundaries.get(s);
|
|
1704
|
+
const childScopeSegs = boundary != null ? scopeSegs.filter(
|
|
1705
|
+
(candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
|
|
1706
|
+
) : scopeSegs;
|
|
1671
1707
|
node = sectionNode(
|
|
1672
1708
|
ctx,
|
|
1673
1709
|
s,
|
|
1674
|
-
buildSectionTree(ctx,
|
|
1710
|
+
buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
|
|
1675
1711
|
scopePrefix
|
|
1676
1712
|
);
|
|
1677
1713
|
}
|
|
@@ -1804,10 +1840,6 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1804
1840
|
} else if (child.type === "section" && !child.collapsible) {
|
|
1805
1841
|
flushRun();
|
|
1806
1842
|
out.push(child);
|
|
1807
|
-
} else if (child.type === "changelog") {
|
|
1808
|
-
flushRun();
|
|
1809
|
-
run.push(child);
|
|
1810
|
-
flushRun();
|
|
1811
1843
|
} else {
|
|
1812
1844
|
run.push(child);
|
|
1813
1845
|
}
|
|
@@ -1922,7 +1954,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1922
1954
|
const variantIndividualSlug = detailSlug(variant);
|
|
1923
1955
|
const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
|
|
1924
1956
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1925
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
1957
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
|
|
1926
1958
|
return {
|
|
1927
1959
|
type: "variant",
|
|
1928
1960
|
...withMetadataDefaults({
|