@fern-api/fdr-sdk 1.2.80-7b2d1af0a2 → 1.2.81-b610bcc332
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/api-definition/snippets/graphql-snippets.d.ts +19 -0
- package/dist/api-definition/snippets/graphql-snippets.d.ts.map +1 -1
- package/dist/api-definition/snippets/graphql-snippets.js +25 -0
- package/dist/api-definition/snippets/graphql-snippets.js.map +1 -1
- package/dist/js/api-definition/index.js +21 -0
- package/dist/js/api-definition/index.js.map +1 -1
- package/dist/js/api-definition/index.mjs +20 -0
- package/dist/js/api-definition/index.mjs.map +1 -1
- package/dist/js/client/FdrClient.js +13 -3
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +13 -3
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/client/types.js.map +1 -1
- package/dist/js/client/types.mjs.map +1 -1
- package/dist/js/converters/index.js +59 -25
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +59 -25
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +72 -28
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +72 -28
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +59 -25
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +59 -25
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +29 -5
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +29 -5
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/navigation/types/latest.js.map +1 -1
- package/dist/js/navigation/types/latest.mjs.map +1 -1
- package/dist/js/navigation/types/v1.js.map +1 -1
- package/dist/js/navigation/types/v1.mjs.map +1 -1
- package/dist/js/orpc-client.js +13 -3
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +13 -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 +185 -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 +41 -5
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/navigation/types/latest.d.ts +1 -0
- package/dist/navigation/types/latest.d.ts.map +1 -1
- package/dist/navigation/types/v1.d.ts +1 -0
- package/dist/navigation/types/v1.d.ts.map +1 -1
- package/dist/navigation/utils/__test__/resolveCurrentTab.test.d.ts +2 -0
- package/dist/navigation/utils/__test__/resolveCurrentTab.test.d.ts.map +1 -0
- package/dist/navigation/utils/__test__/resolveCurrentTab.test.js +70 -0
- package/dist/navigation/utils/__test__/resolveCurrentTab.test.js.map +1 -0
- package/dist/navigation/utils/findNode.d.ts.map +1 -1
- package/dist/navigation/utils/findNode.js +3 -30
- package/dist/navigation/utils/findNode.js.map +1 -1
- package/dist/navigation/utils/index.d.ts +1 -0
- package/dist/navigation/utils/index.d.ts.map +1 -1
- package/dist/navigation/utils/index.js +1 -0
- package/dist/navigation/utils/index.js.map +1 -1
- package/dist/navigation/utils/resolveCurrentTab.d.ts +26 -0
- package/dist/navigation/utils/resolveCurrentTab.d.ts.map +1 -0
- package/dist/navigation/utils/resolveCurrentTab.js +60 -0
- package/dist/navigation/utils/resolveCurrentTab.js.map +1 -0
- package/dist/orpc-client/docs-ledger/contract.d.ts +5126 -0
- package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.js +17 -3
- package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
- package/dist/orpc-client/docs-ledger/ledger-manifest.d.ts +7356 -0
- package/dist/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/dist/types/api-definition/snippets/graphql-snippets.d.ts +19 -0
- package/dist/types/api-definition/snippets/graphql-snippets.d.ts.map +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/navigation/types/latest.d.ts +1 -0
- package/dist/types/navigation/types/latest.d.ts.map +1 -1
- package/dist/types/navigation/types/v1.d.ts +1 -0
- package/dist/types/navigation/types/v1.d.ts.map +1 -1
- package/dist/types/navigation/utils/__test__/resolveCurrentTab.test.d.ts +2 -0
- package/dist/types/navigation/utils/__test__/resolveCurrentTab.test.d.ts.map +1 -0
- package/dist/types/navigation/utils/findNode.d.ts.map +1 -1
- package/dist/types/navigation/utils/index.d.ts +1 -0
- package/dist/types/navigation/utils/index.d.ts.map +1 -1
- package/dist/types/navigation/utils/resolveCurrentTab.d.ts +26 -0
- package/dist/types/navigation/utils/resolveCurrentTab.d.ts.map +1 -0
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +5126 -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 +7356 -0
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/js/index.mjs
CHANGED
|
@@ -157,6 +157,7 @@ __export(api_definition_exports, {
|
|
|
157
157
|
WithDescriptionSchema: () => WithDescriptionSchema,
|
|
158
158
|
WithNamespaceSchema: () => WithNamespaceSchema,
|
|
159
159
|
buildEndpointUrl: () => buildEndpointUrl,
|
|
160
|
+
buildGraphqlExamplesForOperation: () => buildGraphqlExamplesForOperation,
|
|
160
161
|
buildRequestUrl: () => buildRequestUrl,
|
|
161
162
|
buildSdkSnippetRequest: () => buildSdkSnippetRequest,
|
|
162
163
|
cleanLanguage: () => cleanLanguage,
|
|
@@ -5414,6 +5415,25 @@ function getHarRequestBasicAuth(endpoint, auths) {
|
|
|
5414
5415
|
}
|
|
5415
5416
|
|
|
5416
5417
|
// src/api-definition/snippets/graphql-snippets.ts
|
|
5418
|
+
function buildGraphqlExamplesForOperation(operation, types) {
|
|
5419
|
+
if (operation.examples != null && operation.examples.length > 0) {
|
|
5420
|
+
return operation.examples.map((ex) => ({
|
|
5421
|
+
name: ex.name ?? void 0,
|
|
5422
|
+
description: ex.description ?? void 0,
|
|
5423
|
+
query: ex.query,
|
|
5424
|
+
variables: ex.variables ?? void 0,
|
|
5425
|
+
response: ex.response
|
|
5426
|
+
}));
|
|
5427
|
+
}
|
|
5428
|
+
const generated = generateGraphQlSnippet({ operation, types });
|
|
5429
|
+
return [
|
|
5430
|
+
{
|
|
5431
|
+
query: generated.query,
|
|
5432
|
+
variables: Object.keys(generated.variables).length > 0 ? generated.variables : void 0,
|
|
5433
|
+
response: generated.response
|
|
5434
|
+
}
|
|
5435
|
+
];
|
|
5436
|
+
}
|
|
5417
5437
|
var snippetCache = /* @__PURE__ */ new WeakMap();
|
|
5418
5438
|
function generateGraphQlSnippet(context) {
|
|
5419
5439
|
const cached = snippetCache.get(context.operation);
|
|
@@ -9360,6 +9380,13 @@ var FeatureFlagMetadataSchema = z21.array(
|
|
|
9360
9380
|
);
|
|
9361
9381
|
var LinkTargetSchema2 = z21.enum(["_blank", "_self", "_parent", "_top"]);
|
|
9362
9382
|
var CollapsedSchema = z21.union([z21.boolean(), z21.literal("open-by-default")]);
|
|
9383
|
+
var PlaygroundSettingsSchema = z21.object({
|
|
9384
|
+
hidden: z21.boolean().optional(),
|
|
9385
|
+
environments: z21.array(z21.string()).optional(),
|
|
9386
|
+
button: z21.object({ href: z21.string().optional() }).optional(),
|
|
9387
|
+
"limit-websocket-messages-per-connection": z21.number().optional(),
|
|
9388
|
+
"send-optional-defaults": z21.boolean().optional()
|
|
9389
|
+
});
|
|
9363
9390
|
var LedgerAvailabilitySchema = z21.union([
|
|
9364
9391
|
AvailabilitySchema,
|
|
9365
9392
|
z21.enum([
|
|
@@ -9401,7 +9428,8 @@ var NodeMetadataFields = {
|
|
|
9401
9428
|
var ApiNodeMetadataFields = {
|
|
9402
9429
|
...NodeMetadataFields,
|
|
9403
9430
|
apiDefinitionId: z21.string(),
|
|
9404
|
-
availability: LedgerAvailabilitySchema.optional()
|
|
9431
|
+
availability: LedgerAvailabilitySchema.optional(),
|
|
9432
|
+
playground: PlaygroundSettingsSchema.optional()
|
|
9405
9433
|
};
|
|
9406
9434
|
var LedgerSegmentDetailMetadataObjectSchema = LedgerMetadataBaseSchema.extend({
|
|
9407
9435
|
slug: z21.string().optional(),
|
|
@@ -9451,7 +9479,8 @@ var LedgerSegmentMetadataObjectSchema = z21.discriminatedUnion("type", [
|
|
|
9451
9479
|
hideTitle: z21.boolean().optional(),
|
|
9452
9480
|
viewers: MetadataStringArraySchema.optional(),
|
|
9453
9481
|
orphaned: z21.boolean().optional(),
|
|
9454
|
-
featureFlags: FeatureFlagMetadataSchema.optional()
|
|
9482
|
+
featureFlags: FeatureFlagMetadataSchema.optional(),
|
|
9483
|
+
playground: PlaygroundSettingsSchema.optional()
|
|
9455
9484
|
}),
|
|
9456
9485
|
LedgerMetadataBaseSchema.extend({
|
|
9457
9486
|
type: z21.literal("apiPackage"),
|
|
@@ -9465,7 +9494,8 @@ var LedgerSegmentMetadataObjectSchema = z21.discriminatedUnion("type", [
|
|
|
9465
9494
|
pointsTo: z21.string().optional(),
|
|
9466
9495
|
viewers: MetadataStringArraySchema.optional(),
|
|
9467
9496
|
orphaned: z21.boolean().optional(),
|
|
9468
|
-
featureFlags: FeatureFlagMetadataSchema.optional()
|
|
9497
|
+
featureFlags: FeatureFlagMetadataSchema.optional(),
|
|
9498
|
+
playground: PlaygroundSettingsSchema.optional()
|
|
9469
9499
|
}),
|
|
9470
9500
|
LedgerMetadataBaseSchema.extend({
|
|
9471
9501
|
type: z21.literal("changelog"),
|
|
@@ -19635,8 +19665,10 @@ __export(utils_exports, {
|
|
|
19635
19665
|
createBreadcrumb: () => createBreadcrumb,
|
|
19636
19666
|
findNode: () => findNode,
|
|
19637
19667
|
getApiReferenceId: () => getApiReferenceId,
|
|
19668
|
+
getEnclosingTabbedNode: () => getEnclosingTabbedNode,
|
|
19638
19669
|
getNoIndexFromFrontmatter: () => getNoIndexFromFrontmatter,
|
|
19639
19670
|
mutableUpdatePointsTo: () => mutableUpdatePointsTo,
|
|
19671
|
+
resolveCurrentTab: () => resolveCurrentTab,
|
|
19640
19672
|
stripSyntheticSegments: () => stripSyntheticSegments,
|
|
19641
19673
|
toApis: () => toApis,
|
|
19642
19674
|
toPages: () => toPages,
|
|
@@ -19782,6 +19814,41 @@ function createBreadcrumb(nodes) {
|
|
|
19782
19814
|
|
|
19783
19815
|
// src/navigation/utils/findNode.ts
|
|
19784
19816
|
import { escapeRegExp as escapeRegExp3 } from "es-toolkit/string";
|
|
19817
|
+
|
|
19818
|
+
// src/navigation/utils/resolveCurrentTab.ts
|
|
19819
|
+
var isHeaderTab = (child) => child.type === "tab" || child.type === "changelog";
|
|
19820
|
+
function getEnclosingTabbedNode(parents) {
|
|
19821
|
+
const versionChild = (parents.find(isVersionNode) ?? parents.find(isUnversionedNode))?.child;
|
|
19822
|
+
return parents.find(isTabbedNode) ?? (versionChild != null && isTabbedNode(versionChild) ? versionChild : void 0);
|
|
19823
|
+
}
|
|
19824
|
+
function resolveCurrentTab(node, parents) {
|
|
19825
|
+
const tabbedNode = getEnclosingTabbedNode(parents);
|
|
19826
|
+
if (tabbedNode == null) {
|
|
19827
|
+
return void 0;
|
|
19828
|
+
}
|
|
19829
|
+
const parentsAndNode = [...parents, node];
|
|
19830
|
+
const tabbedNodeIndex = parentsAndNode.indexOf(tabbedNode);
|
|
19831
|
+
const currentTabNode = tabbedNodeIndex !== -1 ? parentsAndNode[tabbedNodeIndex + 1] : void 0;
|
|
19832
|
+
let currentTab = currentTabNode?.type === "tab" || currentTabNode?.type === "changelog" ? currentTabNode : void 0;
|
|
19833
|
+
if (currentTab == null) {
|
|
19834
|
+
for (const tab of tabbedNode.children) {
|
|
19835
|
+
if (tab.type === "tab" && tab.pointsTo === node.slug) {
|
|
19836
|
+
currentTab = tab;
|
|
19837
|
+
break;
|
|
19838
|
+
}
|
|
19839
|
+
if (tab.type === "changelog" && tab.slug === node.slug) {
|
|
19840
|
+
currentTab = tab;
|
|
19841
|
+
break;
|
|
19842
|
+
}
|
|
19843
|
+
}
|
|
19844
|
+
if (currentTab == null && node.type === "landingPage") {
|
|
19845
|
+
currentTab = tabbedNode.children.find(isHeaderTab);
|
|
19846
|
+
}
|
|
19847
|
+
}
|
|
19848
|
+
return currentTab;
|
|
19849
|
+
}
|
|
19850
|
+
|
|
19851
|
+
// src/navigation/utils/findNode.ts
|
|
19785
19852
|
function findNode(root, slug) {
|
|
19786
19853
|
const collector = NodeCollector.collect(root);
|
|
19787
19854
|
const found = collector.getSlugMapWithParents().get(canonicalSlugKey(slug));
|
|
@@ -19815,7 +19882,6 @@ function findNode(root, slug) {
|
|
|
19815
19882
|
const currentProduct = found.parents.find(isProductNode);
|
|
19816
19883
|
const currentVersion = found.parents.find(isVersionNode);
|
|
19817
19884
|
const unversionedNode = found.parents.find(isUnversionedNode);
|
|
19818
|
-
const versionChild = (currentVersion ?? unversionedNode)?.child;
|
|
19819
19885
|
const currentVariant = found.parents.find(isVariantNode);
|
|
19820
19886
|
if (!sidebar && currentVersion != null) {
|
|
19821
19887
|
if (isSidebarRootNode(currentVersion.child)) {
|
|
@@ -19823,13 +19889,9 @@ function findNode(root, slug) {
|
|
|
19823
19889
|
}
|
|
19824
19890
|
}
|
|
19825
19891
|
const landingPage = (currentProductGroup ?? currentVersion ?? unversionedNode)?.landingPage;
|
|
19826
|
-
const tabbedNode = found.parents
|
|
19827
|
-
(versionChild != null && isTabbedNode(versionChild) ? versionChild : void 0);
|
|
19892
|
+
const tabbedNode = getEnclosingTabbedNode(found.parents);
|
|
19828
19893
|
const apiReference = found.parents.find(isApiReferenceNode) ?? (found.node.type === "apiReference" ? found.node : void 0);
|
|
19829
19894
|
if (navigation_exports.isPage(found.node)) {
|
|
19830
|
-
const parentsAndNode = [...found.parents, found.node];
|
|
19831
|
-
const tabbedNodeIndex = parentsAndNode.findIndex((node) => node === tabbedNode);
|
|
19832
|
-
const currentTabNode = tabbedNodeIndex !== -1 ? parentsAndNode[tabbedNodeIndex + 1] : void 0;
|
|
19833
19895
|
const products = collector.getProductNodes().map((node) => {
|
|
19834
19896
|
if (node.default) {
|
|
19835
19897
|
if (node.id === currentProduct?.id) {
|
|
@@ -19857,25 +19919,7 @@ function findNode(root, slug) {
|
|
|
19857
19919
|
}
|
|
19858
19920
|
return node;
|
|
19859
19921
|
});
|
|
19860
|
-
|
|
19861
|
-
if (currentTab == null && tabbedNode != null) {
|
|
19862
|
-
for (const tab of tabbedNode.children) {
|
|
19863
|
-
if (tab.type === "tab" && tab.pointsTo === found.node.slug) {
|
|
19864
|
-
currentTab = tab;
|
|
19865
|
-
break;
|
|
19866
|
-
}
|
|
19867
|
-
if (tab.type === "changelog" && tab.slug === found.node.slug) {
|
|
19868
|
-
currentTab = tab;
|
|
19869
|
-
break;
|
|
19870
|
-
}
|
|
19871
|
-
}
|
|
19872
|
-
if (currentTab == null && found.node.type === "landingPage") {
|
|
19873
|
-
const firstTab = tabbedNode.children.find((tab) => tab.type === "tab" || tab.type === "changelog");
|
|
19874
|
-
if (firstTab != null && (firstTab.type === "tab" || firstTab.type === "changelog")) {
|
|
19875
|
-
currentTab = firstTab;
|
|
19876
|
-
}
|
|
19877
|
-
}
|
|
19878
|
-
}
|
|
19922
|
+
const currentTab = resolveCurrentTab(found.node, found.parents);
|
|
19879
19923
|
const slugPrefix = currentVariant?.slug ?? (currentProduct?.type === "product" ? currentProduct.slug : void 0) ?? currentVersion?.slug ?? root.slug;
|
|
19880
19924
|
const unversionedSlug = navigation_exports.Slug(
|
|
19881
19925
|
found.node.slug.replace(new RegExp(`^${escapeRegExp3(slugPrefix)}/`), "")
|