@fern-api/fdr-sdk 1.2.39-4f09cc17dc → 1.2.39-adc66218ce
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 +110 -46
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +110 -46
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.apiReferenceChildren.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.apiReferenceChildren.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.landingPage.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.landingPage.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugTabs.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugTabs.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1123,6 +1123,63 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
return void 0;
|
|
1125
1125
|
}
|
|
1126
|
+
function apiLeafPositionKey(node) {
|
|
1127
|
+
switch (node.type) {
|
|
1128
|
+
case "endpoint":
|
|
1129
|
+
return `endpoint:${node.endpointId}`;
|
|
1130
|
+
case "webhook":
|
|
1131
|
+
return `webhook:${node.webhookId}`;
|
|
1132
|
+
case "webSocket":
|
|
1133
|
+
return `webSocket:${node.webSocketId}`;
|
|
1134
|
+
case "grpc":
|
|
1135
|
+
return `grpc:${node.grpcId}`;
|
|
1136
|
+
case "graphql":
|
|
1137
|
+
return `graphql:${node.graphqlOperationId}`;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
function apiChildPositionKey(node) {
|
|
1141
|
+
switch (node.type) {
|
|
1142
|
+
case "endpoint":
|
|
1143
|
+
case "webhook":
|
|
1144
|
+
case "webSocket":
|
|
1145
|
+
case "grpc":
|
|
1146
|
+
case "graphql":
|
|
1147
|
+
return apiLeafPositionKey(node);
|
|
1148
|
+
default:
|
|
1149
|
+
return void 0;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
function positionedApiLeafChildren(ctx, nav, apiDefinitionId) {
|
|
1153
|
+
const rawLeafNodes = [];
|
|
1154
|
+
const leafPositions = /* @__PURE__ */ new Map();
|
|
1155
|
+
const nonApiLeafNodes = [];
|
|
1156
|
+
for (let i = 0; i < nav.length; i++) {
|
|
1157
|
+
const route = nav[i];
|
|
1158
|
+
const pos = route.displaySortOrder ?? i;
|
|
1159
|
+
const apiLeaf = apiLeafNodeFromNavRouteInternal(ctx, route, apiDefinitionId);
|
|
1160
|
+
if (apiLeaf != null) {
|
|
1161
|
+
rawLeafNodes.push(apiLeaf);
|
|
1162
|
+
const key = apiLeafPositionKey(apiLeaf);
|
|
1163
|
+
leafPositions.set(key, Math.min(leafPositions.get(key) ?? pos, pos));
|
|
1164
|
+
continue;
|
|
1165
|
+
}
|
|
1166
|
+
const node = artifactToNode(ctx, route);
|
|
1167
|
+
if (node?.type === "page" || node?.type === "link") {
|
|
1168
|
+
nonApiLeafNodes.push({ node, pos });
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
const apiLeafNodes = mergeEndpointPairs(ctx, rawLeafNodes, nav);
|
|
1172
|
+
const positionedApiLeafNodes = apiLeafNodes.map((node, index) => {
|
|
1173
|
+
if (node.type === "endpointPair") {
|
|
1174
|
+
const streamPos = leafPositions.get(apiLeafPositionKey(node.stream)) ?? index;
|
|
1175
|
+
const nonStreamPos = leafPositions.get(apiLeafPositionKey(node.nonStream)) ?? index;
|
|
1176
|
+
return { node, pos: Math.min(streamPos, nonStreamPos) };
|
|
1177
|
+
}
|
|
1178
|
+
const key = apiChildPositionKey(node);
|
|
1179
|
+
return { node, pos: key != null ? leafPositions.get(key) ?? index : index };
|
|
1180
|
+
});
|
|
1181
|
+
return [...positionedApiLeafNodes, ...nonApiLeafNodes];
|
|
1182
|
+
}
|
|
1126
1183
|
function collectApiLeafNodesFromNav(routes, basePath, segmentApiDefinitionId2) {
|
|
1127
1184
|
const ctx = createBuildContext(basePath);
|
|
1128
1185
|
return routes.map((route) => apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2)).filter((node) => node != null);
|
|
@@ -1232,7 +1289,9 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1232
1289
|
return {
|
|
1233
1290
|
type: "section",
|
|
1234
1291
|
...defaults,
|
|
1235
|
-
collapsed:
|
|
1292
|
+
// V2 convention: collapsed:false in docs.yml maps to "open-by-default"
|
|
1293
|
+
// so getInitiallyOpenByDefaultNodes picks it up and the UI starts open.
|
|
1294
|
+
collapsed: metaCollapsed(seg.metadata) === false ? "open-by-default" : metaCollapsed(seg.metadata) ?? defaults.collapsed,
|
|
1236
1295
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1237
1296
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1238
1297
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) != null ? true : void 0),
|
|
@@ -1260,8 +1319,7 @@ function directChildApiPackages(parentSection, scopeSegs) {
|
|
|
1260
1319
|
}
|
|
1261
1320
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1262
1321
|
const { seg, nav } = scoped;
|
|
1263
|
-
const
|
|
1264
|
-
const leafNodes = mergeEndpointPairs(ctx, rawLeafNodes, nav);
|
|
1322
|
+
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1265
1323
|
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1266
1324
|
const packageNodes = childPackages.map((child) => ({
|
|
1267
1325
|
node: apiPackageChildNode(
|
|
@@ -1275,18 +1333,10 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
|
|
|
1275
1333
|
}));
|
|
1276
1334
|
const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
|
|
1277
1335
|
if (!hasChildIndex) {
|
|
1278
|
-
return [...leafNodes, ...packageNodes.map((p) => p.node)];
|
|
1279
|
-
}
|
|
1280
|
-
const leafPositions = [];
|
|
1281
|
-
for (const route of nav) {
|
|
1282
|
-
if (route.displaySortOrder != null) {
|
|
1283
|
-
leafPositions.push(route.displaySortOrder);
|
|
1284
|
-
}
|
|
1336
|
+
return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
|
|
1285
1337
|
}
|
|
1286
1338
|
const positioned = [];
|
|
1287
|
-
|
|
1288
|
-
positioned.push({ node: leafNodes[i], pos: leafPositions[i] ?? i });
|
|
1289
|
-
}
|
|
1339
|
+
positioned.push(...leafNodes);
|
|
1290
1340
|
for (const p of packageNodes) {
|
|
1291
1341
|
positioned.push({ node: p.node, pos: p.childIndex ?? Number.MAX_SAFE_INTEGER });
|
|
1292
1342
|
}
|
|
@@ -1589,6 +1639,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1589
1639
|
if (hasOwningApiReference(s, scopeSegs)) {
|
|
1590
1640
|
continue;
|
|
1591
1641
|
}
|
|
1642
|
+
if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
|
|
1643
|
+
continue;
|
|
1644
|
+
}
|
|
1592
1645
|
if (type === "tabRoot" || sec === "" && type !== "section") {
|
|
1593
1646
|
for (const r of s.nav) {
|
|
1594
1647
|
const node = artifactToNode(ctx, r);
|
|
@@ -1737,21 +1790,22 @@ function buildFullRootFromSegments(options) {
|
|
|
1737
1790
|
return root;
|
|
1738
1791
|
}
|
|
1739
1792
|
function uniqueDetails(scoped, dim) {
|
|
1740
|
-
const
|
|
1793
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
1741
1794
|
for (const s of scoped) {
|
|
1742
1795
|
const d = s.seg[dim];
|
|
1743
1796
|
if (d == null) {
|
|
1744
1797
|
continue;
|
|
1745
1798
|
}
|
|
1746
1799
|
const slug = detailSlug(d);
|
|
1747
|
-
const
|
|
1800
|
+
const key = dim === "tab" ? d.id : slug !== "" ? slug : d.id;
|
|
1801
|
+
const existing = byKey.get(key);
|
|
1748
1802
|
if (existing == null) {
|
|
1749
|
-
|
|
1803
|
+
byKey.set(key, d);
|
|
1750
1804
|
} else if (metaStr(d.metadata, "pointsTo") != null && metaStr(existing.metadata, "pointsTo") == null) {
|
|
1751
|
-
|
|
1805
|
+
byKey.set(key, d);
|
|
1752
1806
|
}
|
|
1753
1807
|
}
|
|
1754
|
-
return [...
|
|
1808
|
+
return [...byKey.values()].sort((a, b) => a.sortOrder - b.sortOrder);
|
|
1755
1809
|
}
|
|
1756
1810
|
function scopeSlugPrefix(rootSlug, ...details) {
|
|
1757
1811
|
const parts = [rootSlug];
|
|
@@ -1895,7 +1949,7 @@ function buildUnversioned(ctx, scopeSegs, scopePrefix, tabsPresent) {
|
|
|
1895
1949
|
type: "unversioned",
|
|
1896
1950
|
id: ctx.nodeId(`unversioned:${first?.seg.product?.id ?? "root"}`),
|
|
1897
1951
|
collapsed: void 0,
|
|
1898
|
-
landingPage:
|
|
1952
|
+
landingPage: buildLandingPage(ctx, scopeSegs),
|
|
1899
1953
|
// The enclosing scope prefix (product slug, or rootSlug at the top
|
|
1900
1954
|
// level) roots structural sections so they share the scope's slug
|
|
1901
1955
|
// namespace.
|
|
@@ -1922,7 +1976,7 @@ function buildVersioned(ctx, versions, scoped, rootSlug, productPrefix) {
|
|
|
1922
1976
|
default: detailIsDefault(version),
|
|
1923
1977
|
versionId: VersionId(version.id),
|
|
1924
1978
|
availability: void 0,
|
|
1925
|
-
landingPage:
|
|
1979
|
+
landingPage: buildLandingPage(ctx, versionSegs),
|
|
1926
1980
|
announcement: void 0,
|
|
1927
1981
|
pointsTo: metaStr(version.metadata, "pointsTo") != null ? pointsToSlug(metaStr(version.metadata, "pointsTo")) : void 0,
|
|
1928
1982
|
// The version's full slug roots structural sections so the whole
|
|
@@ -2003,34 +2057,41 @@ function crossVersionDedupKeys(node, parents) {
|
|
|
2003
2057
|
keys.push([...parentTitles, node.title].join("###"));
|
|
2004
2058
|
return keys;
|
|
2005
2059
|
}
|
|
2006
|
-
function
|
|
2007
|
-
|
|
2008
|
-
if (tablessSegs.length === 0) {
|
|
2060
|
+
function routeToLandingPage(ctx, route) {
|
|
2061
|
+
if (route == null || route.type !== "markdown" || route.fullPath == null) {
|
|
2009
2062
|
return void 0;
|
|
2010
2063
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
const pageId = metaStr(md, "pageId") ?? "";
|
|
2016
|
-
const slug = ctx.contentSlug(r.fullPath);
|
|
2017
|
-
return {
|
|
2018
|
-
type: "landingPage",
|
|
2019
|
-
...withMetadataDefaults({
|
|
2020
|
-
id: ctx.nodeId(`landing:${slug}`),
|
|
2021
|
-
title: metaStr(md, "title") ?? "",
|
|
2022
|
-
slug,
|
|
2023
|
-
icon: metaStr(md, "icon"),
|
|
2024
|
-
hidden: r.hidden,
|
|
2025
|
-
viewers: toViewers(metaStrArr(md, "viewers"))
|
|
2026
|
-
}),
|
|
2027
|
-
pageId: PageId(pageId),
|
|
2028
|
-
noindex: metaBool(md, "noindex")
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2064
|
+
const md = route.metadata;
|
|
2065
|
+
const pageId = metaStr(md, "pageId");
|
|
2066
|
+
if (pageId == null) {
|
|
2067
|
+
return void 0;
|
|
2032
2068
|
}
|
|
2033
|
-
|
|
2069
|
+
const slug = ctx.contentSlug(route.fullPath);
|
|
2070
|
+
return {
|
|
2071
|
+
type: "landingPage",
|
|
2072
|
+
...withMetadataDefaults({
|
|
2073
|
+
id: ctx.nodeId(`landing:${slug}`),
|
|
2074
|
+
title: metaStr(md, "title") ?? "",
|
|
2075
|
+
slug,
|
|
2076
|
+
icon: metaStr(md, "icon"),
|
|
2077
|
+
hidden: route.hidden,
|
|
2078
|
+
authed: metaBool(md, "authed"),
|
|
2079
|
+
viewers: toViewers(metaStrArr(md, "viewers")),
|
|
2080
|
+
orphaned: metaBool(md, "orphaned"),
|
|
2081
|
+
featureFlags: metaFeatureFlags(md)
|
|
2082
|
+
}),
|
|
2083
|
+
pageId: PageId(pageId),
|
|
2084
|
+
noindex: metaBool(md, "noindex")
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
function buildLandingPage(ctx, scopeSegs) {
|
|
2088
|
+
const landingSegment = scopeSegs.find(
|
|
2089
|
+
(s) => metaStr(s.seg.metadata, "type") === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true
|
|
2090
|
+
);
|
|
2091
|
+
return routeToLandingPage(
|
|
2092
|
+
ctx,
|
|
2093
|
+
landingSegment?.nav.find((route) => route.type === "markdown")
|
|
2094
|
+
);
|
|
2034
2095
|
}
|
|
2035
2096
|
function markCrossVersionCanonicalSlugs(versionNodes) {
|
|
2036
2097
|
const keyToCanonical = /* @__PURE__ */ new Map();
|
|
@@ -2101,7 +2162,10 @@ function buildProductGroup(ctx, products, scoped, rootSlug) {
|
|
|
2101
2162
|
type: "productgroup",
|
|
2102
2163
|
id: ctx.nodeId("productgroup"),
|
|
2103
2164
|
collapsed: void 0,
|
|
2104
|
-
landingPage:
|
|
2165
|
+
landingPage: buildLandingPage(
|
|
2166
|
+
ctx,
|
|
2167
|
+
scoped.filter((s) => s.seg.product == null)
|
|
2168
|
+
),
|
|
2105
2169
|
children
|
|
2106
2170
|
};
|
|
2107
2171
|
}
|