How to use the graphql-transformer-common.makeOperationType function in graphql-transformer-common

To help you get started, we’ve selected a few graphql-transformer-common 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 / graphql-transformer-core / src / TransformFormatter.ts View on Github external
delete ctx.nodeMap.Query;
      includeQuery = false;
    }
    if (!subscriptionNode || subscriptionNode.fields.length === 0) {
      delete ctx.nodeMap.Subscription;
      includeSubscription = false;
    }
    const ops = [];
    if (includeQuery) {
      ops.push(makeOperationType('query', queryNode.name.value));
    }
    if (includeMutation) {
      ops.push(makeOperationType('mutation', mutationNode.name.value));
    }
    if (includeSubscription) {
      ops.push(makeOperationType('subscription', subscriptionNode.name.value));
    }
    const schema = makeSchema(ops);
    ctx.putSchema(schema);
    const astSansDirectives = stripDirectives(
      {
        kind: 'Document',
        definitions: Object.keys(ctx.nodeMap).map((k: string) => ctx.getType(k)),
      },
      ['aws_subscribe', 'aws_auth', 'aws_api_key', 'aws_iam', 'aws_oidc', 'aws_cognito_user_pools', 'deprecated']
    );
    const SDL = print(astSansDirectives);
    return SDL;
  }
github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / TransformFormatter.ts View on Github external
includeMutation = false;
    }
    if (!queryNode || queryNode.fields.length === 0) {
      delete ctx.nodeMap.Query;
      includeQuery = false;
    }
    if (!subscriptionNode || subscriptionNode.fields.length === 0) {
      delete ctx.nodeMap.Subscription;
      includeSubscription = false;
    }
    const ops = [];
    if (includeQuery) {
      ops.push(makeOperationType('query', queryNode.name.value));
    }
    if (includeMutation) {
      ops.push(makeOperationType('mutation', mutationNode.name.value));
    }
    if (includeSubscription) {
      ops.push(makeOperationType('subscription', subscriptionNode.name.value));
    }
    const schema = makeSchema(ops);
    ctx.putSchema(schema);
    const astSansDirectives = stripDirectives(
      {
        kind: 'Document',
        definitions: Object.keys(ctx.nodeMap).map((k: string) => ctx.getType(k)),
      },
      ['aws_subscribe', 'aws_auth', 'aws_api_key', 'aws_iam', 'aws_oidc', 'aws_cognito_user_pools', 'deprecated']
    );
    const SDL = print(astSansDirectives);
    return SDL;
  }
github aws-amplify / amplify-cli / packages / graphql-appsync-transformer / src / AppSyncTransformer.ts View on Github external
includeMutation = false
        }
        if (!queryNode || queryNode.fields.length === 0) {
            delete ctx.nodeMap.Query
            includeQuery = false
        }
        if (!subscriptionNode || subscriptionNode.fields.length === 0) {
            delete ctx.nodeMap.Subscription
            includeSubscription = false
        }
        const ops = []
        if (includeQuery) {
            ops.push(makeOperationType('query', queryNode.name.value))
        }
        if (includeMutation) {
            ops.push(makeOperationType('mutation', mutationNode.name.value))
        }
        if (includeSubscription) {
            ops.push(makeOperationType('subscription', subscriptionNode.name.value))
        }
        const schema = makeSchema(ops)
        ctx.putSchema(schema)
        const astSansDirectives = stripDirectives({
            kind: 'Document',
            definitions: Object.keys(ctx.nodeMap).map((k: string) => ctx.getType(k))
        }, ['aws_subscribe', 'aws_auth'])
        const SDL = print(astSansDirectives)
        return SDL;
    }
github aws-amplify / amplify-cli / packages / graphql-appsync-transformer / src / AppSyncTransformer.ts View on Github external
let includeSubscription = true
        if (!mutationNode || mutationNode.fields.length === 0) {
            delete ctx.nodeMap.Mutation
            includeMutation = false
        }
        if (!queryNode || queryNode.fields.length === 0) {
            delete ctx.nodeMap.Query
            includeQuery = false
        }
        if (!subscriptionNode || subscriptionNode.fields.length === 0) {
            delete ctx.nodeMap.Subscription
            includeSubscription = false
        }
        const ops = []
        if (includeQuery) {
            ops.push(makeOperationType('query', queryNode.name.value))
        }
        if (includeMutation) {
            ops.push(makeOperationType('mutation', mutationNode.name.value))
        }
        if (includeSubscription) {
            ops.push(makeOperationType('subscription', subscriptionNode.name.value))
        }
        const schema = makeSchema(ops)
        ctx.putSchema(schema)
        const astSansDirectives = stripDirectives({
            kind: 'Document',
            definitions: Object.keys(ctx.nodeMap).map((k: string) => ctx.getType(k))
        }, ['aws_subscribe', 'aws_auth'])
        const SDL = print(astSansDirectives)
        return SDL;
    }
github aws-amplify / amplify-cli / packages / graphql-transformer-core / src / TransformFormatter.ts View on Github external
let includeSubscription = true;
    if (!mutationNode || mutationNode.fields.length === 0) {
      delete ctx.nodeMap.Mutation;
      includeMutation = false;
    }
    if (!queryNode || queryNode.fields.length === 0) {
      delete ctx.nodeMap.Query;
      includeQuery = false;
    }
    if (!subscriptionNode || subscriptionNode.fields.length === 0) {
      delete ctx.nodeMap.Subscription;
      includeSubscription = false;
    }
    const ops = [];
    if (includeQuery) {
      ops.push(makeOperationType('query', queryNode.name.value));
    }
    if (includeMutation) {
      ops.push(makeOperationType('mutation', mutationNode.name.value));
    }
    if (includeSubscription) {
      ops.push(makeOperationType('subscription', subscriptionNode.name.value));
    }
    const schema = makeSchema(ops);
    ctx.putSchema(schema);
    const astSansDirectives = stripDirectives(
      {
        kind: 'Document',
        definitions: Object.keys(ctx.nodeMap).map((k: string) => ctx.getType(k)),
      },
      ['aws_subscribe', 'aws_auth', 'aws_api_key', 'aws_iam', 'aws_oidc', 'aws_cognito_user_pools', 'deprecated']
    );
github aws-amplify / amplify-cli / packages / graphql-appsync-transformer / src / AppSyncTransformer.ts View on Github external
delete ctx.nodeMap.Query
            includeQuery = false
        }
        if (!subscriptionNode || subscriptionNode.fields.length === 0) {
            delete ctx.nodeMap.Subscription
            includeSubscription = false
        }
        const ops = []
        if (includeQuery) {
            ops.push(makeOperationType('query', queryNode.name.value))
        }
        if (includeMutation) {
            ops.push(makeOperationType('mutation', mutationNode.name.value))
        }
        if (includeSubscription) {
            ops.push(makeOperationType('subscription', subscriptionNode.name.value))
        }
        const schema = makeSchema(ops)
        ctx.putSchema(schema)
        const astSansDirectives = stripDirectives({
            kind: 'Document',
            definitions: Object.keys(ctx.nodeMap).map((k: string) => ctx.getType(k))
        }, ['aws_subscribe', 'aws_auth'])
        const SDL = print(astSansDirectives)
        return SDL;
    }