### Install Dependencies and Start Server Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/restified-endpoints/how-to.mdx Navigate to the plugin directory, install dependencies, and start the local development server. ```bash cd engine-plugin-restified-endpoint npm install npm start ``` -------------------------------- ### Install Dependencies and Start Local Server Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/allowlist/how-to.mdx Navigate to the project directory, install dependencies, and start the local development server. ```bash cd allowlist-plugin npm install npm start ``` -------------------------------- ### Automated Docs Setup and Server Start Source: https://github.com/hasura/ddn-docs/blob/main/wiki/contributing.mdx This command automates the cloning, dependency installation, and server startup for the documentation development environment. It's a quick way to get started. ```bash git clone https://github.com/hasura/ddn-docs.git cd ddn-docs yarn install yarn start ``` -------------------------------- ### Install Dependencies and Start Dev Server Source: https://github.com/hasura/ddn-docs/blob/main/wiki/contributing.mdx After cloning the repository, navigate into the directory and install the necessary dependencies using Yarn. Then, start the local development server. ```bash cd ddn-docs && yarn install ``` ```bash yarn start ``` -------------------------------- ### Install a Plugin Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_plugins_install.mdx Use this command to install a specific plugin by its name. The plugin will be fetched from the index and integrated into your DDN CLI setup. ```bash ddn plugins install [flags] ``` ```bash # Install a plugin named "ndc-postgres" ddn plugins install ndc-postgres ``` -------------------------------- ### Initialize Project and Install Dependencies Source: https://github.com/hasura/ddn-docs/blob/main/docs/auth/webhook/tutorials/simple-webhook-auth-server.mdx Set up a new Node.js project and install the Express framework. ```bash mkdir hasura-webhook-auth cd hasura-webhook-auth npm init -y npm install express ``` -------------------------------- ### Install Dependencies and Start Local Server Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/restified-endpoints/how-to.mdx Install project dependencies and start the local development server for your Cloudflare Worker. This allows you to test your worker locally before deployment. ```bash cd restified-endpoints-plugin npm install npm start ``` -------------------------------- ### Start Services Source: https://github.com/hasura/ddn-docs/blob/main/docs/business-logic/tutorials/1-add-custom-logic.mdx This command starts your services, typically in a Docker environment. ```bash ddn run docker-start ``` -------------------------------- ### Example Script Execution Source: https://github.com/hasura/ddn-docs/blob/main/utilities/improve-front-matter-seo/README.md An example demonstrating how to run the script on a specific directory with custom instructions for the AI. ```bash node improve-seo.js /supergraph-modeling 'Remember to focus on cloud-related keywords. Or add the copy from Overview.mdx for the section.' ``` -------------------------------- ### Install Dependencies Source: https://github.com/hasura/ddn-docs/blob/main/utilities/improve-front-matter-seo/README.md Install all the necessary Node.js packages for the project. ```bash npm install ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/hasura/ddn-docs/blob/main/utilities/one-click-llm/README.md Install project dependencies using Bun. Ensure Bun is installed before running. ```sh bun install ``` -------------------------------- ### Example Schema Configuration Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/mongodb/type-expressions.mdx This example demonstrates how to configure a schema, including defining an object type for 'users' with specific fields and their types. ```json { "name": "users", "collections": { "users": { "type": "users" } }, "objectTypes": { "users": { "fields": { "_id": { "type": { "scalar": "objectId" }, "description": "primary key" }, "name": { "type": { "scalar": "string" } }, "metadata": { "type": "extendedJSON" } } } } } ``` -------------------------------- ### Example Product Response Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-stripe.mdx This JSON shows an example response when querying for all products. It includes a list of products with their details. ```json { "data": { "getProducts": { "data": [ { "id": "3bef8a40-3c33-11ee-bb29-070df467ec94", "name": "Tee", "description": "A great t-shirt!" }, { "id": "e0a70b16-65b6-11ed-8788-8fa2504d64a3", "name": "Sticker Sheet", "description": "Who doesn't love stickers??" }, { "id": "a44eda7c-65b6-11ed-997b-53b5bdb7117e", "name": "Hasuras in The Cloud Tee", "description": "The cloud for your cloud." }, { "id": "8aa93f86-65b6-11ed-901c-f320d4e17bb2", "name": "Dark Furry Logo Tee", "description": "Furry for furries." } ] } } } ``` -------------------------------- ### Install Dependencies Source: https://github.com/hasura/ddn-docs/blob/main/utilities/generate-metadata-docs/README.md Install necessary dependencies before running the utility for the first time or when orchestrating CI. Includes installing TypeScript if running in an Action. ```bash cd utilities/generate-metadata-docs # if you're running this in an Action, install TS # npm install typescript npm i ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/hasura/ddn-docs/blob/main/README.md Run this command to install all necessary project dependencies. ```bash $ yarn ``` -------------------------------- ### Starting Services Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-postgresql.mdx Start the Hasura DDN services using Docker. ```APIDOC ## Start Docker Services ### Description Launches the necessary Docker containers for your Hasura DDN project. ### Command ```sh ddn run docker-start ``` ``` -------------------------------- ### Example User Response Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-oracle.mdx This is the expected JSON response when querying for example users. ```json { "data": { "exampleUsers": [ { "userId": 1, "name": "Alice", "age": 25 }, { "userId": 2, "name": "Bob", "age": 30 }, { "userId": 3, "name": "Charlie", "age": 35 } ] } } ``` -------------------------------- ### Start Local Development Server Source: https://github.com/hasura/ddn-docs/blob/main/README.md Starts a local development server that automatically refreshes on changes. Useful for quick iterations during development. ```bash $ yarn start ``` -------------------------------- ### Example Command Definition Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/metadata-reference/commands.mdx A YAML example demonstrating the definition of a 'get_latest_article' command. It includes arguments, source configuration, and GraphQL details. ```yaml kind: Command version: v1 definition: name: get_latest_article outputType: commandArticle arguments: [] source: dataConnectorName: data_connector dataConnectorCommand: function: latest_article argumentMapping: {} graphql: rootFieldName: getLatestArticle rootFieldKind: Query description: Get the latest article ``` -------------------------------- ### API Key Usage Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/http/auth.mdx Example of how an API key is injected into a request using a placeholder. ```text api_key: {{API_KEY}} ``` -------------------------------- ### Verify CLI Installation Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/installation.mdx Run this command after installation to check the CLI version and confirm it's working correctly. ```bash ddn version ``` -------------------------------- ### Example graphql-config.hml with Apollo Federation Enabled Source: https://github.com/hasura/ddn-docs/blob/main/docs/graphql-api/apollo-federation.mdx An example of a `graphql-config.hml` file demonstrating the inclusion of Apollo Federation configuration. ```yaml kind: GraphqlConfig version: v1 definition: query: rootOperationTypeName: Query mutation: rootOperationTypeName: Mutation apolloFederation: enableRootFields: true ``` -------------------------------- ### GraphQL Query Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/metadata-reference/commands.mdx An example of a GraphQL query generated from the command definition, showing how to invoke the 'hello' command with a 'name' argument. ```APIDOC ## GraphQL Query Example ### Description This example demonstrates how a defined command can be invoked via a GraphQL query. ### Query ```graphql query { hello(name: "Hasura") } ``` ``` -------------------------------- ### Set Supergraph Configuration Source: https://github.com/hasura/ddn-docs/blob/main/docs/project-configuration/tutorials/manage-multiple-environments.mdx Configure the supergraph for your current context. This is a starting point for your supergraph setup. ```sh ddn context set supergraph "supergraph.yaml" ``` -------------------------------- ### Use _nregex to Exclude Names Starting with 'J' Source: https://github.com/hasura/ddn-docs/blob/main/docs/graphql-api/queries/filters/text-search-operators.mdx Use the `_nregex` operator to filter out results that match a regular expression. This example excludes users whose names start with 'J'. The `_regex` operators are case-sensitive. ```graphql query UsersWithNRegex { users(where: { name: { _nregex: "/^J/" } }) { id name } } ``` -------------------------------- ### Serve Local Documentation Build Source: https://github.com/hasura/ddn-docs/blob/main/wiki/contributing.mdx After a successful build, use this command to serve the `build` folder locally. This allows you to test how your changes render in a browser. ```bash yarn serve ``` -------------------------------- ### Relationship Field Deprecation Source: https://github.com/hasura/ddn-docs/blob/main/docs/graphql-api/versioning.mdx Example of deprecating a relationship field in Hasura. This helps in phasing out old relationships and guiding users to new ones. ```APIDOC ## Relationship Field Deprecation ### Description This example shows how to deprecate a relationship field in Hasura. It marks the `engineSpec` relationship as deprecated with a reason, indicating that engines on cars are no longer supported. ### Metadata Configuration ```yaml kind: Relationship version: V1 definition: name: engineSpec source: Car target: command: name: GetEngineSpec mapping: - source: fieldPath: - fieldName: engine target: argument: argumentName: name deprecated: reason: Engines on cars are no longer supported from Jan 01 2035 ``` ### Resulting GraphQL Schema ```graphql type Car { Id: String make: String model: String engine: String @deprecated(reason: "Use motor field instead") motor: String engineSpec: Engine @deprecated(reason: "Engines on cars are no longer supported from Jan 01 2035") motorSpec: Motor } ``` ``` -------------------------------- ### List All Plugins Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_plugins_list.mdx Run this command to see a list of all available plugins, their versions, and installation status. ```bash ddn plugins list ``` -------------------------------- ### Example Output of Project Initialization Source: https://github.com/hasura/ddn-docs/blob/main/docs/deployment/hasura-ddn/tutorial/01-create-a-project.mdx This output shows the project name created on Hasura DDN and lists the subgraphs associated with it. It confirms successful project creation. ```bash 4:19PM INF Project "cool-cat-3685" created on Hasura DDN successfully +-----------+---------------+ | Project | fast-pug-7230 | +-----------+---------------+ | Subgraphs | globals,app | +-----------+---------------+ ``` -------------------------------- ### Fetch All Articles (Request) Source: https://github.com/hasura/ddn-docs/blob/main/docs/json-api/queries/index.mdx This is an example HTTP GET request to fetch all articles from the 'Articles' model within the 'default' subgraph. It demonstrates the basic structure for retrieving all resources. ```http GET /v1/jsonapi/default/Articles ``` -------------------------------- ### Create Route Directories and Files Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/tutorials/simple-engine-plugins-ts.mdx Sets up the necessary directory and empty files for your route handlers. ```bash mkdir src/routes && touch src/routes/pre-parse.ts && touch src/routes/pre-response.ts ``` -------------------------------- ### Fetch User with Nested Posts Aggregated Count Source: https://github.com/hasura/ddn-docs/blob/main/docs/graphql-api/queries/aggregation-queries.mdx Aggregate data can be fetched on nested objects through array relationships. This example shows how to get the count of posts associated with a specific user. ```graphql query ArticlesSummaryByAuthor { usersById(id: "1") { id name postsAggregate { _count } posts { id title } } } ``` -------------------------------- ### Create Ingress for Project API Source: https://github.com/hasura/ddn-docs/blob/main/docs/deployment/self-hosted/kubernetes-self-hosted.mdx Define an Ingress resource to expose your Project API. This example assumes nginx and cert-manager are installed. Ensure the namespace, domain, and Helm release name match your deployment. ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: cert-manager.io/cluster-issuer: letsencrypt-prod certmanager.k8s.io/cluster-issuer: letsencrypt-prod labels: app: v3-engine name: v3-engine namespace: spec: ingressClassName: nginx rules: - host: http: paths: - backend: service: name: -v3-engine port: number: 3000 path: / pathType: ImplementationSpecific tls: - hosts: - secretName: -tls-certs ``` -------------------------------- ### Initialize a PromptQL program from an artifact Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_promptql-program_add.mdx Initialize a new PromptQL program by providing a path to a JSON artifact file. This is useful for creating programs from pre-defined configurations. ```bash ddn promptql-programs add --from-artifact ``` -------------------------------- ### Filter Authors by Name Greater Than 'M' Source: https://github.com/hasura/ddn-docs/blob/main/docs/graphql-api/queries/filters/comparison-operators.mdx The `_gt` operator can be used with strings to filter records alphabetically. This example fetches authors whose names start with 'M' or any letter that follows 'M' in dictionary order. ```graphql query AuthorsNameGreaterThanM { authors( where: {name: {_gt: "M"}} ) { id name } } ``` -------------------------------- ### Show diff for models matching a glob pattern Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_model_show.mdx This command allows you to compare multiple models against their NDC collections simultaneously by using a glob pattern. For example, 'User*' will show diffs for all models starting with 'User'. Ensure the pattern is quoted if it contains special characters. ```bash ddn model show "User*" ``` -------------------------------- ### Install DDN Fish Shell Autocompletion for New Sessions Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_completion_fish.mdx To ensure autocompletion is available every time you open a new fish shell session, redirect the output of `ddn completion fish` to a file in the fish completions directory. A new shell must be started for this to take effect. ```bash ddn completion fish > ~/.config/fish/completions/ddn.fish ``` -------------------------------- ### Initialize a new Node.js project for a plugin Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/tutorials/simple-engine-plugins-ts.mdx From the root of your plugin-example directory, initialize a new Node.js project as a sibling to the `ddn` directory. This sets up the basic structure for your plugin. ```sh mkdir simple-plugin && cd simple-plugin && npm init -y ``` -------------------------------- ### Install Curl (if needed) Source: https://github.com/hasura/ddn-docs/blob/main/docs/deployment/hasura-ddn/ci-cd.mdx Installs curl on Debian/Ubuntu-based systems if it's not already present. Verify installation with `curl --version`. ```bash sudo apt update && sudo apt upgrade sudo apt install curl curl --version ``` -------------------------------- ### Initialize Supergraph Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/deployment/self-hosted/kubernetes-self-hosted.mdx Create a new directory for your Hasura project and navigate into it. ```bash mkdir hasura_project && cd hasura_project ``` -------------------------------- ### Initialize Hasura DDN Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/restified-endpoints/how-to.mdx Initialize a cloud project paired with your local metadata if one does not exist. ```bash ddn project init . ``` -------------------------------- ### Run First Query Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-http.mdx Open your local console and execute a GraphQL query to test your setup. ```graphql query GET_USERS { getUsers { id name } } ``` -------------------------------- ### Build and Deploy Go Connector Source: https://github.com/hasura/ddn-docs/blob/main/docs/deployment/hasura-ddn/tutorial/partials/go/_deployment-tutorial.mdx Use the DDN CLI to build and deploy your Go connector. Ensure you update the path to your connector's configuration file. ```bash ddn connector build create --connector ./my_subgraph/connector/my_go/connector.yaml ``` -------------------------------- ### Connect to SQL Server and Create Table Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-sqlserver.mdx Connect to the running SQL Server instance using sqlcmd and create a 'users' table with user ID, name, and age. ```sh docker exec -it sqlserver /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P Password123 -C -N ``` ```sql CREATE TABLE users (user_id int primary key, name varchar(255), age int); GO ``` -------------------------------- ### Build Documentation for Production Source: https://github.com/hasura/ddn-docs/blob/main/README.md Generates static documentation files into the 'build' directory, ready for deployment on any static hosting service. ```bash $ yarn build ``` -------------------------------- ### Initialize PostgreSQL Databases and Tables Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/postgresql/dynamic-connections-tutorial.mdx This SQL script sets up a primary PostgreSQL database with a 'table' and creates three follower databases, each with the same 'table' schema and initial data. It uses \\c to switch between databases. ```sql -- Create the primary database and tables \c primary; CREATE TABLE IF NOT EXISTS "table" ( id SERIAL PRIMARY KEY, name TEXT NOT NULL ); INSERT INTO "table" (name) VALUES ('Primary Record 1'), ('Primary Record 2'), ('Primary Record 3'); -- Create follower databases CREATE DATABASE follower1; CREATE DATABASE follower2; CREATE DATABASE follower3; -- Connect to follower1 and create the same schema \c follower1; CREATE TABLE IF NOT EXISTS "table" ( id SERIAL PRIMARY KEY, name TEXT NOT NULL ); INSERT INTO "table" (name) VALUES ('Follower1 Record 1'), ('Follower1 Record 2'), ('Follower1 Record 3'); -- Connect to follower2 and create the same schema \c follower2; CREATE TABLE IF NOT EXISTS "table" ( id SERIAL PRIMARY KEY, name TEXT NOT NULL ); INSERT INTO "table" (name) VALUES ('Follower2 Record 1'), ('Follower2 Record 2'), ('Follower2 Record 3'); -- Connect to follower3 and create the same schema \c follower3; CREATE TABLE IF NOT EXISTS "table" ( id SERIAL PRIMARY KEY, name TEXT NOT NULL ); INSERT INTO "table" (name) VALUES ('Follower3 Record 1'), ('Follower3 Record 2'), ('Follower3 Record 3'); ``` -------------------------------- ### MySQL Connector Function Definition Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/mysql/configuration.mdx An example of a function definition within the configuration. ```json { "function_catalog": "public", "function_schema": "public", "function_name": "add", "argument_signature": "(N NUMBER, M NUMBER)", "data_type": "TABLE (N NUMBER, M NUMBER)", "comment": "Adds two numbers" } ``` -------------------------------- ### Initialize a Project on Hasura DDN Source: https://github.com/hasura/ddn-docs/blob/main/docs/deployment/hasura-ddn/deploy-to-ddn.mdx Use this command to initialize a new project on Hasura DDN. It creates the project, subgraphs, and an environment file. You can optionally provide a project name. ```bash ddn project init ``` -------------------------------- ### Bearer Token Usage Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/http/auth.mdx Example of how a Bearer token is injected into the Authorization header. ```text Authorization: Bearer {{PET_STORE_BEARER_TOKEN}} ``` -------------------------------- ### Prepare DuckDB Database File Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-duckdb.mdx Prepare an initial DuckDB file with a users table and sample data using the DuckDB CLI. Ensure the DuckDB CLI is installed. ```sh echo " -- Create a sequence since DuckDB doesn't support auto-incrementing CREATE SEQUENCE users_id_seq; -- Create the table using the sequence CREATE TABLE users ( id INTEGER PRIMARY KEY DEFAULT nextval('users_id_seq'), name VARCHAR(255) NOT NULL, age INTEGER NOT NULL ); -- Insert some data INSERT INTO users (name, age) VALUES ('Alice', 25); INSERT INTO users (name, age) VALUES ('Bob', 30); INSERT INTO users (name, age) VALUES ('Charlie', 35); " | duckdb app/connector/my_duckdb/data.duckdb ``` -------------------------------- ### Logical OR Filter Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/json-api/queries/filters.mdx This example filters articles that have a rating equal to 5 OR are featured. ```http GET /v1/jsonapi/default/Articles?filter={" $or":[{"rating":{" $eq":5}},{"featured":{" $eq":true}}]} ``` -------------------------------- ### Create Staging Cloud Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/project-configuration/tutorials/manage-multiple-environments.mdx Initialize a new cloud project for your staging environment using the current context, including a specific cloud environment file. ```sh ddn project init --env-file-name ".env.staging.cloud" ``` -------------------------------- ### Project structure after initialization Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/tutorials/simple-engine-plugins-ts.mdx This illustrates the expected top-level project structure after initializing the `simple-plugin` directory. ```sh ├── ddn └── simple-plugin ``` -------------------------------- ### Install firebase-admin Package Source: https://github.com/hasura/ddn-docs/blob/main/docs/auth/jwt/tutorials/integrations/3-firebase.mdx Install the Firebase Admin SDK for Node.js to interact with Firebase services. ```sh npm i firebase-admin ``` -------------------------------- ### Example Process CPU Seconds Total Response Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-prometheus.mdx This is an example JSON response for the processCpuSecondsTotal query. ```json { "data": { "processCpuSecondsTotal": [ { "timestamp": 1743010998, "value": 0.002222123461179495 } ] } } ``` -------------------------------- ### Create a ConnectorBuild Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_connector_build_create.mdx Use this command to initiate the creation of a ConnectorBuild. Specify the path to your connector's configuration file using the `--connector` flag. ```bash ddn connector build create --connector ./app/connector/my_connector/connector.yaml ``` -------------------------------- ### Logical AND Filter Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/json-api/queries/filters.mdx This example filters articles that have a rating greater than or equal to 4 AND are published. ```http GET /v1/jsonapi/default/Articles?filter={" $and":[{"rating":{" $gte":4}},{"published":{" $eq":true}}]} ``` -------------------------------- ### Example Prometheus HTTP Requests Total Response Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-prometheus.mdx This is an example JSON response for the prometheusHttpRequestsTotal query. ```json { "data": { "prometheusHttpRequestsTotal": [ { "job": "prometheus", "timestamp": 1743004075, "value": 0.08889283968176363 } ] } } ``` -------------------------------- ### Run the Node.js Server Source: https://github.com/hasura/ddn-docs/blob/main/docs/auth/webhook/tutorials/simple-webhook-auth-server.mdx Start the Express webhook authentication server. ```bash node server.js ``` -------------------------------- ### Example DDN Review Type Source: https://github.com/hasura/ddn-docs/blob/main/docs/graphql-api/apollo-federation.mdx This is an example of a 'Review' type defined within Hasura DDN. ```graphql type Review { id: ID! productId: ID! rating: Int! comment: String } ``` -------------------------------- ### Install Packages for TypeScript Connector Source: https://github.com/hasura/ddn-docs/blob/main/docs/business-logic/tutorials/1-add-custom-logic.mdx Navigate to your TypeScript connector directory and install the necessary npm packages. ```bash cd app/connector/my_ts && npm install ``` -------------------------------- ### Initialize Cloud Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/project-configuration/tutorials/work-with-multiple-subgraphs.mdx Run this command to create a new cloud project. It will update your local context and generate subgraphs in your cloud project. ```sh ddn project init ``` -------------------------------- ### Install bcryptjs for TypeScript Source: https://github.com/hasura/ddn-docs/blob/main/docs/business-logic/tutorials/6-validate-credentials.mdx Install the bcryptjs package using npm for password comparison in TypeScript functions. ```sh npm install bcryptjs ``` -------------------------------- ### Build and Run Services Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/postgresql/dynamic-connections-tutorial.mdx Build the supergraph and start the services using the ddn CLI commands. This step is required before testing the dynamic routing. ```bash ddn supergraph build local ddn run docker-start ``` -------------------------------- ### Example: Remove DataConnectorLink Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_connector-link_remove.mdx This example demonstrates how to remove a DataConnectorLink named 'mydb' from the Subgraph located at './app/subgraph.yaml'. ```bash # Remove a DataConnectorLink from the Subgraph "app" ddn connector-link remove mydb --subgraph ./app/subgraph.yaml ``` -------------------------------- ### List all contexts Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/cli/commands/ddn_context_get-context.mdx Run this command without any arguments to get a list of all configured contexts. ```bash ddn context get-context ``` -------------------------------- ### Example GraphQL response Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/tutorials/simple-engine-plugins-ts.mdx This is an example of the JSON response you will receive after executing the GraphQL query for customers and their orders. ```json { "data": { "customers": [ { "id": 1, "name": "Alice", "email": "alice@example.com", "orders": [ { "id": 1, "orderDate": "2025-01-14", "totalAmount": "99.99" } ] }, { "id": 2, "name": "Bob", "email": "bob@example.com", "orders": [ { "id": 2, "orderDate": "2025-01-14", "totalAmount": "49.50" } ] }, { "id": 3, "name": "Charlie", "email": "charlie@example.com", "orders": [ { "id": 3, "orderDate": "2025-01-14", "totalAmount": "75.00" } ] } ] } } ``` -------------------------------- ### Example Query Response (JSON) Source: https://github.com/hasura/ddn-docs/blob/main/docs/how-to-build-with-ddn/with-bigquery.mdx This is an example of the JSON response you can expect after running a query against your BigQuery data. ```json { "data": { "users": [ { "userId": "1", "name": "Alice", "age": "25" }, { "userId": "3", "name": "Charlie", "age": "35" }, { "userId": "2", "name": "Bob", "age": "30" } ] } } ``` -------------------------------- ### Create Project Directory Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/tutorials/simple-engine-plugins-ts.mdx Begin by creating a new directory for your plugin project. ```sh mkdir plugin-tutorial && cd plugin-tutorial ``` -------------------------------- ### Initialize New DDN Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/business-logic/tutorials/1-add-custom-logic.mdx Use the DDN CLI to create a new local DDN project. This command sets up the basic structure for your project. ```bash ddn supergraph init lambda-tutorial ``` -------------------------------- ### Validate DDN CLI Installation Source: https://github.com/hasura/ddn-docs/blob/main/docs/_prereqs.mdx Run this command to verify that the DDN CLI has been installed correctly and is accessible in your environment. ```ddn ddn doctor ``` -------------------------------- ### Build Plugin for Lambda (Windows) Source: https://github.com/hasura/ddn-docs/blob/main/docs/plugins/restified-endpoints/how-to.mdx Build the plugin and prepare it for AWS Lambda deployment on Windows. ```bash npm run build Copy package.lambda.json to dist/package.lambda.json. Go to dist folder and install packages npm install. ``` -------------------------------- ### Foreign Key Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/turso/configuration.mdx This example demonstrates how foreign key relationships are defined within the object fields configuration. ```json { "foreign_keys": { "user_id": { "table": "users", "column": "id" } } } ``` -------------------------------- ### MySQL Connector Native Query Examples Source: https://github.com/hasura/ddn-docs/blob/main/docs/reference/connectors/mysql/configuration.mdx Demonstrates inline and parameterized native query configurations for the MySQL data connector. ```json { "native_query_inline": { "sql": { "parts": [ { "type": "text", "value": "SELECT 1 AS result FROM DUAL" } ] }, "columns": { "result": { "type": "named", "name": "INT" } }, "arguments": {}, "description": "" }, "ArtistById_parameterized": { "sql": { "parts": [ { "type": "text", "value": "SELECT * FROM CHINOOK.ARTIST WHERE ARTISTID = " }, { "type": "parameter", "value": "ARTISTID" } ] }, "columns": { "ARTISTID": { "type": "named", "name": "INT" }, "NAME": { "type": "nullable", "underlying_type": { "type": "named", "name": "STRING" } } }, "arguments": { "ARTISTID": { "description": null, "type": { "type": "named", "name": "INT" } } }, "description": null, "isProcedure": false } } ``` -------------------------------- ### Field Comparison Filter Example Source: https://github.com/hasura/ddn-docs/blob/main/docs/json-api/queries/filters.mdx This example demonstrates filtering articles by a specific rating using the '$eq' operator. ```http GET /v1/jsonapi/default/Articles?filter={"rating":{" $eq":5}} ``` -------------------------------- ### Initialize a New Local Hasura DDN Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/project-configuration/tutorials/manage-multiple-environments.mdx Scaffolds the necessary files for a new Hasura DDN project. Navigate into the created directory after execution. ```sh ddn supergraph init environments-example && cd environments-example ``` -------------------------------- ### Initialize a New Supergraph Project Source: https://github.com/hasura/ddn-docs/blob/main/docs/quickstart.mdx Scaffold a new supergraph project in a specified directory. Navigate into the created directory to begin development. ```bash ddn supergraph init mysupergraph cd mysupergraph ``` -------------------------------- ### Initialize Parent Project and Git Repository Source: https://github.com/hasura/ddn-docs/blob/main/docs/project-configuration/tutorials/work-with-multiple-repositories.mdx Scaffolds a new DDN project and initializes a git repository for the parent project. ```sh ddn supergraph init parent-project && cd parent-project && git init ```