@frogbotai/graphql
v0.30.0
Published
GraphQL schema tools, helper types, and the frogbot-graphql CLI for FrogBot.
Readme
@frogbotai/graphql
GraphQL helper types and the frogbot-graphql schema generator for FrogBot.
The GraphQL API itself is served by two route files from @frogbotai/next/routes. See Enable GraphQL.
Installation
pnpm add @frogbotai/graphql -DGenerate the schema
pnpm frogbot-graphql generate:schemaThe command finds your FrogBot config the same way frogbot generate:types does (set FROGBOT_CONFIG_PATH to override) and writes graphQL.schemaOutputFile, which defaults to schema.graphql in the current directory.
Custom queries
import { GraphQLJSON } from '@frogbotai/graphql/types';
import type { FrogBotConfig } from 'frogbot';
export const graphQL: FrogBotConfig['graphQL'] = {
queries: () => ({
serverInfo: {
type: GraphQLJSON,
resolve: () => ({ startedAt: new Date().toISOString() }),
},
}),
};Pass graphQL to buildConfig in your FrogBot config. See Custom Queries and Mutations.
Entry points
| Entry | Exports |
| ------------------------------ | ----------------------------------------------------------------------- |
| @frogbotai/graphql | configToSchema(config): builds the schema from your FrogBot config |
| @frogbotai/graphql/types | GraphQL, GraphQLJSON, GraphQLJSONObject, buildPaginatedListType |
| @frogbotai/graphql/utilities | generateSchema(config): writes the schema file and returns its path |
