While the setup function command makes it quick to add functions, sometimes you want a function handler for a RedwoodJS GraphQL operation.
Perhaps:
consume graphql schema and list query and mutation operations
prompt to pick
prompt for function type
generates function with the event name for that operation
Or, better:
somehow scan web side graphql operations made in web/types/graphql.d.ts
do same function setup as above
but now use the proper operation name for the query or mutation
Perhaps:
import type * as exportedTypes from './web/types/graphql.d.ts';
function getQueryAndMutationTypes(types: any[]): string[] {
const result: string[] = [];
for (const type of types) {
if (type.__typename === 'Query' || type.__typename === 'Mutation') {
result.push(type.name);
}
}
return result;
}
While the setup function command makes it quick to add functions, sometimes you want a function handler for a RedwoodJS GraphQL operation.
Perhaps:
Or, better:
web/types/graphql.d.ts
Perhaps:
and then