inngest / envelop-plugin-inngest

An envelop plugin that sends GraphQL response data to Inngest to help build event-driven applications.
MIT License
10 stars 3 forks source link

Feature Request: Ability to quickly add a function for a RedwoodJS GraphQL Operation #70

Closed dthyresson closed 1 year ago

dthyresson commented 1 year ago

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:

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;
}

and then

getQueryAndMutationTypes(exportedTypes)