Skip to content

Commit

Permalink
chore: algolia v3 to v1 record converter (#1760)
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava authored Nov 1, 2024
1 parent 8715af7 commit 2563bf5
Show file tree
Hide file tree
Showing 13 changed files with 22,322 additions and 2,352 deletions.
2 changes: 2 additions & 0 deletions packages/fdr-sdk/src/navigation/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export * from "./createBreadcrumb";
export * from "./findNode";
export * from "./getApiReferenceId";
export * from "./getNoIndexFromFrontmatter";
export * from "./toApis";
export * from "./toPages";
export * from "./toRootNode";
export * from "./toUnversionedSlug";
13 changes: 13 additions & 0 deletions packages/fdr-sdk/src/navigation/utils/toApis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { mapValues } from "es-toolkit";
import { ApiDefinition } from "../..";
import { DocsV2Read } from "../../client";

export function toApis(docs: DocsV2Read.LoadDocsForUrlResponse) {
return mapValues(docs.definition.apis, (api) =>
ApiDefinition.ApiDefinitionV1ToLatest.from(api, {
useJavaScriptAsTypeScript: false,
alwaysEnableJavaScriptFetch: false,
usesApplicationJsonInFormDataValue: false,
}).migrate(),
);
}
6 changes: 6 additions & 0 deletions packages/fdr-sdk/src/navigation/utils/toPages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { mapValues } from "es-toolkit";
import { DocsV2Read } from "../../client";

export function toPages(docs: DocsV2Read.LoadDocsForUrlResponse) {
return mapValues(docs.definition.pages, (page) => page.markdown);
}
4 changes: 4 additions & 0 deletions packages/ui/fern-docs-search-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@
"@fern-ui/fern-docs-mdx": "workspace:*",
"algoliasearch": "^5.8.1",
"es-toolkit": "^1.24.0",
"html-to-text": "^9.0.5",
"marked": "^5.1.0",
"pnpm": "^9.12.1",
"ts-essentials": "^10.0.1"
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/html-to-text": "^9.0.1",
"@types/marked": "^5.0.0",
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^8.56.0",
Expand Down
Loading

0 comments on commit 2563bf5

Please sign in to comment.