@fern-api/fdr-sdk 1.2.39-adc66218ce → 1.2.39-afedd1fee5
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 +1 -0
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +1 -0
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/converters/index.js +1 -6
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +1 -6
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +2 -6
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +2 -6
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +1 -6
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +1 -6
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +126 -17
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +126 -17
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/orpc-client.js +1 -0
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +1 -0
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.collapsedDeterminism.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.collapsedDeterminism.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.metadataPreservation.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.metadataPreservation.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.rootSlug.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.rootSlug.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.variantSharedSegments.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.variantSharedSegments.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts +12 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/navigation/utils/findNode.d.ts.map +1 -1
- package/dist/types/navigation/utils/followRedirect.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +50 -0
- package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts +12 -0
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1248,12 +1248,10 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1248
1248
|
return {
|
|
1249
1249
|
type: "section",
|
|
1250
1250
|
...defaults,
|
|
1251
|
-
|
|
1252
|
-
// so getInitiallyOpenByDefaultNodes picks it up and the UI starts open.
|
|
1253
|
-
collapsed: metaCollapsed(seg.metadata) === false ? "open-by-default" : metaCollapsed(seg.metadata) ?? defaults.collapsed,
|
|
1251
|
+
collapsed: metaCollapsed(seg.metadata) ?? defaults.collapsed,
|
|
1254
1252
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1255
1253
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1256
|
-
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata)
|
|
1254
|
+
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1257
1255
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1258
1256
|
availability: metaStr(seg.metadata, "availability"),
|
|
1259
1257
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1480,7 +1478,7 @@ function changelogNode(ctx, scoped, scopePrefix) {
|
|
|
1480
1478
|
pageId: PageId(metaStr(r.metadata, "pageId") ?? ""),
|
|
1481
1479
|
noindex: metaBool(r.metadata, "noindex"),
|
|
1482
1480
|
date: dateStr ?? "",
|
|
1483
|
-
tags:
|
|
1481
|
+
tags: metaStrArr(r.metadata, "tags")
|
|
1484
1482
|
};
|
|
1485
1483
|
let months = byYear.get(year);
|
|
1486
1484
|
if (months == null) {
|
|
@@ -1587,11 +1585,46 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1587
1585
|
return { node, childIndex };
|
|
1588
1586
|
});
|
|
1589
1587
|
}
|
|
1588
|
+
function computeSiblingSortBoundaries(ordered) {
|
|
1589
|
+
const result = /* @__PURE__ */ new Map();
|
|
1590
|
+
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1591
|
+
const rootSections = [];
|
|
1592
|
+
for (const s of ordered) {
|
|
1593
|
+
const type = metaStr(s.seg.metadata, "type");
|
|
1594
|
+
const sec = s.seg.section;
|
|
1595
|
+
if (type !== "section" || sec === "") {
|
|
1596
|
+
continue;
|
|
1597
|
+
}
|
|
1598
|
+
const parent = parentSectionPath(sec);
|
|
1599
|
+
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1600
|
+
if (isRootLevel) {
|
|
1601
|
+
rootSections.push(s);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
1605
|
+
for (const s of rootSections) {
|
|
1606
|
+
const group = byPath.get(s.seg.section) ?? [];
|
|
1607
|
+
group.push(s);
|
|
1608
|
+
byPath.set(s.seg.section, group);
|
|
1609
|
+
}
|
|
1610
|
+
for (const [, siblings] of byPath) {
|
|
1611
|
+
if (siblings.length <= 1) {
|
|
1612
|
+
continue;
|
|
1613
|
+
}
|
|
1614
|
+
for (let i = 0; i < siblings.length; i++) {
|
|
1615
|
+
const lo = siblings[i].seg.sortOrder;
|
|
1616
|
+
const hi = i + 1 < siblings.length ? siblings[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER;
|
|
1617
|
+
result.set(siblings[i], { lo, hi });
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
return result;
|
|
1621
|
+
}
|
|
1590
1622
|
function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePrefix) {
|
|
1591
1623
|
const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1592
1624
|
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1593
1625
|
const annotated = [];
|
|
1594
1626
|
const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
|
|
1627
|
+
const siblingBoundaries = computeSiblingSortBoundaries(ordered);
|
|
1595
1628
|
for (const s of ordered) {
|
|
1596
1629
|
const type = metaStr(s.seg.metadata, "type");
|
|
1597
1630
|
const sec = s.seg.section;
|
|
@@ -1628,14 +1661,21 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1628
1661
|
} else if (type === "changelog") {
|
|
1629
1662
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1630
1663
|
} else {
|
|
1664
|
+
const bounds = siblingBoundaries.get(s);
|
|
1665
|
+
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1631
1666
|
node = sectionNode(
|
|
1632
1667
|
ctx,
|
|
1633
1668
|
s,
|
|
1634
|
-
buildSectionTree(ctx,
|
|
1669
|
+
buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
|
|
1635
1670
|
scopePrefix
|
|
1636
1671
|
);
|
|
1637
1672
|
}
|
|
1638
|
-
|
|
1673
|
+
const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
|
|
1674
|
+
annotated.push({
|
|
1675
|
+
node,
|
|
1676
|
+
pos: isSharedSection ? void 0 : metaNum(s.seg.metadata, "childIndex"),
|
|
1677
|
+
isLeaf: false
|
|
1678
|
+
});
|
|
1639
1679
|
}
|
|
1640
1680
|
}
|
|
1641
1681
|
const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
|
|
@@ -1687,13 +1727,13 @@ function buildSidebarRoot(ctx, scopeSegs, scopePrefix, changelogScopePrefix) {
|
|
|
1687
1727
|
};
|
|
1688
1728
|
}
|
|
1689
1729
|
function buildFullRootFromSegments(options) {
|
|
1690
|
-
const { basePath, title, segments, navBySegment } = options;
|
|
1730
|
+
const { basePath, rootSlug: sourceRootSlug, title, segments, navBySegment, skipSharedSectionMerge } = options;
|
|
1691
1731
|
const ctx = createBuildContext(basePath);
|
|
1692
1732
|
const scoped = segments.filter((seg) => {
|
|
1693
1733
|
const t = metaStr(seg.metadata, "type");
|
|
1694
1734
|
return t !== "files" && t !== "redirects";
|
|
1695
1735
|
}).map((seg) => ({ seg, nav: navBySegment.get(seg.segmentHash) ?? [] }));
|
|
1696
|
-
const rootSlug = asSlug(basePath);
|
|
1736
|
+
const rootSlug = asSlug(sourceRootSlug ?? basePath);
|
|
1697
1737
|
const scopesByKey = /* @__PURE__ */ new Map();
|
|
1698
1738
|
for (const s of scoped) {
|
|
1699
1739
|
const key = scopeKey(s.seg);
|
|
@@ -1706,9 +1746,9 @@ function buildFullRootFromSegments(options) {
|
|
|
1706
1746
|
const tabs = uniqueDetails(scoped, "tab");
|
|
1707
1747
|
let child;
|
|
1708
1748
|
if (products.length > 0) {
|
|
1709
|
-
child = buildProductGroup(ctx, products, scoped, rootSlug);
|
|
1749
|
+
child = buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMerge);
|
|
1710
1750
|
} else if (versions.length > 0) {
|
|
1711
|
-
child = buildVersioned(ctx, versions, scoped, rootSlug, void 0);
|
|
1751
|
+
child = buildVersioned(ctx, versions, scoped, rootSlug, void 0, skipSharedSectionMerge);
|
|
1712
1752
|
} else {
|
|
1713
1753
|
child = buildUnversioned(ctx, scoped, rootSlug, tabs.length > 0);
|
|
1714
1754
|
}
|
|
@@ -1815,20 +1855,34 @@ function buildSidebarRootWithVariants(ctx, scopeSegs, scopePrefix, changelogScop
|
|
|
1815
1855
|
if (variants.length <= 1) {
|
|
1816
1856
|
return buildSidebarRoot(ctx, scopeSegs, scopePrefix, changelogScopePrefix);
|
|
1817
1857
|
}
|
|
1858
|
+
const sharedSegs = scopeSegs.filter((s) => s.seg.variant == null);
|
|
1818
1859
|
const variantedNode = buildVariantedNode(ctx, variants, scopeSegs, scopePrefix);
|
|
1860
|
+
const sharedChildren = sharedSegs.length > 0 ? buildSidebarRootChildren(ctx, sharedSegs, scopePrefix, changelogScopePrefix) : [];
|
|
1819
1861
|
const first = scopeSegs[0];
|
|
1820
1862
|
return {
|
|
1821
1863
|
type: "sidebarRoot",
|
|
1822
1864
|
id: ctx.nodeId(`sidebar:${first != null ? scopeKey(first.seg) : "root"}`),
|
|
1823
1865
|
collapsed: void 0,
|
|
1824
|
-
children: [variantedNode]
|
|
1866
|
+
children: [...sharedChildren, variantedNode]
|
|
1825
1867
|
};
|
|
1826
1868
|
}
|
|
1827
1869
|
function buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent, scopePrefix) {
|
|
1828
1870
|
if (!tabsPresent) {
|
|
1829
1871
|
const variants = uniqueDetails(scopeSegs, "variant");
|
|
1830
1872
|
if (variants.length > 1) {
|
|
1831
|
-
|
|
1873
|
+
const sharedSegs = scopeSegs.filter((s) => s.seg.variant == null);
|
|
1874
|
+
const variantedNode = buildVariantedNode(ctx, variants, scopeSegs, scopePrefix);
|
|
1875
|
+
if (sharedSegs.length > 0) {
|
|
1876
|
+
const sharedChildren = buildSidebarRootChildren(ctx, sharedSegs, scopePrefix);
|
|
1877
|
+
const first2 = scopeSegs[0];
|
|
1878
|
+
return {
|
|
1879
|
+
type: "sidebarRoot",
|
|
1880
|
+
id: ctx.nodeId(`sidebar:${first2 != null ? scopeKey(first2.seg) : "root"}`),
|
|
1881
|
+
collapsed: void 0,
|
|
1882
|
+
children: [...sharedChildren, variantedNode]
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
return variantedNode;
|
|
1832
1886
|
}
|
|
1833
1887
|
return buildSidebarRoot(ctx, scopeSegs, scopePrefix);
|
|
1834
1888
|
}
|
|
@@ -1915,9 +1969,64 @@ function buildUnversioned(ctx, scopeSegs, scopePrefix, tabsPresent) {
|
|
|
1915
1969
|
child: buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent, scopePrefix)
|
|
1916
1970
|
};
|
|
1917
1971
|
}
|
|
1918
|
-
function
|
|
1972
|
+
function mergeSharedSections(defaultSegs, allScoped, defaultVersion, versionSlugs) {
|
|
1973
|
+
const defaultTabsByName = /* @__PURE__ */ new Map();
|
|
1974
|
+
for (const s of defaultSegs) {
|
|
1975
|
+
if (s.seg.tab != null) {
|
|
1976
|
+
const tabName = s.seg.tab.displayName;
|
|
1977
|
+
if (!defaultTabsByName.has(tabName)) {
|
|
1978
|
+
defaultTabsByName.set(tabName, s.seg.tab);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
const existingSections = new Set(
|
|
1983
|
+
defaultSegs.filter((s) => metaStr(s.seg.metadata, "type") === "section").map((s) => s.seg.section)
|
|
1984
|
+
);
|
|
1985
|
+
const maxSortOrder = defaultSegs.reduce((max, s) => Math.max(max, s.seg.sortOrder), 0);
|
|
1986
|
+
let nextSortOrder = maxSortOrder + 1;
|
|
1987
|
+
const merged = [...defaultSegs];
|
|
1988
|
+
for (const s of allScoped) {
|
|
1989
|
+
if (s.seg.version?.id === defaultVersion.id) {
|
|
1990
|
+
continue;
|
|
1991
|
+
}
|
|
1992
|
+
const type = metaStr(s.seg.metadata, "type");
|
|
1993
|
+
if (type !== "section") {
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
const sectionPath = s.seg.section;
|
|
1997
|
+
if (versionSlugs.some((vs) => sectionPath === vs || sectionPath.startsWith(vs + "/"))) {
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
if (existingSections.has(sectionPath)) {
|
|
2001
|
+
continue;
|
|
2002
|
+
}
|
|
2003
|
+
const sourceTabName = s.seg.tab?.displayName ?? "";
|
|
2004
|
+
const targetTab = defaultTabsByName.get(sourceTabName);
|
|
2005
|
+
if (targetTab == null) {
|
|
2006
|
+
continue;
|
|
2007
|
+
}
|
|
2008
|
+
const metadata = s.seg.metadata != null ? { ...s.seg.metadata, childIndex: void 0 } : s.seg.metadata;
|
|
2009
|
+
merged.push({
|
|
2010
|
+
seg: {
|
|
2011
|
+
...s.seg,
|
|
2012
|
+
tab: targetTab,
|
|
2013
|
+
version: defaultVersion,
|
|
2014
|
+
sortOrder: nextSortOrder++,
|
|
2015
|
+
metadata
|
|
2016
|
+
},
|
|
2017
|
+
nav: s.nav
|
|
2018
|
+
});
|
|
2019
|
+
existingSections.add(sectionPath);
|
|
2020
|
+
}
|
|
2021
|
+
return merged;
|
|
2022
|
+
}
|
|
2023
|
+
function buildVersioned(ctx, versions, scoped, rootSlug, productPrefix, skipSharedSectionMerge) {
|
|
2024
|
+
const versionSlugs = versions.map((v) => detailSlug(v)).filter((s) => s !== "");
|
|
1919
2025
|
const children = versions.map((version) => {
|
|
1920
|
-
|
|
2026
|
+
let versionSegs = scoped.filter((s) => s.seg.version?.id === version.id);
|
|
2027
|
+
if (detailIsDefault(version) && !skipSharedSectionMerge) {
|
|
2028
|
+
versionSegs = mergeSharedSections(versionSegs, scoped, version, versionSlugs);
|
|
2029
|
+
}
|
|
1921
2030
|
const tabsPresent = uniqueDetails(versionSegs, "tab").length > 0;
|
|
1922
2031
|
const prefix = productPrefix != null ? productPrefix : rootSlug;
|
|
1923
2032
|
const versionSegment = detailSlug(version);
|
|
@@ -2085,13 +2194,13 @@ function markCrossVersionCanonicalSlugs(versionNodes) {
|
|
|
2085
2194
|
});
|
|
2086
2195
|
}
|
|
2087
2196
|
}
|
|
2088
|
-
function buildProductGroup(ctx, products, scoped, rootSlug) {
|
|
2197
|
+
function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMerge) {
|
|
2089
2198
|
const children = products.map((product) => {
|
|
2090
2199
|
const productSegs = scoped.filter((s) => s.seg.product?.id === product.id);
|
|
2091
2200
|
const versions = uniqueDetails(productSegs, "version");
|
|
2092
2201
|
const tabsPresent = uniqueDetails(productSegs, "tab").length > 0;
|
|
2093
2202
|
const productPrefix = scopeSlugPrefix(rootSlug, product);
|
|
2094
|
-
const productChild = versions.length > 0 ? buildVersioned(ctx, versions, productSegs, rootSlug, productPrefix) : buildUnversioned(ctx, productSegs, asSlug(productPrefix), tabsPresent);
|
|
2203
|
+
const productChild = versions.length > 0 ? buildVersioned(ctx, versions, productSegs, rootSlug, productPrefix, skipSharedSectionMerge) : buildUnversioned(ctx, productSegs, asSlug(productPrefix), tabsPresent);
|
|
2095
2204
|
const node = {
|
|
2096
2205
|
type: "product",
|
|
2097
2206
|
...withMetadataDefaults({
|