How to use the @graphql-box/helpers.getInlineFragments function in @graphql-box/helpers

To help you get started, we’ve selected a few @graphql-box/helpers 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 badbatch / graphql-box / packages / cache-manager / src / main / index.ts View on Github external
private _filterInlineFragments(field: FieldNode): boolean {
    const inlineFragments = getInlineFragments(field);
    let filtered = false;

    inlineFragments.forEach(fragment => {
      const fieldsAndTypeNames = getChildFields(fragment);

      if (!fieldsAndTypeNames || !fieldsAndTypeNames.length) {
        deleteInlineFragments(field, fragment);
        filtered = true;
        return;
      }

      if (fieldsAndTypeNames.length === 1) {
        const { fieldNode } = fieldsAndTypeNames[0];

        if (getName(fieldNode) === this._typeIDKey) {
          deleteInlineFragments(field, fragment);