ClientCRUD Plugin
The ClientCRUDPlugin
plugin uses your GraphQL schema to generate queries, mutations, subscriptions and fragments for use in your client-side application. The generated documents are compatible with all major GraphQL providers, such as Apollo GraphQL and urql.
#
InstallationTo execute this plugin on-demand, you will use the Graphback CLI. Install it as a devDependency in your project.
#
UsageIt is recommended to use the Graphback CLI for certain Graphback plugins, such as those that can modify files which your application depends on. This will prevent hidden accidental file modifications that would otherwise happen during start-up, which might cause issues in your application.
To load the ClientCRUDPlugin
plugin, it should be configuration in a .graphqlrc
GraphQL Config file. The Grahback CLI can dynamically load and execute plugins from a .graphqlrc
file.
The SchemaCRUDPlugin
should be defined before ClientCRUDPlugin
as graphback-schema
to ensure the latest schema is used to generate client documents.
See SchemaCRUDPlugin for an installation and configuration guide.
Run yarn graphback generate
to execute plugins from the .graphqlrc
config file on-demand.
The client documents will be created in a file called ./client/src/graphql/graphback.graphql
.
#
ConfigurationBelow is a full list of the available configuration options for this plugin.
Argument | Description | Type |
---|---|---|
pluginConfig.outputFile | Relative path to the GraphQL documents to be created. Example: "/path/to/documents.graphql" . Supported file extensions: .ts , .graphql | string |
pluginConfig.fragmentOnly | Optional. When true Graphback generates only creates fragments, and skips creating queries, mutations and subscriptions. | boolean |