@fern-api/fdr-sdk 1.2.42-1fb0ba4870 → 1.2.42-304ea6b285
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 +43 -11
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +43 -11
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +306 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +46 -12
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-root-builder.ledgerParity.test.d.ts","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.ledgerParity.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { buildFullRootFromSegments } from "../ledger-root-builder.js";
|
|
3
|
+
function segment(opts) {
|
|
4
|
+
return {
|
|
5
|
+
segmentId: opts.segmentHash,
|
|
6
|
+
segmentHash: opts.segmentHash,
|
|
7
|
+
section: opts.section,
|
|
8
|
+
locale: "en",
|
|
9
|
+
sortOrder: opts.sortOrder,
|
|
10
|
+
hidden: false,
|
|
11
|
+
metadata: opts.metadata,
|
|
12
|
+
product: null,
|
|
13
|
+
version: null,
|
|
14
|
+
variant: opts.variant ?? null,
|
|
15
|
+
tab: null
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function pageRoute(opts) {
|
|
19
|
+
return {
|
|
20
|
+
type: "markdown",
|
|
21
|
+
fullPath: opts.fullPath,
|
|
22
|
+
hidden: false,
|
|
23
|
+
displaySortOrder: opts.displaySortOrder,
|
|
24
|
+
metadata: { title: opts.title, pageId: opts.pageId ?? `${opts.fullPath}.mdx` }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function changelogRoute(opts) {
|
|
28
|
+
return {
|
|
29
|
+
type: "changelog",
|
|
30
|
+
fullPath: opts.fullPath,
|
|
31
|
+
hidden: false,
|
|
32
|
+
displaySortOrder: opts.displaySortOrder,
|
|
33
|
+
metadata: {
|
|
34
|
+
title: opts.title,
|
|
35
|
+
pageId: `${opts.fullPath}.mdx`,
|
|
36
|
+
date: opts.date
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const pythonVariant = {
|
|
41
|
+
id: "variant-python",
|
|
42
|
+
displayName: "Python",
|
|
43
|
+
icon: undefined,
|
|
44
|
+
sortOrder: 0,
|
|
45
|
+
hidden: false,
|
|
46
|
+
viewers: [],
|
|
47
|
+
orphaned: false,
|
|
48
|
+
featureFlags: [],
|
|
49
|
+
metadata: { slug: "python", default: true }
|
|
50
|
+
};
|
|
51
|
+
const typescriptVariant = {
|
|
52
|
+
id: "variant-typescript",
|
|
53
|
+
displayName: "TypeScript",
|
|
54
|
+
icon: undefined,
|
|
55
|
+
sortOrder: 1,
|
|
56
|
+
hidden: false,
|
|
57
|
+
viewers: [],
|
|
58
|
+
orphaned: false,
|
|
59
|
+
featureFlags: [],
|
|
60
|
+
metadata: { slug: "typescript" }
|
|
61
|
+
};
|
|
62
|
+
function collectByType(node, type) {
|
|
63
|
+
const results = [];
|
|
64
|
+
function walk(value) {
|
|
65
|
+
if (value == null || typeof value !== "object") {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const current = value;
|
|
69
|
+
if (current.type === type) {
|
|
70
|
+
results.push(current);
|
|
71
|
+
}
|
|
72
|
+
for (const child of current.children ?? []) {
|
|
73
|
+
walk(child);
|
|
74
|
+
}
|
|
75
|
+
if (current.child != null) {
|
|
76
|
+
walk(current.child);
|
|
77
|
+
}
|
|
78
|
+
if (current.changelog != null) {
|
|
79
|
+
walk(current.changelog);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
walk(node);
|
|
83
|
+
return results;
|
|
84
|
+
}
|
|
85
|
+
function buildRoot(opts) {
|
|
86
|
+
return buildFullRootFromSegments({
|
|
87
|
+
basePath: "",
|
|
88
|
+
title: "Ledger parity",
|
|
89
|
+
segments: opts.segments,
|
|
90
|
+
navBySegment: (opts.navBySegment ?? new Map())
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
describe("buildFullRootFromSegments — ledger/v2 parity repros", () => {
|
|
94
|
+
it("scopes structural children below their owning variant slug", () => {
|
|
95
|
+
const root = buildRoot({
|
|
96
|
+
segments: [
|
|
97
|
+
segment({
|
|
98
|
+
segmentHash: "seg-python-guides",
|
|
99
|
+
section: "guides",
|
|
100
|
+
sortOrder: 0,
|
|
101
|
+
metadata: { type: "section", title: "Guides" },
|
|
102
|
+
variant: pythonVariant
|
|
103
|
+
}),
|
|
104
|
+
segment({
|
|
105
|
+
segmentHash: "seg-typescript-guides",
|
|
106
|
+
section: "guides",
|
|
107
|
+
sortOrder: 1,
|
|
108
|
+
metadata: { type: "section", title: "Guides" },
|
|
109
|
+
variant: typescriptVariant
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
expect(collectByType(root, "section")
|
|
114
|
+
.map((node) => node.slug)
|
|
115
|
+
.sort()).toEqual(["python/guides", "typescript/guides"]);
|
|
116
|
+
});
|
|
117
|
+
it("keeps api packages under the matching api definition", () => {
|
|
118
|
+
const root = buildRoot({
|
|
119
|
+
segments: [
|
|
120
|
+
segment({
|
|
121
|
+
segmentHash: "seg-api-a",
|
|
122
|
+
section: "",
|
|
123
|
+
sortOrder: 0,
|
|
124
|
+
metadata: { type: "apiReference", title: "Plant API", apiDefinitionId: "api-a" }
|
|
125
|
+
}),
|
|
126
|
+
segment({
|
|
127
|
+
segmentHash: "seg-users",
|
|
128
|
+
section: "users",
|
|
129
|
+
sortOrder: 1,
|
|
130
|
+
metadata: { type: "apiPackage", title: "Users", apiDefinitionId: "api-a" }
|
|
131
|
+
}),
|
|
132
|
+
segment({
|
|
133
|
+
segmentHash: "seg-api-b",
|
|
134
|
+
section: "",
|
|
135
|
+
sortOrder: 2,
|
|
136
|
+
metadata: { type: "apiReference", title: "Garden API", apiDefinitionId: "api-b" }
|
|
137
|
+
}),
|
|
138
|
+
segment({
|
|
139
|
+
segmentHash: "seg-orgs",
|
|
140
|
+
section: "orgs",
|
|
141
|
+
sortOrder: 3,
|
|
142
|
+
metadata: { type: "apiPackage", title: "Orgs", apiDefinitionId: "api-b" }
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
const apiReferences = collectByType(root, "apiReference");
|
|
147
|
+
const plantApi = apiReferences.find((node) => node.title === "Plant API");
|
|
148
|
+
const gardenApi = apiReferences.find((node) => node.title === "Garden API");
|
|
149
|
+
expect(plantApi?.children?.map((node) => node.title)).toEqual(["Users"]);
|
|
150
|
+
expect(gardenApi?.children?.map((node) => node.title)).toEqual(["Orgs"]);
|
|
151
|
+
});
|
|
152
|
+
it("attaches an api changelog only to the matching repeated api reference", () => {
|
|
153
|
+
const root = buildRoot({
|
|
154
|
+
segments: [
|
|
155
|
+
segment({
|
|
156
|
+
segmentHash: "seg-public-api",
|
|
157
|
+
section: "public",
|
|
158
|
+
sortOrder: 0,
|
|
159
|
+
metadata: { type: "apiReference", title: "Public API", apiDefinitionId: "plants" }
|
|
160
|
+
}),
|
|
161
|
+
segment({
|
|
162
|
+
segmentHash: "seg-internal-api",
|
|
163
|
+
section: "internal",
|
|
164
|
+
sortOrder: 1,
|
|
165
|
+
metadata: { type: "apiReference", title: "Internal API", apiDefinitionId: "plants" }
|
|
166
|
+
}),
|
|
167
|
+
segment({
|
|
168
|
+
segmentHash: "seg-internal-changelog",
|
|
169
|
+
section: "internal/changelog",
|
|
170
|
+
sortOrder: 2,
|
|
171
|
+
metadata: { type: "changelog", title: "Internal changelog", apiDefinitionId: "plants" }
|
|
172
|
+
})
|
|
173
|
+
],
|
|
174
|
+
navBySegment: new Map([
|
|
175
|
+
[
|
|
176
|
+
"seg-internal-changelog",
|
|
177
|
+
[
|
|
178
|
+
changelogRoute({
|
|
179
|
+
fullPath: "internal/changelog/2026/06/23/plant-updates",
|
|
180
|
+
title: "Plant updates",
|
|
181
|
+
date: "2026-06-23"
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
]
|
|
185
|
+
])
|
|
186
|
+
});
|
|
187
|
+
const publicApi = collectByType(root, "apiReference").find((node) => node.title === "Public API");
|
|
188
|
+
const internalApi = collectByType(root, "apiReference").find((node) => node.title === "Internal API");
|
|
189
|
+
expect(publicApi?.changelog).toBeUndefined();
|
|
190
|
+
expect(internalApi?.changelog?.title).toBe("Internal changelog");
|
|
191
|
+
});
|
|
192
|
+
it("keeps duplicate nested sections from adopting sibling children", () => {
|
|
193
|
+
const root = buildRoot({
|
|
194
|
+
segments: [
|
|
195
|
+
segment({
|
|
196
|
+
segmentHash: "seg-guides",
|
|
197
|
+
section: "guides",
|
|
198
|
+
sortOrder: 0,
|
|
199
|
+
metadata: { type: "section", title: "Guides" }
|
|
200
|
+
}),
|
|
201
|
+
segment({
|
|
202
|
+
segmentHash: "seg-foo-a",
|
|
203
|
+
section: "guides/foo",
|
|
204
|
+
sortOrder: 10,
|
|
205
|
+
metadata: { type: "section", title: "Foo A" }
|
|
206
|
+
}),
|
|
207
|
+
segment({
|
|
208
|
+
segmentHash: "seg-a",
|
|
209
|
+
section: "guides/foo/a",
|
|
210
|
+
sortOrder: 11,
|
|
211
|
+
metadata: { type: "section", title: "A" }
|
|
212
|
+
}),
|
|
213
|
+
segment({
|
|
214
|
+
segmentHash: "seg-foo-b",
|
|
215
|
+
section: "guides/foo",
|
|
216
|
+
sortOrder: 20,
|
|
217
|
+
metadata: { type: "section", title: "Foo B" }
|
|
218
|
+
}),
|
|
219
|
+
segment({
|
|
220
|
+
segmentHash: "seg-b",
|
|
221
|
+
section: "guides/foo/b",
|
|
222
|
+
sortOrder: 21,
|
|
223
|
+
metadata: { type: "section", title: "B" }
|
|
224
|
+
})
|
|
225
|
+
]
|
|
226
|
+
});
|
|
227
|
+
const fooA = collectByType(root, "section").find((node) => node.title === "Foo A");
|
|
228
|
+
const fooB = collectByType(root, "section").find((node) => node.title === "Foo B");
|
|
229
|
+
expect(fooA?.children?.map((node) => node.title)).toEqual(["A"]);
|
|
230
|
+
expect(fooB?.children?.map((node) => node.title)).toEqual(["B"]);
|
|
231
|
+
});
|
|
232
|
+
it("groups standalone changelogs with adjacent loose pages", () => {
|
|
233
|
+
const root = buildRoot({
|
|
234
|
+
segments: [
|
|
235
|
+
segment({
|
|
236
|
+
segmentHash: "seg-root",
|
|
237
|
+
section: "",
|
|
238
|
+
sortOrder: 0,
|
|
239
|
+
metadata: { type: "tabRoot" }
|
|
240
|
+
}),
|
|
241
|
+
segment({
|
|
242
|
+
segmentHash: "seg-changelog",
|
|
243
|
+
section: "changelog",
|
|
244
|
+
sortOrder: 1,
|
|
245
|
+
metadata: { type: "changelog", title: "Changelog", childIndex: 1 }
|
|
246
|
+
})
|
|
247
|
+
],
|
|
248
|
+
navBySegment: new Map([
|
|
249
|
+
[
|
|
250
|
+
"seg-root",
|
|
251
|
+
[
|
|
252
|
+
pageRoute({ fullPath: "overview", title: "Overview", displaySortOrder: 0 }),
|
|
253
|
+
pageRoute({ fullPath: "guides", title: "Guides", displaySortOrder: 2 })
|
|
254
|
+
]
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
"seg-changelog",
|
|
258
|
+
[
|
|
259
|
+
changelogRoute({
|
|
260
|
+
fullPath: "changelog/2026/06/23/new-plant",
|
|
261
|
+
title: "New plant",
|
|
262
|
+
date: "2026-06-23"
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
]
|
|
266
|
+
])
|
|
267
|
+
});
|
|
268
|
+
const sidebarGroups = collectByType(root, "sidebarGroup");
|
|
269
|
+
expect(sidebarGroups).toHaveLength(1);
|
|
270
|
+
expect(sidebarGroups[0]?.children?.map((node) => node.type)).toEqual(["page", "changelog", "page"]);
|
|
271
|
+
});
|
|
272
|
+
it("preserves api reference paginated metadata", () => {
|
|
273
|
+
const root = buildRoot({
|
|
274
|
+
segments: [
|
|
275
|
+
segment({
|
|
276
|
+
segmentHash: "seg-unpaginated-api",
|
|
277
|
+
section: "api",
|
|
278
|
+
sortOrder: 0,
|
|
279
|
+
metadata: { type: "apiReference", title: "API", apiDefinitionId: "plants", paginated: false }
|
|
280
|
+
}),
|
|
281
|
+
segment({
|
|
282
|
+
segmentHash: "seg-paginated-api",
|
|
283
|
+
section: "paginated-api",
|
|
284
|
+
sortOrder: 1,
|
|
285
|
+
metadata: {
|
|
286
|
+
type: "apiReference",
|
|
287
|
+
title: "Paginated API",
|
|
288
|
+
apiDefinitionId: "paginated-plants",
|
|
289
|
+
paginated: true
|
|
290
|
+
}
|
|
291
|
+
}),
|
|
292
|
+
segment({
|
|
293
|
+
segmentHash: "seg-default-api",
|
|
294
|
+
section: "default-api",
|
|
295
|
+
sortOrder: 2,
|
|
296
|
+
metadata: { type: "apiReference", title: "Default API", apiDefinitionId: "default-plants" }
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
});
|
|
300
|
+
const apis = collectByType(root, "apiReference");
|
|
301
|
+
expect(apis.find((api) => api.title === "API")?.paginated).toBe(false);
|
|
302
|
+
expect(apis.find((api) => api.title === "Paginated API")?.paginated).toBe(true);
|
|
303
|
+
expect(apis.find((api) => api.title === "Default API")?.paginated).toBeUndefined();
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
//# sourceMappingURL=ledger-root-builder.ledgerParity.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-root-builder.ledgerParity.test.js","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.ledgerParity.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,SAAS,OAAO,CAAC,IAMhB;IACG,OAAO;QACH,SAAS,EAAE,IAAI,CAAC,WAAW;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI;QAC7B,GAAG,EAAE,IAAI;KACZ,CAAC;AACN,CAAC;AAED,SAAS,SAAS,CAAC,IAAqF;IACpG,OAAO;QACH,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,KAAK;QACb,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,MAAM,EAAE;KACjF,CAAC;AACN,CAAC;AAED,SAAS,cAAc,CAAC,IAAkF;IACtG,OAAO;QACH,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;Q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E,WAAW,EAAE,EACxB,MAAM,EAAE,QAAQ,EAAE,GACnB,cAAc,CAAC,eAAe,EAAE,CAsElC;AA8pBD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAmF5F"}
|
|
@@ -569,6 +569,30 @@ function stripLeadingScopePrefix(section, scopePrefix) {
|
|
|
569
569
|
}
|
|
570
570
|
return section;
|
|
571
571
|
}
|
|
572
|
+
function computeDuplicateSiblingSortBoundaries(siblings) {
|
|
573
|
+
const result = new Map();
|
|
574
|
+
const byPath = new Map();
|
|
575
|
+
for (const sibling of siblings) {
|
|
576
|
+
if (metaStr(sibling.seg.metadata, "type") !== "section") {
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
const group = byPath.get(sibling.seg.section) ?? [];
|
|
580
|
+
group.push(sibling);
|
|
581
|
+
byPath.set(sibling.seg.section, group);
|
|
582
|
+
}
|
|
583
|
+
for (const [, group] of byPath) {
|
|
584
|
+
if (group.length <= 1) {
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
for (let i = 0; i < group.length; i++) {
|
|
588
|
+
result.set(group[i], {
|
|
589
|
+
lo: group[i].seg.sortOrder,
|
|
590
|
+
hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return result;
|
|
595
|
+
}
|
|
572
596
|
/**
|
|
573
597
|
* Merge leaf children and section children by their original V1 tree position.
|
|
574
598
|
* Leaves carry position via `displaySortOrder` (stored in nav routes), sections
|
|
@@ -642,13 +666,16 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
642
666
|
* `parentSectionPath(seg.section) === parentSection`, or is an orphaned segment
|
|
643
667
|
* whose nearest existing ancestor is `parentSection`.
|
|
644
668
|
*/
|
|
645
|
-
function directChildApiPackages(parentSection, scopeSegs) {
|
|
669
|
+
function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
646
670
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
647
671
|
return scopeSegs
|
|
648
672
|
.filter((s) => {
|
|
649
673
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
650
674
|
return false;
|
|
651
675
|
}
|
|
676
|
+
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
677
|
+
return false;
|
|
678
|
+
}
|
|
652
679
|
const parent = parentSectionPath(s.seg.section);
|
|
653
680
|
if (parent === parentSection) {
|
|
654
681
|
return true;
|
|
@@ -673,7 +700,7 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
|
|
|
673
700
|
// API leaf types.
|
|
674
701
|
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
675
702
|
// Build nested ApiPackageNodes from direct child apiPackage segments.
|
|
676
|
-
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
703
|
+
const childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
|
|
677
704
|
const packageNodes = childPackages.map((child) => ({
|
|
678
705
|
node: apiPackageChildNode(ctx, child, scopeSegs, apiDefinitionId, scopePrefix),
|
|
679
706
|
childIndex: metaNum(child.seg.metadata, "childIndex")
|
|
@@ -834,7 +861,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
834
861
|
availability: metaAvailability(seg.metadata),
|
|
835
862
|
overviewPageId: overviewPageId != null ? FernNavigation.PageId(overviewPageId) : undefined,
|
|
836
863
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
837
|
-
paginated:
|
|
864
|
+
paginated: metaBool(seg.metadata, "paginated"),
|
|
838
865
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
839
866
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
840
867
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : undefined,
|
|
@@ -852,7 +879,12 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
852
879
|
}
|
|
853
880
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
854
881
|
});
|
|
855
|
-
const
|
|
882
|
+
const apiReferenceCount = scopeSegs.filter((candidate) => {
|
|
883
|
+
return (metaStr(candidate.seg.metadata, "type") === "apiReference" &&
|
|
884
|
+
metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId);
|
|
885
|
+
}).length;
|
|
886
|
+
const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ??
|
|
887
|
+
(apiReferenceCount === 1 ? candidates[0] : undefined);
|
|
856
888
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : undefined;
|
|
857
889
|
}
|
|
858
890
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -860,12 +892,14 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
860
892
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
861
893
|
return false;
|
|
862
894
|
}
|
|
863
|
-
|
|
895
|
+
const candidates = scopeSegs.filter((candidate) => {
|
|
864
896
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
865
897
|
return false;
|
|
866
898
|
}
|
|
867
899
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
868
900
|
});
|
|
901
|
+
return (candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) ||
|
|
902
|
+
candidates.length === 1);
|
|
869
903
|
}
|
|
870
904
|
/**
|
|
871
905
|
* True when this segment is an `apiPackage` that will be nested under an in-scope
|
|
@@ -1058,6 +1092,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1058
1092
|
return false;
|
|
1059
1093
|
})
|
|
1060
1094
|
.sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1095
|
+
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1061
1096
|
return direct.map((s) => {
|
|
1062
1097
|
const type = metaStr(s.seg.metadata, "type");
|
|
1063
1098
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1070,7 +1105,11 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1070
1105
|
}
|
|
1071
1106
|
else {
|
|
1072
1107
|
// section (or unrecognised) → recurse for nested sections.
|
|
1073
|
-
|
|
1108
|
+
const boundary = siblingBoundaries.get(s);
|
|
1109
|
+
const childScopeSegs = boundary != null
|
|
1110
|
+
? scopeSegs.filter((candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi)
|
|
1111
|
+
: scopeSegs;
|
|
1112
|
+
node = sectionNode(ctx, s, buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix), scopePrefix);
|
|
1074
1113
|
}
|
|
1075
1114
|
return { node, childIndex };
|
|
1076
1115
|
});
|
|
@@ -1339,11 +1378,6 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1339
1378
|
flushRun();
|
|
1340
1379
|
out.push(child);
|
|
1341
1380
|
}
|
|
1342
|
-
else if (child.type === "changelog") {
|
|
1343
|
-
flushRun();
|
|
1344
|
-
run.push(child);
|
|
1345
|
-
flushRun();
|
|
1346
|
-
}
|
|
1347
1381
|
else {
|
|
1348
1382
|
run.push(child);
|
|
1349
1383
|
}
|
|
@@ -1510,7 +1544,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1510
1544
|
? asSlug(FernNavigation.slugjoin(scopePrefix, variantIndividualSlug))
|
|
1511
1545
|
: scopePrefix;
|
|
1512
1546
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1513
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
1547
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
|
|
1514
1548
|
return {
|
|
1515
1549
|
type: "variant",
|
|
1516
1550
|
...withMetadataDefaults({
|