Depot GraphQL Tool
This package contains a helper method required to automatically create *.graphql schema files from depot snowflake package. (See depot-package-common).
Use this package when you want to convert you Depot package schemas in to the graphql schemas. For example when you to create and api to depot based database.
⚠️ This package requires JAVA to be installed.
You will need to create your own node.js executable which import depot package schema and execute generateGraphql helper method:
import { generateGraphql } from "@stage-tech/depot-graphql-tool";
import { join } from "path";
// "src/schema" should be replaced with a path pointing to your depot schema
import { pkg } from "src/schema";
(async () => {
await generateGraphql(pkg.schemas, join(__dirname, {
// "graphql/generated/schema.graphql" should be replaced with a path where you wish the graphql shema should be generated
graphql: "graphql/generated/schema.graphql",
// "graphql/generated/schema.json" should be replaced with a path where you wish json schema to be generated (optional)
json: "graphql/generated/schema.json"
}));
})();
Once setup, you should execute graphql generator file using ts-node
npx ts-node graphql-generate.ts
node -r ts-node/register graphql-generate.ts