How to use the amplify-codegen.prePushUpdateGraphQLCodegenHook function in amplify-codegen

To help you get started, we’ve selected a few amplify-codegen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / amplify-provider-awscloudformation / lib / graphql-codegen.js View on Github external
async function prePushGraphQLCodegen(context, createResources, updateResources) {
  createResources = createResources.filter(resource => resource.service === 'AppSync');
  // There can only be one appsync resource
  if (createResources.length > 0) {
    const resource = createResources[0];
    const { resourceName } = resource;
    graphQLConfig = await prePushAddGraphQLCodegenHook(context, resourceName);
    return;
  }
  if (updateResources.length > 0) {
    const resource = updateResources[0];
    const { resourceName } = resource;
    graphQLConfig = await prePushUpdateGraphQLCodegenHook(context, resourceName);
  }
}