Apollo Persisted Query Manifests in Hive CLI

Laurin Quast
Laurin Quast

The Hive CLI now accepts Apollo persisted query manifest files when pushing persisted documents to an App Deployment.

Why Persisted Documents/Queries?

Persisted documents let clients send a compact operation ID instead of the full GraphQL document. With Hive App Deployments, you can publish those documents to the Hive CDN, restrict your GraphQL Gateway/API to known operations, track operations by app version, and include active app deployments in breaking change checks.

Publishing Apollo Persisted Query Manifests

If your build already generates an Apollo manifest, upload it as an App Deployment and publish it before releasing your app to make the persisted documents available to your gateway or server.

Pass the generated manifest directly to hive app:create:

hive app:create \
  --registry.accessToken "<ACCESS_TOKEN>" \
  --target "<ORGANIZATION>/<PROJECT>/<TARGET>" \
  --name "my-app" \
  --version "1.0.0" \
  persisted-query-manifest.json

Hive reads each operation's id and body from version 1 of the apollo-persisted-query-manifest format. Existing operation IDs are preserved, so no intermediate conversion to the GraphQL Code Generator or Relay manifest format is required.

persisted-query-manifest.json
{
  "format": "apollo-persisted-query-manifest",
  "version": 1,
  "operations": [
    {
      "id": "e50da5010bca3f3ea824008ff6d885e7a877936c5834705e55c7fd0f1e0be47b",
      "body": "query GetProduct { product { id name } }",
      "name": "GetProduct",
      "type": "query"
    }
  ]
}