Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: audience filters via jwt #1629

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fern/apis/fdr/definition/commons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ types:

PropertyKey: string

AudienceId: string

EndpointIdentifier:
properties:
path: EndpointPathLiteral
Expand Down
17 changes: 15 additions & 2 deletions fern/apis/fdr/definition/navigation/latest/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,21 @@ types:
type: optional<Slug>
docs: The slug that should be used in the canonical URL rel. If not provided, the `slug` will be used.
icon: optional<string>
hidden: optional<boolean>
authed: optional<boolean>
hidden:
type: optional<boolean>
docs: If true, this node will not be displayed in the sidebar, and noindex will be considered true.
authed:
type: optional<boolean>
docs: |
If true, this node is only visible to authenticated users.
If false, this node is only visible to all users (including anonymous).
audience:
type: optional<list<commons.AudienceId>>
availability: in-development
docs: |
The audience(s) that this node is intended for. If not provided, the node is intended for all audiences.
If provided, the node is only intended for the specified audience(s). OR logic is used for multiple audiences on a single node.
AND logic is used when evaluating audiences up the tree.

WithPage:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ exports[`hume > gets navigation root for /reference/expression-measurement-api/s

exports[`hume > gets navigation root for /support 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`no-version-no-tabs > gets navigation root for /docs 1`] = `

exports[`no-version-no-tabs > gets navigation root for /docs/api/page-6 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand All @@ -46,6 +47,7 @@ exports[`no-version-no-tabs > gets navigation root for /docs/api/section-1 1`] =

exports[`no-version-no-tabs > gets navigation root for /docs/api/section-2 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`no-version-yes-tabs > gets navigation root for /docs/api 1`] = `

exports[`no-version-yes-tabs > gets navigation root for /docs/api/page-2 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand All @@ -49,6 +50,7 @@ exports[`no-version-yes-tabs > gets navigation root for /docs/api/section-1 1`]

exports[`no-version-yes-tabs > gets navigation root for /docs/api/tab-1 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand All @@ -68,6 +70,7 @@ exports[`no-version-yes-tabs > gets navigation root for /docs/api/tab-1 3`] = `"

exports[`no-version-yes-tabs > gets navigation root for /docs/api/tab-2 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ exports[`polytomic > gets navigation root for /2023-04-25/not-found 1`] = `

exports[`polytomic > gets navigation root for /2024-02-08/guides/introduction 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ exports[`primer > gets navigation root for /docs/api/introduction/getting-starte
exports[`primer > gets navigation root for /docs/api/v2.1/api-reference/client-session-api/retrieve-client-side-token 1`] = `
{
"apiDefinitionId": "7ed504c0-fc2e-4a52-b3fd-b277869eda14",
"audience": undefined,
"authed": undefined,
"availability": undefined,
"canonicalSlug": "docs/api/v2.3/api-reference/client-session-api/retrieve-client-side-token",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ exports[`uploadcare > gets navigation root for /docs/file-management 1`] = `

exports[`uploadcare > gets navigation root for /docs/file-management/overview 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand Down Expand Up @@ -119,6 +120,7 @@ exports[`uploadcare > gets navigation root for /docs/introduction 1`] = `

exports[`uploadcare > gets navigation root for /docs/introduction/intro 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-1 3`]

exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-1/page-5 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand All @@ -93,6 +94,7 @@ exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-1/sect

exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-1/version-1 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand All @@ -119,6 +121,7 @@ exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-2 1`]

exports[`yes-version-no-tabs > gets navigation root for /docs/api/version-2/version-1 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ exports[`yes-version-yes-tabs > gets navigation root for /docs/api/version-1 1`]

exports[`yes-version-yes-tabs > gets navigation root for /docs/api/version-1/section-2 1`] = `
{
"audience": undefined,
"authed": undefined,
"canonicalSlug": undefined,
"hidden": undefined,
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.

16 changes: 16 additions & 0 deletions packages/fdr-sdk/src/navigation/migrators/v1ToV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class FernNavigationV1ToLatest {
icon: node.icon,
hidden: node.hidden,
authed: undefined,
audience: undefined,
};

return latest;
Expand Down Expand Up @@ -100,6 +101,7 @@ export class FernNavigationV1ToLatest {
authed: undefined,
id: FernNavigation.NodeId(node.id),
pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,
audience: undefined,
};
return latest;
};
Expand All @@ -124,6 +126,7 @@ export class FernNavigationV1ToLatest {
id: FernNavigation.NodeId(node.id),
pageId: FernNavigation.PageId(node.pageId),
noindex: node.noindex,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -161,6 +164,7 @@ export class FernNavigationV1ToLatest {
authed: undefined,
id: FernNavigation.NodeId(node.id),
pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -261,6 +265,7 @@ export class FernNavigationV1ToLatest {
versioned: (value) => this.versioned(value, [...parents, node]),
}),
subtitle: node.subtitle,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -315,6 +320,7 @@ export class FernNavigationV1ToLatest {
authed: undefined,
pageId: FernNavigation.PageId(node.pageId),
noindex: node.noindex,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -346,6 +352,7 @@ export class FernNavigationV1ToLatest {
collapsed: node.collapsed,
overviewPageId,
noindex: node.noindex,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -383,6 +390,7 @@ export class FernNavigationV1ToLatest {
apiDefinitionId: node.apiDefinitionId,
availability: this.#availability(node.availability),
pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -412,6 +420,7 @@ export class FernNavigationV1ToLatest {
authed: undefined,
overviewPageId,
noindex: node.noindex,
audience: undefined,
};
return latest;
};
Expand All @@ -431,6 +440,7 @@ export class FernNavigationV1ToLatest {
hidden: node.hidden,
authed: undefined,
year: node.year,
audience: undefined,
};
return latest;
};
Expand All @@ -450,6 +460,7 @@ export class FernNavigationV1ToLatest {
hidden: node.hidden,
authed: undefined,
month: node.month,
audience: undefined,
};
return latest;
};
Expand All @@ -475,6 +486,7 @@ export class FernNavigationV1ToLatest {
date: node.date,
pageId: FernNavigation.PageId(node.pageId),
noindex: node.noindex,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -508,6 +520,7 @@ export class FernNavigationV1ToLatest {
noindex: node.noindex,
apiDefinitionId: node.apiDefinitionId,
availability: this.#availability(node.availability),
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -539,6 +552,7 @@ export class FernNavigationV1ToLatest {
method: node.method,
endpointId: node.endpointId,
isResponseStream: node.isResponseStream,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -581,6 +595,7 @@ export class FernNavigationV1ToLatest {
apiDefinitionId: node.apiDefinitionId,
availability: this.#availability(node.availability),
webSocketId: node.webSocketId,
audience: undefined,
};
return latest;
};
Expand Down Expand Up @@ -610,6 +625,7 @@ export class FernNavigationV1ToLatest {
availability: this.#availability(node.availability),
method: node.method,
webhookId: node.webhookId,
audience: undefined,
};
return latest;
};
Expand Down
Loading
Loading