@fern-api/fdr-sdk 1.2.79-88e3cf0ca5 → 1.2.80-1fdc01b49c
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 +12 -3
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +12 -3
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/index.js +12 -3
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +12 -3
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +28 -5
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +28 -5
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/orpc-client.js +12 -3
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +12 -3
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.playgroundPreservation.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.playgroundPreservation.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.playgroundPreservation.test.js +154 -0
- package/dist/navigation/__test__/ledger-root-builder.playgroundPreservation.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +40 -5
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.d.ts +4591 -0
- package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.js +16 -3
- package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
- package/dist/orpc-client/docs-ledger/ledger-manifest.d.ts +6584 -0
- package/dist/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.playgroundPreservation.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.playgroundPreservation.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +4591 -0
- package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts +6584 -0
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-root-builder.playgroundPreservation.test.d.ts","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.playgroundPreservation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { buildFullRootFromSegments } from "../ledger-root-builder.js";
|
|
3
|
+
/**
|
|
4
|
+
* Regression test for docs.yml `playground` settings (e.g. `playground.hidden: true`)
|
|
5
|
+
* being dropped when the navigation tree is rebuilt from ledger segments.
|
|
6
|
+
*
|
|
7
|
+
* The ledger rebuild (`ledger-root-builder.ts`) currently hardcodes `playground: undefined`
|
|
8
|
+
* on apiReference / apiPackage / endpoint / webSocket / graphql nodes, and the flatten step
|
|
9
|
+
* never writes `playground` into segment metadata. As a result, `playground.hidden` (and every
|
|
10
|
+
* other playground setting) is a no-op on any ledger-backed (published) docs site, even though
|
|
11
|
+
* it works locally under `fern docs dev` (which uses the legacy DocsV1Read path).
|
|
12
|
+
*
|
|
13
|
+
* These tests assert the DESIRED behavior: playground settings present in segment / route
|
|
14
|
+
* metadata are read back onto the rebuilt nodes. They fail before the fix (value comes back
|
|
15
|
+
* `undefined`) and pass once the builder reads `playground` from metadata.
|
|
16
|
+
*/
|
|
17
|
+
function segment(opts) {
|
|
18
|
+
return {
|
|
19
|
+
segmentId: opts.segmentHash,
|
|
20
|
+
segmentHash: opts.segmentHash,
|
|
21
|
+
section: opts.section,
|
|
22
|
+
locale: "en",
|
|
23
|
+
sortOrder: opts.sortOrder,
|
|
24
|
+
hidden: false,
|
|
25
|
+
metadata: opts.metadata,
|
|
26
|
+
product: null,
|
|
27
|
+
version: null,
|
|
28
|
+
variant: null,
|
|
29
|
+
tab: null
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function restRoute(opts) {
|
|
33
|
+
return {
|
|
34
|
+
type: "rest",
|
|
35
|
+
fullPath: opts.fullPath,
|
|
36
|
+
hidden: false,
|
|
37
|
+
metadata: {
|
|
38
|
+
title: opts.title,
|
|
39
|
+
endpointId: opts.endpointId,
|
|
40
|
+
method: opts.method,
|
|
41
|
+
apiDefinitionId: "api-def-1",
|
|
42
|
+
...(opts.playground != null ? { playground: opts.playground } : {})
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
function collectByType(node, targetType) {
|
|
48
|
+
const results = [];
|
|
49
|
+
if (node == null || typeof node !== "object") {
|
|
50
|
+
return results;
|
|
51
|
+
}
|
|
52
|
+
if (node.type === targetType) {
|
|
53
|
+
results.push(node);
|
|
54
|
+
}
|
|
55
|
+
for (const child of node.children ?? []) {
|
|
56
|
+
results.push(...collectByType(child, targetType));
|
|
57
|
+
}
|
|
58
|
+
if (node.child != null) {
|
|
59
|
+
results.push(...collectByType(node.child, targetType));
|
|
60
|
+
}
|
|
61
|
+
return results;
|
|
62
|
+
}
|
|
63
|
+
describe("playground preservation on ledger rebuild", () => {
|
|
64
|
+
it("reads playground.hidden from apiReference segment metadata", () => {
|
|
65
|
+
const root = buildFullRootFromSegments({
|
|
66
|
+
basePath: "",
|
|
67
|
+
title: "Test",
|
|
68
|
+
segments: [
|
|
69
|
+
segment({
|
|
70
|
+
segmentHash: "seg-api",
|
|
71
|
+
section: "api",
|
|
72
|
+
sortOrder: 0,
|
|
73
|
+
metadata: {
|
|
74
|
+
type: "apiReference",
|
|
75
|
+
title: "API",
|
|
76
|
+
apiDefinitionId: "api-def-1",
|
|
77
|
+
playground: { hidden: true }
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
],
|
|
81
|
+
navBySegment: new Map([
|
|
82
|
+
[
|
|
83
|
+
"seg-api",
|
|
84
|
+
[
|
|
85
|
+
restRoute({
|
|
86
|
+
fullPath: "api/create",
|
|
87
|
+
title: "Create",
|
|
88
|
+
endpointId: "create",
|
|
89
|
+
method: "POST"
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
]
|
|
93
|
+
])
|
|
94
|
+
});
|
|
95
|
+
const apis = collectByType(root, "apiReference");
|
|
96
|
+
expect(apis).toHaveLength(1);
|
|
97
|
+
expect(apis[0].playground).toEqual({ hidden: true });
|
|
98
|
+
});
|
|
99
|
+
it("reads playground.hidden from endpoint route metadata", () => {
|
|
100
|
+
const root = buildFullRootFromSegments({
|
|
101
|
+
basePath: "",
|
|
102
|
+
title: "Test",
|
|
103
|
+
segments: [
|
|
104
|
+
segment({
|
|
105
|
+
segmentHash: "seg-api",
|
|
106
|
+
section: "api",
|
|
107
|
+
sortOrder: 0,
|
|
108
|
+
metadata: { type: "apiReference", title: "API", apiDefinitionId: "api-def-1" }
|
|
109
|
+
})
|
|
110
|
+
],
|
|
111
|
+
navBySegment: new Map([
|
|
112
|
+
[
|
|
113
|
+
"seg-api",
|
|
114
|
+
[
|
|
115
|
+
restRoute({
|
|
116
|
+
fullPath: "api/create",
|
|
117
|
+
title: "Create",
|
|
118
|
+
endpointId: "create",
|
|
119
|
+
method: "POST",
|
|
120
|
+
playground: { hidden: true }
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
]
|
|
124
|
+
])
|
|
125
|
+
});
|
|
126
|
+
const endpoints = collectByType(root, "endpoint");
|
|
127
|
+
expect(endpoints).toHaveLength(1);
|
|
128
|
+
expect(endpoints[0].playground).toEqual({ hidden: true });
|
|
129
|
+
});
|
|
130
|
+
it("leaves playground undefined when metadata carries none", () => {
|
|
131
|
+
const root = buildFullRootFromSegments({
|
|
132
|
+
basePath: "",
|
|
133
|
+
title: "Test",
|
|
134
|
+
segments: [
|
|
135
|
+
segment({
|
|
136
|
+
segmentHash: "seg-api",
|
|
137
|
+
section: "api",
|
|
138
|
+
sortOrder: 0,
|
|
139
|
+
metadata: { type: "apiReference", title: "API", apiDefinitionId: "api-def-1" }
|
|
140
|
+
})
|
|
141
|
+
],
|
|
142
|
+
navBySegment: new Map([
|
|
143
|
+
[
|
|
144
|
+
"seg-api",
|
|
145
|
+
[restRoute({ fullPath: "api/list", title: "List", endpointId: "list", method: "GET" })]
|
|
146
|
+
]
|
|
147
|
+
])
|
|
148
|
+
});
|
|
149
|
+
const endpoints = collectByType(root, "endpoint");
|
|
150
|
+
expect(endpoints).toHaveLength(1);
|
|
151
|
+
expect(endpoints[0].playground).toBeUndefined();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=ledger-root-builder.playgroundPreservation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-root-builder.playgroundPreservation.test.js","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.playgroundPreservation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AAEH,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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;;;GAMG;AACH,MAAM,MAAM,WAAW,GACjB,cAAc,CAAC,YAAY,GAC3B,cAAc,CAAC,WAAW,GAC1B,cAAc,CAAC,aAAa,GAC5B,cAAc,CAAC,QAAQ,GACvB,cAAc,CAAC,WAAW,CAAC;AAOjC;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,MAAM,GAC/B,WAAW,GAAG,SAAS,CAGzB;AAqLD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,QAAQ,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,MAAM,GAC/B,WAAW,EAAE,CAKf;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,SAAS,CASxF;AA2bD;;;;;;GAMG;AACH,2CAA2C;AAC3C,wBAAgB,kBAAkB,CAC9B,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,WAAW,EAAE,EACxB,MAAM,EAAE,QAAQ,EAAE,GACnB,cAAc,CAAC,eAAe,EAAE,CAsElC;AA21BD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CA0F5F"}
|
|
@@ -127,6 +127,41 @@ function metaCollapsed(metadata) {
|
|
|
127
127
|
}
|
|
128
128
|
return undefined;
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Read docs.yml `playground` settings from a metadata blob. The flatten step
|
|
132
|
+
* (docsPublishTransform) writes the nav node's `playground` object verbatim into
|
|
133
|
+
* segment / api-artifact metadata; here we read it back and coerce the known
|
|
134
|
+
* fields onto a branded PlaygroundSettings. Returns undefined when absent, so the
|
|
135
|
+
* nearest-apiReference inheritance in withPrunedNavigation still applies to leaves.
|
|
136
|
+
*/
|
|
137
|
+
function metaPlayground(metadata) {
|
|
138
|
+
if (metadata == null || typeof metadata !== "object" || !("playground" in metadata)) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
const raw = metadata.playground;
|
|
142
|
+
if (raw == null || typeof raw !== "object") {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
const pg = raw;
|
|
146
|
+
const environments = Array.isArray(pg.environments)
|
|
147
|
+
? pg.environments.filter((x) => typeof x === "string")
|
|
148
|
+
: undefined;
|
|
149
|
+
// Preserve a button object whenever one is present (matching the schema, where
|
|
150
|
+
// `href` is optional); only its `href` is coerced to a branded Url.
|
|
151
|
+
const hasButton = pg.button != null && typeof pg.button === "object";
|
|
152
|
+
const buttonHref = hasButton ? pg.button.href : undefined;
|
|
153
|
+
const limit = pg["limit-websocket-messages-per-connection"];
|
|
154
|
+
return {
|
|
155
|
+
environments: environments != null && environments.length > 0
|
|
156
|
+
? environments.map((e) => FernNavigation.EnvironmentId(e))
|
|
157
|
+
: undefined,
|
|
158
|
+
button: hasButton
|
|
159
|
+
? { href: typeof buttonHref === "string" ? FernNavigation.Url(buttonHref) : undefined }
|
|
160
|
+
: undefined,
|
|
161
|
+
"limit-websocket-messages-per-connection": typeof limit === "number" ? limit : undefined,
|
|
162
|
+
hidden: typeof pg.hidden === "boolean" ? pg.hidden : undefined
|
|
163
|
+
};
|
|
164
|
+
}
|
|
130
165
|
/** Extract a string array from a metadata blob (e.g. page-level `viewers`). */
|
|
131
166
|
function metaStrArr(metadata, key) {
|
|
132
167
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
@@ -316,7 +351,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId) {
|
|
|
316
351
|
apiDefinitionId,
|
|
317
352
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
318
353
|
availability: metaAvailability(md),
|
|
319
|
-
playground:
|
|
354
|
+
playground: metaPlayground(md)
|
|
320
355
|
};
|
|
321
356
|
}
|
|
322
357
|
if (route.type === "webhook") {
|
|
@@ -345,7 +380,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId) {
|
|
|
345
380
|
webSocketId: FernNavigation.WebSocketId(webSocketId),
|
|
346
381
|
apiDefinitionId,
|
|
347
382
|
availability: metaAvailability(md),
|
|
348
|
-
playground:
|
|
383
|
+
playground: metaPlayground(md)
|
|
349
384
|
};
|
|
350
385
|
}
|
|
351
386
|
if (route.type === "grpc") {
|
|
@@ -377,7 +412,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId) {
|
|
|
377
412
|
graphqlOperationIds: undefined,
|
|
378
413
|
apiDefinitionId,
|
|
379
414
|
availability: metaAvailability(md),
|
|
380
|
-
playground:
|
|
415
|
+
playground: metaPlayground(md)
|
|
381
416
|
};
|
|
382
417
|
}
|
|
383
418
|
return undefined;
|
|
@@ -812,7 +847,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
812
847
|
// compute it via followRedirect, matching v2 behavior.
|
|
813
848
|
pointsTo: undefined,
|
|
814
849
|
children,
|
|
815
|
-
playground:
|
|
850
|
+
playground: metaPlayground(seg.metadata)
|
|
816
851
|
};
|
|
817
852
|
}
|
|
818
853
|
/**
|
|
@@ -930,7 +965,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
930
965
|
pointsTo: undefined,
|
|
931
966
|
children,
|
|
932
967
|
changelog,
|
|
933
|
-
playground:
|
|
968
|
+
playground: metaPlayground(seg.metadata),
|
|
934
969
|
postmanCollectionUrl: undefined
|
|
935
970
|
};
|
|
936
971
|
}
|