Skip to content

Commit

Permalink
Merge branch 'main' into chdeskur/embed
Browse files Browse the repository at this point in the history
  • Loading branch information
chdeskur authored Jan 15, 2025
2 parents bcaff8a + 785f1e7 commit 61b5ccd
Show file tree
Hide file tree
Showing 60 changed files with 839 additions and 432 deletions.
11 changes: 11 additions & 0 deletions fern/apis/fdr/definition/navigation/latest/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ types:
extends:
- WithNodeId
- WithPermissions
- WithFeatureFlags
properties:
title:
type: string
Expand Down Expand Up @@ -373,6 +374,16 @@ types:
properties:
pointsTo: optional<Slug>

WithFeatureFlags:
properties:
featureFlags: optional<list<FeatureFlagOptions>>

FeatureFlagOptions:
properties:
flag: string
default: optional<unknown>
match: optional<unknown>

BreadcrumbItem:
properties:
title: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ exports[`hume > gets navigation root for /support 1`] = `
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": false,
"icon": undefined,
"id": "root.uv.docs.docs.introduction.support",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`no-version-no-tabs > gets navigation root for /docs/api/page-6 1`] = `
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.section-3.page-6",
Expand Down Expand Up @@ -51,6 +52,7 @@ exports[`no-version-no-tabs > gets navigation root for /docs/api/section-2 1`] =
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.section-2.page-3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ exports[`no-version-yes-tabs > gets navigation root for /docs/api/page-2 1`] = `
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.tab-1.tab-1.section-1.page-2",
Expand Down Expand Up @@ -54,6 +55,7 @@ exports[`no-version-yes-tabs > gets navigation root for /docs/api/tab-1 1`] = `
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.tab-1.tab-1.section-3.page-6",
Expand All @@ -75,6 +77,7 @@ exports[`no-version-yes-tabs > gets navigation root for /docs/api/tab-2 1`] = `
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.tab-2.tab-2.section-5.page-10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ exports[`polytomic > gets navigation root for /2024-02-08/guides/introduction 1`
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": false,
"icon": undefined,
"id": "root..2024-02-08.uv.guides.guides.getting-started.introduction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ exports[`primer > gets navigation root for /docs/api/v2.1/api-reference/client-s
"availability": undefined,
"canonicalSlug": "docs/api/v2.3/api-reference/client-session-api/retrieve-client-side-token",
"endpointId": "subpackage_clientSessionApi.retrieveClientSideToken",
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root..v2.1.uv.api-reference.subpackage_clientSessionApi.subpackage_clientSessionApi.retrieveClientSideToken",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ exports[`uploadcare > gets navigation root for /docs/file-management/overview 1`
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.docs.docs.file-management.overview",
Expand Down Expand Up @@ -123,6 +124,7 @@ exports[`uploadcare > gets navigation root for /docs/introduction/intro 1`] = `
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root.uv.docs.docs.introduction.intro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-1/page
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root..version-1.uv.section-3.page-5",
Expand Down Expand Up @@ -97,6 +98,7 @@ exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-1/vers
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root..version-1.uv.section-3.page-6",
Expand Down Expand Up @@ -125,6 +127,7 @@ exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-2/vers
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root..version-2.uv.section-5.page-9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ exports[`yes-version-yes-tabs > gets navigation root for /docs/api/version-1/sec
{
"authed": undefined,
"canonicalSlug": undefined,
"featureFlags": undefined,
"hidden": undefined,
"icon": undefined,
"id": "root..version-1.uv.tab-1.tab-1.section-2.page-3",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 28 additions & 12 deletions packages/fdr-sdk/src/navigation/migrators/v1ToV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class FernNavigationV1ToLatest {
viewers: node.viewers,
orphaned: node.orphaned,
roles: node.roles,
featureFlags: undefined,
};

return latest;
Expand All @@ -61,11 +62,11 @@ export class FernNavigationV1ToLatest {
/**
* the default version should be the preferred canonical slug
*/
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const defaultVersion = this.version(node.children[defaultVersionIdx]!, [
...parents,
node,
]);
const defaultVersionV1 = node.children[defaultVersionIdx];
if (!defaultVersionV1) {
throw new Error("default version is undefined");
}
const defaultVersion = this.version(defaultVersionV1, [...parents, node]);

/**
* visit the rest of the children, but splice the default version in its original position
Expand Down Expand Up @@ -118,6 +119,7 @@ export class FernNavigationV1ToLatest {
pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand All @@ -144,6 +146,7 @@ export class FernNavigationV1ToLatest {
noindex: node.noindex,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -183,13 +186,14 @@ export class FernNavigationV1ToLatest {
pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};

public link = (
node: FernNavigation.V1.LinkNode,
parents: FernNavigation.V1.NavigationNode[]
_parents: FernNavigation.V1.NavigationNode[]
): FernNavigation.LinkNode => {
const latest: FernNavigation.LinkNode = {
type: "link",
Expand Down Expand Up @@ -247,11 +251,11 @@ export class FernNavigationV1ToLatest {
/**
* the default product should be the preferred canonical slug
*/
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const defaultProduct = this.product(node.children[defaultProductIdx]!, [
...parents,
node,
]);
const defaultProductV1 = node.children[defaultProductIdx];
if (!defaultProductV1) {
throw new Error("default product is undefined");
}
const defaultProduct = this.product(defaultProductV1, [...parents, node]);

/**
* visit the rest of the children, but splice the default product in its original position
Expand Down Expand Up @@ -300,6 +304,7 @@ export class FernNavigationV1ToLatest {
subtitle: node.subtitle,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -358,6 +363,7 @@ export class FernNavigationV1ToLatest {
noindex: node.noindex,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -395,6 +401,7 @@ export class FernNavigationV1ToLatest {
noindex: node.noindex,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -440,6 +447,7 @@ export class FernNavigationV1ToLatest {
pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -472,6 +480,7 @@ export class FernNavigationV1ToLatest {
noindex: node.noindex,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand All @@ -495,6 +504,7 @@ export class FernNavigationV1ToLatest {
year: node.year,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand All @@ -518,13 +528,14 @@ export class FernNavigationV1ToLatest {
month: node.month,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};

public changelogEntry = (
node: FernNavigation.V1.ChangelogEntryNode,
parents: FernNavigation.V1.NavigationNode[]
_parents: FernNavigation.V1.NavigationNode[]
): FernNavigation.ChangelogEntryNode => {
const slug = FernNavigation.Slug(node.slug);
// NOTE: do NOT use title disambiguation key here, since the title may not always be unique
Expand All @@ -543,6 +554,7 @@ export class FernNavigationV1ToLatest {
noindex: node.noindex,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -582,6 +594,7 @@ export class FernNavigationV1ToLatest {
availability: this.#availability(node.availability),
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -615,6 +628,7 @@ export class FernNavigationV1ToLatest {
isResponseStream: node.isResponseStream,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -659,6 +673,7 @@ export class FernNavigationV1ToLatest {
webSocketId: node.webSocketId,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down Expand Up @@ -690,6 +705,7 @@ export class FernNavigationV1ToLatest {
webhookId: node.webhookId,
viewers: node.viewers,
orphaned: node.orphaned,
featureFlags: undefined,
};
return latest;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function sectionNode(
overviewPageId: undefined,
noindex: undefined,
pointsTo: undefined,
featureFlags: undefined,
...section,
};
}
Expand All @@ -39,6 +40,7 @@ function pageNode(
viewers: undefined,
orphaned: undefined,
noindex: undefined,
featureFlags: undefined,
...page,
};
}
Expand Down
Loading

0 comments on commit 61b5ccd

Please sign in to comment.