guides/operation_store/client_workflow.md
To use persisted queries with your client application, you must:
OperationStore, as described in {% internal_link "Getting Started","/operation_store/getting_started" %}params[:operationId] from the client appThis documentation also touches on {% internal_link "graphql-ruby-client sync", "/javascript_client/sync" %}, a JavaScript client library for using OperationStore.
Clients are registered via {% internal_link "the dashboard","/operation_store/getting_started#add-routes" %}:
{{ "/operation_store/add_a_client.png" | link_to_img:"Add a Client for Persisted Queries" }}
A default secret is provided for you, but you can also enter your own. The secret is used for {% internal_link "HMAC authentication", "/operation_store/access_control" %}.
(Are you interested in a Ruby API for this? Please {% open_an_issue "OperationStore Ruby API" %} or email [email protected].)
Once a client is registered, it can push queries to the server via {% internal_link "the Sync API","/operation_store/getting_started#add-routes" %}.
The easiest way to sync is with graphql-ruby-client sync, a command-line tool written in JavaScript ({% internal_link "Sync Guide", "/javascript_client/sync" %})
In short, it:
.graphql files or relay-compiler output in the provided --path--client and --secret--url--outfileFor example:
{{ "/operation_store/sync_example.png" | link_to_img:"OperationStore client sync" }}
For help syncing in another language, you can take inspiration from the JavaScript implementation, {% open_an_issue "Implementing operation sync in another language" %}, or email [email protected].
See the {% internal_link "Sync Guide", "/javascript_client/sync" %} for using OperationStore with Relay Modern, Apollo 1.x, Apollo Link, or plain JavaScript.
To run stored operations from another client, send a param called operationId which is composed of:
{
# ...
operationId: "my-relay-app/ce79aa2784fc..."
# ^ client id / ^ operation id
}
The server will use those values to fetch an operation from the database.
Learn more about OperationStore's {% internal_link "authentication", "/operation_store/access_control" %} or read some tips for {% internal_link "server management","/operation_store/server_management" %}.