@fern-api/fdr-sdk 1.2.42-54880bfeac → 1.2.42-6d01f91096
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/converters/index.js +0 -9
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +0 -9
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +0 -10
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +0 -10
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +0 -9
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +0 -9
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +36 -212
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +36 -212
- 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/__test__/ledger-root-builder.skipSlugApiReference.test.js +0 -276
- package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +47 -312
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/navigation/utils/index.d.ts +0 -1
- package/dist/navigation/utils/index.d.ts.map +1 -1
- package/dist/navigation/utils/index.js +0 -1
- package/dist/navigation/utils/index.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/navigation/utils/index.d.ts +0 -1
- package/dist/types/navigation/utils/index.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/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +0 -29
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +0 -1
- package/dist/navigation/utils/syntheticSectionPath.d.ts +0 -13
- package/dist/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
- package/dist/navigation/utils/syntheticSectionPath.js +0 -20
- package/dist/navigation/utils/syntheticSectionPath.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
- package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
- package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
- package/dist/types/navigation/utils/syntheticSectionPath.d.ts +0 -13
- package/dist/types/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import * as FernNavigation from "../index.js";
|
|
3
|
-
import { buildFullRootFromSegments } from "../ledger-root-builder.js";
|
|
4
|
-
import { createBreadcrumb } from "../utils/createBreadcrumb.js";
|
|
5
|
-
/**
|
|
6
|
-
* Tests for sidebarDepth-based root section identification.
|
|
7
|
-
*
|
|
8
|
-
* V1 configs define flat root sections (e.g. "Users", "Policies",
|
|
9
|
-
* "Verification") that the decomposer marks as sidebarDepth=0. Without
|
|
10
|
-
* this marker, the builder's slug-derived hierarchy would infer that
|
|
11
|
-
* "users/verification" is a child of "users", creating extra ancestor
|
|
12
|
-
* levels in the breadcrumb.
|
|
13
|
-
*/
|
|
14
|
-
function pageRoute(opts) {
|
|
15
|
-
return {
|
|
16
|
-
type: "markdown",
|
|
17
|
-
fullPath: opts.fullPath,
|
|
18
|
-
hidden: false,
|
|
19
|
-
metadata: { title: opts.title, pageId: `pg-${opts.title.toLowerCase().replace(/\s+/g, "-")}` },
|
|
20
|
-
...(opts.displaySortOrder != null ? { displaySortOrder: opts.displaySortOrder } : {})
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function segment(opts) {
|
|
24
|
-
return {
|
|
25
|
-
segmentId: opts.segmentHash,
|
|
26
|
-
segmentHash: opts.segmentHash,
|
|
27
|
-
section: opts.section,
|
|
28
|
-
locale: "en",
|
|
29
|
-
sortOrder: opts.sortOrder,
|
|
30
|
-
hidden: false,
|
|
31
|
-
metadata: opts.metadata,
|
|
32
|
-
product: null,
|
|
33
|
-
version: null,
|
|
34
|
-
variant: null,
|
|
35
|
-
tab: null
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/** Flatten sidebar-root children (unwrapping sidebarGroups) to section info. */
|
|
39
|
-
function rootSections(root) {
|
|
40
|
-
const unversioned = root.child;
|
|
41
|
-
const sidebar = unversioned.child;
|
|
42
|
-
const result = [];
|
|
43
|
-
for (const child of sidebar.children) {
|
|
44
|
-
const items = child.type === "sidebarGroup"
|
|
45
|
-
? child.children
|
|
46
|
-
: [child];
|
|
47
|
-
for (const item of items) {
|
|
48
|
-
if (item.type === "section") {
|
|
49
|
-
const childTitles = (item.children ?? []).map((c) => c.title ?? "");
|
|
50
|
-
result.push({ title: item.title ?? "", childTitles });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
/** Count all section nodes in the tree via DFS. */
|
|
57
|
-
function countSectionNodes(root) {
|
|
58
|
-
let count = 0;
|
|
59
|
-
FernNavigation.traverseDF(root, (node) => {
|
|
60
|
-
if (node.type === "section") {
|
|
61
|
-
count++;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
return count;
|
|
65
|
-
}
|
|
66
|
-
/** Find a page node by slug and return its breadcrumb. */
|
|
67
|
-
function breadcrumbForSlug(root, slug) {
|
|
68
|
-
const collector = FernNavigation.NodeCollector.collect(root);
|
|
69
|
-
const found = collector.getSlugMapWithParents().get(FernNavigation.Slug(slug));
|
|
70
|
-
if (found == null) {
|
|
71
|
-
throw new Error(`Slug "${slug}" not found in tree`);
|
|
72
|
-
}
|
|
73
|
-
return createBreadcrumb(found.parents);
|
|
74
|
-
}
|
|
75
|
-
// ── Fix #1: sidebarDepth prevents false root section nesting ─────────────────
|
|
76
|
-
describe("buildFullRootFromSegments — sidebarDepth prevents false nesting", () => {
|
|
77
|
-
/**
|
|
78
|
-
* Reproduces the structure that causes extra breadcrumb links:
|
|
79
|
-
*
|
|
80
|
-
* V1 config (flat):
|
|
81
|
-
* Introduction (skipUrlSlug → sec="")
|
|
82
|
-
* Users (sec="users", sidebarDepth=0)
|
|
83
|
-
* Policies (sec="users/policies", sidebarDepth=0)
|
|
84
|
-
* Verification (sec="users/verification", sidebarDepth=0)
|
|
85
|
-
*
|
|
86
|
-
* Without sidebarDepth, the builder would nest Policies and Verification
|
|
87
|
-
* under Users (since parentSectionPath("users/policies") === "users"),
|
|
88
|
-
* creating extra breadcrumb ancestors.
|
|
89
|
-
*
|
|
90
|
-
* With sidebarDepth=0, they remain flat root peers.
|
|
91
|
-
*/
|
|
92
|
-
function buildFlatRoot() {
|
|
93
|
-
return buildFullRootFromSegments({
|
|
94
|
-
basePath: "docs",
|
|
95
|
-
title: "Test",
|
|
96
|
-
segments: [
|
|
97
|
-
segment({
|
|
98
|
-
segmentHash: "seg-root",
|
|
99
|
-
section: "",
|
|
100
|
-
sortOrder: 0,
|
|
101
|
-
metadata: { type: "tabRoot" }
|
|
102
|
-
}),
|
|
103
|
-
// Root section wrapper (Introduction, skipUrlSlug → sec="")
|
|
104
|
-
segment({
|
|
105
|
-
segmentHash: "seg-intro",
|
|
106
|
-
section: "",
|
|
107
|
-
sortOrder: 1,
|
|
108
|
-
metadata: {
|
|
109
|
-
type: "section",
|
|
110
|
-
title: "Introduction",
|
|
111
|
-
sidebarDepth: 0,
|
|
112
|
-
childIndex: 0,
|
|
113
|
-
pointsTo: "docs/guides/e-wallet"
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
|
-
// Users — depth 0, should be root peer
|
|
117
|
-
segment({
|
|
118
|
-
segmentHash: "seg-users",
|
|
119
|
-
section: "users",
|
|
120
|
-
sortOrder: 2,
|
|
121
|
-
metadata: {
|
|
122
|
-
type: "section",
|
|
123
|
-
title: "Users",
|
|
124
|
-
sidebarDepth: 0,
|
|
125
|
-
childIndex: 1,
|
|
126
|
-
pointsTo: "docs/guides/users/types"
|
|
127
|
-
}
|
|
128
|
-
}),
|
|
129
|
-
// Policies — depth 0, path is "users/policies" but should NOT
|
|
130
|
-
// be nested under Users
|
|
131
|
-
segment({
|
|
132
|
-
segmentHash: "seg-policies",
|
|
133
|
-
section: "users/policies",
|
|
134
|
-
sortOrder: 3,
|
|
135
|
-
metadata: {
|
|
136
|
-
type: "section",
|
|
137
|
-
title: "Policies",
|
|
138
|
-
sidebarDepth: 0,
|
|
139
|
-
childIndex: 2,
|
|
140
|
-
pointsTo: "docs/guides/users/blocked-users"
|
|
141
|
-
}
|
|
142
|
-
}),
|
|
143
|
-
// Verification — depth 0, path is "users/verification" but
|
|
144
|
-
// should NOT be nested under Users
|
|
145
|
-
segment({
|
|
146
|
-
segmentHash: "seg-verification",
|
|
147
|
-
section: "users/verification",
|
|
148
|
-
sortOrder: 4,
|
|
149
|
-
metadata: {
|
|
150
|
-
type: "section",
|
|
151
|
-
title: "User KYC/KYB verification",
|
|
152
|
-
sidebarDepth: 0,
|
|
153
|
-
childIndex: 3
|
|
154
|
-
}
|
|
155
|
-
}),
|
|
156
|
-
// Nested child under Verification (depth 1)
|
|
157
|
-
segment({
|
|
158
|
-
segmentHash: "seg-hosted",
|
|
159
|
-
section: "users/verification/hosted",
|
|
160
|
-
sortOrder: 5,
|
|
161
|
-
metadata: {
|
|
162
|
-
type: "section",
|
|
163
|
-
title: "Flows per user type",
|
|
164
|
-
sidebarDepth: 1,
|
|
165
|
-
childIndex: 0,
|
|
166
|
-
pointsTo: "docs/guides/users/verification/hosted/natural"
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
],
|
|
170
|
-
navBySegment: new Map([
|
|
171
|
-
[
|
|
172
|
-
"seg-root",
|
|
173
|
-
[pageRoute({ fullPath: "docs/guides/e-wallet", title: "E-wallet system", displaySortOrder: 0 })]
|
|
174
|
-
],
|
|
175
|
-
["seg-intro", []],
|
|
176
|
-
["seg-users", [pageRoute({ fullPath: "docs/guides/users/types", title: "User types" })]],
|
|
177
|
-
["seg-policies", [pageRoute({ fullPath: "docs/guides/users/blocked-users", title: "Blocked users" })]],
|
|
178
|
-
[
|
|
179
|
-
"seg-verification",
|
|
180
|
-
[pageRoute({ fullPath: "docs/guides/users/verification", title: "Verification overview" })]
|
|
181
|
-
],
|
|
182
|
-
[
|
|
183
|
-
"seg-hosted",
|
|
184
|
-
[pageRoute({ fullPath: "docs/guides/users/verification/hosted/natural", title: "Natural persons" })]
|
|
185
|
-
]
|
|
186
|
-
])
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
it("preserves flat root sections instead of nesting by slug hierarchy", () => {
|
|
190
|
-
const root = buildFlatRoot();
|
|
191
|
-
const sections = rootSections(root);
|
|
192
|
-
const titles = sections.map((s) => s.title);
|
|
193
|
-
// All depth-0 sections should appear as root peers
|
|
194
|
-
expect(titles).toContain("Users");
|
|
195
|
-
expect(titles).toContain("Policies");
|
|
196
|
-
expect(titles).toContain("User KYC/KYB verification");
|
|
197
|
-
});
|
|
198
|
-
it("does not create extra breadcrumb ancestors for flat sections", () => {
|
|
199
|
-
const root = buildFlatRoot();
|
|
200
|
-
// The verification section's slug is docs/users/verification.
|
|
201
|
-
// Its page lives at docs/docs/guides/users/verification (basePath + fullPath).
|
|
202
|
-
const bc = breadcrumbForSlug(root, "docs/users/verification");
|
|
203
|
-
// With flat root sections, the verification page should have at most
|
|
204
|
-
// one section ancestor, not extra "Users" + "Policies" ancestors.
|
|
205
|
-
const linkedEntries = bc.filter((item) => item.pointsTo != null);
|
|
206
|
-
expect(linkedEntries.length).toBeLessThanOrEqual(1);
|
|
207
|
-
// Total breadcrumb entries should be 1 (just the verification section)
|
|
208
|
-
// not 3 (Introduction + Policies + Verification)
|
|
209
|
-
expect(bc.length).toBeLessThanOrEqual(1);
|
|
210
|
-
});
|
|
211
|
-
it("still nests depth>0 children under their parent section", () => {
|
|
212
|
-
const root = buildFlatRoot();
|
|
213
|
-
// "Flows per user type" (depth 1, sec="users/verification/hosted")
|
|
214
|
-
// should be nested under "User KYC/KYB verification" (depth 0,
|
|
215
|
-
// sec="users/verification")
|
|
216
|
-
const sections = rootSections(root);
|
|
217
|
-
const verification = sections.find((s) => s.title === "User KYC/KYB verification");
|
|
218
|
-
expect(verification).toBeDefined();
|
|
219
|
-
expect(verification.childTitles).toContain("Flows per user type");
|
|
220
|
-
});
|
|
221
|
-
it("does not produce duplicate section nodes", () => {
|
|
222
|
-
const root = buildFlatRoot();
|
|
223
|
-
const totalSections = countSectionNodes(root);
|
|
224
|
-
// 5 unique sections: Introduction, Users, Policies,
|
|
225
|
-
// User KYC/KYB verification, Flows per user type
|
|
226
|
-
expect(totalSections).toBe(5);
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
// ── Backward compatibility: segments without sidebarDepth ────────────────────
|
|
230
|
-
describe("buildFullRootFromSegments — backward compatibility without sidebarDepth", () => {
|
|
231
|
-
it("falls back to path-based hierarchy when sidebarDepth is absent", () => {
|
|
232
|
-
// Old data without sidebarDepth: "users/verification" is correctly
|
|
233
|
-
// nested under "users" via slug hierarchy.
|
|
234
|
-
const root = buildFullRootFromSegments({
|
|
235
|
-
basePath: "docs",
|
|
236
|
-
title: "Test",
|
|
237
|
-
segments: [
|
|
238
|
-
segment({
|
|
239
|
-
segmentHash: "seg-root",
|
|
240
|
-
section: "",
|
|
241
|
-
sortOrder: 0,
|
|
242
|
-
metadata: { type: "tabRoot" }
|
|
243
|
-
}),
|
|
244
|
-
segment({
|
|
245
|
-
segmentHash: "seg-users",
|
|
246
|
-
section: "users",
|
|
247
|
-
sortOrder: 1,
|
|
248
|
-
metadata: { type: "section", title: "Users", childIndex: 0 }
|
|
249
|
-
}),
|
|
250
|
-
segment({
|
|
251
|
-
segmentHash: "seg-verification",
|
|
252
|
-
section: "users/verification",
|
|
253
|
-
sortOrder: 2,
|
|
254
|
-
metadata: { type: "section", title: "Verification", childIndex: 0 }
|
|
255
|
-
})
|
|
256
|
-
],
|
|
257
|
-
navBySegment: new Map([
|
|
258
|
-
["seg-root", [pageRoute({ fullPath: "docs/overview", title: "Overview", displaySortOrder: 0 })]],
|
|
259
|
-
["seg-users", [pageRoute({ fullPath: "docs/users/types", title: "User types" })]],
|
|
260
|
-
[
|
|
261
|
-
"seg-verification",
|
|
262
|
-
[pageRoute({ fullPath: "docs/users/verification/guide", title: "Verification guide" })]
|
|
263
|
-
]
|
|
264
|
-
])
|
|
265
|
-
});
|
|
266
|
-
// Without sidebarDepth, Verification nests under Users (slug-derived)
|
|
267
|
-
const sections = rootSections(root);
|
|
268
|
-
const users = sections.find((s) => s.title === "Users");
|
|
269
|
-
expect(users).toBeDefined();
|
|
270
|
-
expect(users.childTitles).toContain("Verification");
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
//# sourceMappingURL=ledger-root-builder.sidebarDepth.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ledger-root-builder.sidebarDepth.test.js","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.sidebarDepth.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,cAAc,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;;;GAQG;AAEH,SAAS,SAAS,CAAC,IAAoE;IACnF,OAAO;QACH,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE;QAC9F,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CA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,EAAE,CAAC,CAAC,CAAC;gBACjF;oBACI,kBAAkB;oBAClB,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,+BAA+B,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;iBAC1F;aACJ,CAAU;SACd,CAAC,CAAC;QAEH,sEAAsE;QACtE,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,CAAC,KAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ledger-root-builder.skipSlugGroupOrdering.test.d.ts","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import * as FernNavigation from "../index.js";
|
|
3
|
-
import { buildFullRootFromSegments } from "../ledger-root-builder.js";
|
|
4
|
-
function segment(opts) {
|
|
5
|
-
return {
|
|
6
|
-
segmentId: opts.segmentHash,
|
|
7
|
-
segmentHash: opts.segmentHash,
|
|
8
|
-
section: opts.section,
|
|
9
|
-
locale: "en",
|
|
10
|
-
sortOrder: opts.sortOrder,
|
|
11
|
-
hidden: false,
|
|
12
|
-
metadata: opts.metadata,
|
|
13
|
-
product: null,
|
|
14
|
-
version: null,
|
|
15
|
-
variant: null,
|
|
16
|
-
tab: null
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function restRoute(opts) {
|
|
20
|
-
return {
|
|
21
|
-
type: "rest",
|
|
22
|
-
fullPath: opts.fullPath,
|
|
23
|
-
hidden: false,
|
|
24
|
-
displaySortOrder: opts.displaySortOrder,
|
|
25
|
-
metadata: {
|
|
26
|
-
title: opts.title,
|
|
27
|
-
apiDefinitionId: "plant-api-def",
|
|
28
|
-
endpointId: opts.endpointId,
|
|
29
|
-
method: "GET",
|
|
30
|
-
isResponseStream: false
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
describe("buildFullRootFromSegments — skipUrlSlug group package ordering", () => {
|
|
35
|
-
it("preserves DFS order when multiple apiPackage groups share the same section path", () => {
|
|
36
|
-
// Simulates the structure where an apiReference has multiple skipUrlSlug
|
|
37
|
-
// group packages (all sharing section "api") with leaf packages underneath.
|
|
38
|
-
// DFS order: apiRef → groupA → leafA1, leafA2 → groupB → leafB1, leafB2
|
|
39
|
-
const segments = [
|
|
40
|
-
segment({
|
|
41
|
-
segmentHash: "api-ref",
|
|
42
|
-
section: "api",
|
|
43
|
-
sortOrder: 0,
|
|
44
|
-
metadata: { type: "apiReference", title: "API", apiDefinitionId: "plant-api-def" }
|
|
45
|
-
}),
|
|
46
|
-
// Group A (skipUrlSlug — same section as apiReference)
|
|
47
|
-
segment({
|
|
48
|
-
segmentHash: "group-a",
|
|
49
|
-
section: "api",
|
|
50
|
-
sortOrder: 1,
|
|
51
|
-
metadata: {
|
|
52
|
-
type: "apiPackage",
|
|
53
|
-
title: "Soil Management",
|
|
54
|
-
childIndex: 0,
|
|
55
|
-
apiDefinitionId: "plant-api-def"
|
|
56
|
-
}
|
|
57
|
-
}),
|
|
58
|
-
// Leaf A1 — child of group A
|
|
59
|
-
segment({
|
|
60
|
-
segmentHash: "leaf-a1",
|
|
61
|
-
section: "api/soil-types",
|
|
62
|
-
sortOrder: 2,
|
|
63
|
-
metadata: { type: "apiPackage", title: "Soil Types", childIndex: 0, apiDefinitionId: "plant-api-def" }
|
|
64
|
-
}),
|
|
65
|
-
// Leaf A2 — child of group A
|
|
66
|
-
segment({
|
|
67
|
-
segmentHash: "leaf-a2",
|
|
68
|
-
section: "api/soil-nutrients",
|
|
69
|
-
sortOrder: 3,
|
|
70
|
-
metadata: {
|
|
71
|
-
type: "apiPackage",
|
|
72
|
-
title: "Soil Nutrients",
|
|
73
|
-
childIndex: 1,
|
|
74
|
-
apiDefinitionId: "plant-api-def"
|
|
75
|
-
}
|
|
76
|
-
}),
|
|
77
|
-
// Group B (skipUrlSlug — same section as apiReference)
|
|
78
|
-
segment({
|
|
79
|
-
segmentHash: "group-b",
|
|
80
|
-
section: "api",
|
|
81
|
-
sortOrder: 4,
|
|
82
|
-
metadata: { type: "apiPackage", title: "Watering", childIndex: 1, apiDefinitionId: "plant-api-def" }
|
|
83
|
-
}),
|
|
84
|
-
// Leaf B1 — child of group B
|
|
85
|
-
segment({
|
|
86
|
-
segmentHash: "leaf-b1",
|
|
87
|
-
section: "api/watering-schedules",
|
|
88
|
-
sortOrder: 5,
|
|
89
|
-
metadata: {
|
|
90
|
-
type: "apiPackage",
|
|
91
|
-
title: "Watering Schedules",
|
|
92
|
-
childIndex: 0,
|
|
93
|
-
apiDefinitionId: "plant-api-def"
|
|
94
|
-
}
|
|
95
|
-
}),
|
|
96
|
-
// Leaf B2 — child of group B
|
|
97
|
-
segment({
|
|
98
|
-
segmentHash: "leaf-b2",
|
|
99
|
-
section: "api/watering-methods",
|
|
100
|
-
sortOrder: 6,
|
|
101
|
-
metadata: {
|
|
102
|
-
type: "apiPackage",
|
|
103
|
-
title: "Watering Methods",
|
|
104
|
-
childIndex: 1,
|
|
105
|
-
apiDefinitionId: "plant-api-def"
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
];
|
|
109
|
-
const navBySegment = new Map([
|
|
110
|
-
["api-ref", []],
|
|
111
|
-
["group-a", []],
|
|
112
|
-
[
|
|
113
|
-
"leaf-a1",
|
|
114
|
-
[
|
|
115
|
-
restRoute({
|
|
116
|
-
fullPath: "api/soil-types/list",
|
|
117
|
-
title: "List Soil Types",
|
|
118
|
-
endpointId: "listSoilTypes",
|
|
119
|
-
displaySortOrder: 0
|
|
120
|
-
}),
|
|
121
|
-
restRoute({
|
|
122
|
-
fullPath: "api/soil-types/get",
|
|
123
|
-
title: "Get Soil Type",
|
|
124
|
-
endpointId: "getSoilType",
|
|
125
|
-
displaySortOrder: 1
|
|
126
|
-
})
|
|
127
|
-
]
|
|
128
|
-
],
|
|
129
|
-
[
|
|
130
|
-
"leaf-a2",
|
|
131
|
-
[
|
|
132
|
-
restRoute({
|
|
133
|
-
fullPath: "api/soil-nutrients/list",
|
|
134
|
-
title: "List Nutrients",
|
|
135
|
-
endpointId: "listNutrients",
|
|
136
|
-
displaySortOrder: 0
|
|
137
|
-
})
|
|
138
|
-
]
|
|
139
|
-
],
|
|
140
|
-
["group-b", []],
|
|
141
|
-
[
|
|
142
|
-
"leaf-b1",
|
|
143
|
-
[
|
|
144
|
-
restRoute({
|
|
145
|
-
fullPath: "api/watering-schedules/list",
|
|
146
|
-
title: "List Schedules",
|
|
147
|
-
endpointId: "listSchedules",
|
|
148
|
-
displaySortOrder: 0
|
|
149
|
-
})
|
|
150
|
-
]
|
|
151
|
-
],
|
|
152
|
-
[
|
|
153
|
-
"leaf-b2",
|
|
154
|
-
[
|
|
155
|
-
restRoute({
|
|
156
|
-
fullPath: "api/watering-methods/list",
|
|
157
|
-
title: "List Methods",
|
|
158
|
-
endpointId: "listMethods",
|
|
159
|
-
displaySortOrder: 0
|
|
160
|
-
})
|
|
161
|
-
]
|
|
162
|
-
]
|
|
163
|
-
]);
|
|
164
|
-
const root = buildFullRootFromSegments({
|
|
165
|
-
basePath: "docs",
|
|
166
|
-
title: "Plant Docs",
|
|
167
|
-
segments,
|
|
168
|
-
navBySegment
|
|
169
|
-
});
|
|
170
|
-
FernNavigation.utils.mutableUpdatePointsTo(root);
|
|
171
|
-
const sidebar = root.child.child;
|
|
172
|
-
const apiRef = sidebar.children[0];
|
|
173
|
-
expect(apiRef.type).toBe("apiReference");
|
|
174
|
-
// The apiReference should preserve DFS order: soil-types, soil-nutrients,
|
|
175
|
-
// watering-schedules, watering-methods (not round-robin: soil-types,
|
|
176
|
-
// watering-schedules, soil-nutrients, watering-methods).
|
|
177
|
-
const childTitles = apiRef.children.map((c) => c.title);
|
|
178
|
-
expect(childTitles).toEqual(["Soil Types", "Soil Nutrients", "Watering Schedules", "Watering Methods"]);
|
|
179
|
-
});
|
|
180
|
-
it("group packages do not create duplicate root-level nodes when sharing section with apiReference", () => {
|
|
181
|
-
const segments = [
|
|
182
|
-
segment({
|
|
183
|
-
segmentHash: "api-ref",
|
|
184
|
-
section: "api",
|
|
185
|
-
sortOrder: 0,
|
|
186
|
-
metadata: { type: "apiReference", title: "API", apiDefinitionId: "plant-api-def" }
|
|
187
|
-
}),
|
|
188
|
-
segment({
|
|
189
|
-
segmentHash: "group-a",
|
|
190
|
-
section: "api",
|
|
191
|
-
sortOrder: 1,
|
|
192
|
-
metadata: {
|
|
193
|
-
type: "apiPackage",
|
|
194
|
-
title: "Soil Management",
|
|
195
|
-
childIndex: 0,
|
|
196
|
-
apiDefinitionId: "plant-api-def"
|
|
197
|
-
}
|
|
198
|
-
}),
|
|
199
|
-
segment({
|
|
200
|
-
segmentHash: "leaf-a1",
|
|
201
|
-
section: "api/soil-types",
|
|
202
|
-
sortOrder: 2,
|
|
203
|
-
metadata: { type: "apiPackage", title: "Soil Types", childIndex: 0, apiDefinitionId: "plant-api-def" }
|
|
204
|
-
})
|
|
205
|
-
];
|
|
206
|
-
const navBySegment = new Map([
|
|
207
|
-
["api-ref", []],
|
|
208
|
-
["group-a", []],
|
|
209
|
-
[
|
|
210
|
-
"leaf-a1",
|
|
211
|
-
[
|
|
212
|
-
restRoute({
|
|
213
|
-
fullPath: "api/soil-types/list",
|
|
214
|
-
title: "List Soil Types",
|
|
215
|
-
endpointId: "listSoilTypes",
|
|
216
|
-
displaySortOrder: 0
|
|
217
|
-
})
|
|
218
|
-
]
|
|
219
|
-
]
|
|
220
|
-
]);
|
|
221
|
-
const root = buildFullRootFromSegments({
|
|
222
|
-
basePath: "docs",
|
|
223
|
-
title: "Plant Docs",
|
|
224
|
-
segments,
|
|
225
|
-
navBySegment
|
|
226
|
-
});
|
|
227
|
-
FernNavigation.utils.mutableUpdatePointsTo(root);
|
|
228
|
-
const sidebar = root.child.child;
|
|
229
|
-
// Only one apiReference node should exist (groups should not create duplicates)
|
|
230
|
-
const apiRefNodes = sidebar.children.filter((c) => c.type === "apiReference");
|
|
231
|
-
expect(apiRefNodes).toHaveLength(1);
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
//# sourceMappingURL=ledger-root-builder.skipSlugGroupOrdering.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ledger-root-builder.skipSlugGroupOrdering.test.js","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,cAAc,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,SAAS,OAAO,CAAC,IAKhB;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;QACb,GAAG,EAAE,IAAI;KACZ,CAAC;AACN,CAAC;AAED,SAAS,SAAS,CAAC,IAAuF;IACtG,OAAO;QACH,IAAI,EAAE,MAAM;QACZ,QAAQ,EAA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,IAAI,GAAG,yBAAyB,CAAC;YACnC,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,YAAY;YACnB,QAAQ;YACR,YAAY;SACf,CAAC,CAAC;QAEH,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAI,IAAI,CAAC,KAA0D,CAAC,KAAK,CAAC;QAEvF,gFAAgF;QAChF,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;QAC9E,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ledger-root-builder.skipSlugSiblingSection.test.d.ts","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.ts"],"names":[],"mappings":""}
|