This script generates a list of _entities
requests that are part of the query plan for a given operation, along with their required input variables.
APOLLO_KEY=xxx APOLLO_GRAPH_REF=MyGraph@variant npx github:@apollosolutions/entity-requests-from-queryplan \
--operations path/to/operations/
The output of this script will be a json file in the current directory in the following format:
entity-ops-${now}.json
- Download this repository
- Install dependencies
- Set environment variables
npm install
Copy the .env-example
file
cp .env-example .env
Set the following environment variables:
APOLLO_KEY
(required)APOLLO_GRAPH_REF
(used if not overridden)
Export environment variables so the script can use them:
source .env
--operations
The path to a local directory that contains the operations to process.--supergraph
(path to a local supergraph schema file) OR--graphref
(Graph Reference of published schemas to GraphOS.)
./bin/index.js \
--operations examples \
--supergraph examples/supergraph.graphql
APOLLO_GRAPH_REF="MyGraphId@variant" ./bin/index.js --operations examples
# OR
./bin/index.js --operations path/to/ops/ --graphref MyGraphId@variant
--out
To override the name of the script output file.
The code in this repository is experimental and has been provided for reference purposes only. Community feedback is welcome but this project may not be supported in the same way that repositories in the official Apollo GraphQL GitHub organization are. If you need help you can file an issue on this repository, contact Apollo to talk to an expert, or create a ticket directly in Apollo Studio.