From 4c4f4704ca57a7a6775c2d89035f9c1d986be357 Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Thu, 6 Jun 2024 15:00:06 -0400 Subject: [PATCH] fix: remove internal dependencies from fdr-sdk (#976) --- .github/workflows/fdr-ete.yml | 7 +- package.json | 2 +- packages/commons/core-utils/src/index.ts | 1 - packages/commons/fdr-utils/src/docs.ts | 17 +- packages/commons/fdr-utils/tsconfig.json | 3 +- packages/fdr-sdk/package.json | 15 +- packages/fdr-sdk/src/client/index.ts | 2 + .../converters/db/convertAPIDefinitionToDb.ts | 2 +- .../db/convertDocsDefinitionToDb.ts | 2 +- .../db/snippets/SDKSnippetHolder.ts | 2 +- .../db/upgrade/migrateDocsDbDefinition.ts | 2 +- .../converters/db/upgrade/upgradeV2ToV3.ts | 2 +- .../read/convertDbDocsConfigToRead.ts | 52 +-- packages/fdr-sdk/src/index.ts | 1 - .../fdr-sdk/src/navigation/NodeCollector.ts | 2 +- .../ApiReferenceNavigationConverter.ts | 2 +- .../converters/NavigationConfigConverter.ts | 2 +- packages/fdr-sdk/src/navigation/index.ts | 2 +- .../navigation/utils/convertAvailability.ts | 2 +- .../utils/convertLoadDocsForUrlResponse.ts | 2 +- .../fdr-sdk/src/navigation/utils/findNode.ts | 2 +- .../src/navigation/utils/followRedirect.ts | 8 +- .../src/navigation/utils/getApiReferenceId.ts | 2 +- .../fdr-sdk/src/navigation/utils/getPageId.ts | 2 +- .../navigation/utils/traverseNavigation.ts | 4 +- packages/fdr-sdk/src/utils/assertNever.ts | 6 + packages/fdr-sdk/src/utils/index.ts | 5 + packages/fdr-sdk/src/utils/isPlainObject.ts | 18 + .../src/utils}/lodash/before.ts | 0 .../src => fdr-sdk/src/utils}/lodash/index.ts | 1 + .../src/utils}/lodash/internal/getTag.ts | 0 .../utils}/lodash/internal/unicodeWords.ts | 0 .../src/utils}/lodash/isSymbol.ts | 0 .../src/utils}/lodash/kebabCase.ts | 0 .../src/utils}/lodash/mapValues.ts | 0 packages/fdr-sdk/src/utils/lodash/noop.ts | 2 + .../src => fdr-sdk/src/utils}/lodash/once.ts | 0 .../src/utils}/lodash/toString.ts | 0 .../src => fdr-sdk/src/utils}/lodash/words.ts | 0 packages/fdr-sdk/src/utils/specialTokens.ts | 361 ++++++++++++++++++ packages/fdr-sdk/src/utils/titleCase.ts | 19 + .../src/utils/visitDiscriminatedUnion.ts | 33 ++ packages/fdr-sdk/tsconfig.json | 3 +- packages/fdr-sdk/turbo.json | 2 +- packages/template-resolver/turbo.json | 2 +- .../endpoints/EndpointContentCodeSnippets.tsx | 1 - .../PlaygroundEndpointSelectorContent.tsx | 3 +- packages/ui/app/src/api-playground/utils.ts | 6 +- .../src/contexts/docs-context/DocsContext.ts | 3 +- .../docs-context/DocsContextProvider.tsx | 3 +- .../src/sidebar/CollapseSidebarContext.tsx | 3 +- packages/ui/app/tsconfig.json | 4 +- .../src/pages/api/fern-docs/resolve-api.ts | 9 +- .../src/pages/api/fern-docs/revalidate-all.ts | 6 +- .../pages/api/fern-docs/revalidate-all/v2.ts | 6 +- .../pages/api/fern-docs/revalidate-all/v3.ts | 6 +- .../src/pages/api/fern-docs/sitemap.ts | 6 +- .../src/pages/api/fern-docs/sitemap.xml.ts | 6 +- .../docs-bundle/src/utils/getDocsPageProps.ts | 8 +- .../ui/local-preview-bundle/.depcheckrc.json | 3 +- pnpm-lock.yaml | 192 ++-------- servers/fdr/package.json | 2 - servers/fdr/src/__test__/local/util.ts | 3 +- servers/fdr/turbo.json | 2 +- shared/.prettierignore | 1 + turbo.json | 2 +- 66 files changed, 590 insertions(+), 277 deletions(-) create mode 100644 packages/fdr-sdk/src/utils/assertNever.ts create mode 100644 packages/fdr-sdk/src/utils/index.ts create mode 100644 packages/fdr-sdk/src/utils/isPlainObject.ts rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/before.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/index.ts (85%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/internal/getTag.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/internal/unicodeWords.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/isSymbol.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/kebabCase.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/mapValues.ts (100%) create mode 100644 packages/fdr-sdk/src/utils/lodash/noop.ts rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/once.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/toString.ts (100%) rename packages/{commons/core-utils/src => fdr-sdk/src/utils}/lodash/words.ts (100%) create mode 100644 packages/fdr-sdk/src/utils/specialTokens.ts create mode 100644 packages/fdr-sdk/src/utils/titleCase.ts create mode 100644 packages/fdr-sdk/src/utils/visitDiscriminatedUnion.ts diff --git a/.github/workflows/fdr-ete.yml b/.github/workflows/fdr-ete.yml index c86c19c5d2..b8ac1f8f95 100644 --- a/.github/workflows/fdr-ete.yml +++ b/.github/workflows/fdr-ete.yml @@ -29,9 +29,6 @@ jobs: uses: ./.github/actions/install - name: Setup database - # TODO: re-enable when moving to turbo - # pnpm turbo --filter= docker:local run: | - cd servers/fdr - pnpm run docker:local - pnpm run test:ete + pnpm turbo --filter=@fern-platform/fdr docker:local + pnpm --filter=@fern-platform/fdr run test:ete diff --git a/package.json b/package.json index 21785cf24c..fe1c304fa3 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "tailwindcss": "^3.4.3", "ts-node": "^10.9.1", "tsx": "^4.7.1", - "turbo": "^1.12.5", + "turbo": "^2.0.1", "typescript": "5.4.3", "typescript-plugin-css-modules": "^5.1.0", "vitest": "^1.5.0" diff --git a/packages/commons/core-utils/src/index.ts b/packages/commons/core-utils/src/index.ts index a632e4e64a..78a328929d 100644 --- a/packages/commons/core-utils/src/index.ts +++ b/packages/commons/core-utils/src/index.ts @@ -7,7 +7,6 @@ export { withMinimumTime } from "./delay/withMinimumTime"; export { EMPTY_ARRAY, EMPTY_OBJECT } from "./empty"; export { identity } from "./identity"; export { assertNonNullish, isNonNullish } from "./isNonNullish"; -export * from "./lodash"; export { noop } from "./noop"; export { entries, type Entries } from "./objects/entries"; export { isPlainObject } from "./objects/isPlainObject"; diff --git a/packages/commons/fdr-utils/src/docs.ts b/packages/commons/fdr-utils/src/docs.ts index 29f7bdad71..8947547f60 100644 --- a/packages/commons/fdr-utils/src/docs.ts +++ b/packages/commons/fdr-utils/src/docs.ts @@ -1,4 +1,5 @@ -import { DocsV1Read, FernNavigation } from "@fern-api/fdr-sdk"; +import { DocsV1Read } from "@fern-api/fdr-sdk"; +import { Availability } from "@fern-api/fdr-sdk/navigation"; export function isVersionedNavigationConfig( navigationConfig: DocsV1Read.NavigationConfig, @@ -42,19 +43,19 @@ export function assertIsUnversionedNavigationConfig( } } -export function getVersionAvailabilityLabel(availability: FernNavigation.Availability): string { +export function getVersionAvailabilityLabel(availability: Availability): string { switch (availability) { - case FernNavigation.Availability.Beta: + case Availability.Beta: return "beta"; - case FernNavigation.Availability.Deprecated: + case Availability.Deprecated: return "deprecated"; - case FernNavigation.Availability.GenerallyAvailable: + case Availability.GenerallyAvailable: return "generally available"; - case FernNavigation.Availability.Stable: + case Availability.Stable: return "stable"; - case FernNavigation.Availability.InDevelopment: + case Availability.InDevelopment: return "in development"; - case FernNavigation.Availability.PreRelease: + case Availability.PreRelease: return "pre-release"; default: return "unknown"; diff --git a/packages/commons/fdr-utils/tsconfig.json b/packages/commons/fdr-utils/tsconfig.json index 9a6c82205a..ac034eb684 100644 --- a/packages/commons/fdr-utils/tsconfig.json +++ b/packages/commons/fdr-utils/tsconfig.json @@ -1,5 +1,6 @@ { "extends": "@fern-platform/configs/tsconfig/library.json", "compilerOptions": { "outDir": "./dist", "rootDir": "./src" }, - "include": ["./src/**/*"] + "include": ["./src/**/*"], + "references": [{ "path": "../../fdr-sdk" }] } diff --git a/packages/fdr-sdk/package.json b/packages/fdr-sdk/package.json index 30126cde2c..4f035b5e88 100644 --- a/packages/fdr-sdk/package.json +++ b/packages/fdr-sdk/package.json @@ -9,14 +9,24 @@ "type": "module", "module": "dist/index.js", "source": "src/index.ts", + "exports": { + "./navigation": { + "types": "./dist/navigation/index.d.ts", + "import": "./dist/navigation/index.js" + }, + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, "dependencies": { - "@fern-ui/core-utils": "workspace:*", "dayjs": "^1.11.11", "fast-deep-equal": "^3.1.3", "form-data": "4.0.0", "js-base64": "3.7.7", "qs": "6.12.0", "tinycolor2": "^1.6.0", + "title": "^3.5.3", "url-join": "4.0.1" }, "devDependencies": { @@ -27,11 +37,10 @@ "@fern-platform/configs": "workspace:*", "@types/qs": "6.9.14", "@types/tinycolor2": "^1.4.6", + "@types/title": "^3.4.3", "@types/url-join": "4.0.1", "eslint": "^8.56.0", - "eslint-config-custom": "*", "prettier": "^3.2.4", - "tsconfig": "*", "typescript": "5.4.3", "vitest": "^1.5.0" }, diff --git a/packages/fdr-sdk/src/client/index.ts b/packages/fdr-sdk/src/client/index.ts index cf1d9828a5..81f10e527c 100644 --- a/packages/fdr-sdk/src/client/index.ts +++ b/packages/fdr-sdk/src/client/index.ts @@ -7,6 +7,8 @@ export * as APIV1Read from "./generated/api/resources/api/resources/v1/resources export * as APIV1Write from "./generated/api/resources/api/resources/v1/resources/register"; export * as DocsV2Read from "./generated/api/resources/docs/resources/v2/resources/read"; export * as DocsV2Write from "./generated/api/resources/docs/resources/v2/resources/write"; +export * as Snippets from "./generated/api/resources/snippets/types"; +export * from "./generated/core/fetcher/APIResponse"; export { visitDbNavigationConfig, visitUnversionedDbNavigationConfig } from "./visitDbNavigationConfig"; export { visitDbNavigationTab, visitWriteNavigationTab } from "./visitNavigationTab"; export { visitReadNavigationConfig, visitUnversionedReadNavigationConfig } from "./visitReadNavigationConfig"; diff --git a/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts b/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts index d5889cb145..05a9e16210 100644 --- a/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts +++ b/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts @@ -1,6 +1,6 @@ -import { kebabCase, titleCase } from "@fern-ui/core-utils"; import isEqual from "fast-deep-equal"; import { APIV1Db, APIV1Read, APIV1Write, FdrAPI } from "../../client"; +import { kebabCase, titleCase } from "../../utils"; import { WithoutQuestionMarks } from "../utils/WithoutQuestionMarks"; import { assertNever } from "../utils/assertNever"; import { diff --git a/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts b/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts index c763fcd825..8e7a5b577c 100644 --- a/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts +++ b/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts @@ -1,4 +1,3 @@ -import { kebabCase } from "@fern-ui/core-utils"; import { DocsV1Db, DocsV1Read, @@ -10,6 +9,7 @@ import { visitWriteNavigationConfig, } from "../../client"; import { isNavigationTabLink } from "../../client/visitNavigationTab"; +import { kebabCase } from "../../utils"; import { type WithoutQuestionMarks } from "../utils/WithoutQuestionMarks"; import { assertNever } from "../utils/assertNever"; import { DEFAULT_DARK_MODE_ACCENT_PRIMARY, DEFAULT_LIGHT_MODE_ACCENT_PRIMARY } from "../utils/colors"; diff --git a/packages/fdr-sdk/src/converters/db/snippets/SDKSnippetHolder.ts b/packages/fdr-sdk/src/converters/db/snippets/SDKSnippetHolder.ts index 6ef6d5075c..0b1df024e3 100644 --- a/packages/fdr-sdk/src/converters/db/snippets/SDKSnippetHolder.ts +++ b/packages/fdr-sdk/src/converters/db/snippets/SDKSnippetHolder.ts @@ -183,7 +183,7 @@ export class SDKSnippetHolder { return exampleId != null && snippet.exampleIdentifier === exampleId; }); // if no example match, just pick first snippet for backwards-compatibility reasons - if (snippets.length === 0) { + if (snippets.length === 0 && snippetsForEndpoint[0] != null) { snippets = [snippetsForEndpoint[0]]; } diff --git a/packages/fdr-sdk/src/converters/db/upgrade/migrateDocsDbDefinition.ts b/packages/fdr-sdk/src/converters/db/upgrade/migrateDocsDbDefinition.ts index 1129035007..0e5dac153d 100644 --- a/packages/fdr-sdk/src/converters/db/upgrade/migrateDocsDbDefinition.ts +++ b/packages/fdr-sdk/src/converters/db/upgrade/migrateDocsDbDefinition.ts @@ -1,5 +1,5 @@ -import { isPlainObject } from "@fern-ui/core-utils"; import { DocsV1Db } from "../../../client"; +import { isPlainObject } from "../../../utils"; import { upgradeV1ToV2 } from "./upgradeV1ToV2"; import { upgradeV2ToV3 } from "./upgradeV2ToV3"; diff --git a/packages/fdr-sdk/src/converters/db/upgrade/upgradeV2ToV3.ts b/packages/fdr-sdk/src/converters/db/upgrade/upgradeV2ToV3.ts index 3b81280e85..3aa8d1a736 100644 --- a/packages/fdr-sdk/src/converters/db/upgrade/upgradeV2ToV3.ts +++ b/packages/fdr-sdk/src/converters/db/upgrade/upgradeV2ToV3.ts @@ -1,5 +1,5 @@ -import { mapValues } from "@fern-ui/core-utils"; import { DocsV1Db } from "../../../client"; +import { mapValues } from "../../../utils"; export function upgradeV2ToV3(v2: DocsV1Db.DocsDefinitionDb.V2): DocsV1Db.DocsDefinitionDb.V3 { return { diff --git a/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts b/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts index d7eecfbedd..78eb4f10b7 100644 --- a/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts +++ b/packages/fdr-sdk/src/converters/read/convertDbDocsConfigToRead.ts @@ -1,7 +1,7 @@ -import { kebabCase } from "@fern-ui/core-utils"; import tinycolor from "tinycolor2"; import { DocsV1Db, DocsV1Read, visitDbNavigationConfig, visitUnversionedDbNavigationConfig } from "../../client"; import { visitDbNavigationTab } from "../../client/visitNavigationTab"; +import { kebabCase } from "../../utils"; import { WithoutQuestionMarks } from "../utils/WithoutQuestionMarks"; import { assertNever } from "../utils/assertNever"; import { DEFAULT_DARK_MODE_ACCENT_PRIMARY, DEFAULT_LIGHT_MODE_ACCENT_PRIMARY } from "../utils/colors"; @@ -63,32 +63,32 @@ function transformTypographyToV2( }; } -function transformFontConfigV2ToV1(fontConfig: DocsV1Read.FontConfigV2 | undefined): DocsV1Read.FontConfig | undefined { - if (fontConfig == null) { - return undefined; - } - const firstVariant = fontConfig.variants[0]; - if (firstVariant == null) { - return undefined; - } - return { - name: fontConfig.name, - fontFile: firstVariant.fontFile, - }; -} +// function transformFontConfigV2ToV1(fontConfig: DocsV1Read.FontConfigV2 | undefined): DocsV1Read.FontConfig | undefined { +// if (fontConfig == null) { +// return undefined; +// } +// const firstVariant = fontConfig.variants[0]; +// if (firstVariant == null) { +// return undefined; +// } +// return { +// name: fontConfig.name, +// fontFile: firstVariant.fontFile, +// }; +// } -function transformTypographyV2ToV1( - typography: DocsV1Read.DocsTypographyConfigV2 | undefined, -): DocsV1Read.DocsTypographyConfig | undefined { - if (typography == null) { - return undefined; - } - return { - headingsFont: transformFontConfigV2ToV1(typography.headingsFont), - bodyFont: transformFontConfigV2ToV1(typography.bodyFont), - codeFont: transformFontConfigV2ToV1(typography.codeFont), - }; -} +// function transformTypographyV2ToV1( +// typography: DocsV1Read.DocsTypographyConfigV2 | undefined, +// ): DocsV1Read.DocsTypographyConfig | undefined { +// if (typography == null) { +// return undefined; +// } +// return { +// headingsFont: transformFontConfigV2ToV1(typography.headingsFont), +// bodyFont: transformFontConfigV2ToV1(typography.bodyFont), +// codeFont: transformFontConfigV2ToV1(typography.codeFont), +// }; +// } export function transformNavigationConfigToRead(dbShape: DocsV1Db.NavigationConfig): DocsV1Read.NavigationConfig { return visitDbNavigationConfig(dbShape, { diff --git a/packages/fdr-sdk/src/index.ts b/packages/fdr-sdk/src/index.ts index ce9d9409dc..1dd0b8d881 100644 --- a/packages/fdr-sdk/src/index.ts +++ b/packages/fdr-sdk/src/index.ts @@ -1,4 +1,3 @@ export * from "./client"; export * from "./converters"; export * as FernNavigation from "./navigation"; -export { NodeCollector } from "./navigation/NodeCollector"; diff --git a/packages/fdr-sdk/src/navigation/NodeCollector.ts b/packages/fdr-sdk/src/navigation/NodeCollector.ts index 4be19a739b..e8c56ddfdf 100644 --- a/packages/fdr-sdk/src/navigation/NodeCollector.ts +++ b/packages/fdr-sdk/src/navigation/NodeCollector.ts @@ -1,5 +1,5 @@ -import { once } from "@fern-ui/core-utils"; import urljoin from "url-join"; +import { once } from "../utils"; import { FernNavigation } from "./generated"; import { NavigationNode, diff --git a/packages/fdr-sdk/src/navigation/converters/ApiReferenceNavigationConverter.ts b/packages/fdr-sdk/src/navigation/converters/ApiReferenceNavigationConverter.ts index 051cb0aa02..10b21cc6f9 100644 --- a/packages/fdr-sdk/src/navigation/converters/ApiReferenceNavigationConverter.ts +++ b/packages/fdr-sdk/src/navigation/converters/ApiReferenceNavigationConverter.ts @@ -1,6 +1,6 @@ -import { noop, titleCase, visitDiscriminatedUnion } from "@fern-ui/core-utils"; import urljoin from "url-join"; import { APIV1Read, DocsV1Read } from "../../client"; +import { noop, titleCase, visitDiscriminatedUnion } from "../../utils"; import { ApiDefinitionHolder } from "../ApiDefinitionHolder"; import { FernNavigation } from "../generated"; import { followRedirects } from "../utils"; diff --git a/packages/fdr-sdk/src/navigation/converters/NavigationConfigConverter.ts b/packages/fdr-sdk/src/navigation/converters/NavigationConfigConverter.ts index 1fb5ef049d..39bcce046d 100644 --- a/packages/fdr-sdk/src/navigation/converters/NavigationConfigConverter.ts +++ b/packages/fdr-sdk/src/navigation/converters/NavigationConfigConverter.ts @@ -1,6 +1,6 @@ -import { assertNever, kebabCase, visitDiscriminatedUnion } from "@fern-ui/core-utils"; import urljoin from "url-join"; import { APIV1Read, DocsV1Read, visitReadNavigationConfig, visitUnversionedReadNavigationConfig } from "../../client"; +import { assertNever, kebabCase, visitDiscriminatedUnion } from "../../utils"; import { FernNavigation } from "../generated"; import { followRedirect, followRedirects } from "../utils"; import { convertAvailability } from "../utils/convertAvailability"; diff --git a/packages/fdr-sdk/src/navigation/index.ts b/packages/fdr-sdk/src/navigation/index.ts index 93f561cbaf..050bb65876 100644 --- a/packages/fdr-sdk/src/navigation/index.ts +++ b/packages/fdr-sdk/src/navigation/index.ts @@ -11,4 +11,4 @@ export { ApiReferenceNavigationConverter } from "./converters/ApiReferenceNaviga export * from "./generated/api"; export * from "./types"; export * as utils from "./utils"; -export { collectSlugs, convert, createApiHolder }; +export { ApiDefinitionHolder, collectSlugs, convert, createApiHolder, NavigationConfigConverter, NodeCollector }; diff --git a/packages/fdr-sdk/src/navigation/utils/convertAvailability.ts b/packages/fdr-sdk/src/navigation/utils/convertAvailability.ts index f774272873..2167be100e 100644 --- a/packages/fdr-sdk/src/navigation/utils/convertAvailability.ts +++ b/packages/fdr-sdk/src/navigation/utils/convertAvailability.ts @@ -1,5 +1,5 @@ -import { assertNever } from "@fern-ui/core-utils"; import { APIV1Read, DocsV1Read } from "../../client"; +import { assertNever } from "../../utils"; import { FernNavigation } from "../generated"; export function convertAvailability( diff --git a/packages/fdr-sdk/src/navigation/utils/convertLoadDocsForUrlResponse.ts b/packages/fdr-sdk/src/navigation/utils/convertLoadDocsForUrlResponse.ts index a6451d84e9..10bcca8baa 100644 --- a/packages/fdr-sdk/src/navigation/utils/convertLoadDocsForUrlResponse.ts +++ b/packages/fdr-sdk/src/navigation/utils/convertLoadDocsForUrlResponse.ts @@ -1,5 +1,5 @@ -import { mapValues } from "@fern-ui/core-utils"; import { APIV1Read, DocsV2Read } from "../../client"; +import { mapValues } from "../../utils"; import { NavigationConfigConverter } from "../converters/NavigationConfigConverter"; export function convertLoadDocsForUrlResponse(response: DocsV2Read.LoadDocsForUrlResponse) { diff --git a/packages/fdr-sdk/src/navigation/utils/findNode.ts b/packages/fdr-sdk/src/navigation/utils/findNode.ts index 26c06109bd..9455f1fe57 100644 --- a/packages/fdr-sdk/src/navigation/utils/findNode.ts +++ b/packages/fdr-sdk/src/navigation/utils/findNode.ts @@ -1,4 +1,4 @@ -import { noop, visitDiscriminatedUnion } from "@fern-ui/core-utils"; +import { noop, visitDiscriminatedUnion } from "../../utils"; import urljoin from "url-join"; import { NodeCollector } from "../NodeCollector"; diff --git a/packages/fdr-sdk/src/navigation/utils/followRedirect.ts b/packages/fdr-sdk/src/navigation/utils/followRedirect.ts index f36134e3d1..374a4a987d 100644 --- a/packages/fdr-sdk/src/navigation/utils/followRedirect.ts +++ b/packages/fdr-sdk/src/navigation/utils/followRedirect.ts @@ -1,4 +1,4 @@ -import { visitDiscriminatedUnion } from "@fern-ui/core-utils"; +import { visitDiscriminatedUnion } from "../../utils"; import { FernNavigation } from "../generated"; import { NavigationNode } from "../types/NavigationNode"; @@ -37,17 +37,11 @@ export function followRedirect(nodeToFollow: NavigationNode | undefined): FernNa } export function followRedirects(nodes: NavigationNode[]): FernNavigation.Slug | undefined { - let traversedFirst = false; for (const node of nodes) { - // if (traversedFirst) { - // // eslint-disable-next-line no-console - // console.error("First redirect path was not followed, this should not happen."); - // } const redirect = followRedirect(node); if (redirect != null) { return redirect; } - traversedFirst = true; } return; } diff --git a/packages/fdr-sdk/src/navigation/utils/getApiReferenceId.ts b/packages/fdr-sdk/src/navigation/utils/getApiReferenceId.ts index efa2a0d713..ea58c4274a 100644 --- a/packages/fdr-sdk/src/navigation/utils/getApiReferenceId.ts +++ b/packages/fdr-sdk/src/navigation/utils/getApiReferenceId.ts @@ -1,4 +1,4 @@ -import { visitDiscriminatedUnion } from "@fern-ui/core-utils"; +import { visitDiscriminatedUnion } from "../../utils"; import { FernNavigation } from "../generated"; import { NavigationNode } from "../types/NavigationNode"; diff --git a/packages/fdr-sdk/src/navigation/utils/getPageId.ts b/packages/fdr-sdk/src/navigation/utils/getPageId.ts index ef9de81f65..ecfabf190d 100644 --- a/packages/fdr-sdk/src/navigation/utils/getPageId.ts +++ b/packages/fdr-sdk/src/navigation/utils/getPageId.ts @@ -1,4 +1,4 @@ -import { visitDiscriminatedUnion } from "@fern-ui/core-utils"; +import { visitDiscriminatedUnion } from "../../utils"; import { FernNavigation } from "../generated"; import { NavigationNodePage } from "../types"; diff --git a/packages/fdr-sdk/src/navigation/utils/traverseNavigation.ts b/packages/fdr-sdk/src/navigation/utils/traverseNavigation.ts index 3419ddc670..f97fd750cd 100644 --- a/packages/fdr-sdk/src/navigation/utils/traverseNavigation.ts +++ b/packages/fdr-sdk/src/navigation/utils/traverseNavigation.ts @@ -1,9 +1,9 @@ -import { noop, visitDiscriminatedUnion } from "@fern-ui/core-utils"; +import { noop, visitDiscriminatedUnion } from "../../utils"; import { NavigationNode } from "../types/NavigationNode"; const SKIP = "skip" as const; -const CONTINUE = true as const; +// const CONTINUE = true as const; const STOP = false as const; export function traverseNavigation( diff --git a/packages/fdr-sdk/src/utils/assertNever.ts b/packages/fdr-sdk/src/utils/assertNever.ts new file mode 100644 index 0000000000..e96382acf1 --- /dev/null +++ b/packages/fdr-sdk/src/utils/assertNever.ts @@ -0,0 +1,6 @@ +export function assertNever(x: never): never { + throw new Error("Unexpected value: " + JSON.stringify(x)); +} + +// eslint-disable-next-line @typescript-eslint/no-empty-function +export function assertNeverNoThrow(_: never): void {} diff --git a/packages/fdr-sdk/src/utils/index.ts b/packages/fdr-sdk/src/utils/index.ts new file mode 100644 index 0000000000..b2a5f8b14a --- /dev/null +++ b/packages/fdr-sdk/src/utils/index.ts @@ -0,0 +1,5 @@ +export * from "./assertNever"; +export * from "./isPlainObject"; +export * from "./lodash"; +export * from "./titleCase"; +export * from "./visitDiscriminatedUnion"; diff --git a/packages/fdr-sdk/src/utils/isPlainObject.ts b/packages/fdr-sdk/src/utils/isPlainObject.ts new file mode 100644 index 0000000000..96272f18e1 --- /dev/null +++ b/packages/fdr-sdk/src/utils/isPlainObject.ts @@ -0,0 +1,18 @@ +// https://github.com/lodash/lodash/blob/master/isPlainObject.js +export function isPlainObject(value: unknown): value is Record { + if (!isObjectLike(value) || String(value) !== "[object Object]") { + return false; + } + if (Object.getPrototypeOf(value) == null) { + return true; + } + let proto = value; + while (Object.getPrototypeOf(proto) != null) { + proto = Object.getPrototypeOf(proto); + } + return Object.getPrototypeOf(value) === proto; +} + +function isObjectLike(value: unknown) { + return typeof value === "object" && value != null; +} diff --git a/packages/commons/core-utils/src/lodash/before.ts b/packages/fdr-sdk/src/utils/lodash/before.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/before.ts rename to packages/fdr-sdk/src/utils/lodash/before.ts diff --git a/packages/commons/core-utils/src/lodash/index.ts b/packages/fdr-sdk/src/utils/lodash/index.ts similarity index 85% rename from packages/commons/core-utils/src/lodash/index.ts rename to packages/fdr-sdk/src/utils/lodash/index.ts index c429874fb2..175d2e00bf 100644 --- a/packages/commons/core-utils/src/lodash/index.ts +++ b/packages/fdr-sdk/src/utils/lodash/index.ts @@ -1,3 +1,4 @@ export { default as kebabCase } from "./kebabCase"; export { default as mapValues } from "./mapValues"; +export * from "./noop"; export { default as once } from "./once"; diff --git a/packages/commons/core-utils/src/lodash/internal/getTag.ts b/packages/fdr-sdk/src/utils/lodash/internal/getTag.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/internal/getTag.ts rename to packages/fdr-sdk/src/utils/lodash/internal/getTag.ts diff --git a/packages/commons/core-utils/src/lodash/internal/unicodeWords.ts b/packages/fdr-sdk/src/utils/lodash/internal/unicodeWords.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/internal/unicodeWords.ts rename to packages/fdr-sdk/src/utils/lodash/internal/unicodeWords.ts diff --git a/packages/commons/core-utils/src/lodash/isSymbol.ts b/packages/fdr-sdk/src/utils/lodash/isSymbol.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/isSymbol.ts rename to packages/fdr-sdk/src/utils/lodash/isSymbol.ts diff --git a/packages/commons/core-utils/src/lodash/kebabCase.ts b/packages/fdr-sdk/src/utils/lodash/kebabCase.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/kebabCase.ts rename to packages/fdr-sdk/src/utils/lodash/kebabCase.ts diff --git a/packages/commons/core-utils/src/lodash/mapValues.ts b/packages/fdr-sdk/src/utils/lodash/mapValues.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/mapValues.ts rename to packages/fdr-sdk/src/utils/lodash/mapValues.ts diff --git a/packages/fdr-sdk/src/utils/lodash/noop.ts b/packages/fdr-sdk/src/utils/lodash/noop.ts new file mode 100644 index 0000000000..51cea12263 --- /dev/null +++ b/packages/fdr-sdk/src/utils/lodash/noop.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-empty-function +export function noop(): void {} diff --git a/packages/commons/core-utils/src/lodash/once.ts b/packages/fdr-sdk/src/utils/lodash/once.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/once.ts rename to packages/fdr-sdk/src/utils/lodash/once.ts diff --git a/packages/commons/core-utils/src/lodash/toString.ts b/packages/fdr-sdk/src/utils/lodash/toString.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/toString.ts rename to packages/fdr-sdk/src/utils/lodash/toString.ts diff --git a/packages/commons/core-utils/src/lodash/words.ts b/packages/fdr-sdk/src/utils/lodash/words.ts similarity index 100% rename from packages/commons/core-utils/src/lodash/words.ts rename to packages/fdr-sdk/src/utils/lodash/words.ts diff --git a/packages/fdr-sdk/src/utils/specialTokens.ts b/packages/fdr-sdk/src/utils/specialTokens.ts new file mode 100644 index 0000000000..e5f69d47da --- /dev/null +++ b/packages/fdr-sdk/src/utils/specialTokens.ts @@ -0,0 +1,361 @@ +export const SPECIAL_TOKENS = [ + // privacy + "PII", + "PHI", + "PCI", + "GDPR", + "CCPA", + "HIPAA", + "COPPA", + "FERPA", + "GLBA", + "SOX", + "FISMA", + "NIST", + "CIS", + "ISO", + "IEC", + "ITAR", + "EAR", + "CMMC", + "CUI", + "CDI", + "FTC", + "FCC", + "SEC", + "FINRA", + + // security + "XSS", + "CSRF", + "SSRF", + "XSRF", + "TLS", + "SSL", + "SSH", + "API", + "OAuth", + "OAuth1", + "OAuth1.0", + "OAuth2", + "OAuth2.0", + "SAML", + "OpenID", + "OpenID Connect", + "CAPTCHA", + "reCAPTCHA", + "2FA", + "MFA", + "OTP", + "TOTP", + "HOTP", + "U2F", + "FIDO", + "FIDO2", + "PKI", + "HMAC", + "AES", + "RSA", + "SHA", + "MD5", + "BCrypt", + "PBKDF2", + "Argon2", + "SCrypt", + "JWT", + "JWE", + "JWS", + "JWK", + "JWA", + "JOSE", + + // shopping + "SKU", + "SKUs", + "UPC", + "EAN", + "ISBN", + "ASIN", + "MPN", + "MSRP", + "MAP", + "RRP", + "MSRP", + + // time + "AM", + "PM", + "UTC", + "GMT", + "PST", + "PDT", + "EST", + "EDT", + "CST", + "CDT", + "MST", + "MDT", + + // geography + "USA", + "UK", + "EU", + "UAE", + "APAC", + "EMEA", + "LATAM", + "ANZ", + "SEA", + "MEA", + "MENA", + "NATO", + "NA", + "SA", + "CA", + "EU", + "AU", + "NZ", + "JP", + "KR", + "CN", + "HK", + "TW", + "SG", + "MY", + "TH", + "ID", + "PH", + "VN", + "IN", + "PK", + "BD", + "LK", + "NP", + "MM", + "KH", + "LA", + "MM", + "BT", + "MV", + + // finance + "USD", + "EUR", + "GBP", + "JPY", + "CNY", + "RUB", + "INR", + "AUD", + "CAD", + "CHF", + "SGD", + "MYR", + "THB", + "IDR", + "KRW", + "PHP", + "VND", + "HKD", + "TWD", + "MXN", + "BRL", + "ARS", + "CLP", + "COP", + "PEN", + "ZAR", + "NGN", + "EGP", + "AED", + "SAR", + "ILS", + "TRY", + "SEK", + "NOK", + "DKK", + "ISK", + "HUF", + "PLN", + "CZK", + "RON", + "BGN", + + // programming + "API", + "APIs", + "SDK", + "SDKs", + "AI", + "OCR", + "REST", + "SOAP", + "JSON", + "XML", + "HTTP", + "HTTPS", + "URI", + "URL", + "CRUD", + "RESTful", + "KYB", + "KYC", + "AML", + "HTML", + "CSS", + "JS", + "SQL", + "DB", + "UI", + "UX", + "SaaS", + "PaaS", + "IaaS", + "IP", + "TCP", + "UDP", + "DNS", + "FTP", + "SMTP", + "IMAP", + "POP3", + "CSV", + "MVC", + "MVP", + "MVVM", + "DOM", + "SPA", + "SSR", + "CSR", + "DDoS", + "CDN", + "IoT", + "ML", + "DL", + "NLP", + "CLI", + "GUI", + "BI", + "ETL", + "RDBMS", + "NoSQL", + "IDE", + "CMS", + "CCPA", + "POSIX", + "ABI", + "API", + "AST", + "COBOL", + "DDL", + "DML", + + // AI-related + "NN", // Neural Network + "CNN", // Convolutional Neural Network + "RNN", // Recurrent Neural Network + "LSTM", // Long Short Term Memory + "GRU", // Gated Recurrent Unit + "ANN", // Artificial Neural Network + "GAN", // Generative Adversarial Network + "RL", // Reinforcement Learning + "DL", // Deep Learning + "ML", // Machine Learning + "NLP", // Natural Language Processing + "NLG", // Natural Language Generation + "NLU", // Natural Language Understanding + "BERT", // Bidirectional Encoder Representations from Transformers + "GPT", // Generative Pre-training Transformer + "SVM", // Support Vector Machine + "PCA", // Principal Component Analysis + "AI", // Artificial Intelligence + "CV", // Computer Vision + "TF", // TensorFlow + "TTS", // Text-to-Speech + "ASR", // Automatic Speech Recognition + "HMM", // Hidden Markov Model + "DNN", // Deep Neural Network + "MLP", // Multi-Layer Perceptron + "RBM", // Restricted Boltzmann Machine + "CRF", // Conditional Random Field + + // Media + "PDF", + "PDFs", + "RTF", + "TXT", + "XLS", + "XLSX", + "PPT", + + // Image + "JPG", + "JPEG", + "PNG", + "GIF", + "GIFs", + "SVG", + "TIFF", + "BMP", + "ICO", + "PSD", + "WebP", + "AVIF", + "HEIF", + "HEIC", + "EPS", + + // Audio + "MP3", + "WAV", + "AIFF", + "FLAC", + "WMA", + "AAC", + "OGG", + + // Video + "AVI", + "WMV", + "MOV", + "M4V", + "MP4", + "MPG", + "MPEG", + "FLV", + "SWF", + "MKV", + "WebM", + + // Cloud Computing + "GCP", // Google Cloud Platform + "AWS", // Amazon Web Services + "VM", // Virtual Machines + "VPC", // Virtual Private Cloud + "S3", // AWS Simple Storage Service + "EC2", // AWS Elastic Compute Cloud + + // Data Storage and Databases + "DynamoDB", + "CosmosDB", + "BigQuery", + "CI/CD", + + // Security and Compliance + "SOC1", // Service Organization Control 1 + "SOC2", // Service Organization Control 2 + "SOC3", // Service Organization Control 3 + "PCI DSS", // Payment Card Industry Data Security Standard + "WAF", // Web Application Firewall + "IAM", // Identity and Access Management + + // Networking + "SDN", // Software-Defined Networking + "MPLS", // Multi-Protocol Label Switching + "BGP", // Border Gateway Protocol + + // Frameworks and Libraries + "Vue.js", + "Node.js", + ".NET", +]; diff --git a/packages/fdr-sdk/src/utils/titleCase.ts b/packages/fdr-sdk/src/utils/titleCase.ts new file mode 100644 index 0000000000..d2b047ed59 --- /dev/null +++ b/packages/fdr-sdk/src/utils/titleCase.ts @@ -0,0 +1,19 @@ +import title from "title"; +import { SPECIAL_TOKENS } from "./specialTokens"; + +export function titleCase(name: string): string { + // regex match pascalCase or CamelCase and add spaces between words + name = name.replace(/([a-z])([A-Z])/g, "$1 $2"); + + // regex match snake_case and replace "_" with " " + name = name.replace(/_/g, " "); + + // regex match kebab-case and replace "-" with " " + name = name.replace(/-/g, " "); + + const titleCased = title(name, { special: SPECIAL_TOKENS }); + + // regex match "V 2", "V 4", etc. and replace it with "V2", "V4", etc. + const versionedTitle = titleCased.replace(/V\s(\d)/g, "V$1"); + return versionedTitle; +} diff --git a/packages/fdr-sdk/src/utils/visitDiscriminatedUnion.ts b/packages/fdr-sdk/src/utils/visitDiscriminatedUnion.ts new file mode 100644 index 0000000000..c36b74250c --- /dev/null +++ b/packages/fdr-sdk/src/utils/visitDiscriminatedUnion.ts @@ -0,0 +1,33 @@ +import { assertNever } from "./assertNever"; + +export type DiscriminatedUnionVisitor, U, Discriminant extends string> = { + [D in T[Discriminant]]: (value: Extract>) => U; +} & { + _other?: (value: Record) => U; +}; + +export function visitDiscriminatedUnion>( + item: T, +): { _visit: (visitor: DiscriminatedUnionVisitor) => U }; +export function visitDiscriminatedUnion, Discriminant extends string>( + item: T, + discriminant: Discriminant, +): { _visit: (visitor: DiscriminatedUnionVisitor) => U }; +export function visitDiscriminatedUnion, Discriminant extends string>( + item: T, + discriminant: Discriminant = "type" as Discriminant, +): { _visit: (visitor: DiscriminatedUnionVisitor) => U } { + return { + _visit: (visitor) => { + const visit = visitor[item[discriminant]]; + if (visit != null) { + return visit(item as Extract>); + } else { + if (visitor._other == null) { + assertNever(item as never); + } + return visitor._other(item); + } + }, + }; +} diff --git a/packages/fdr-sdk/tsconfig.json b/packages/fdr-sdk/tsconfig.json index 01a2cacccb..4cc214d5d3 100644 --- a/packages/fdr-sdk/tsconfig.json +++ b/packages/fdr-sdk/tsconfig.json @@ -1,8 +1,9 @@ { "$schema": "https://json.schemastore.org/tsconfig", - "extends": "@fern-platform/configs/tsconfig/react-library.json", + "extends": "@fern-platform/configs/tsconfig/library.json", "compilerOptions": { "isolatedModules": false, + "lib": ["ESNext", "DOM"], "outDir": "./dist", "rootDir": "./src" }, diff --git a/packages/fdr-sdk/turbo.json b/packages/fdr-sdk/turbo.json index cc807bcb92..a902298336 100644 --- a/packages/fdr-sdk/turbo.json +++ b/packages/fdr-sdk/turbo.json @@ -1,7 +1,7 @@ { "$schema": "https://turbo.build/schema.json", "extends": ["//"], - "pipeline": { + "tasks": { "compile": { "outputs": ["dist/**"], "dependsOn": ["^build", "^compile", "codegen"] diff --git a/packages/template-resolver/turbo.json b/packages/template-resolver/turbo.json index cc807bcb92..a902298336 100644 --- a/packages/template-resolver/turbo.json +++ b/packages/template-resolver/turbo.json @@ -1,7 +1,7 @@ { "$schema": "https://turbo.build/schema.json", "extends": ["//"], - "pipeline": { + "tasks": { "compile": { "outputs": ["dist/**"], "dependsOn": ["^build", "^compile", "codegen"] diff --git a/packages/ui/app/src/api-page/endpoints/EndpointContentCodeSnippets.tsx b/packages/ui/app/src/api-page/endpoints/EndpointContentCodeSnippets.tsx index 396e434744..c0a63a8c52 100644 --- a/packages/ui/app/src/api-page/endpoints/EndpointContentCodeSnippets.tsx +++ b/packages/ui/app/src/api-page/endpoints/EndpointContentCodeSnippets.tsx @@ -1,4 +1,3 @@ -"use client"; import { APIV1Read, FernNavigation } from "@fern-api/fdr-sdk"; import { FernButton, FernButtonGroup, FernScrollArea } from "@fern-ui/components"; import { EMPTY_OBJECT, visitDiscriminatedUnion } from "@fern-ui/core-utils"; diff --git a/packages/ui/app/src/api-playground/PlaygroundEndpointSelectorContent.tsx b/packages/ui/app/src/api-playground/PlaygroundEndpointSelectorContent.tsx index 1e74e2827c..64d1b23842 100644 --- a/packages/ui/app/src/api-playground/PlaygroundEndpointSelectorContent.tsx +++ b/packages/ui/app/src/api-playground/PlaygroundEndpointSelectorContent.tsx @@ -1,5 +1,4 @@ import { FernNavigation } from "@fern-api/fdr-sdk"; -import { traverseNavigation } from "@fern-api/fdr-sdk/dist/navigation/utils"; import { FernButton, FernInput, FernScrollArea, FernTooltip, FernTooltipProvider } from "@fern-ui/components"; import { isNonNullish } from "@fern-ui/core-utils"; import { Cross1Icon, MagnifyingGlassIcon, SlashIcon } from "@radix-ui/react-icons"; @@ -30,7 +29,7 @@ export interface ApiGroup { export function flattenApiSection(root: FernNavigation.SidebarRootNode): ApiGroup[] { const result: ApiGroup[] = []; - traverseNavigation(root, (node, _, parents) => { + FernNavigation.utils.traverseNavigation(root, (node, _, parents) => { if (node.type === "changelog") { return "skip"; } diff --git a/packages/ui/app/src/api-playground/utils.ts b/packages/ui/app/src/api-playground/utils.ts index 2589582dfa..891aab05aa 100644 --- a/packages/ui/app/src/api-playground/utils.ts +++ b/packages/ui/app/src/api-playground/utils.ts @@ -1,4 +1,4 @@ -import { CustomSnippetPayload } from "@fern-api/fdr-sdk/dist/client/generated/api"; +import { Snippets } from "@fern-api/fdr-sdk"; import { SnippetTemplateResolver } from "@fern-api/template-resolver"; import { isNonNullish, isPlainObject, visitDiscriminatedUnion } from "@fern-ui/core-utils"; import { isEmpty, mapValues, noop } from "lodash-es"; @@ -334,7 +334,9 @@ ${buildRequests({})}`, }); } -export function convertToCustomSnippetPayload(formState: PlaygroundEndpointRequestFormState): CustomSnippetPayload { +export function convertToCustomSnippetPayload( + formState: PlaygroundEndpointRequestFormState, +): Snippets.CustomSnippetPayload { return { pathParameters: Object.entries(formState.pathParameters).map(([name, value]) => ({ name, value })), queryParameters: Object.entries(formState.queryParameters).map(([name, value]) => ({ name, value })), diff --git a/packages/ui/app/src/contexts/docs-context/DocsContext.ts b/packages/ui/app/src/contexts/docs-context/DocsContext.ts index 929371a8d5..582ce525b6 100644 --- a/packages/ui/app/src/contexts/docs-context/DocsContext.ts +++ b/packages/ui/app/src/contexts/docs-context/DocsContext.ts @@ -1,4 +1,5 @@ -import { DocsV1Read, FdrAPI, FernNavigation, NodeCollector } from "@fern-api/fdr-sdk"; +import { DocsV1Read, FdrAPI, FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { ColorsConfig } from "@fern-ui/fdr-utils"; import React from "react"; import { DocsPage } from "../../next-app/DocsPage"; diff --git a/packages/ui/app/src/contexts/docs-context/DocsContextProvider.tsx b/packages/ui/app/src/contexts/docs-context/DocsContextProvider.tsx index bcc677e93c..d5e68866df 100644 --- a/packages/ui/app/src/contexts/docs-context/DocsContextProvider.tsx +++ b/packages/ui/app/src/contexts/docs-context/DocsContextProvider.tsx @@ -1,4 +1,5 @@ -import { DocsV1Read, NodeCollector } from "@fern-api/fdr-sdk"; +import { DocsV1Read } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { useDeepCompareMemoize } from "@fern-ui/react-commons"; import { useTheme } from "next-themes"; import Head from "next/head"; diff --git a/packages/ui/app/src/sidebar/CollapseSidebarContext.tsx b/packages/ui/app/src/sidebar/CollapseSidebarContext.tsx index 5adabff910..328b7d49e3 100644 --- a/packages/ui/app/src/sidebar/CollapseSidebarContext.tsx +++ b/packages/ui/app/src/sidebar/CollapseSidebarContext.tsx @@ -1,4 +1,5 @@ -import { FernNavigation, NodeCollector } from "@fern-api/fdr-sdk"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { noop } from "lodash-es"; import { useRouter } from "next/router"; import { diff --git a/packages/ui/app/tsconfig.json b/packages/ui/app/tsconfig.json index 99caaa26c6..2b8d436b2c 100644 --- a/packages/ui/app/tsconfig.json +++ b/packages/ui/app/tsconfig.json @@ -12,6 +12,8 @@ { "path": "../../commons/loadable" }, { "path": "../components" }, { "path": "../../commons/react/react-commons" }, - { "path": "../../template-resolver" } + { "path": "../../template-resolver" }, + { "path": "../../fdr-sdk" }, + { "path": "../../commons/fdr-utils" } ] } diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/resolve-api.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/resolve-api.ts index 0f0b2c4a2d..b5cb1f4d12 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/resolve-api.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/resolve-api.ts @@ -1,6 +1,5 @@ -import { ApiDefinitionHolder } from "@fern-api/fdr-sdk/dist/navigation/ApiDefinitionHolder"; -import { collectApiReferences } from "@fern-api/fdr-sdk/dist/navigation/utils/collectApiReferences"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { ApiDefinitionHolder } from "@fern-api/fdr-sdk/navigation"; import { ApiDefinitionResolver, ApiTypeResolver, REGISTRY_SERVICE, type ResolvedRootPackage } from "@fern-ui/ui"; import { NextApiHandler, NextApiResponse } from "next"; import { buildUrlFromApiNode } from "../../../utils/buildUrlFromApi"; @@ -35,12 +34,12 @@ const resolveApiHandler: NextApiHandler = async ( } const docs = docsResponse.body; - const root = convertLoadDocsForUrlResponse(docsResponse.body); + const root = FernNavigation.utils.convertLoadDocsForUrlResponse(docsResponse.body); const featureFlags = await getFeatureFlags(docs.baseUrl.domain); const packagesPromise: Promise[] = []; - collectApiReferences(root).forEach((apiReference) => { + FernNavigation.utils.collectApiReferences(root).forEach((apiReference) => { const api = docs.definition.apis[apiReference.apiDefinitionId]; if (api == null) { return; diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all.ts index a33798af67..b5abdce8fc 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all.ts @@ -1,5 +1,5 @@ -import { NodeCollector } from "@fern-api/fdr-sdk/dist/navigation/NodeCollector"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { buildUrl } from "@fern-ui/fdr-utils"; import { NextApiHandler, NextApiRequest, NextApiResponse } from "next"; import urljoin from "url-join"; @@ -62,7 +62,7 @@ const handler: NextApiHandler = async ( return res.status(404).json({ successfulRevalidations: [], failedRevalidations: [] }); } - const node = convertLoadDocsForUrlResponse(docs); + const node = FernNavigation.utils.convertLoadDocsForUrlResponse(docs); const slugCollector = NodeCollector.collect(node); const urls = slugCollector.getSlugs().map((slug) => urljoin(xFernHost, slug)); diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v2.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v2.ts index 06db5ac3ee..a7039a15f5 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v2.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v2.ts @@ -1,5 +1,5 @@ -import { NodeCollector } from "@fern-api/fdr-sdk/dist/navigation/NodeCollector"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { isPlainObject } from "@fern-ui/core-utils"; import { buildUrl } from "@fern-ui/fdr-utils"; import { NextApiHandler, NextApiRequest, NextApiResponse } from "next"; @@ -63,7 +63,7 @@ const handler: NextApiHandler = async ( return res.status(404).json({ successfulRevalidations: [], failedRevalidations: [] }); } - const node = convertLoadDocsForUrlResponse(docs); + const node = FernNavigation.utils.convertLoadDocsForUrlResponse(docs); const slugCollector = NodeCollector.collect(node); const urls = slugCollector.getSlugs().map((slug) => urljoin(xFernHost, slug)); diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v3.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v3.ts index 8e7e4bb710..77710d247c 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v3.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/revalidate-all/v3.ts @@ -1,5 +1,5 @@ -import { NodeCollector } from "@fern-api/fdr-sdk/dist/navigation/NodeCollector"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { buildUrl } from "@fern-ui/fdr-utils"; import { NextApiHandler, NextApiRequest, NextApiResponse } from "next"; import urljoin from "url-join"; @@ -62,7 +62,7 @@ const handler: NextApiHandler = async ( return res.status(404).json({ successfulRevalidations: [], failedRevalidations: [] }); } - const node = convertLoadDocsForUrlResponse(docs); + const node = FernNavigation.utils.convertLoadDocsForUrlResponse(docs); const slugCollector = NodeCollector.collect(node); const urls = slugCollector.getSlugs().map((slug) => urljoin(xFernHost, slug)); diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.ts index d6023936e3..7deabf07ca 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.ts @@ -1,5 +1,5 @@ -import { NodeCollector } from "@fern-api/fdr-sdk/dist/navigation/NodeCollector"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { NextRequest, NextResponse } from "next/server"; import urljoin from "url-join"; import { buildUrlFromApiEdge } from "../../../utils/buildUrlFromApi"; @@ -25,7 +25,7 @@ export default async function GET(req: NextRequest): Promise { return jsonResponse(404, [], { headers }); } - const node = convertLoadDocsForUrlResponse(docs); + const node = FernNavigation.utils.convertLoadDocsForUrlResponse(docs); const slugCollector = NodeCollector.collect(node); const urls = slugCollector.getPageSlugs().map((slug) => urljoin(xFernHost, slug)); diff --git a/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.xml.ts b/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.xml.ts index 4920db6e49..b3e83ece52 100644 --- a/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.xml.ts +++ b/packages/ui/docs-bundle/src/pages/api/fern-docs/sitemap.xml.ts @@ -1,5 +1,5 @@ -import { NodeCollector } from "@fern-api/fdr-sdk/dist/navigation/NodeCollector"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; +import { FernNavigation } from "@fern-api/fdr-sdk"; +import { NodeCollector } from "@fern-api/fdr-sdk/navigation"; import { NextRequest, NextResponse } from "next/server"; import urljoin from "url-join"; import { buildUrlFromApiEdge } from "../../../utils/buildUrlFromApi"; @@ -25,7 +25,7 @@ export default async function GET(req: NextRequest): Promise { return new NextResponse(null, { status: 404 }); } - const node = convertLoadDocsForUrlResponse(docs); + const node = FernNavigation.utils.convertLoadDocsForUrlResponse(docs); const slugCollector = NodeCollector.collect(node); const urls = slugCollector.getPageSlugs().map((slug) => urljoin(xFernHost, slug)); diff --git a/packages/ui/docs-bundle/src/utils/getDocsPageProps.ts b/packages/ui/docs-bundle/src/utils/getDocsPageProps.ts index 879ae8669c..221393fb83 100644 --- a/packages/ui/docs-bundle/src/utils/getDocsPageProps.ts +++ b/packages/ui/docs-bundle/src/utils/getDocsPageProps.ts @@ -1,6 +1,4 @@ -import { FdrClient, type DocsV2Read } from "@fern-api/fdr-sdk"; -import { convertLoadDocsForUrlResponse } from "@fern-api/fdr-sdk/dist/navigation/utils/convertLoadDocsForUrlResponse"; -import { findNode } from "@fern-api/fdr-sdk/dist/navigation/utils/findNode"; +import { FdrClient, FernNavigation, type DocsV2Read } from "@fern-api/fdr-sdk"; import { FernVenusApi, FernVenusApiClient } from "@fern-api/venus-api-sdk"; import { visitDiscriminatedUnion } from "@fern-ui/core-utils"; import { SidebarTab, buildUrl } from "@fern-ui/fdr-utils"; @@ -174,8 +172,8 @@ async function convertDocsToDocsPageProps({ }; } - const root = convertLoadDocsForUrlResponse(docs); - const node = findNode(root, slug); + const root = FernNavigation.utils.convertLoadDocsForUrlResponse(docs); + const node = FernNavigation.utils.findNode(root, slug); if (node.type === "notFound") { // eslint-disable-next-line no-console diff --git a/packages/ui/local-preview-bundle/.depcheckrc.json b/packages/ui/local-preview-bundle/.depcheckrc.json index b2a82a4ecf..ef3f5df4b1 100644 --- a/packages/ui/local-preview-bundle/.depcheckrc.json +++ b/packages/ui/local-preview-bundle/.depcheckrc.json @@ -16,7 +16,8 @@ "lodash-es", "@types/lodash-es", "node-fetch", - "@types/node-fetch" + "@types/node-fetch", + "@emotion/is-prop-valid" ], "ignore-patterns": ["dist"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1a3b65d4e7..576882bc48 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -157,8 +157,8 @@ importers: specifier: ^4.7.1 version: 4.9.3 turbo: - specifier: ^1.12.5 - version: 1.13.3 + specifier: ^2.0.1 + version: 2.0.1 typescript: specifier: 5.4.3 version: 5.4.3 @@ -621,9 +621,6 @@ importers: packages/fdr-sdk: dependencies: - '@fern-ui/core-utils': - specifier: workspace:* - version: link:../commons/core-utils dayjs: specifier: ^1.11.11 version: 1.11.11 @@ -642,6 +639,9 @@ importers: tinycolor2: specifier: ^1.6.0 version: 1.6.0 + title: + specifier: ^3.5.3 + version: 3.5.3 url-join: specifier: 4.0.1 version: 4.0.1 @@ -667,21 +667,18 @@ importers: '@types/tinycolor2': specifier: ^1.4.6 version: 1.4.6 + '@types/title': + specifier: ^3.4.3 + version: 3.4.3 '@types/url-join': specifier: 4.0.1 version: 4.0.1 eslint: specifier: ^8.56.0 version: 8.57.0 - eslint-config-custom: - specifier: '*' - version: 0.0.0(eslint@8.57.0)(typescript@5.4.3) prettier: specifier: ^3.2.4 version: 3.2.5 - tsconfig: - specifier: '*' - version: 7.0.0 typescript: specifier: 5.4.3 version: 5.4.3 @@ -880,8 +877,6 @@ importers: specifier: 5.4.3 version: 5.4.3 - packages/template-resolver/dist/esm: {} - packages/ui/app: dependencies: '@datadog/browser-logs': @@ -1904,9 +1899,6 @@ importers: eslint: specifier: ^8.56.0 version: 8.57.0 - eslint-config-custom: - specifier: '*' - version: 0.0.0(eslint@8.57.0)(typescript@5.4.3) execa: specifier: ^5.1.1 version: 5.1.1 @@ -1919,9 +1911,6 @@ importers: prisma: specifier: 5.13.0 version: 5.13.0 - tsconfig: - specifier: '*' - version: 7.0.0 tsx: specifier: ^4.7.1 version: 4.9.3 @@ -5660,12 +5649,6 @@ packages: /@next/env@14.2.3: resolution: {integrity: sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==} - /@next/eslint-plugin-next@12.3.4: - resolution: {integrity: sha512-BFwj8ykJY+zc1/jWANsDprDIu2MgwPOIKxNVnrKvPs+f5TPegrVnem8uScND+1veT4B7F6VeqgaNLFW1Hzl9Og==} - dependencies: - glob: 7.1.7 - dev: true - /@next/eslint-plugin-next@14.2.3: resolution: {integrity: sha512-L3oDricIIjgj1AVnRdRor21gI7mShlSwU/1ZGHmqM3LzHhXXhdkrfeNY5zif25Bi5Dd7fiJHsbhoZCHfXYvlAw==} dependencies: @@ -10888,26 +10871,6 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.4.3) - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.57.0 - typescript: 5.4.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -15017,44 +14980,6 @@ packages: source-map: 0.6.1 dev: true - /eslint-config-custom@0.0.0(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-kwCw78yisbgKdJBJ5qooPmpBYDphDfM2oxSROmtfOwBXBwXuRiSV3suO01W3mVLEFpmQZxMWd/qajKpJhkKSug==} - dependencies: - eslint-config-next: 12.3.4(eslint@8.57.0)(typescript@5.4.3) - eslint-config-prettier: 8.10.0(eslint@8.57.0) - eslint-plugin-react: 7.28.0(eslint@8.57.0) - transitivePeerDependencies: - - eslint - - eslint-import-resolver-webpack - - supports-color - - typescript - dev: true - - /eslint-config-next@12.3.4(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-WuT3gvgi7Bwz00AOmKGhOeqnyA5P29Cdyr0iVjLyfDbk+FANQKcOjFUTZIdyYfe5Tq1x4TGcmoe4CwctGvFjHQ==} - peerDependencies: - eslint: ^7.23.0 || ^8.0.0 - typescript: '>=3.3.1' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@next/eslint-plugin-next': 12.3.4 - '@rushstack/eslint-patch': 1.10.2 - '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@5.4.3) - eslint: 8.57.0 - eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 2.7.1(eslint-plugin-import@2.29.1)(eslint@8.57.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0) - eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.0) - eslint-plugin-react: 7.34.1(eslint@8.57.0) - eslint-plugin-react-hooks: 4.6.2(eslint@8.57.0) - typescript: 5.4.3 - transitivePeerDependencies: - - eslint-import-resolver-webpack - - supports-color - dev: true - /eslint-config-next@14.2.3(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-ZkNztm3Q7hjqvB1rRlOX8P9E/cXRL9ajRcs8jufEtwMfTVYRqnmtnaSu57QqHyBlovMuiB8LEzfLBkh5RYV6Fg==} peerDependencies: @@ -15080,15 +15005,6 @@ packages: - supports-color dev: true - /eslint-config-prettier@8.10.0(eslint@8.57.0): - resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - dependencies: - eslint: 8.57.0 - dev: true - /eslint-config-prettier@9.1.0(eslint@8.57.0): resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true @@ -15106,24 +15022,6 @@ packages: transitivePeerDependencies: - supports-color - /eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.29.1)(eslint@8.57.0): - resolution: {integrity: sha512-00UbgGwV8bSgUv34igBDbTOtKhqoRMy9bFjNehT40bXg6585PNIct8HhXZ0SybqB9rWtXj9crcku8ndDn/gIqQ==} - engines: {node: '>=4'} - peerDependencies: - eslint: '*' - eslint-plugin-import: '*' - dependencies: - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.57.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0) - glob: 7.2.3 - is-glob: 4.0.3 - resolve: 1.22.8 - tsconfig-paths: 3.15.0 - transitivePeerDependencies: - - supports-color - dev: true - /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0): resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==} engines: {node: ^14.18.0 || >=16.0.0} @@ -15337,29 +15235,6 @@ packages: dependencies: eslint: 8.57.0 - /eslint-plugin-react@7.28.0(eslint@8.57.0): - resolution: {integrity: sha512-IOlFIRHzWfEQQKcAD4iyYDndHwTQiCMcJVJjxempf203jnNLUnW34AXLrV33+nEXoifJE2ZEGmcjKPL8957eSw==} - engines: {node: '>=4'} - peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 - dependencies: - array-includes: 3.1.8 - array.prototype.flatmap: 1.3.2 - doctrine: 2.1.0 - eslint: 8.57.0 - estraverse: 5.3.0 - jsx-ast-utils: 3.3.5 - minimatch: 3.1.2 - object.entries: 1.1.8 - object.fromentries: 2.0.8 - object.hasown: 1.1.4 - object.values: 1.2.0 - prop-types: 15.8.1 - resolve: 2.0.0-next.5 - semver: 6.3.1 - string.prototype.matchall: 4.0.11 - dev: true - /eslint-plugin-react@7.34.1(eslint@8.57.0): resolution: {integrity: sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==} engines: {node: '>=4'} @@ -16588,17 +16463,6 @@ packages: minipass: 7.1.1 path-scurry: 1.11.0 - /glob@7.1.7: - resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true - /glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} dependencies: @@ -25577,64 +25441,64 @@ packages: engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} dev: true - /turbo-darwin-64@1.13.3: - resolution: {integrity: sha512-glup8Qx1qEFB5jerAnXbS8WrL92OKyMmg5Hnd4PleLljAeYmx+cmmnsmLT7tpaVZIN58EAAwu8wHC6kIIqhbWA==} + /turbo-darwin-64@2.0.1: + resolution: {integrity: sha512-GO391pUmI6c6l/EpUIaXNzwbVDWRvYahm5oLB176dAWRYKYO+Osqs/XBdOM0G3l7ZFdR6nUtRJc8qinJp7qDUQ==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-darwin-arm64@1.13.3: - resolution: {integrity: sha512-/np2xD+f/+9qY8BVtuOQXRq5f9LehCFxamiQnwdqWm5iZmdjygC5T3uVSYuagVFsZKMvX3ycySwh8dylGTl6lg==} + /turbo-darwin-arm64@2.0.1: + resolution: {integrity: sha512-rmjJoxeq7nmH/F2aWKapahrDE2zE2Uc15rvs4Rz6qHOzSqC8R5uyLpQyTKIPIZ95O/z9nKfLfVPyiRENuk5vpw==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-linux-64@1.13.3: - resolution: {integrity: sha512-G+HGrau54iAnbXLfl+N/PynqpDwi/uDzb6iM9hXEDG+yJnSJxaHMShhOkXYJPk9offm9prH33Khx2scXrYVW1g==} + /turbo-linux-64@2.0.1: + resolution: {integrity: sha512-vwTOc4v4jm6tM+9WlsiDlN+zwHP8A2wlsAYiNqz2u0DZL55aCWaVdivh2VpVLN36Mr9HgREGH0Fw+jx6ObcNRg==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-linux-arm64@1.13.3: - resolution: {integrity: sha512-qWwEl5VR02NqRyl68/3pwp3c/olZuSp+vwlwrunuoNTm6JXGLG5pTeme4zoHNnk0qn4cCX7DFrOboArlYxv0wQ==} + /turbo-linux-arm64@2.0.1: + resolution: {integrity: sha512-DkVt76fjwY940DfmqznWhpYIlKYduvKAoTtylkERrDlcWUpDYWwqNbcf9PRRIbnjnv9lIxvuom1KZmMY+cw/Ig==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-windows-64@1.13.3: - resolution: {integrity: sha512-Nudr4bRChfJzBPzEmpVV85VwUYRCGKecwkBFpbp2a4NtrJ3+UP1VZES653ckqCu2FRyRuS0n03v9euMbAvzH+Q==} + /turbo-windows-64@2.0.1: + resolution: {integrity: sha512-XskV34kYuXVIHbRbgH8jr35Y8uA6kJOQ0LJStU4jFk7piiyk0a4n2GNDymMtvIwAxYdbuTe+pKuPCThFdirHBQ==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true - /turbo-windows-arm64@1.13.3: - resolution: {integrity: sha512-ouJCgsVLd3icjRLmRvHQDDZnmGzT64GBupM1Y+TjtYn2LVaEBoV6hicFy8x5DUpnqdLy+YpCzRMkWlwhmkX7sQ==} + /turbo-windows-arm64@2.0.1: + resolution: {integrity: sha512-R2/RmKr2uQxkOCtXK5LNxdD3Iv7lUm56iy2FrDwTDgPI7X7K6WRjrxdirmFIu/fABYE5n6EampU3ejbG5mmGtg==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /turbo@1.13.3: - resolution: {integrity: sha512-n17HJv4F4CpsYTvKzUJhLbyewbXjq1oLCi90i5tW1TiWDz16ML1eDG7wi5dHaKxzh5efIM56SITnuVbMq5dk4g==} + /turbo@2.0.1: + resolution: {integrity: sha512-sJhxfBaN14pYj//xxAG6zAyStkE2j4HI9JVXVMob35SGob6dz/HuSqV/4QlVqw0uKAkwc1lXIsnykbe8RLmOOw==} hasBin: true optionalDependencies: - turbo-darwin-64: 1.13.3 - turbo-darwin-arm64: 1.13.3 - turbo-linux-64: 1.13.3 - turbo-linux-arm64: 1.13.3 - turbo-windows-64: 1.13.3 - turbo-windows-arm64: 1.13.3 + turbo-darwin-64: 2.0.1 + turbo-darwin-arm64: 2.0.1 + turbo-linux-64: 2.0.1 + turbo-linux-arm64: 2.0.1 + turbo-windows-64: 2.0.1 + turbo-windows-arm64: 2.0.1 dev: true /tween-functions@1.2.0: diff --git a/servers/fdr/package.json b/servers/fdr/package.json index fc2620a887..ccd4d45408 100644 --- a/servers/fdr/package.json +++ b/servers/fdr/package.json @@ -59,13 +59,11 @@ "@yarnpkg/pnpify": "^4.0.1", "dotenv-cli": "^6.0.0", "eslint": "^8.56.0", - "eslint-config-custom": "*", "execa": "^5.1.1", "nodemon": "^3.0.0", "prettier": "^3.2.4", "prisma": "5.13.0", "redis": "^4.6.13", - "tsconfig": "*", "tsx": "^4.7.1", "typescript": "5.4.3", "vitest": "^1.5.0" diff --git a/servers/fdr/src/__test__/local/util.ts b/servers/fdr/src/__test__/local/util.ts index 75d4cb4722..539ef3abb0 100644 --- a/servers/fdr/src/__test__/local/util.ts +++ b/servers/fdr/src/__test__/local/util.ts @@ -1,5 +1,4 @@ -import { APIV1Write, FdrClient } from "@fern-api/fdr-sdk"; -import { APIResponse } from "@fern-api/fdr-sdk/dist/client/generated/core"; +import { APIResponse, APIV1Write, FdrClient } from "@fern-api/fdr-sdk"; import type { DocsV2, IndexSegment } from "@prisma/client"; export function getUniqueDocsForUrl(prefix: string): string { diff --git a/servers/fdr/turbo.json b/servers/fdr/turbo.json index cc807bcb92..a902298336 100644 --- a/servers/fdr/turbo.json +++ b/servers/fdr/turbo.json @@ -1,7 +1,7 @@ { "$schema": "https://turbo.build/schema.json", "extends": ["//"], - "pipeline": { + "tasks": { "compile": { "outputs": ["dist/**"], "dependsOn": ["^build", "^compile", "codegen"] diff --git a/shared/.prettierignore b/shared/.prettierignore index 70e45f1598..24f927d4f8 100644 --- a/shared/.prettierignore +++ b/shared/.prettierignore @@ -24,3 +24,4 @@ clis/docs-migrator/src/__test__/fixtures/bland/api-reference/endpoint/call.mdx **/__test__/**/*.json **/__test__/fixtures/ **/__test__/outputs/ +.turbo diff --git a/turbo.json b/turbo.json index bc07845ca3..03026b6e38 100644 --- a/turbo.json +++ b/turbo.json @@ -1,6 +1,6 @@ { "$schema": "https://turbo.build/schema.json", - "pipeline": { + "tasks": { "build": { "outputs": ["dist/**", ".next/**", "!.next/cache/**"], "dependsOn": ["^build", "^compile", "codegen"]