From 04b155961bc8227a430f098e56247d4ed2085fb4 Mon Sep 17 00:00:00 2001 From: Matthew Goodwin <49927862+m4ttheweric@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:13:41 -0500 Subject: [PATCH 1/2] add script to build a routes object --- package.json | 3 +- routes.json | 363 +++++++++++++++++++++++++++++++++++++ scripts/generateRoutes.cjs | 29 +++ 3 files changed, 394 insertions(+), 1 deletion(-) create mode 100644 routes.json create mode 100644 scripts/generateRoutes.cjs diff --git a/package.json b/package.json index 2dda82210..60a545fbc 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "write-cli-docs": "cd utilities/auto-cli && ./scaffold.sh", "write-metadata-docs": "cd utilities/generate-metadata-docs && npm run start", "seo": "cd utilities/improve-front-matter-seo/ && node improve-seo.js", - "update-cli-version": "cd utilities/update-cli-version/ && npm run start" + "update-cli-version": "cd utilities/update-cli-version/ && npm run start", + "build-routes": "node ./scripts/generateRoutes.cjs" }, "dependencies": { "@docusaurus/core": "3.4.0", diff --git a/routes.json b/routes.json new file mode 100644 index 000000000..3476c534e --- /dev/null +++ b/routes.json @@ -0,0 +1,363 @@ +{ + "Introduction": "/docs/3.0/index", + "Getting Started": { + "Overview": "/docs/3.0/getting-started/overview", + "Quickstart": "/docs/3.0/getting-started/quickstart", + "With PostgreSQL": "/docs/3.0/getting-started/with-postgresql", + "With MongoDB": "/docs/3.0/getting-started/with-mongodb", + "With ClickHouse": "/docs/3.0/getting-started/with-clickhouse", + "With other sources": "/docs/3.0/getting-started/with-others" + }, + "Understanding DDN": { + "Overview": "/docs/3.0/basics/overview", + "Background": "/docs/3.0/basics/background", + "Core Concepts": "/docs/3.0/basics/core-concepts", + "Explore a Finished Supergraph": { + "Explore your Supergraph": "/docs/3.0/basics/explore/explore-your-api", + "Interact with your Supergraph": "/docs/3.0/basics/explore/interact", + "Monitor your Supergraph": "/docs/3.0/basics/explore/monitor" + } + }, + "GraphQL API": { + "Overview": "/docs/3.0/graphql-api/overview", + "Queries": { + "Simple Queries": "/docs/3.0/graphql-api/queries/simple-queries", + "Nested Queries": "/docs/3.0/graphql-api/queries/nested-queries", + "Sort query results": "/docs/3.0/graphql-api/queries/sorting", + "Paginate query results": "/docs/3.0/graphql-api/queries/pagination", + "Filter query results": { + "Filter by comparing values": "/docs/3.0/graphql-api/queries/filters/comparison-operators", + "Filter by boolean expressions": "/docs/3.0/graphql-api/queries/filters/boolean-operators", + "Filter by text": "/docs/3.0/graphql-api/queries/filters/text-search-operators", + "Filter based on nested fields": "/docs/3.0/graphql-api/queries/filters/nested-objects", + "Performance of relationship comparisons": "/docs/3.0/graphql-api/queries/filters/performance-relationship-comparisons" + }, + "Use multiple arguments": "/docs/3.0/graphql-api/queries/multiple-arguments", + "Multiple queries in a request": "/docs/3.0/graphql-api/queries/multiple-queries", + "Use variables / aliases / fragments / directives": "/docs/3.0/graphql-api/queries/variables-aliases-fragments-directives" + }, + "Mutations": "/docs/3.0/graphql-api/mutations/", + "Global IDs": "/docs/3.0/graphql-api/global-ids", + "API Versioning": "/docs/3.0/graphql-api/versioning", + "Apollo Federation": "/docs/3.0/graphql-api/apollo-federation", + "Errors": "/docs/3.0/graphql-api/errors", + "GraphQL Schema Diff": "/docs/3.0/graphql-api/graphql-schema-diff" + }, + "Connectors": { + "Overview": "/docs/3.0/connectors/overview", + "Introduction": "/docs/3.0/connectors/introduction", + "PostgreSQL": { + "Data Modeling": "/docs/3.0/connectors/postgresql/modeling", + "Configuration Reference": { + "Version 5": "/docs/3.0/connectors/postgresql/configuration-reference/version-5", + "Version 4 (Deprecated)": "/docs/3.0/connectors/postgresql/configuration-reference/version-4", + "Version 3 (Deprecated)": "/docs/3.0/connectors/postgresql/configuration-reference/version-3" + }, + "Native Operations": { + "Native Queries": "/docs/3.0/connectors/postgresql/native-operations/custom-queries", + "Native Mutations": "/docs/3.0/connectors/postgresql/native-operations/custom-mutations", + "Vector Search": "/docs/3.0/connectors/postgresql/native-operations/vector-search", + "Syntax": "/docs/3.0/connectors/postgresql/native-operations/syntax" + }, + "Run a Postgres database locally": "/docs/3.0/connectors/postgresql/local-postgres", + "Troubleshooting": "/docs/3.0/connectors/postgresql/troubleshooting" + }, + "MongoDB": { + "Data Modeling": "/docs/3.0/connectors/mongodb/modeling", + "Configuration": "/docs/3.0/connectors/mongodb/config", + "Native Operations": { + "Native Queries": "/docs/3.0/connectors/mongodb/native-operations/native-queries", + "Native Mutations": "/docs/3.0/connectors/mongodb/native-operations/native-mutations", + "Vector Search": "/docs/3.0/connectors/mongodb/native-operations/vector-search", + "Syntax": "/docs/3.0/connectors/mongodb/native-operations/syntax" + } + }, + "ClickHouse": { + "Data Modeling": "/docs/3.0/connectors/clickhouse/modeling", + "Configuration": "/docs/3.0/connectors/clickhouse/config", + "Native Queries": "/docs/3.0/connectors/clickhouse/native-queries" + }, + "External APIs": { + "GraphQL": "/docs/3.0/connectors/external-apis/graphql", + "OpenAPI": "/docs/3.0/connectors/external-apis/open-api" + }, + "Other connectors": "/docs/3.0/connectors/other-connectors", + "Managing a Connector": "/docs/3.0/connectors/deployment", + "Region Routing": "/docs/3.0/connectors/region-routing", + "Response Size Limit": "/docs/3.0/connectors/response-size-limit", + "Build your own connector": { + "Connector in TypeScript Tutorial": "/docs/3.0/connectors/build-your-own/introduction", + "Get Started": { + "Clone the Repo": "/docs/3.0/connectors/build-your-own/get-started/clone", + "Basic Setup": "/docs/3.0/connectors/build-your-own/get-started/basics", + "Configuration and State": "/docs/3.0/connectors/build-your-own/get-started/configuration-and-state", + "Function Definitions": "/docs/3.0/connectors/build-your-own/get-started/function-definitions", + "Implementation": "/docs/3.0/connectors/build-your-own/get-started/implementation", + "The Get Schema Function": "/docs/3.0/connectors/build-your-own/get-started/implement-get-schema-and-query", + "Testing": "/docs/3.0/connectors/build-your-own/get-started/testing", + "The Query Function": "/docs/3.0/connectors/build-your-own/get-started/query-function" + }, + "Predicates": { + "Where Clause": "/docs/3.0/connectors/build-your-own/predicates/where-clause", + "Expression Types": "/docs/3.0/connectors/build-your-own/predicates/expression-types", + "Building the 'where' clause": "/docs/3.0/connectors/build-your-own/predicates/building-the-where-clause", + "Testing": "/docs/3.0/connectors/build-your-own/predicates/testing" + }, + "Sorting": { + "Order By": "/docs/3.0/connectors/build-your-own/sorting/order_by" + }, + "Aggregates": { + "Implementing Aggregates": "/docs/3.0/connectors/build-your-own/aggregates/fetch-aggregates" + }, + "Relationships": { + "Relationships": "/docs/3.0/connectors/build-your-own/relationships/relationships" + }, + "Operators": { + "Custom Operators": "/docs/3.0/connectors/build-your-own/operators/operators" + }, + "Observability": { + "Observability": "/docs/3.0/connectors/build-your-own/observability/observability" + }, + "Conclusion": "/docs/3.0/connectors/build-your-own/conclusion" + } + }, + "Auth": { + "Overview": "/docs/3.0/auth/overview", + "Authentication": { + "JWT": { + "Enabling JWT Authentication": "/docs/3.0/auth/authentication/jwt/setup", + "Providers": "/docs/3.0/auth/authentication/jwt/providers", + "Set up a Test JWT": "/docs/3.0/auth/authentication/jwt/setup-test-jwt" + }, + "Webhook": { + "Enabling Webhook Authentication": "/docs/3.0/auth/authentication/webhook/setup", + "Enabling Admin and Unauthenticated Requests": "/docs/3.0/auth/authentication/webhook/special-roles" + } + }, + "Authorization": "/docs/3.0/auth/authorization/index" + }, + "Business Logic": { + "Overview": "/docs/3.0/business-logic/overview", + "Introduction": "/docs/3.0/business-logic/introduction", + "TypeScript": "/docs/3.0/business-logic/typescript", + "Python": "/docs/3.0/business-logic/python", + "Go": "/docs/3.0/business-logic/go" + }, + "Collaboration": { + "Overview": "/docs/3.0/collaboration/overview", + "Invite others & allow access": "/docs/3.0/collaboration/invite", + "Onboard Teams": "/docs/3.0/collaboration/federation", + "Best Practices": "/docs/3.0/collaboration/best-practices", + "Comment on Metadata": "/docs/3.0/collaboration/comment" + }, + "Project Configuration": { + "Overview": "/docs/3.0/project-configuration/overview", + "Directory structure": "/docs/3.0/project-configuration/config", + "Projects": "/docs/3.0/project-configuration/projects", + "Subgraphs": "/docs/3.0/project-configuration/subgraphs", + "Builds": "/docs/3.0/project-configuration/builds", + "Custom scripts": "/docs/3.0/project-configuration/custom-scripts", + "Contexts": "/docs/3.0/project-configuration/contexts", + "Generating metadata": "/docs/3.0/project-configuration/metadata-generation", + "Upgrading legacy configuration": { + "Deprecated Metadata Upgrades": "/docs/3.0/project-configuration/upgrading-project-config/deprecated-metadata-upgrades", + "Upgrade to project config v2": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-project-v2", + "Upgrade to supergraph config v2": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-supergraph-v2", + "Upgrade to project config v3": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-project-v3", + "Upgrade to context config v3": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-context-v3", + "Fix env var for OTLP endpoint": "/docs/3.0/project-configuration/upgrading-project-config/fix-traces-env-var" + } + }, + "Supergraph Modeling": { + "Overview": "/docs/3.0/supergraph-modeling/overview", + "Working with Metadata": "/docs/3.0/supergraph-modeling/introduction", + "Build configs": "/docs/3.0/supergraph-modeling/build-configs", + "Data Connector Links": "/docs/3.0/supergraph-modeling/data-connector-links", + "Types": "/docs/3.0/supergraph-modeling/types", + "Models": "/docs/3.0/supergraph-modeling/models", + "Commands": "/docs/3.0/supergraph-modeling/commands", + "Boolean Expressions": "/docs/3.0/supergraph-modeling/boolean-expressions", + "Aggregate Expressions": "/docs/3.0/supergraph-modeling/aggregate-expressions", + "Relationships": "/docs/3.0/supergraph-modeling/relationships", + "Permissions": "/docs/3.0/supergraph-modeling/permissions", + "GraphQL API Configuration": "/docs/3.0/supergraph-modeling/graphql-config", + "AuthConfig": "/docs/3.0/supergraph-modeling/auth-config", + "CompatibilityConfig": "/docs/3.0/supergraph-modeling/compatibility-config", + "Engine Plugins": "/docs/3.0/supergraph-modeling/engine-plugins" + }, + "Hasura CLI": { + "Overview": "/docs/3.0/cli/overview", + "Installation": "/docs/3.0/cli/installation", + "Commands": { + "ddn": "/docs/3.0/cli/commands/ddn", + "ddn auth": "/docs/3.0/cli/commands/ddn_auth", + "ddn auth login": "/docs/3.0/cli/commands/ddn_auth_login", + "ddn auth logout": "/docs/3.0/cli/commands/ddn_auth_logout", + "ddn auth print-pat": "/docs/3.0/cli/commands/ddn_auth_print-pat", + "ddn codemod": "/docs/3.0/cli/commands/ddn_codemod", + "ddn codemod fix-traces-env-var": "/docs/3.0/cli/commands/ddn_codemod_fix-traces-env-var", + "ddn codemod rename-graphql-prefixes": "/docs/3.0/cli/commands/ddn_codemod_rename-graphql-prefixes", + "ddn codemod upgrade-context-v2-to-v3": "/docs/3.0/cli/commands/ddn_codemod_upgrade-context-v2-to-v3", + "ddn codemod upgrade-graphqlconfig-aggregate": "/docs/3.0/cli/commands/ddn_codemod_upgrade-graphqlconfig-aggregate", + "ddn codemod upgrade-object-boolean-expression-types": "/docs/3.0/cli/commands/ddn_codemod_upgrade-object-boolean-expression-types", + "ddn codemod upgrade-project-config-v2-to-v3": "/docs/3.0/cli/commands/ddn_codemod_upgrade-project-config-v2-to-v3", + "ddn codemod upgrade-supergraph-config-v1-to-v2": "/docs/3.0/cli/commands/ddn_codemod_upgrade-supergraph-config-v1-to-v2", + "ddn command": "/docs/3.0/cli/commands/ddn_command", + "ddn command add": "/docs/3.0/cli/commands/ddn_command_add", + "ddn command update": "/docs/3.0/cli/commands/ddn_command_update", + "ddn connector": "/docs/3.0/cli/commands/ddn_connector", + "ddn connector build": "/docs/3.0/cli/commands/ddn_connector_build", + "ddn connector build create": "/docs/3.0/cli/commands/ddn_connector_build_create", + "ddn connector build delete": "/docs/3.0/cli/commands/ddn_connector_build_delete", + "ddn connector build get": "/docs/3.0/cli/commands/ddn_connector_build_get", + "ddn connector build logs": "/docs/3.0/cli/commands/ddn_connector_build_logs", + "ddn connector init": "/docs/3.0/cli/commands/ddn_connector_init", + "ddn connector introspect": "/docs/3.0/cli/commands/ddn_connector_introspect", + "ddn connector plugin": "/docs/3.0/cli/commands/ddn_connector_plugin", + "ddn connector setenv": "/docs/3.0/cli/commands/ddn_connector_setenv", + "ddn connector-link": "/docs/3.0/cli/commands/ddn_connector-link", + "ddn connector-link add": "/docs/3.0/cli/commands/ddn_connector-link_add", + "ddn connector-link add-resources": "/docs/3.0/cli/commands/ddn_connector-link_add-resources", + "ddn connector-link show": "/docs/3.0/cli/commands/ddn_connector-link_show", + "ddn connector-link update": "/docs/3.0/cli/commands/ddn_connector-link_update", + "ddn console": "/docs/3.0/cli/commands/ddn_console", + "ddn context": "/docs/3.0/cli/commands/ddn_context", + "ddn context create-context": "/docs/3.0/cli/commands/ddn_context_create-context", + "ddn context get": "/docs/3.0/cli/commands/ddn_context_get", + "ddn context get-context": "/docs/3.0/cli/commands/ddn_context_get-context", + "ddn context get-current-context": "/docs/3.0/cli/commands/ddn_context_get-current-context", + "ddn context set": "/docs/3.0/cli/commands/ddn_context_set", + "ddn context set-current-context": "/docs/3.0/cli/commands/ddn_context_set-current-context", + "ddn context unset": "/docs/3.0/cli/commands/ddn_context_unset", + "ddn doctor": "/docs/3.0/cli/commands/ddn_doctor", + "ddn model": "/docs/3.0/cli/commands/ddn_model", + "ddn model add": "/docs/3.0/cli/commands/ddn_model_add", + "ddn model update": "/docs/3.0/cli/commands/ddn_model_update", + "ddn plugins": "/docs/3.0/cli/commands/ddn_plugins", + "ddn plugins install": "/docs/3.0/cli/commands/ddn_plugins_install", + "ddn plugins list": "/docs/3.0/cli/commands/ddn_plugins_list", + "ddn plugins uninstall": "/docs/3.0/cli/commands/ddn_plugins_uninstall", + "ddn plugins upgrade": "/docs/3.0/cli/commands/ddn_plugins_upgrade", + "ddn project": "/docs/3.0/cli/commands/ddn_project", + "ddn project create": "/docs/3.0/cli/commands/ddn_project_create", + "ddn project delete": "/docs/3.0/cli/commands/ddn_project_delete", + "ddn project get": "/docs/3.0/cli/commands/ddn_project_get", + "ddn project init": "/docs/3.0/cli/commands/ddn_project_init", + "ddn project set-self-hosted-engine-url": "/docs/3.0/cli/commands/ddn_project_set-self-hosted-engine-url", + "ddn project subgraph": "/docs/3.0/cli/commands/ddn_project_subgraph", + "ddn project subgraph create": "/docs/3.0/cli/commands/ddn_project_subgraph_create", + "ddn project subgraph delete": "/docs/3.0/cli/commands/ddn_project_subgraph_delete", + "ddn project subgraph get": "/docs/3.0/cli/commands/ddn_project_subgraph_get", + "ddn relationship": "/docs/3.0/cli/commands/ddn_relationship", + "ddn relationship add": "/docs/3.0/cli/commands/ddn_relationship_add", + "ddn run": "/docs/3.0/cli/commands/ddn_run", + "ddn subgraph": "/docs/3.0/cli/commands/ddn_subgraph", + "ddn subgraph add": "/docs/3.0/cli/commands/ddn_subgraph_add", + "ddn subgraph build": "/docs/3.0/cli/commands/ddn_subgraph_build", + "ddn subgraph build apply": "/docs/3.0/cli/commands/ddn_subgraph_build_apply", + "ddn subgraph build create": "/docs/3.0/cli/commands/ddn_subgraph_build_create", + "ddn subgraph build get": "/docs/3.0/cli/commands/ddn_subgraph_build_get", + "ddn subgraph init": "/docs/3.0/cli/commands/ddn_subgraph_init", + "ddn supergraph": "/docs/3.0/cli/commands/ddn_supergraph", + "ddn supergraph build": "/docs/3.0/cli/commands/ddn_supergraph_build", + "ddn supergraph build apply": "/docs/3.0/cli/commands/ddn_supergraph_build_apply", + "ddn supergraph build create": "/docs/3.0/cli/commands/ddn_supergraph_build_create", + "ddn supergraph build delete": "/docs/3.0/cli/commands/ddn_supergraph_build_delete", + "ddn supergraph build diff": "/docs/3.0/cli/commands/ddn_supergraph_build_diff", + "ddn supergraph build get": "/docs/3.0/cli/commands/ddn_supergraph_build_get", + "ddn version": "/docs/3.0/cli/commands/ddn_version", + "ddn supergraph build local": "/docs/3.0/cli/commands/ddn_supergraph_build_local", + "ddn supergraph build set-self-hosted-engine-url": "/docs/3.0/cli/commands/ddn_supergraph_build_set-self-hosted-engine-url", + "ddn supergraph init": "/docs/3.0/cli/commands/ddn_supergraph_init", + "ddn update-cli": "/docs/3.0/cli/commands/ddn_update-cli" + } + }, + "Data Federation": { + "Overview": "/docs/3.0/federation/overview", + "Architecture": "/docs/3.0/federation/architecture", + "Basics": "/docs/3.0/federation/basics", + "Independent Subgraph Development": "/docs/3.0/federation/independent-subgraph-development", + "Cross-repo Relationships": "/docs/3.0/federation/cross-repo-relationships", + "Subgraph Prefixing": "/docs/3.0/federation/subgraph-prefixing", + "Build Commands": "/docs/3.0/federation/build-commands" + }, + "Recipes": { + "Overview": "/docs/3.0/recipes/overview", + "Authentication": { + "Auth0": "/docs/3.0/recipes/authentication/auth0", + "AWS Cognito": "/docs/3.0/recipes/authentication/aws-cognito", + "Firebase": "/docs/3.0/recipes/authentication/firebase", + "Clerk": "/docs/3.0/recipes/authentication/clerk" + }, + "Authorization": { + "Limit data to users": "/docs/3.0/recipes/authorization/simple-user-permissions", + "Public access": "/docs/3.0/recipes/authorization/public-access-role", + "Service accounts": "/docs/3.0/recipes/authorization/service-account" + }, + "Business Logic": { + "Format datetime objects": "/docs/3.0/recipes/business-logic/format-datetime-objects", + "Translate content": "/docs/3.0/recipes/business-logic/translate-content", + "Hash Passwords": "/docs/3.0/recipes/business-logic/hash-passwords", + "Validate Credentials": "/docs/3.0/recipes/business-logic/validate-credentials", + "Enrich data with LLMs": "/docs/3.0/recipes/business-logic/enrich-data-with-an-llm", + "HTTP Header Forwarding": "/docs/3.0/recipes/business-logic/http-header-forwarding" + }, + "Project configuration": { + "Rename a subgraph": "/docs/3.0/recipes/project-config/rename-subgraph", + "Remove a subgraph": "/docs/3.0/recipes/project-config/remove-subgraph", + "Deploy connectors independently": "/docs/3.0/recipes/project-config/independent-connector-deployment" + } + }, + "Plugins": { + "Overview": "/docs/3.0/plugins/overview", + "Introduction": "/docs/3.0/plugins/introduction", + "Quickstart": "/docs/3.0/plugins/quickstart" + }, + "Observability": { + "Overview": "/docs/3.0/observability/overview", + "Query Plan": { + "API Reference": "/docs/3.0/observability/explain/api-reference" + }, + "Metrics": "/docs/3.0/observability/metrics", + "Traces": "/docs/3.0/observability/traces", + "Analytics": { + "Operation Analytics": "/docs/3.0/observability/model-analytics/operation", + "Field Analytics": "/docs/3.0/observability/model-analytics/field" + } + }, + "Upgrade to DDN": { + "Upgrade Guide": "/docs/3.0/upgrade/guide", + "Feature Availability": { + "API": "/docs/3.0/upgrade/feature-availability/api-features", + "Tooling": "/docs/3.0/upgrade/feature-availability/tooling" + } + }, + "Deployment": { + "Overview": "/docs/3.0/deployment/overview", + "Architecture": "/docs/3.0/deployment/architecture", + "Serverless Edge": "/docs/3.0/deployment/serverless", + "Hasura Cloud Deployment": { + "Create a project": "/docs/3.0/deployment/deployment/create-a-project", + "Create a subgraph": "/docs/3.0/deployment/deployment/create-a-subgraph", + "Deploy a connector": "/docs/3.0/deployment/deployment/deploy-a-connector", + "Deploy your supergraph": "/docs/3.0/deployment/deployment/deploy-your-supergraph" + }, + "Private Deployment": { + "Hasura Hosted (VPC)": "/docs/3.0/deployment/private/hasura-hosted", + "Data Plane Collaboration": "/docs/3.0/deployment/private/data-plane-collaboration", + "Self-Hosted (BYOC)": { + "Data Plane Installation": "/docs/3.0/deployment/private/self-hosted/self-hosted-deployment" + } + } + }, + "Billing": { + "Overview": "/docs/3.0/billing/overview", + "Plans and Pricing": "/docs/3.0/billing/pricing", + "Billing": "/docs/3.0/billing/setup" + }, + "Support": { + "FAQ": "/docs/3.0/support/faq", + "Glossary": "/docs/3.0/support/glossary", + "Get Help": "/docs/3.0/support/get-support" + } +} \ No newline at end of file diff --git a/scripts/generateRoutes.cjs b/scripts/generateRoutes.cjs new file mode 100644 index 000000000..36165a2f8 --- /dev/null +++ b/scripts/generateRoutes.cjs @@ -0,0 +1,29 @@ +const fs = require('fs'); +const path = require('path'); + +// Path to your JSON file +const filePath = path.join(__dirname, '../.docusaurus/docusaurus-plugin-content-docs/default/p/docs-3-0-442.json'); +const metadata = require(filePath); + +const data = metadata.version; + +function buildRoutesObject(arr) { + const result = {}; + + arr.forEach(item => { + if (item.type === 'link') { + result[item.label] = item.href; + } else if (item.type === 'category') { + result[item.label] = buildRoutesObject(item.items); + } + }); + + return result; +} + +// Usage +const routesObject = buildRoutesObject(data.docsSidebars.docsSidebar); + +// Save the structured sidebar as JSON +fs.writeFileSync('./routes.json', JSON.stringify(routesObject, null, 2)); +console.log('Routes JSON generated at build/routes.json'); From b42ef9c3890605fb9791caea24cd0be39495e3ef Mon Sep 17 00:00:00 2001 From: Matthew Goodwin <49927862+m4ttheweric@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:22:35 -0500 Subject: [PATCH 2/2] save a typescript file as const --- docsLinks.ts | 374 +++++++++++++++++++++++++++++++++++++ routes.json | 363 ----------------------------------- scripts/generateRoutes.cjs | 11 +- 3 files changed, 380 insertions(+), 368 deletions(-) create mode 100644 docsLinks.ts delete mode 100644 routes.json diff --git a/docsLinks.ts b/docsLinks.ts new file mode 100644 index 000000000..f4dcd2689 --- /dev/null +++ b/docsLinks.ts @@ -0,0 +1,374 @@ +const docsLinks = { + Introduction: '/docs/3.0/index', + 'Getting Started': { + Overview: '/docs/3.0/getting-started/overview', + Quickstart: '/docs/3.0/getting-started/quickstart', + 'With PostgreSQL': '/docs/3.0/getting-started/with-postgresql', + 'With MongoDB': '/docs/3.0/getting-started/with-mongodb', + 'With ClickHouse': '/docs/3.0/getting-started/with-clickhouse', + 'With other sources': '/docs/3.0/getting-started/with-others', + }, + 'Understanding DDN': { + Overview: '/docs/3.0/basics/overview', + Background: '/docs/3.0/basics/background', + 'Core Concepts': '/docs/3.0/basics/core-concepts', + 'Explore a Finished Supergraph': { + 'Explore your Supergraph': '/docs/3.0/basics/explore/explore-your-api', + 'Interact with your Supergraph': '/docs/3.0/basics/explore/interact', + 'Monitor your Supergraph': '/docs/3.0/basics/explore/monitor', + }, + }, + 'GraphQL API': { + Overview: '/docs/3.0/graphql-api/overview', + Queries: { + 'Simple Queries': '/docs/3.0/graphql-api/queries/simple-queries', + 'Nested Queries': '/docs/3.0/graphql-api/queries/nested-queries', + 'Sort query results': '/docs/3.0/graphql-api/queries/sorting', + 'Paginate query results': '/docs/3.0/graphql-api/queries/pagination', + 'Filter query results': { + 'Filter by comparing values': '/docs/3.0/graphql-api/queries/filters/comparison-operators', + 'Filter by boolean expressions': '/docs/3.0/graphql-api/queries/filters/boolean-operators', + 'Filter by text': '/docs/3.0/graphql-api/queries/filters/text-search-operators', + 'Filter based on nested fields': '/docs/3.0/graphql-api/queries/filters/nested-objects', + 'Performance of relationship comparisons': + '/docs/3.0/graphql-api/queries/filters/performance-relationship-comparisons', + }, + 'Use multiple arguments': '/docs/3.0/graphql-api/queries/multiple-arguments', + 'Multiple queries in a request': '/docs/3.0/graphql-api/queries/multiple-queries', + 'Use variables / aliases / fragments / directives': + '/docs/3.0/graphql-api/queries/variables-aliases-fragments-directives', + }, + Mutations: '/docs/3.0/graphql-api/mutations/', + 'Global IDs': '/docs/3.0/graphql-api/global-ids', + 'API Versioning': '/docs/3.0/graphql-api/versioning', + 'Apollo Federation': '/docs/3.0/graphql-api/apollo-federation', + Errors: '/docs/3.0/graphql-api/errors', + 'GraphQL Schema Diff': '/docs/3.0/graphql-api/graphql-schema-diff', + }, + Connectors: { + Overview: '/docs/3.0/connectors/overview', + Introduction: '/docs/3.0/connectors/introduction', + PostgreSQL: { + 'Data Modeling': '/docs/3.0/connectors/postgresql/modeling', + 'Configuration Reference': { + 'Version 5': '/docs/3.0/connectors/postgresql/configuration-reference/version-5', + 'Version 4 (Deprecated)': '/docs/3.0/connectors/postgresql/configuration-reference/version-4', + 'Version 3 (Deprecated)': '/docs/3.0/connectors/postgresql/configuration-reference/version-3', + }, + 'Native Operations': { + 'Native Queries': '/docs/3.0/connectors/postgresql/native-operations/custom-queries', + 'Native Mutations': '/docs/3.0/connectors/postgresql/native-operations/custom-mutations', + 'Vector Search': '/docs/3.0/connectors/postgresql/native-operations/vector-search', + Syntax: '/docs/3.0/connectors/postgresql/native-operations/syntax', + }, + 'Run a Postgres database locally': '/docs/3.0/connectors/postgresql/local-postgres', + Troubleshooting: '/docs/3.0/connectors/postgresql/troubleshooting', + }, + MongoDB: { + 'Data Modeling': '/docs/3.0/connectors/mongodb/modeling', + Configuration: '/docs/3.0/connectors/mongodb/config', + 'Native Operations': { + 'Native Queries': '/docs/3.0/connectors/mongodb/native-operations/native-queries', + 'Native Mutations': '/docs/3.0/connectors/mongodb/native-operations/native-mutations', + 'Vector Search': '/docs/3.0/connectors/mongodb/native-operations/vector-search', + Syntax: '/docs/3.0/connectors/mongodb/native-operations/syntax', + }, + }, + ClickHouse: { + 'Data Modeling': '/docs/3.0/connectors/clickhouse/modeling', + Configuration: '/docs/3.0/connectors/clickhouse/config', + 'Native Queries': '/docs/3.0/connectors/clickhouse/native-queries', + }, + 'External APIs': { + GraphQL: '/docs/3.0/connectors/external-apis/graphql', + OpenAPI: '/docs/3.0/connectors/external-apis/open-api', + }, + 'Other connectors': '/docs/3.0/connectors/other-connectors', + 'Managing a Connector': '/docs/3.0/connectors/deployment', + 'Region Routing': '/docs/3.0/connectors/region-routing', + 'Response Size Limit': '/docs/3.0/connectors/response-size-limit', + 'Build your own connector': { + 'Connector in TypeScript Tutorial': '/docs/3.0/connectors/build-your-own/introduction', + 'Get Started': { + 'Clone the Repo': '/docs/3.0/connectors/build-your-own/get-started/clone', + 'Basic Setup': '/docs/3.0/connectors/build-your-own/get-started/basics', + 'Configuration and State': '/docs/3.0/connectors/build-your-own/get-started/configuration-and-state', + 'Function Definitions': '/docs/3.0/connectors/build-your-own/get-started/function-definitions', + Implementation: '/docs/3.0/connectors/build-your-own/get-started/implementation', + 'The Get Schema Function': '/docs/3.0/connectors/build-your-own/get-started/implement-get-schema-and-query', + Testing: '/docs/3.0/connectors/build-your-own/get-started/testing', + 'The Query Function': '/docs/3.0/connectors/build-your-own/get-started/query-function', + }, + Predicates: { + 'Where Clause': '/docs/3.0/connectors/build-your-own/predicates/where-clause', + 'Expression Types': '/docs/3.0/connectors/build-your-own/predicates/expression-types', + "Building the 'where' clause": '/docs/3.0/connectors/build-your-own/predicates/building-the-where-clause', + Testing: '/docs/3.0/connectors/build-your-own/predicates/testing', + }, + Sorting: { + 'Order By': '/docs/3.0/connectors/build-your-own/sorting/order_by', + }, + Aggregates: { + 'Implementing Aggregates': '/docs/3.0/connectors/build-your-own/aggregates/fetch-aggregates', + }, + Relationships: { + Relationships: '/docs/3.0/connectors/build-your-own/relationships/relationships', + }, + Operators: { + 'Custom Operators': '/docs/3.0/connectors/build-your-own/operators/operators', + }, + Observability: { + Observability: '/docs/3.0/connectors/build-your-own/observability/observability', + }, + Conclusion: '/docs/3.0/connectors/build-your-own/conclusion', + }, + }, + Auth: { + Overview: '/docs/3.0/auth/overview', + Authentication: { + JWT: { + 'Enabling JWT Authentication': '/docs/3.0/auth/authentication/jwt/setup', + Providers: '/docs/3.0/auth/authentication/jwt/providers', + 'Set up a Test JWT': '/docs/3.0/auth/authentication/jwt/setup-test-jwt', + }, + Webhook: { + 'Enabling Webhook Authentication': '/docs/3.0/auth/authentication/webhook/setup', + 'Enabling Admin and Unauthenticated Requests': '/docs/3.0/auth/authentication/webhook/special-roles', + }, + }, + Authorization: '/docs/3.0/auth/authorization/index', + }, + 'Business Logic': { + Overview: '/docs/3.0/business-logic/overview', + Introduction: '/docs/3.0/business-logic/introduction', + TypeScript: '/docs/3.0/business-logic/typescript', + Python: '/docs/3.0/business-logic/python', + Go: '/docs/3.0/business-logic/go', + }, + Collaboration: { + Overview: '/docs/3.0/collaboration/overview', + 'Invite others & allow access': '/docs/3.0/collaboration/invite', + 'Onboard Teams': '/docs/3.0/collaboration/federation', + 'Best Practices': '/docs/3.0/collaboration/best-practices', + 'Comment on Metadata': '/docs/3.0/collaboration/comment', + }, + 'Project Configuration': { + Overview: '/docs/3.0/project-configuration/overview', + 'Directory structure': '/docs/3.0/project-configuration/config', + Projects: '/docs/3.0/project-configuration/projects', + Subgraphs: '/docs/3.0/project-configuration/subgraphs', + Builds: '/docs/3.0/project-configuration/builds', + 'Custom scripts': '/docs/3.0/project-configuration/custom-scripts', + Contexts: '/docs/3.0/project-configuration/contexts', + 'Generating metadata': '/docs/3.0/project-configuration/metadata-generation', + 'Upgrading legacy configuration': { + 'Deprecated Metadata Upgrades': + '/docs/3.0/project-configuration/upgrading-project-config/deprecated-metadata-upgrades', + 'Upgrade to project config v2': '/docs/3.0/project-configuration/upgrading-project-config/upgrade-project-v2', + 'Upgrade to supergraph config v2': + '/docs/3.0/project-configuration/upgrading-project-config/upgrade-supergraph-v2', + 'Upgrade to project config v3': '/docs/3.0/project-configuration/upgrading-project-config/upgrade-project-v3', + 'Upgrade to context config v3': '/docs/3.0/project-configuration/upgrading-project-config/upgrade-context-v3', + 'Fix env var for OTLP endpoint': '/docs/3.0/project-configuration/upgrading-project-config/fix-traces-env-var', + }, + }, + 'Supergraph Modeling': { + Overview: '/docs/3.0/supergraph-modeling/overview', + 'Working with Metadata': '/docs/3.0/supergraph-modeling/introduction', + 'Build configs': '/docs/3.0/supergraph-modeling/build-configs', + 'Data Connector Links': '/docs/3.0/supergraph-modeling/data-connector-links', + Types: '/docs/3.0/supergraph-modeling/types', + Models: '/docs/3.0/supergraph-modeling/models', + Commands: '/docs/3.0/supergraph-modeling/commands', + 'Boolean Expressions': '/docs/3.0/supergraph-modeling/boolean-expressions', + 'Aggregate Expressions': '/docs/3.0/supergraph-modeling/aggregate-expressions', + Relationships: '/docs/3.0/supergraph-modeling/relationships', + Permissions: '/docs/3.0/supergraph-modeling/permissions', + 'GraphQL API Configuration': '/docs/3.0/supergraph-modeling/graphql-config', + AuthConfig: '/docs/3.0/supergraph-modeling/auth-config', + CompatibilityConfig: '/docs/3.0/supergraph-modeling/compatibility-config', + 'Engine Plugins': '/docs/3.0/supergraph-modeling/engine-plugins', + }, + 'Hasura CLI': { + Overview: '/docs/3.0/cli/overview', + Installation: '/docs/3.0/cli/installation', + Commands: { + ddn: '/docs/3.0/cli/commands/ddn', + 'ddn auth': '/docs/3.0/cli/commands/ddn_auth', + 'ddn auth login': '/docs/3.0/cli/commands/ddn_auth_login', + 'ddn auth logout': '/docs/3.0/cli/commands/ddn_auth_logout', + 'ddn auth print-pat': '/docs/3.0/cli/commands/ddn_auth_print-pat', + 'ddn codemod': '/docs/3.0/cli/commands/ddn_codemod', + 'ddn codemod fix-traces-env-var': '/docs/3.0/cli/commands/ddn_codemod_fix-traces-env-var', + 'ddn codemod rename-graphql-prefixes': '/docs/3.0/cli/commands/ddn_codemod_rename-graphql-prefixes', + 'ddn codemod upgrade-context-v2-to-v3': '/docs/3.0/cli/commands/ddn_codemod_upgrade-context-v2-to-v3', + 'ddn codemod upgrade-graphqlconfig-aggregate': + '/docs/3.0/cli/commands/ddn_codemod_upgrade-graphqlconfig-aggregate', + 'ddn codemod upgrade-object-boolean-expression-types': + '/docs/3.0/cli/commands/ddn_codemod_upgrade-object-boolean-expression-types', + 'ddn codemod upgrade-project-config-v2-to-v3': + '/docs/3.0/cli/commands/ddn_codemod_upgrade-project-config-v2-to-v3', + 'ddn codemod upgrade-supergraph-config-v1-to-v2': + '/docs/3.0/cli/commands/ddn_codemod_upgrade-supergraph-config-v1-to-v2', + 'ddn command': '/docs/3.0/cli/commands/ddn_command', + 'ddn command add': '/docs/3.0/cli/commands/ddn_command_add', + 'ddn command update': '/docs/3.0/cli/commands/ddn_command_update', + 'ddn connector': '/docs/3.0/cli/commands/ddn_connector', + 'ddn connector build': '/docs/3.0/cli/commands/ddn_connector_build', + 'ddn connector build create': '/docs/3.0/cli/commands/ddn_connector_build_create', + 'ddn connector build delete': '/docs/3.0/cli/commands/ddn_connector_build_delete', + 'ddn connector build get': '/docs/3.0/cli/commands/ddn_connector_build_get', + 'ddn connector build logs': '/docs/3.0/cli/commands/ddn_connector_build_logs', + 'ddn connector init': '/docs/3.0/cli/commands/ddn_connector_init', + 'ddn connector introspect': '/docs/3.0/cli/commands/ddn_connector_introspect', + 'ddn connector plugin': '/docs/3.0/cli/commands/ddn_connector_plugin', + 'ddn connector setenv': '/docs/3.0/cli/commands/ddn_connector_setenv', + 'ddn connector-link': '/docs/3.0/cli/commands/ddn_connector-link', + 'ddn connector-link add': '/docs/3.0/cli/commands/ddn_connector-link_add', + 'ddn connector-link add-resources': '/docs/3.0/cli/commands/ddn_connector-link_add-resources', + 'ddn connector-link show': '/docs/3.0/cli/commands/ddn_connector-link_show', + 'ddn connector-link update': '/docs/3.0/cli/commands/ddn_connector-link_update', + 'ddn console': '/docs/3.0/cli/commands/ddn_console', + 'ddn context': '/docs/3.0/cli/commands/ddn_context', + 'ddn context create-context': '/docs/3.0/cli/commands/ddn_context_create-context', + 'ddn context get': '/docs/3.0/cli/commands/ddn_context_get', + 'ddn context get-context': '/docs/3.0/cli/commands/ddn_context_get-context', + 'ddn context get-current-context': '/docs/3.0/cli/commands/ddn_context_get-current-context', + 'ddn context set': '/docs/3.0/cli/commands/ddn_context_set', + 'ddn context set-current-context': '/docs/3.0/cli/commands/ddn_context_set-current-context', + 'ddn context unset': '/docs/3.0/cli/commands/ddn_context_unset', + 'ddn doctor': '/docs/3.0/cli/commands/ddn_doctor', + 'ddn model': '/docs/3.0/cli/commands/ddn_model', + 'ddn model add': '/docs/3.0/cli/commands/ddn_model_add', + 'ddn model update': '/docs/3.0/cli/commands/ddn_model_update', + 'ddn plugins': '/docs/3.0/cli/commands/ddn_plugins', + 'ddn plugins install': '/docs/3.0/cli/commands/ddn_plugins_install', + 'ddn plugins list': '/docs/3.0/cli/commands/ddn_plugins_list', + 'ddn plugins uninstall': '/docs/3.0/cli/commands/ddn_plugins_uninstall', + 'ddn plugins upgrade': '/docs/3.0/cli/commands/ddn_plugins_upgrade', + 'ddn project': '/docs/3.0/cli/commands/ddn_project', + 'ddn project create': '/docs/3.0/cli/commands/ddn_project_create', + 'ddn project delete': '/docs/3.0/cli/commands/ddn_project_delete', + 'ddn project get': '/docs/3.0/cli/commands/ddn_project_get', + 'ddn project init': '/docs/3.0/cli/commands/ddn_project_init', + 'ddn project set-self-hosted-engine-url': '/docs/3.0/cli/commands/ddn_project_set-self-hosted-engine-url', + 'ddn project subgraph': '/docs/3.0/cli/commands/ddn_project_subgraph', + 'ddn project subgraph create': '/docs/3.0/cli/commands/ddn_project_subgraph_create', + 'ddn project subgraph delete': '/docs/3.0/cli/commands/ddn_project_subgraph_delete', + 'ddn project subgraph get': '/docs/3.0/cli/commands/ddn_project_subgraph_get', + 'ddn relationship': '/docs/3.0/cli/commands/ddn_relationship', + 'ddn relationship add': '/docs/3.0/cli/commands/ddn_relationship_add', + 'ddn run': '/docs/3.0/cli/commands/ddn_run', + 'ddn subgraph': '/docs/3.0/cli/commands/ddn_subgraph', + 'ddn subgraph add': '/docs/3.0/cli/commands/ddn_subgraph_add', + 'ddn subgraph build': '/docs/3.0/cli/commands/ddn_subgraph_build', + 'ddn subgraph build apply': '/docs/3.0/cli/commands/ddn_subgraph_build_apply', + 'ddn subgraph build create': '/docs/3.0/cli/commands/ddn_subgraph_build_create', + 'ddn subgraph build get': '/docs/3.0/cli/commands/ddn_subgraph_build_get', + 'ddn subgraph init': '/docs/3.0/cli/commands/ddn_subgraph_init', + 'ddn supergraph': '/docs/3.0/cli/commands/ddn_supergraph', + 'ddn supergraph build': '/docs/3.0/cli/commands/ddn_supergraph_build', + 'ddn supergraph build apply': '/docs/3.0/cli/commands/ddn_supergraph_build_apply', + 'ddn supergraph build create': '/docs/3.0/cli/commands/ddn_supergraph_build_create', + 'ddn supergraph build delete': '/docs/3.0/cli/commands/ddn_supergraph_build_delete', + 'ddn supergraph build diff': '/docs/3.0/cli/commands/ddn_supergraph_build_diff', + 'ddn supergraph build get': '/docs/3.0/cli/commands/ddn_supergraph_build_get', + 'ddn version': '/docs/3.0/cli/commands/ddn_version', + 'ddn supergraph build local': '/docs/3.0/cli/commands/ddn_supergraph_build_local', + 'ddn supergraph build set-self-hosted-engine-url': + '/docs/3.0/cli/commands/ddn_supergraph_build_set-self-hosted-engine-url', + 'ddn supergraph init': '/docs/3.0/cli/commands/ddn_supergraph_init', + 'ddn update-cli': '/docs/3.0/cli/commands/ddn_update-cli', + }, + }, + 'Data Federation': { + Overview: '/docs/3.0/federation/overview', + Architecture: '/docs/3.0/federation/architecture', + Basics: '/docs/3.0/federation/basics', + 'Independent Subgraph Development': '/docs/3.0/federation/independent-subgraph-development', + 'Cross-repo Relationships': '/docs/3.0/federation/cross-repo-relationships', + 'Subgraph Prefixing': '/docs/3.0/federation/subgraph-prefixing', + 'Build Commands': '/docs/3.0/federation/build-commands', + }, + Recipes: { + Overview: '/docs/3.0/recipes/overview', + Authentication: { + Auth0: '/docs/3.0/recipes/authentication/auth0', + 'AWS Cognito': '/docs/3.0/recipes/authentication/aws-cognito', + Firebase: '/docs/3.0/recipes/authentication/firebase', + Clerk: '/docs/3.0/recipes/authentication/clerk', + }, + Authorization: { + 'Limit data to users': '/docs/3.0/recipes/authorization/simple-user-permissions', + 'Public access': '/docs/3.0/recipes/authorization/public-access-role', + 'Service accounts': '/docs/3.0/recipes/authorization/service-account', + }, + 'Business Logic': { + 'Format datetime objects': '/docs/3.0/recipes/business-logic/format-datetime-objects', + 'Translate content': '/docs/3.0/recipes/business-logic/translate-content', + 'Hash Passwords': '/docs/3.0/recipes/business-logic/hash-passwords', + 'Validate Credentials': '/docs/3.0/recipes/business-logic/validate-credentials', + 'Enrich data with LLMs': '/docs/3.0/recipes/business-logic/enrich-data-with-an-llm', + 'HTTP Header Forwarding': '/docs/3.0/recipes/business-logic/http-header-forwarding', + }, + 'Project configuration': { + 'Rename a subgraph': '/docs/3.0/recipes/project-config/rename-subgraph', + 'Remove a subgraph': '/docs/3.0/recipes/project-config/remove-subgraph', + 'Deploy connectors independently': '/docs/3.0/recipes/project-config/independent-connector-deployment', + }, + }, + Plugins: { + Overview: '/docs/3.0/plugins/overview', + Introduction: '/docs/3.0/plugins/introduction', + Quickstart: '/docs/3.0/plugins/quickstart', + }, + Observability: { + Overview: '/docs/3.0/observability/overview', + 'Query Plan': { + 'API Reference': '/docs/3.0/observability/explain/api-reference', + }, + Metrics: '/docs/3.0/observability/metrics', + Traces: '/docs/3.0/observability/traces', + Analytics: { + 'Operation Analytics': '/docs/3.0/observability/model-analytics/operation', + 'Field Analytics': '/docs/3.0/observability/model-analytics/field', + }, + }, + 'Upgrade to DDN': { + 'Upgrade Guide': '/docs/3.0/upgrade/guide', + 'Feature Availability': { + API: '/docs/3.0/upgrade/feature-availability/api-features', + Tooling: '/docs/3.0/upgrade/feature-availability/tooling', + }, + }, + Deployment: { + Overview: '/docs/3.0/deployment/overview', + Architecture: '/docs/3.0/deployment/architecture', + 'Serverless Edge': '/docs/3.0/deployment/serverless', + 'Hasura Cloud Deployment': { + 'Create a project': '/docs/3.0/deployment/deployment/create-a-project', + 'Create a subgraph': '/docs/3.0/deployment/deployment/create-a-subgraph', + 'Deploy a connector': '/docs/3.0/deployment/deployment/deploy-a-connector', + 'Deploy your supergraph': '/docs/3.0/deployment/deployment/deploy-your-supergraph', + }, + 'Private Deployment': { + 'Hasura Hosted (VPC)': '/docs/3.0/deployment/private/hasura-hosted', + 'Data Plane Collaboration': '/docs/3.0/deployment/private/data-plane-collaboration', + 'Self-Hosted (BYOC)': { + 'Data Plane Installation': '/docs/3.0/deployment/private/self-hosted/self-hosted-deployment', + }, + }, + }, + Billing: { + Overview: '/docs/3.0/billing/overview', + 'Plans and Pricing': '/docs/3.0/billing/pricing', + Billing: '/docs/3.0/billing/setup', + }, + Support: { + FAQ: '/docs/3.0/support/faq', + Glossary: '/docs/3.0/support/glossary', + 'Get Help': '/docs/3.0/support/get-support', + }, +} as const; + +export default docsLinks; diff --git a/routes.json b/routes.json deleted file mode 100644 index 3476c534e..000000000 --- a/routes.json +++ /dev/null @@ -1,363 +0,0 @@ -{ - "Introduction": "/docs/3.0/index", - "Getting Started": { - "Overview": "/docs/3.0/getting-started/overview", - "Quickstart": "/docs/3.0/getting-started/quickstart", - "With PostgreSQL": "/docs/3.0/getting-started/with-postgresql", - "With MongoDB": "/docs/3.0/getting-started/with-mongodb", - "With ClickHouse": "/docs/3.0/getting-started/with-clickhouse", - "With other sources": "/docs/3.0/getting-started/with-others" - }, - "Understanding DDN": { - "Overview": "/docs/3.0/basics/overview", - "Background": "/docs/3.0/basics/background", - "Core Concepts": "/docs/3.0/basics/core-concepts", - "Explore a Finished Supergraph": { - "Explore your Supergraph": "/docs/3.0/basics/explore/explore-your-api", - "Interact with your Supergraph": "/docs/3.0/basics/explore/interact", - "Monitor your Supergraph": "/docs/3.0/basics/explore/monitor" - } - }, - "GraphQL API": { - "Overview": "/docs/3.0/graphql-api/overview", - "Queries": { - "Simple Queries": "/docs/3.0/graphql-api/queries/simple-queries", - "Nested Queries": "/docs/3.0/graphql-api/queries/nested-queries", - "Sort query results": "/docs/3.0/graphql-api/queries/sorting", - "Paginate query results": "/docs/3.0/graphql-api/queries/pagination", - "Filter query results": { - "Filter by comparing values": "/docs/3.0/graphql-api/queries/filters/comparison-operators", - "Filter by boolean expressions": "/docs/3.0/graphql-api/queries/filters/boolean-operators", - "Filter by text": "/docs/3.0/graphql-api/queries/filters/text-search-operators", - "Filter based on nested fields": "/docs/3.0/graphql-api/queries/filters/nested-objects", - "Performance of relationship comparisons": "/docs/3.0/graphql-api/queries/filters/performance-relationship-comparisons" - }, - "Use multiple arguments": "/docs/3.0/graphql-api/queries/multiple-arguments", - "Multiple queries in a request": "/docs/3.0/graphql-api/queries/multiple-queries", - "Use variables / aliases / fragments / directives": "/docs/3.0/graphql-api/queries/variables-aliases-fragments-directives" - }, - "Mutations": "/docs/3.0/graphql-api/mutations/", - "Global IDs": "/docs/3.0/graphql-api/global-ids", - "API Versioning": "/docs/3.0/graphql-api/versioning", - "Apollo Federation": "/docs/3.0/graphql-api/apollo-federation", - "Errors": "/docs/3.0/graphql-api/errors", - "GraphQL Schema Diff": "/docs/3.0/graphql-api/graphql-schema-diff" - }, - "Connectors": { - "Overview": "/docs/3.0/connectors/overview", - "Introduction": "/docs/3.0/connectors/introduction", - "PostgreSQL": { - "Data Modeling": "/docs/3.0/connectors/postgresql/modeling", - "Configuration Reference": { - "Version 5": "/docs/3.0/connectors/postgresql/configuration-reference/version-5", - "Version 4 (Deprecated)": "/docs/3.0/connectors/postgresql/configuration-reference/version-4", - "Version 3 (Deprecated)": "/docs/3.0/connectors/postgresql/configuration-reference/version-3" - }, - "Native Operations": { - "Native Queries": "/docs/3.0/connectors/postgresql/native-operations/custom-queries", - "Native Mutations": "/docs/3.0/connectors/postgresql/native-operations/custom-mutations", - "Vector Search": "/docs/3.0/connectors/postgresql/native-operations/vector-search", - "Syntax": "/docs/3.0/connectors/postgresql/native-operations/syntax" - }, - "Run a Postgres database locally": "/docs/3.0/connectors/postgresql/local-postgres", - "Troubleshooting": "/docs/3.0/connectors/postgresql/troubleshooting" - }, - "MongoDB": { - "Data Modeling": "/docs/3.0/connectors/mongodb/modeling", - "Configuration": "/docs/3.0/connectors/mongodb/config", - "Native Operations": { - "Native Queries": "/docs/3.0/connectors/mongodb/native-operations/native-queries", - "Native Mutations": "/docs/3.0/connectors/mongodb/native-operations/native-mutations", - "Vector Search": "/docs/3.0/connectors/mongodb/native-operations/vector-search", - "Syntax": "/docs/3.0/connectors/mongodb/native-operations/syntax" - } - }, - "ClickHouse": { - "Data Modeling": "/docs/3.0/connectors/clickhouse/modeling", - "Configuration": "/docs/3.0/connectors/clickhouse/config", - "Native Queries": "/docs/3.0/connectors/clickhouse/native-queries" - }, - "External APIs": { - "GraphQL": "/docs/3.0/connectors/external-apis/graphql", - "OpenAPI": "/docs/3.0/connectors/external-apis/open-api" - }, - "Other connectors": "/docs/3.0/connectors/other-connectors", - "Managing a Connector": "/docs/3.0/connectors/deployment", - "Region Routing": "/docs/3.0/connectors/region-routing", - "Response Size Limit": "/docs/3.0/connectors/response-size-limit", - "Build your own connector": { - "Connector in TypeScript Tutorial": "/docs/3.0/connectors/build-your-own/introduction", - "Get Started": { - "Clone the Repo": "/docs/3.0/connectors/build-your-own/get-started/clone", - "Basic Setup": "/docs/3.0/connectors/build-your-own/get-started/basics", - "Configuration and State": "/docs/3.0/connectors/build-your-own/get-started/configuration-and-state", - "Function Definitions": "/docs/3.0/connectors/build-your-own/get-started/function-definitions", - "Implementation": "/docs/3.0/connectors/build-your-own/get-started/implementation", - "The Get Schema Function": "/docs/3.0/connectors/build-your-own/get-started/implement-get-schema-and-query", - "Testing": "/docs/3.0/connectors/build-your-own/get-started/testing", - "The Query Function": "/docs/3.0/connectors/build-your-own/get-started/query-function" - }, - "Predicates": { - "Where Clause": "/docs/3.0/connectors/build-your-own/predicates/where-clause", - "Expression Types": "/docs/3.0/connectors/build-your-own/predicates/expression-types", - "Building the 'where' clause": "/docs/3.0/connectors/build-your-own/predicates/building-the-where-clause", - "Testing": "/docs/3.0/connectors/build-your-own/predicates/testing" - }, - "Sorting": { - "Order By": "/docs/3.0/connectors/build-your-own/sorting/order_by" - }, - "Aggregates": { - "Implementing Aggregates": "/docs/3.0/connectors/build-your-own/aggregates/fetch-aggregates" - }, - "Relationships": { - "Relationships": "/docs/3.0/connectors/build-your-own/relationships/relationships" - }, - "Operators": { - "Custom Operators": "/docs/3.0/connectors/build-your-own/operators/operators" - }, - "Observability": { - "Observability": "/docs/3.0/connectors/build-your-own/observability/observability" - }, - "Conclusion": "/docs/3.0/connectors/build-your-own/conclusion" - } - }, - "Auth": { - "Overview": "/docs/3.0/auth/overview", - "Authentication": { - "JWT": { - "Enabling JWT Authentication": "/docs/3.0/auth/authentication/jwt/setup", - "Providers": "/docs/3.0/auth/authentication/jwt/providers", - "Set up a Test JWT": "/docs/3.0/auth/authentication/jwt/setup-test-jwt" - }, - "Webhook": { - "Enabling Webhook Authentication": "/docs/3.0/auth/authentication/webhook/setup", - "Enabling Admin and Unauthenticated Requests": "/docs/3.0/auth/authentication/webhook/special-roles" - } - }, - "Authorization": "/docs/3.0/auth/authorization/index" - }, - "Business Logic": { - "Overview": "/docs/3.0/business-logic/overview", - "Introduction": "/docs/3.0/business-logic/introduction", - "TypeScript": "/docs/3.0/business-logic/typescript", - "Python": "/docs/3.0/business-logic/python", - "Go": "/docs/3.0/business-logic/go" - }, - "Collaboration": { - "Overview": "/docs/3.0/collaboration/overview", - "Invite others & allow access": "/docs/3.0/collaboration/invite", - "Onboard Teams": "/docs/3.0/collaboration/federation", - "Best Practices": "/docs/3.0/collaboration/best-practices", - "Comment on Metadata": "/docs/3.0/collaboration/comment" - }, - "Project Configuration": { - "Overview": "/docs/3.0/project-configuration/overview", - "Directory structure": "/docs/3.0/project-configuration/config", - "Projects": "/docs/3.0/project-configuration/projects", - "Subgraphs": "/docs/3.0/project-configuration/subgraphs", - "Builds": "/docs/3.0/project-configuration/builds", - "Custom scripts": "/docs/3.0/project-configuration/custom-scripts", - "Contexts": "/docs/3.0/project-configuration/contexts", - "Generating metadata": "/docs/3.0/project-configuration/metadata-generation", - "Upgrading legacy configuration": { - "Deprecated Metadata Upgrades": "/docs/3.0/project-configuration/upgrading-project-config/deprecated-metadata-upgrades", - "Upgrade to project config v2": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-project-v2", - "Upgrade to supergraph config v2": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-supergraph-v2", - "Upgrade to project config v3": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-project-v3", - "Upgrade to context config v3": "/docs/3.0/project-configuration/upgrading-project-config/upgrade-context-v3", - "Fix env var for OTLP endpoint": "/docs/3.0/project-configuration/upgrading-project-config/fix-traces-env-var" - } - }, - "Supergraph Modeling": { - "Overview": "/docs/3.0/supergraph-modeling/overview", - "Working with Metadata": "/docs/3.0/supergraph-modeling/introduction", - "Build configs": "/docs/3.0/supergraph-modeling/build-configs", - "Data Connector Links": "/docs/3.0/supergraph-modeling/data-connector-links", - "Types": "/docs/3.0/supergraph-modeling/types", - "Models": "/docs/3.0/supergraph-modeling/models", - "Commands": "/docs/3.0/supergraph-modeling/commands", - "Boolean Expressions": "/docs/3.0/supergraph-modeling/boolean-expressions", - "Aggregate Expressions": "/docs/3.0/supergraph-modeling/aggregate-expressions", - "Relationships": "/docs/3.0/supergraph-modeling/relationships", - "Permissions": "/docs/3.0/supergraph-modeling/permissions", - "GraphQL API Configuration": "/docs/3.0/supergraph-modeling/graphql-config", - "AuthConfig": "/docs/3.0/supergraph-modeling/auth-config", - "CompatibilityConfig": "/docs/3.0/supergraph-modeling/compatibility-config", - "Engine Plugins": "/docs/3.0/supergraph-modeling/engine-plugins" - }, - "Hasura CLI": { - "Overview": "/docs/3.0/cli/overview", - "Installation": "/docs/3.0/cli/installation", - "Commands": { - "ddn": "/docs/3.0/cli/commands/ddn", - "ddn auth": "/docs/3.0/cli/commands/ddn_auth", - "ddn auth login": "/docs/3.0/cli/commands/ddn_auth_login", - "ddn auth logout": "/docs/3.0/cli/commands/ddn_auth_logout", - "ddn auth print-pat": "/docs/3.0/cli/commands/ddn_auth_print-pat", - "ddn codemod": "/docs/3.0/cli/commands/ddn_codemod", - "ddn codemod fix-traces-env-var": "/docs/3.0/cli/commands/ddn_codemod_fix-traces-env-var", - "ddn codemod rename-graphql-prefixes": "/docs/3.0/cli/commands/ddn_codemod_rename-graphql-prefixes", - "ddn codemod upgrade-context-v2-to-v3": "/docs/3.0/cli/commands/ddn_codemod_upgrade-context-v2-to-v3", - "ddn codemod upgrade-graphqlconfig-aggregate": "/docs/3.0/cli/commands/ddn_codemod_upgrade-graphqlconfig-aggregate", - "ddn codemod upgrade-object-boolean-expression-types": "/docs/3.0/cli/commands/ddn_codemod_upgrade-object-boolean-expression-types", - "ddn codemod upgrade-project-config-v2-to-v3": "/docs/3.0/cli/commands/ddn_codemod_upgrade-project-config-v2-to-v3", - "ddn codemod upgrade-supergraph-config-v1-to-v2": "/docs/3.0/cli/commands/ddn_codemod_upgrade-supergraph-config-v1-to-v2", - "ddn command": "/docs/3.0/cli/commands/ddn_command", - "ddn command add": "/docs/3.0/cli/commands/ddn_command_add", - "ddn command update": "/docs/3.0/cli/commands/ddn_command_update", - "ddn connector": "/docs/3.0/cli/commands/ddn_connector", - "ddn connector build": "/docs/3.0/cli/commands/ddn_connector_build", - "ddn connector build create": "/docs/3.0/cli/commands/ddn_connector_build_create", - "ddn connector build delete": "/docs/3.0/cli/commands/ddn_connector_build_delete", - "ddn connector build get": "/docs/3.0/cli/commands/ddn_connector_build_get", - "ddn connector build logs": "/docs/3.0/cli/commands/ddn_connector_build_logs", - "ddn connector init": "/docs/3.0/cli/commands/ddn_connector_init", - "ddn connector introspect": "/docs/3.0/cli/commands/ddn_connector_introspect", - "ddn connector plugin": "/docs/3.0/cli/commands/ddn_connector_plugin", - "ddn connector setenv": "/docs/3.0/cli/commands/ddn_connector_setenv", - "ddn connector-link": "/docs/3.0/cli/commands/ddn_connector-link", - "ddn connector-link add": "/docs/3.0/cli/commands/ddn_connector-link_add", - "ddn connector-link add-resources": "/docs/3.0/cli/commands/ddn_connector-link_add-resources", - "ddn connector-link show": "/docs/3.0/cli/commands/ddn_connector-link_show", - "ddn connector-link update": "/docs/3.0/cli/commands/ddn_connector-link_update", - "ddn console": "/docs/3.0/cli/commands/ddn_console", - "ddn context": "/docs/3.0/cli/commands/ddn_context", - "ddn context create-context": "/docs/3.0/cli/commands/ddn_context_create-context", - "ddn context get": "/docs/3.0/cli/commands/ddn_context_get", - "ddn context get-context": "/docs/3.0/cli/commands/ddn_context_get-context", - "ddn context get-current-context": "/docs/3.0/cli/commands/ddn_context_get-current-context", - "ddn context set": "/docs/3.0/cli/commands/ddn_context_set", - "ddn context set-current-context": "/docs/3.0/cli/commands/ddn_context_set-current-context", - "ddn context unset": "/docs/3.0/cli/commands/ddn_context_unset", - "ddn doctor": "/docs/3.0/cli/commands/ddn_doctor", - "ddn model": "/docs/3.0/cli/commands/ddn_model", - "ddn model add": "/docs/3.0/cli/commands/ddn_model_add", - "ddn model update": "/docs/3.0/cli/commands/ddn_model_update", - "ddn plugins": "/docs/3.0/cli/commands/ddn_plugins", - "ddn plugins install": "/docs/3.0/cli/commands/ddn_plugins_install", - "ddn plugins list": "/docs/3.0/cli/commands/ddn_plugins_list", - "ddn plugins uninstall": "/docs/3.0/cli/commands/ddn_plugins_uninstall", - "ddn plugins upgrade": "/docs/3.0/cli/commands/ddn_plugins_upgrade", - "ddn project": "/docs/3.0/cli/commands/ddn_project", - "ddn project create": "/docs/3.0/cli/commands/ddn_project_create", - "ddn project delete": "/docs/3.0/cli/commands/ddn_project_delete", - "ddn project get": "/docs/3.0/cli/commands/ddn_project_get", - "ddn project init": "/docs/3.0/cli/commands/ddn_project_init", - "ddn project set-self-hosted-engine-url": "/docs/3.0/cli/commands/ddn_project_set-self-hosted-engine-url", - "ddn project subgraph": "/docs/3.0/cli/commands/ddn_project_subgraph", - "ddn project subgraph create": "/docs/3.0/cli/commands/ddn_project_subgraph_create", - "ddn project subgraph delete": "/docs/3.0/cli/commands/ddn_project_subgraph_delete", - "ddn project subgraph get": "/docs/3.0/cli/commands/ddn_project_subgraph_get", - "ddn relationship": "/docs/3.0/cli/commands/ddn_relationship", - "ddn relationship add": "/docs/3.0/cli/commands/ddn_relationship_add", - "ddn run": "/docs/3.0/cli/commands/ddn_run", - "ddn subgraph": "/docs/3.0/cli/commands/ddn_subgraph", - "ddn subgraph add": "/docs/3.0/cli/commands/ddn_subgraph_add", - "ddn subgraph build": "/docs/3.0/cli/commands/ddn_subgraph_build", - "ddn subgraph build apply": "/docs/3.0/cli/commands/ddn_subgraph_build_apply", - "ddn subgraph build create": "/docs/3.0/cli/commands/ddn_subgraph_build_create", - "ddn subgraph build get": "/docs/3.0/cli/commands/ddn_subgraph_build_get", - "ddn subgraph init": "/docs/3.0/cli/commands/ddn_subgraph_init", - "ddn supergraph": "/docs/3.0/cli/commands/ddn_supergraph", - "ddn supergraph build": "/docs/3.0/cli/commands/ddn_supergraph_build", - "ddn supergraph build apply": "/docs/3.0/cli/commands/ddn_supergraph_build_apply", - "ddn supergraph build create": "/docs/3.0/cli/commands/ddn_supergraph_build_create", - "ddn supergraph build delete": "/docs/3.0/cli/commands/ddn_supergraph_build_delete", - "ddn supergraph build diff": "/docs/3.0/cli/commands/ddn_supergraph_build_diff", - "ddn supergraph build get": "/docs/3.0/cli/commands/ddn_supergraph_build_get", - "ddn version": "/docs/3.0/cli/commands/ddn_version", - "ddn supergraph build local": "/docs/3.0/cli/commands/ddn_supergraph_build_local", - "ddn supergraph build set-self-hosted-engine-url": "/docs/3.0/cli/commands/ddn_supergraph_build_set-self-hosted-engine-url", - "ddn supergraph init": "/docs/3.0/cli/commands/ddn_supergraph_init", - "ddn update-cli": "/docs/3.0/cli/commands/ddn_update-cli" - } - }, - "Data Federation": { - "Overview": "/docs/3.0/federation/overview", - "Architecture": "/docs/3.0/federation/architecture", - "Basics": "/docs/3.0/federation/basics", - "Independent Subgraph Development": "/docs/3.0/federation/independent-subgraph-development", - "Cross-repo Relationships": "/docs/3.0/federation/cross-repo-relationships", - "Subgraph Prefixing": "/docs/3.0/federation/subgraph-prefixing", - "Build Commands": "/docs/3.0/federation/build-commands" - }, - "Recipes": { - "Overview": "/docs/3.0/recipes/overview", - "Authentication": { - "Auth0": "/docs/3.0/recipes/authentication/auth0", - "AWS Cognito": "/docs/3.0/recipes/authentication/aws-cognito", - "Firebase": "/docs/3.0/recipes/authentication/firebase", - "Clerk": "/docs/3.0/recipes/authentication/clerk" - }, - "Authorization": { - "Limit data to users": "/docs/3.0/recipes/authorization/simple-user-permissions", - "Public access": "/docs/3.0/recipes/authorization/public-access-role", - "Service accounts": "/docs/3.0/recipes/authorization/service-account" - }, - "Business Logic": { - "Format datetime objects": "/docs/3.0/recipes/business-logic/format-datetime-objects", - "Translate content": "/docs/3.0/recipes/business-logic/translate-content", - "Hash Passwords": "/docs/3.0/recipes/business-logic/hash-passwords", - "Validate Credentials": "/docs/3.0/recipes/business-logic/validate-credentials", - "Enrich data with LLMs": "/docs/3.0/recipes/business-logic/enrich-data-with-an-llm", - "HTTP Header Forwarding": "/docs/3.0/recipes/business-logic/http-header-forwarding" - }, - "Project configuration": { - "Rename a subgraph": "/docs/3.0/recipes/project-config/rename-subgraph", - "Remove a subgraph": "/docs/3.0/recipes/project-config/remove-subgraph", - "Deploy connectors independently": "/docs/3.0/recipes/project-config/independent-connector-deployment" - } - }, - "Plugins": { - "Overview": "/docs/3.0/plugins/overview", - "Introduction": "/docs/3.0/plugins/introduction", - "Quickstart": "/docs/3.0/plugins/quickstart" - }, - "Observability": { - "Overview": "/docs/3.0/observability/overview", - "Query Plan": { - "API Reference": "/docs/3.0/observability/explain/api-reference" - }, - "Metrics": "/docs/3.0/observability/metrics", - "Traces": "/docs/3.0/observability/traces", - "Analytics": { - "Operation Analytics": "/docs/3.0/observability/model-analytics/operation", - "Field Analytics": "/docs/3.0/observability/model-analytics/field" - } - }, - "Upgrade to DDN": { - "Upgrade Guide": "/docs/3.0/upgrade/guide", - "Feature Availability": { - "API": "/docs/3.0/upgrade/feature-availability/api-features", - "Tooling": "/docs/3.0/upgrade/feature-availability/tooling" - } - }, - "Deployment": { - "Overview": "/docs/3.0/deployment/overview", - "Architecture": "/docs/3.0/deployment/architecture", - "Serverless Edge": "/docs/3.0/deployment/serverless", - "Hasura Cloud Deployment": { - "Create a project": "/docs/3.0/deployment/deployment/create-a-project", - "Create a subgraph": "/docs/3.0/deployment/deployment/create-a-subgraph", - "Deploy a connector": "/docs/3.0/deployment/deployment/deploy-a-connector", - "Deploy your supergraph": "/docs/3.0/deployment/deployment/deploy-your-supergraph" - }, - "Private Deployment": { - "Hasura Hosted (VPC)": "/docs/3.0/deployment/private/hasura-hosted", - "Data Plane Collaboration": "/docs/3.0/deployment/private/data-plane-collaboration", - "Self-Hosted (BYOC)": { - "Data Plane Installation": "/docs/3.0/deployment/private/self-hosted/self-hosted-deployment" - } - } - }, - "Billing": { - "Overview": "/docs/3.0/billing/overview", - "Plans and Pricing": "/docs/3.0/billing/pricing", - "Billing": "/docs/3.0/billing/setup" - }, - "Support": { - "FAQ": "/docs/3.0/support/faq", - "Glossary": "/docs/3.0/support/glossary", - "Get Help": "/docs/3.0/support/get-support" - } -} \ No newline at end of file diff --git a/scripts/generateRoutes.cjs b/scripts/generateRoutes.cjs index 36165a2f8..2bfab1b02 100644 --- a/scripts/generateRoutes.cjs +++ b/scripts/generateRoutes.cjs @@ -1,7 +1,6 @@ const fs = require('fs'); const path = require('path'); -// Path to your JSON file const filePath = path.join(__dirname, '../.docusaurus/docusaurus-plugin-content-docs/default/p/docs-3-0-442.json'); const metadata = require(filePath); @@ -21,9 +20,11 @@ function buildRoutesObject(arr) { return result; } -// Usage const routesObject = buildRoutesObject(data.docsSidebars.docsSidebar); -// Save the structured sidebar as JSON -fs.writeFileSync('./routes.json', JSON.stringify(routesObject, null, 2)); -console.log('Routes JSON generated at build/routes.json'); +// Format the object as a TypeScript constant +const tsOutput = `const docsLinks = ${JSON.stringify(routesObject, null, 2)} as const;\n\nexport default docsLinks;`; + +// Write to a .ts file +fs.writeFileSync('./docsLinks.ts', tsOutput); +console.log('docsLinks.ts file created successfully.');