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

chore(cli): bump fdr version to enable websocket playground limiting #5019

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions docs-yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,16 @@
"type": "null"
}
]
},
"limit-websocket-messages-per-connection": {
"oneOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down
4 changes: 4 additions & 0 deletions fern/apis/docs-yml/definition/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,10 @@ types:
If not provided, all environments are allowed. And if the provided list is empty, the playground should be disabled.
button: optional<PlaygroundButtonSettings>
oauth: optional<boolean>
"limit-websocket-messages-per-connection":
type: optional<integer>
docs: |
The maximum number of websocket messages per connection in the playground.

PlaygroundButtonSettings:
properties:
Expand Down
14 changes: 11 additions & 3 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
- changelogEntry:
- summary: |
The Fern CLI temporarily does not support RBAC/Audiences (they will be added in again shortly).
type: internal
- summary: |
- enables `limit-websocket-messages-per-connection` in playground settings for websockets.
this allows for the limiting of received messages per websocket connection in the playground for a demo.
type: feat
irVersion: 53
version: 0.45.0-rc26

- changelogEntry:
- summary: |
The Fern CLI temporarily does not support RBAC/Audiences (they will be added in again shortly).
type: internal
irVersion: 53
version: 0.45.0-rc25

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fern-api/fs-utils": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-api/fern-definition-schema": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.0.5833",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"@fern-fern/fiddle-sdk": "0.0.584",
"@fern-fern/generators-sdk": "0.114.0-5745f9e74",
"find-up": "^6.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface PlaygroundSettings {
environments?: string[];
button?: FernDocsConfig.PlaygroundButtonSettings;
oauth?: boolean;
/** The maximum number of websocket messages per connection in the playground. */
limitWebsocketMessagesPerConnection?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ export const PlaygroundSettings: core.serialization.ObjectSchema<
environments: core.serialization.list(core.serialization.string()).optional(),
button: core.serialization.lazyObject(async () => (await import("../../..")).PlaygroundButtonSettings).optional(),
oauth: core.serialization.boolean().optional(),
limitWebsocketMessagesPerConnection: core.serialization.property(
"limit-websocket-messages-per-connection",
core.serialization.number().optional()
),
});

export declare namespace PlaygroundSettings {
interface Raw {
environments?: string[] | null;
button?: serializers.PlaygroundButtonSettings.Raw | null;
oauth?: boolean | null;
"limit-websocket-messages-per-connection"?: number | null;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js
export function isPlainObject(value: unknown): value is Record<string, unknown> {
if (typeof value !== "object" || value === null) {
if (typeof value !== "object" || value == null) {
return false;
}

if (Object.getPrototypeOf(value) === null) {
if (Object.getPrototypeOf(value) == null) {
return true;
}

let proto = value;
while (Object.getPrototypeOf(proto) !== null) {
while (Object.getPrototypeOf(proto) != null) {
proto = Object.getPrototypeOf(proto);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-importers/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@fern-api/configuration": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.111.0-51d403bce",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"js-yaml": "^4.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-importers/mintlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@fern-api/task-context": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.111.0-51d403bce",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"gray-matter": "^4.0.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-markdown-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@fern-api/fs-utils": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.0.5833",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"gray-matter": "^4.0.3",
"mdast-util-from-markdown": "^2.0.1",
"mdast-util-mdx": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@fern-api/docs-resolver": "workspace:*",
"@fern-api/fdr-sdk": "0.115.0-3cf21db72",
"@fern-api/fdr-sdk": "0.121.2-9e12414a0",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/logger": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/docs-preview/src/previewDocs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DocsDefinitionResolver } from "@fern-api/docs-resolver";

import {
APIV1Read,
APIV1Write,
Expand Down Expand Up @@ -105,7 +106,7 @@ class ReferencedAPICollector {
}: {
ir: IntermediateRepresentation;
snippetsConfig: APIV1Write.SnippetsConfig;
playgroundConfig?: DocsV1Read.PlaygroundConfig;
playgroundConfig?: { oauth?: boolean };
}): APIDefinitionID {
try {
const id = uuidv4();
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/docs-preview/src/runPreviewServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const EMPTY_DOCS_DEFINITION: DocsV1Read.DocsDefinition = {
analyticsConfig: undefined,
integrations: undefined,
css: undefined,
js: undefined,
playground: undefined
js: undefined
},
search: {
type: "legacyMultiAlgoliaIndex",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/docs-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"@fern-api/configuration": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/docs-markdown-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.115.0-3cf21db72",
"@fern-api/ui-core-utils": "0.115.0-3cf21db72",
"@fern-api/fdr-sdk": "0.121.2-9e12414a0",
"@fern-api/ui-core-utils": "0.121.2-9e12414a0",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/docs-resolver/src/ApiReferenceNodeConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ export class ApiReferenceNodeConverter {
button:
playgroundSettings.button != null && playgroundSettings.button.href
? { href: FernNavigation.V1.Url(playgroundSettings.button.href) }
: undefined,
"limit-websocket-messages-per-connection":
playgroundSettings.limitWebsocketMessagesPerConnection != null
? playgroundSettings.limitWebsocketMessagesPerConnection
: undefined
};
}
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/docs-resolver/src/DocsDefinitionResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ export interface UploadedFile extends FilePathPair {
fileId: string;
}

export type PlaygroundConfig = Pick<docsYml.RawSchemas.PlaygroundSettings, "oauth">;

type AsyncOrSync<T> = T | Promise<T>;

type UploadFilesFn = (files: FilePathPair[]) => AsyncOrSync<UploadedFile[]>;

type RegisterApiFn = (opts: {
ir: IntermediateRepresentation;
snippetsConfig: APIV1Write.SnippetsConfig;
playgroundConfig?: DocsV1Write.PlaygroundConfig;
playgroundConfig?: PlaygroundConfig;
apiName?: string;
}) => AsyncOrSync<string>;

Expand Down Expand Up @@ -315,7 +317,6 @@ export class DocsDefinitionResolver {
this.parsedDocsConfig.announcement != null
? { text: this.parsedDocsConfig.announcement.message }
: undefined,
playground: undefined,
// deprecated
logo: undefined,
logoV2: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "@fern-api/fdr-sdk";
import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { convertIrToFdrApi } from "@fern-api/register";
import { PlaygroundConfig } from "../DocsDefinitionResolver";

const EMPTY_SNIPPET_HOLDER = new SDKSnippetHolder({
snippetsBySdkId: {},
Expand All @@ -19,7 +20,7 @@ const EMPTY_SNIPPET_HOLDER = new SDKSnippetHolder({
export function convertIrToApiDefinition(
ir: IntermediateRepresentation,
apiDefinitionId: string,
playgroundConfig?: DocsV1Read.PlaygroundConfig
playgroundConfig?: PlaygroundConfig
): APIV1Read.ApiDefinition {
// the navigation constructor doesn't need to know about snippets, so we can pass an empty object
return convertDbAPIDefinitionToRead(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/ete-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@fern-api/configuration": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.0.5833",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-typescript/fetcher": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@fern-api/core-utils": "workspace:*",
"@fern-api/docs-resolver": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.0.5833",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-migrations": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fern-api/configuration": "workspace:*",
"@fern-api/core": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-fern/fdr-cjs-sdk": "0.0.5833",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
Expand All @@ -43,7 +43,7 @@
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"@types/node": "18.7.18",
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { assertNever } from "@fern-api/core-utils";
import { FernIr as Ir } from "@fern-api/ir-sdk";
import { FernRegistry as FdrCjsSdk } from "@fern-fern/fdr-cjs-sdk";
import { PlaygroundConfig } from "@fern-fern/fdr-cjs-sdk/api/resources/docs/resources/v1/resources/commons";

export interface PlaygroundConfig {
oauth?: boolean;
};

Check failure on line 7 in packages/cli/register/src/ir-to-fdr-converter/convertAuth.ts

View workflow job for this annotation

GitHub Actions / eslint

Unnecessary semicolon

export function convertAuth(
auth: Ir.auth.ApiAuth,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { FernRegistry as FdrCjsSdk } from "@fern-fern/fdr-cjs-sdk";
import { PlaygroundConfig } from "@fern-fern/fdr-cjs-sdk/api/resources/docs/resources/v1/resources/commons";
import { convertIrAvailability, convertPackage } from "./convertPackage";
import { convertTypeReference, convertTypeShape } from "./convertTypeShape";
import { convertAuth } from "./covertAuth";
import { convertAuth, PlaygroundConfig } from "./convertAuth";

export function convertIrToFdrApi({
ir,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/register/src/registerApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { TaskContext } from "@fern-api/task-context";
import { FernWorkspace } from "@fern-api/api-workspace-commons";
import { FernRegistry as FdrCjsSdk } from "@fern-fern/fdr-cjs-sdk";
import { PlaygroundConfig } from "@fern-fern/fdr-cjs-sdk/api/resources/docs/resources/v1/resources/commons";
import { convertIrToFdrApi } from "./ir-to-fdr-converter/convertIrToFdrApi";
import { PlaygroundConfig } from "./ir-to-fdr-converter/convertAuth";

export async function registerApi({
organization,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"depcheck": "depcheck"
},
"dependencies": {
"@fern-fern/fdr-cjs-sdk": "0.0.5833",
"@fern-fern/fdr-cjs-sdk": "0.121.2-9e12414a0",
"@fern-fern/generators-sdk": "0.114.0-5745f9e74",
"@fern-api/venus-api-sdk": "0.0.38",
"@fern-fern/fdr-test-sdk": "^0.0.5297",
"@fern-fern/fiddle-sdk": "0.0.584"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.12",
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
Expand Down
Loading
Loading