@fern-api/fdr-sdk 1.2.42-0c024f5b0d → 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/navigation/ledger-root-builder.js +64 -19
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +64 -19
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +109 -4
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +102 -0
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +256 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +100 -21
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -51,6 +51,17 @@ var VersionIdSchema = z.string();
|
|
|
51
51
|
function VersionId(value) {
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
|
+
var Availability = {
|
|
55
|
+
Alpha: "Alpha",
|
|
56
|
+
Stable: "Stable",
|
|
57
|
+
GenerallyAvailable: "GenerallyAvailable",
|
|
58
|
+
InDevelopment: "InDevelopment",
|
|
59
|
+
PreRelease: "PreRelease",
|
|
60
|
+
Deprecated: "Deprecated",
|
|
61
|
+
Beta: "Beta",
|
|
62
|
+
Preview: "Preview",
|
|
63
|
+
Legacy: "Legacy"
|
|
64
|
+
};
|
|
54
65
|
var SnippetsByEndpointMethodSchema = z.record(
|
|
55
66
|
HttpMethodSchema,
|
|
56
67
|
z.array(z.unknown())
|
|
@@ -847,6 +858,35 @@ function metaStr(metadata, key) {
|
|
|
847
858
|
}
|
|
848
859
|
return void 0;
|
|
849
860
|
}
|
|
861
|
+
var AVAILABILITY_LOOKUP = {
|
|
862
|
+
// V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
|
|
863
|
+
alpha: Availability.Alpha,
|
|
864
|
+
stable: Availability.Stable,
|
|
865
|
+
"generally-available": Availability.GenerallyAvailable,
|
|
866
|
+
"in-development": Availability.InDevelopment,
|
|
867
|
+
"pre-release": Availability.PreRelease,
|
|
868
|
+
deprecated: Availability.Deprecated,
|
|
869
|
+
beta: Availability.Beta,
|
|
870
|
+
preview: Availability.Preview,
|
|
871
|
+
legacy: Availability.Legacy,
|
|
872
|
+
// Latest PascalCase values (pass-through)
|
|
873
|
+
Alpha: Availability.Alpha,
|
|
874
|
+
Stable: Availability.Stable,
|
|
875
|
+
GenerallyAvailable: Availability.GenerallyAvailable,
|
|
876
|
+
InDevelopment: Availability.InDevelopment,
|
|
877
|
+
PreRelease: Availability.PreRelease,
|
|
878
|
+
Deprecated: Availability.Deprecated,
|
|
879
|
+
Beta: Availability.Beta,
|
|
880
|
+
Preview: Availability.Preview,
|
|
881
|
+
Legacy: Availability.Legacy
|
|
882
|
+
};
|
|
883
|
+
function metaAvailability(metadata) {
|
|
884
|
+
const raw = metaStr(metadata, "availability");
|
|
885
|
+
if (raw == null) {
|
|
886
|
+
return void 0;
|
|
887
|
+
}
|
|
888
|
+
return AVAILABILITY_LOOKUP[raw];
|
|
889
|
+
}
|
|
850
890
|
function metaBool(metadata, key) {
|
|
851
891
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
852
892
|
const v = metadata[key];
|
|
@@ -964,7 +1004,7 @@ function artifactToNode(ctx, route) {
|
|
|
964
1004
|
}),
|
|
965
1005
|
pageId: PageId(pageId),
|
|
966
1006
|
noindex: metaBool(md, "noindex"),
|
|
967
|
-
availability:
|
|
1007
|
+
availability: metaAvailability(md)
|
|
968
1008
|
};
|
|
969
1009
|
return node;
|
|
970
1010
|
}
|
|
@@ -1029,7 +1069,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1029
1069
|
endpointId: EndpointId(endpointId),
|
|
1030
1070
|
apiDefinitionId,
|
|
1031
1071
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
1032
|
-
availability:
|
|
1072
|
+
availability: metaAvailability(md),
|
|
1033
1073
|
playground: void 0
|
|
1034
1074
|
};
|
|
1035
1075
|
}
|
|
@@ -1045,7 +1085,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1045
1085
|
method,
|
|
1046
1086
|
webhookId: WebhookId(webhookId),
|
|
1047
1087
|
apiDefinitionId,
|
|
1048
|
-
availability:
|
|
1088
|
+
availability: metaAvailability(md)
|
|
1049
1089
|
};
|
|
1050
1090
|
}
|
|
1051
1091
|
if (route.type === "asyncapi") {
|
|
@@ -1058,7 +1098,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1058
1098
|
...meta,
|
|
1059
1099
|
webSocketId: WebSocketId(webSocketId),
|
|
1060
1100
|
apiDefinitionId,
|
|
1061
|
-
availability:
|
|
1101
|
+
availability: metaAvailability(md),
|
|
1062
1102
|
playground: void 0
|
|
1063
1103
|
};
|
|
1064
1104
|
}
|
|
@@ -1074,7 +1114,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1074
1114
|
method,
|
|
1075
1115
|
grpcId: GrpcId(grpcId),
|
|
1076
1116
|
apiDefinitionId,
|
|
1077
|
-
availability:
|
|
1117
|
+
availability: metaAvailability(md)
|
|
1078
1118
|
};
|
|
1079
1119
|
}
|
|
1080
1120
|
if (route.type === "graphql") {
|
|
@@ -1090,7 +1130,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1090
1130
|
graphqlOperationId: GraphQlOperationId(graphqlOperationId),
|
|
1091
1131
|
graphqlOperationIds: void 0,
|
|
1092
1132
|
apiDefinitionId,
|
|
1093
|
-
availability:
|
|
1133
|
+
availability: metaAvailability(md),
|
|
1094
1134
|
playground: void 0
|
|
1095
1135
|
};
|
|
1096
1136
|
}
|
|
@@ -1268,7 +1308,7 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1268
1308
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1269
1309
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1270
1310
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1271
|
-
availability:
|
|
1311
|
+
availability: metaAvailability(seg.metadata),
|
|
1272
1312
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
1273
1313
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1274
1314
|
};
|
|
@@ -1342,7 +1382,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1342
1382
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1343
1383
|
}),
|
|
1344
1384
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1345
|
-
availability:
|
|
1385
|
+
availability: metaAvailability(seg.metadata),
|
|
1346
1386
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1347
1387
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1348
1388
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1430,7 +1470,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1430
1470
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1431
1471
|
}),
|
|
1432
1472
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1433
|
-
availability:
|
|
1473
|
+
availability: metaAvailability(seg.metadata),
|
|
1434
1474
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1435
1475
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1436
1476
|
paginated: true,
|
|
@@ -1645,7 +1685,11 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1645
1685
|
for (const s of ordered) {
|
|
1646
1686
|
const type = metaStr(s.seg.metadata, "type");
|
|
1647
1687
|
const sec = s.seg.section;
|
|
1648
|
-
if (type !== "section"
|
|
1688
|
+
if (type !== "section") {
|
|
1689
|
+
continue;
|
|
1690
|
+
}
|
|
1691
|
+
if (sec === "") {
|
|
1692
|
+
rootSections.push(s);
|
|
1649
1693
|
continue;
|
|
1650
1694
|
}
|
|
1651
1695
|
const parent = parentSectionPath(sec);
|
|
@@ -1676,8 +1720,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1676
1720
|
const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1677
1721
|
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1678
1722
|
const annotated = [];
|
|
1679
|
-
const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
|
|
1680
1723
|
const siblingBoundaries = computeSiblingSortBoundaries(ordered);
|
|
1724
|
+
const hasRootSection = ordered.some(
|
|
1725
|
+
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1726
|
+
);
|
|
1681
1727
|
for (const s of ordered) {
|
|
1682
1728
|
const type = metaStr(s.seg.metadata, "type");
|
|
1683
1729
|
const sec = s.seg.section;
|
|
@@ -1696,8 +1742,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1696
1742
|
}
|
|
1697
1743
|
continue;
|
|
1698
1744
|
}
|
|
1699
|
-
if (type === "section" && sec === "") {
|
|
1700
|
-
const
|
|
1745
|
+
if (type === "section" && sec === "" && hasRootSection) {
|
|
1746
|
+
const bounds = siblingBoundaries.get(s);
|
|
1747
|
+
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1748
|
+
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1701
1749
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1702
1750
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1703
1751
|
continue;
|
|
@@ -1716,12 +1764,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1716
1764
|
} else {
|
|
1717
1765
|
const bounds = siblingBoundaries.get(s);
|
|
1718
1766
|
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
|
|
1723
|
-
scopePrefix
|
|
1724
|
-
);
|
|
1767
|
+
const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
|
|
1768
|
+
const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
|
|
1769
|
+
node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1725
1770
|
}
|
|
1726
1771
|
const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
|
|
1727
1772
|
annotated.push({
|