@fern-api/fdr-sdk 1.2.42-080b4f1d94 → 1.2.42-0c024f5b0d
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 +33 -164
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +33 -164
- 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.metadataPreservation.test.js +4 -109
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +0 -102
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +44 -253
- 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/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -360
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.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
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
|
@@ -51,17 +51,6 @@ 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
|
-
};
|
|
65
54
|
var SnippetsByEndpointMethodSchema = z.record(
|
|
66
55
|
HttpMethodSchema,
|
|
67
56
|
z.array(z.unknown())
|
|
@@ -858,35 +847,6 @@ function metaStr(metadata, key) {
|
|
|
858
847
|
}
|
|
859
848
|
return void 0;
|
|
860
849
|
}
|
|
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
|
-
}
|
|
890
850
|
function metaBool(metadata, key) {
|
|
891
851
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
892
852
|
const v = metadata[key];
|
|
@@ -1004,7 +964,7 @@ function artifactToNode(ctx, route) {
|
|
|
1004
964
|
}),
|
|
1005
965
|
pageId: PageId(pageId),
|
|
1006
966
|
noindex: metaBool(md, "noindex"),
|
|
1007
|
-
availability:
|
|
967
|
+
availability: metaStr(md, "availability")
|
|
1008
968
|
};
|
|
1009
969
|
return node;
|
|
1010
970
|
}
|
|
@@ -1069,7 +1029,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1069
1029
|
endpointId: EndpointId(endpointId),
|
|
1070
1030
|
apiDefinitionId,
|
|
1071
1031
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
1072
|
-
availability:
|
|
1032
|
+
availability: metaStr(md, "availability"),
|
|
1073
1033
|
playground: void 0
|
|
1074
1034
|
};
|
|
1075
1035
|
}
|
|
@@ -1085,7 +1045,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1085
1045
|
method,
|
|
1086
1046
|
webhookId: WebhookId(webhookId),
|
|
1087
1047
|
apiDefinitionId,
|
|
1088
|
-
availability:
|
|
1048
|
+
availability: metaStr(md, "availability")
|
|
1089
1049
|
};
|
|
1090
1050
|
}
|
|
1091
1051
|
if (route.type === "asyncapi") {
|
|
@@ -1098,7 +1058,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1098
1058
|
...meta,
|
|
1099
1059
|
webSocketId: WebSocketId(webSocketId),
|
|
1100
1060
|
apiDefinitionId,
|
|
1101
|
-
availability:
|
|
1061
|
+
availability: metaStr(md, "availability"),
|
|
1102
1062
|
playground: void 0
|
|
1103
1063
|
};
|
|
1104
1064
|
}
|
|
@@ -1114,7 +1074,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1114
1074
|
method,
|
|
1115
1075
|
grpcId: GrpcId(grpcId),
|
|
1116
1076
|
apiDefinitionId,
|
|
1117
|
-
availability:
|
|
1077
|
+
availability: metaStr(md, "availability")
|
|
1118
1078
|
};
|
|
1119
1079
|
}
|
|
1120
1080
|
if (route.type === "graphql") {
|
|
@@ -1130,7 +1090,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1130
1090
|
graphqlOperationId: GraphQlOperationId(graphqlOperationId),
|
|
1131
1091
|
graphqlOperationIds: void 0,
|
|
1132
1092
|
apiDefinitionId,
|
|
1133
|
-
availability:
|
|
1093
|
+
availability: metaStr(md, "availability"),
|
|
1134
1094
|
playground: void 0
|
|
1135
1095
|
};
|
|
1136
1096
|
}
|
|
@@ -1259,30 +1219,6 @@ function stripLeadingScopePrefix(section, scopePrefix) {
|
|
|
1259
1219
|
}
|
|
1260
1220
|
return section;
|
|
1261
1221
|
}
|
|
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
1222
|
function mergeChildrenByPosition(ctx, nav, sectionChildren) {
|
|
1287
1223
|
const leafNodes = [];
|
|
1288
1224
|
for (let i = 0; i < nav.length; i++) {
|
|
@@ -1332,20 +1268,17 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1332
1268
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1333
1269
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1334
1270
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1335
|
-
availability:
|
|
1271
|
+
availability: metaStr(seg.metadata, "availability"),
|
|
1336
1272
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
1337
1273
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1338
1274
|
};
|
|
1339
1275
|
}
|
|
1340
|
-
function directChildApiPackages(parentSection, scopeSegs
|
|
1276
|
+
function directChildApiPackages(parentSection, scopeSegs) {
|
|
1341
1277
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1342
1278
|
return scopeSegs.filter((s) => {
|
|
1343
1279
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
1344
1280
|
return false;
|
|
1345
1281
|
}
|
|
1346
|
-
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
1347
|
-
return false;
|
|
1348
|
-
}
|
|
1349
1282
|
const parent = parentSectionPath(s.seg.section);
|
|
1350
1283
|
if (parent === parentSection) {
|
|
1351
1284
|
return true;
|
|
@@ -1359,17 +1292,7 @@ function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
|
1359
1292
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1360
1293
|
const { seg, nav } = scoped;
|
|
1361
1294
|
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
|
-
}
|
|
1295
|
+
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1373
1296
|
const packageNodes = childPackages.map((child) => ({
|
|
1374
1297
|
node: apiPackageChildNode(
|
|
1375
1298
|
ctx,
|
|
@@ -1380,9 +1303,6 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
|
|
|
1380
1303
|
),
|
|
1381
1304
|
childIndex: metaNum(child.seg.metadata, "childIndex")
|
|
1382
1305
|
}));
|
|
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
1306
|
const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
|
|
1387
1307
|
if (!hasChildIndex) {
|
|
1388
1308
|
return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
|
|
@@ -1422,7 +1342,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1422
1342
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1423
1343
|
}),
|
|
1424
1344
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1425
|
-
availability:
|
|
1345
|
+
availability: metaStr(seg.metadata, "availability"),
|
|
1426
1346
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1427
1347
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1428
1348
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1510,10 +1430,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1510
1430
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1511
1431
|
}),
|
|
1512
1432
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1513
|
-
availability:
|
|
1433
|
+
availability: metaStr(seg.metadata, "availability"),
|
|
1514
1434
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1515
1435
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1516
|
-
paginated:
|
|
1436
|
+
paginated: true,
|
|
1517
1437
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
1518
1438
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
1519
1439
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1531,10 +1451,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
1531
1451
|
}
|
|
1532
1452
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1533
1453
|
});
|
|
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);
|
|
1454
|
+
const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? candidates[0];
|
|
1538
1455
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
|
|
1539
1456
|
}
|
|
1540
1457
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -1542,13 +1459,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1542
1459
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
1543
1460
|
return false;
|
|
1544
1461
|
}
|
|
1545
|
-
|
|
1462
|
+
return scopeSegs.some((candidate) => {
|
|
1546
1463
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
1547
1464
|
return false;
|
|
1548
1465
|
}
|
|
1549
1466
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1550
1467
|
});
|
|
1551
|
-
return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
|
|
1552
1468
|
}
|
|
1553
1469
|
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1554
1470
|
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
@@ -1694,10 +1610,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1694
1610
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1695
1611
|
return false;
|
|
1696
1612
|
}
|
|
1697
|
-
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1698
|
-
if (depth === 0) {
|
|
1699
|
-
return false;
|
|
1700
|
-
}
|
|
1701
1613
|
const parent = parentSectionPath(sec);
|
|
1702
1614
|
if (parent === parentPath) {
|
|
1703
1615
|
return true;
|
|
@@ -1707,7 +1619,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1707
1619
|
}
|
|
1708
1620
|
return false;
|
|
1709
1621
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1710
|
-
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1711
1622
|
return direct.map((s) => {
|
|
1712
1623
|
const type = metaStr(s.seg.metadata, "type");
|
|
1713
1624
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1717,14 +1628,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1717
1628
|
} else if (type === "changelog") {
|
|
1718
1629
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1719
1630
|
} 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
1631
|
node = sectionNode(
|
|
1725
1632
|
ctx,
|
|
1726
1633
|
s,
|
|
1727
|
-
buildSectionTree(ctx,
|
|
1634
|
+
buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
|
|
1728
1635
|
scopePrefix
|
|
1729
1636
|
);
|
|
1730
1637
|
}
|
|
@@ -1738,16 +1645,11 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1738
1645
|
for (const s of ordered) {
|
|
1739
1646
|
const type = metaStr(s.seg.metadata, "type");
|
|
1740
1647
|
const sec = s.seg.section;
|
|
1741
|
-
if (type !== "section") {
|
|
1742
|
-
continue;
|
|
1743
|
-
}
|
|
1744
|
-
if (sec === "") {
|
|
1745
|
-
rootSections.push(s);
|
|
1648
|
+
if (type !== "section" || sec === "") {
|
|
1746
1649
|
continue;
|
|
1747
1650
|
}
|
|
1748
|
-
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1749
1651
|
const parent = parentSectionPath(sec);
|
|
1750
|
-
const isRootLevel =
|
|
1652
|
+
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1751
1653
|
if (isRootLevel) {
|
|
1752
1654
|
rootSections.push(s);
|
|
1753
1655
|
}
|
|
@@ -1774,24 +1676,14 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1774
1676
|
const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1775
1677
|
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1776
1678
|
const annotated = [];
|
|
1679
|
+
const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
|
|
1777
1680
|
const siblingBoundaries = computeSiblingSortBoundaries(ordered);
|
|
1778
|
-
const hasRootSection = ordered.some(
|
|
1779
|
-
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1780
|
-
);
|
|
1781
1681
|
for (const s of ordered) {
|
|
1782
1682
|
const type = metaStr(s.seg.metadata, "type");
|
|
1783
1683
|
const sec = s.seg.section;
|
|
1784
1684
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1785
1685
|
continue;
|
|
1786
1686
|
}
|
|
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
1687
|
if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
|
|
1796
1688
|
continue;
|
|
1797
1689
|
}
|
|
@@ -1804,18 +1696,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1804
1696
|
}
|
|
1805
1697
|
continue;
|
|
1806
1698
|
}
|
|
1807
|
-
if (type === "section" && sec === ""
|
|
1808
|
-
const
|
|
1809
|
-
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1810
|
-
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1699
|
+
if (type === "section" && sec === "") {
|
|
1700
|
+
const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
|
|
1811
1701
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1812
1702
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1813
1703
|
continue;
|
|
1814
1704
|
}
|
|
1815
|
-
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1816
1705
|
const parent = parentSectionPath(sec);
|
|
1817
|
-
const isRootLevel =
|
|
1818
|
-
if (isRootLevel && hasRootSection && sec !== ""
|
|
1706
|
+
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1707
|
+
if (isRootLevel && hasRootSection && sec !== "") {
|
|
1819
1708
|
continue;
|
|
1820
1709
|
}
|
|
1821
1710
|
if (isRootLevel) {
|
|
@@ -1827,9 +1716,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1827
1716
|
} else {
|
|
1828
1717
|
const bounds = siblingBoundaries.get(s);
|
|
1829
1718
|
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1719
|
+
node = sectionNode(
|
|
1720
|
+
ctx,
|
|
1721
|
+
s,
|
|
1722
|
+
buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
|
|
1723
|
+
scopePrefix
|
|
1724
|
+
);
|
|
1833
1725
|
}
|
|
1834
1726
|
const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
|
|
1835
1727
|
annotated.push({
|
|
@@ -1867,6 +1759,10 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1867
1759
|
} else if (child.type === "section" && !child.collapsible) {
|
|
1868
1760
|
flushRun();
|
|
1869
1761
|
out.push(child);
|
|
1762
|
+
} else if (child.type === "changelog") {
|
|
1763
|
+
flushRun();
|
|
1764
|
+
run.push(child);
|
|
1765
|
+
flushRun();
|
|
1870
1766
|
} else {
|
|
1871
1767
|
run.push(child);
|
|
1872
1768
|
}
|
|
@@ -1981,7 +1877,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1981
1877
|
const variantIndividualSlug = detailSlug(variant);
|
|
1982
1878
|
const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
|
|
1983
1879
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1984
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
1880
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
|
|
1985
1881
|
return {
|
|
1986
1882
|
type: "variant",
|
|
1987
1883
|
...withMetadataDefaults({
|
|
@@ -2383,7 +2279,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2383
2279
|
};
|
|
2384
2280
|
return node;
|
|
2385
2281
|
});
|
|
2386
|
-
markCrossProductCanonicalSlugs(children);
|
|
2387
2282
|
return {
|
|
2388
2283
|
type: "productgroup",
|
|
2389
2284
|
id: ctx.nodeId("productgroup"),
|
|
@@ -2395,32 +2290,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2395
2290
|
children
|
|
2396
2291
|
};
|
|
2397
2292
|
}
|
|
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
2293
|
export {
|
|
2425
2294
|
apiLeafNodeFromNavRoute,
|
|
2426
2295
|
buildFullRootFromSegments,
|