@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.
- package/dist/js/client/FdrClient.js +0 -1
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +0 -1
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/index.js +0 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +0 -1
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +14 -100
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +14 -100
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/orpc-client.js +0 -1
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +0 -1
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +1 -105
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -1
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +23 -153
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.d.ts +0 -9
- package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.js +0 -1
- package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +0 -9
- package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js +0 -234
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js.map +0 -1
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
- package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
- package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
|
@@ -1259,30 +1259,6 @@ 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
|
-
}
|
|
1286
1262
|
function mergeChildrenByPosition(ctx, nav, sectionChildren) {
|
|
1287
1263
|
const leafNodes = [];
|
|
1288
1264
|
for (let i = 0; i < nav.length; i++) {
|
|
@@ -1337,15 +1313,12 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1337
1313
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1338
1314
|
};
|
|
1339
1315
|
}
|
|
1340
|
-
function directChildApiPackages(parentSection, scopeSegs
|
|
1316
|
+
function directChildApiPackages(parentSection, scopeSegs) {
|
|
1341
1317
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1342
1318
|
return scopeSegs.filter((s) => {
|
|
1343
1319
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
1344
1320
|
return false;
|
|
1345
1321
|
}
|
|
1346
|
-
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
1347
|
-
return false;
|
|
1348
|
-
}
|
|
1349
1322
|
const parent = parentSectionPath(s.seg.section);
|
|
1350
1323
|
if (parent === parentSection) {
|
|
1351
1324
|
return true;
|
|
@@ -1359,17 +1332,7 @@ function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
|
1359
1332
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1360
1333
|
const { seg, nav } = scoped;
|
|
1361
1334
|
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1362
|
-
|
|
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
|
-
}
|
|
1335
|
+
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1373
1336
|
const packageNodes = childPackages.map((child) => ({
|
|
1374
1337
|
node: apiPackageChildNode(
|
|
1375
1338
|
ctx,
|
|
@@ -1380,9 +1343,6 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
|
|
|
1380
1343
|
),
|
|
1381
1344
|
childIndex: metaNum(child.seg.metadata, "childIndex")
|
|
1382
1345
|
}));
|
|
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
1346
|
const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
|
|
1387
1347
|
if (!hasChildIndex) {
|
|
1388
1348
|
return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
|
|
@@ -1513,7 +1473,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1513
1473
|
availability: metaAvailability(seg.metadata),
|
|
1514
1474
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1515
1475
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1516
|
-
paginated:
|
|
1476
|
+
paginated: true,
|
|
1517
1477
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
1518
1478
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
1519
1479
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1531,10 +1491,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
1531
1491
|
}
|
|
1532
1492
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1533
1493
|
});
|
|
1534
|
-
const
|
|
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);
|
|
1494
|
+
const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? candidates[0];
|
|
1538
1495
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
|
|
1539
1496
|
}
|
|
1540
1497
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -1542,13 +1499,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1542
1499
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
1543
1500
|
return false;
|
|
1544
1501
|
}
|
|
1545
|
-
|
|
1502
|
+
return scopeSegs.some((candidate) => {
|
|
1546
1503
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
1547
1504
|
return false;
|
|
1548
1505
|
}
|
|
1549
1506
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1550
1507
|
});
|
|
1551
|
-
return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
|
|
1552
1508
|
}
|
|
1553
1509
|
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1554
1510
|
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
@@ -1694,10 +1650,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1694
1650
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1695
1651
|
return false;
|
|
1696
1652
|
}
|
|
1697
|
-
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1698
|
-
if (depth === 0) {
|
|
1699
|
-
return false;
|
|
1700
|
-
}
|
|
1701
1653
|
const parent = parentSectionPath(sec);
|
|
1702
1654
|
if (parent === parentPath) {
|
|
1703
1655
|
return true;
|
|
@@ -1707,7 +1659,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1707
1659
|
}
|
|
1708
1660
|
return false;
|
|
1709
1661
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1710
|
-
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1711
1662
|
return direct.map((s) => {
|
|
1712
1663
|
const type = metaStr(s.seg.metadata, "type");
|
|
1713
1664
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1717,14 +1668,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1717
1668
|
} else if (type === "changelog") {
|
|
1718
1669
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1719
1670
|
} 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
1671
|
node = sectionNode(
|
|
1725
1672
|
ctx,
|
|
1726
1673
|
s,
|
|
1727
|
-
buildSectionTree(ctx,
|
|
1674
|
+
buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
|
|
1728
1675
|
scopePrefix
|
|
1729
1676
|
);
|
|
1730
1677
|
}
|
|
@@ -1745,9 +1692,8 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1745
1692
|
rootSections.push(s);
|
|
1746
1693
|
continue;
|
|
1747
1694
|
}
|
|
1748
|
-
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1749
1695
|
const parent = parentSectionPath(sec);
|
|
1750
|
-
const isRootLevel =
|
|
1696
|
+
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1751
1697
|
if (isRootLevel) {
|
|
1752
1698
|
rootSections.push(s);
|
|
1753
1699
|
}
|
|
@@ -1784,14 +1730,6 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1784
1730
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1785
1731
|
continue;
|
|
1786
1732
|
}
|
|
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
1733
|
if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
|
|
1796
1734
|
continue;
|
|
1797
1735
|
}
|
|
@@ -1812,10 +1750,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1812
1750
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1813
1751
|
continue;
|
|
1814
1752
|
}
|
|
1815
|
-
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1816
1753
|
const parent = parentSectionPath(sec);
|
|
1817
|
-
const isRootLevel =
|
|
1818
|
-
if (isRootLevel && hasRootSection && sec !== ""
|
|
1754
|
+
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1755
|
+
if (isRootLevel && hasRootSection && sec !== "") {
|
|
1819
1756
|
continue;
|
|
1820
1757
|
}
|
|
1821
1758
|
if (isRootLevel) {
|
|
@@ -1867,6 +1804,10 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1867
1804
|
} else if (child.type === "section" && !child.collapsible) {
|
|
1868
1805
|
flushRun();
|
|
1869
1806
|
out.push(child);
|
|
1807
|
+
} else if (child.type === "changelog") {
|
|
1808
|
+
flushRun();
|
|
1809
|
+
run.push(child);
|
|
1810
|
+
flushRun();
|
|
1870
1811
|
} else {
|
|
1871
1812
|
run.push(child);
|
|
1872
1813
|
}
|
|
@@ -1981,7 +1922,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1981
1922
|
const variantIndividualSlug = detailSlug(variant);
|
|
1982
1923
|
const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
|
|
1983
1924
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1984
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
1925
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
|
|
1985
1926
|
return {
|
|
1986
1927
|
type: "variant",
|
|
1987
1928
|
...withMetadataDefaults({
|
|
@@ -2383,7 +2324,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2383
2324
|
};
|
|
2384
2325
|
return node;
|
|
2385
2326
|
});
|
|
2386
|
-
markCrossProductCanonicalSlugs(children);
|
|
2387
2327
|
return {
|
|
2388
2328
|
type: "productgroup",
|
|
2389
2329
|
id: ctx.nodeId("productgroup"),
|
|
@@ -2395,32 +2335,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2395
2335
|
children
|
|
2396
2336
|
};
|
|
2397
2337
|
}
|
|
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
2338
|
export {
|
|
2425
2339
|
apiLeafNodeFromNavRoute,
|
|
2426
2340
|
buildFullRootFromSegments,
|