{"id":21500498,"url":"https://github.com/node-libraries/pothos-query-generator","last_synced_at":"2026-04-21T22:36:06.760Z","repository":{"id":199382661,"uuid":"702773626","full_name":"node-libraries/pothos-query-generator","owner":"node-libraries","description":"Plugin to output 'query.graphql' from pothos to file","archived":false,"fork":false,"pushed_at":"2023-10-10T01:53:38.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-15T11:07:27.049Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-libraries.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-10T01:46:59.000Z","updated_at":"2023-10-10T01:53:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a5266cc-2487-457e-a873-d24d1c71cc3f","html_url":"https://github.com/node-libraries/pothos-query-generator","commit_stats":null,"previous_names":["node-libraries/pothos-query-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/node-libraries/pothos-query-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-libraries%2Fpothos-query-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-libraries%2Fpothos-query-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-libraries%2Fpothos-query-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-libraries%2Fpothos-query-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-libraries","download_url":"https://codeload.github.com/node-libraries/pothos-query-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-libraries%2Fpothos-query-generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263154344,"owners_count":23422009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T17:41:57.023Z","updated_at":"2026-04-21T22:36:06.752Z","avatar_url":"https://github.com/node-libraries.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pothos-query-generator\n\n[![](https://img.shields.io/npm/l/pothos-query-generator)](https://www.npmjs.com/package/pothos-query-generator)\n[![](https://img.shields.io/npm/v/pothos-query-generator)](https://www.npmjs.com/package/pothos-query-generator)\n[![](https://img.shields.io/npm/dw/pothos-query-generator)](https://www.npmjs.com/package/pothos-query-generator)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/node-libraries/pothos-query-generator)\n\nA plugin for [Pothos](https://pothos-graphql.dev/) that automatically generates example GraphQL queries using [graphql-auto-query](https://github.com/SoraKumo001/graphql-auto-query).\n\nThis plugin hooks into the Pothos schema build process and outputs a file containing generated queries based on your schema definition.\n\n## Usage\n\n### Basic Setup\n\nAdd the plugin to your `SchemaBuilder` and configure the `pothosQueryGenerator` options.\n\n```ts\nimport SchemaBuilder from \"@pothos/core\";\nimport PothosQueryGeneratorPlugin from \"pothos-query-generator\";\n\nconst builder = new SchemaBuilder({\n  plugins: [PothosQueryGeneratorPlugin],\n  pothosQueryGenerator: {\n    // Path to the output file\n    output: \"query.graphql\",\n    // Optional: Depth of the generated queries (default depends on graphql-auto-query)\n    depth: 2,\n  },\n});\n\n// ... define your schema ...\n\nbuilder.toSchema();\n```\n\n### Conditional Output\n\nYou can conditionally disable the output by setting `output` to `false`, `null`, or `undefined`. This is useful for generating files only in development environments.\n\n```ts\nimport path from \"path\";\nimport SchemaBuilder from \"@pothos/core\";\nimport PothosQueryGeneratorPlugin from \"pothos-query-generator\";\n\nconst builder = new SchemaBuilder({\n  plugins: [PothosQueryGeneratorPlugin],\n  pothosQueryGenerator: {\n    output:\n      process.env.NODE_ENV === \"development\"\n        ? path.join(process.cwd(), \"graphql\", \"query.graphql\")\n        : false,\n  },\n});\n```\n\n## Options\n\n| Option              | Type                      | Description                                                                                   |\n| ------------------- | ------------------------- | --------------------------------------------------------------------------------------------- |\n| `output`            | `string \\| null \\| false` | The file path where the generated queries will be saved. If falsy, no file is written.        |\n| `depth`             | `number`                  | (Optional) The recursion depth for generating nested fields in the query.                     |\n| `queryDepth`        | `number`                  | (Optional) The recursion depth for generating nested fields in the query. (overrides `depth`) |\n| `mutationDepth`     | `number`                  | (Optional) The recursion depth for generating nested fields in the mutation.                  |\n| `subscriptionDepth` | `number`                  | (Optional) The recursion depth for generating nested fields in the subscription.              |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-libraries%2Fpothos-query-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-libraries%2Fpothos-query-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-libraries%2Fpothos-query-generator/lists"}