exp:expgraphqlpersist
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.
Script bin/php/expgraphqlpersist.php, code in kernel/private/classes/commands/expgraphqlpersist.php. Run it from the installation root, as the user the web server runs as:
./console exp:expgraphqlpersist --help
./console exp:graphql:persist --help
php bin/php/expgraphqlpersist.php --helpHelp text
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
| Option | Value | Help |
|---|---|---|
--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) |
Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).
Arguments: [path].
Related
Generated by ./console exp:help:examples from bin/php/expgraphqlpersist.php, kernel/private/classes/commands/expgraphqlpersist.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.