exp:expgraphqlpersist
Available since Exponential 6.0.15 (in development, not in a release yet).
Summary
Store GraphQL queries on the server as persisted queries (called by name or SHA-256), list them or remove them; a dry run unless --apply
Usage
./console exp:expgraphqlpersist [options] php bin/php/expgraphqlpersist.php [options] ./console exp:graphql:persist [options]
Aliases
exp:graphql:persist
Help
The output of ./console help exp:expgraphqlpersist (the script run with --help), without the standard options:
Usage: bin/php/expgraphqlpersist.php [OPTION]... [PATH] Store GraphQL queries on the server as persisted queries Each .graphql file (a file, or every .graphql file of a directory) is checked against the schema of the siteaccess and stored under its SHA-256 and its file name without .graphql (its name). A client then runs it by name (GET /api/graphql?id=articles) or by hash (Apollo's persisted queries), and only persisted queries are cached (graphql.ini ResponseCache). Nothing is written without --apply. ./console exp:graphql:persist queries/ check every .graphql file, store nothing ./console exp:graphql:persist queries/ --apply store them ./console exp:graphql:persist menu.graphql --name=main-menu --apply ./console exp:graphql:persist --list [--format=json] ./console exp:graphql:persist --remove=main-menu --apply Exit code: 0 fine; 1 a query does not fit the schema (nothing is stored then); 3 the library is missing; 2 wrong options. Options: --name=VALUE the name of the query (one file only); default: the file name without .graphql --list list the persisted queries --remove=VALUE remove the persisted query of this name or SHA-256 (and its names) --apply write; without it nothing is changed --format=VALUE text (the default) or json (with --list)
Options
| Option | Value | Description |
|---|---|---|
| --name | required | the name of the query (one file only); default: the file name without .graphql |
| --list | - | list the persisted queries |
| --remove | required | remove the persisted query of this name or SHA-256 (and its names) |
| --apply | - | write; without it nothing is changed |
| --format | required | text (the default) or json (with --list) |
Arguments
[path]
Standard options
Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.
Source
bin/php/expgraphqlpersist.php, kernel/private/classes/commands/expgraphqlpersist.php
See also
Generated example: exp:expgraphqlpersist
Added to the reference for Exponential 6.0.15.
Contributors
- Graham Brookins Updated
Comments
Add a comment