Generate GraphQL mutations/queries
npm install launchql-gen
import {
generate
} from 'launchql-gen';
import { print } from 'graphql/language';
const gen = generate(resultOfIntrospectionQuery);
const output = Object.keys(gen).reduce((m, key) => {
m[key] = print(gen[key].ast);
return m;
}, {});
console.log(output);
which will output the entire API as an object with the mutations and queries as values
{
"createApiTokenMutation": "mutation createApiTokenMutation($id: UUID, $userId: UUID!, $accessToken: String, $accessTokenExpiresAt: Datetime) {
createApiToken(input: {apiToken: {id: $id, userId: $userId, accessToken: $accessToken, accessTokenExpiresAt: $accessTokenExpiresAt}}) {
apiToken {
id
userId
accessToken
accessTokenExpiresAt
}
}
}