How to use the graphql-compose.isFunction function in graphql-compose

To help you get started, we’ve selected a few graphql-compose 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 graphql-compose / graphql-compose-mongoose / src / typeStorage.js View on Github external
getOrSet(typeName: string, typeOrThunk: T | (() => T)): T {
    if (this.has(typeName)) {
      return (this.get(typeName): any);
    }

    const gqType: any = isFunction(typeOrThunk) ? typeOrThunk() : typeOrThunk;
    if (gqType) {
      this.set(typeName, gqType);
    }

    return gqType;
  }
}
github graphql-compose / graphql-compose-connection / src / types / sortInputType.js View on Github external
`for composeWithConnection in opts.sort.${key}` +
        'Ideally this field(s) should be in unique index. ' +
        'Connection will work incorrectly, if some records have same values.'
    );
  }

  if (!opts.beforeCursorQuery || !isFunction(opts.beforeCursorQuery)) {
    throw new Error(
      'You should provide `beforeCursorQuery` function ' +
        `for composeWithConnection in opts.sort.${key}. ` +
        'Connections should have ability to filter ' +
        'backward records started from cursor.'
    );
  }

  if (!opts.afterCursorQuery || !isFunction(opts.afterCursorQuery)) {
    throw new Error(
      'You should provide `afterCursorQuery` function ' +
        `for composeWithConnection in opts.sort.${key}. ` +
        'Connections should have ability to filter ' +
        'forward records started from cursor.'
    );
  }
}
github graphql-compose / graphql-compose-connection / src / types / sortInputType.js View on Github external
'You should provide `value` ' +
        `for composeWithConnection in opts.sort.${key}. ` +
        'Connections does not work without sorting.'
    );
  }

  if (!opts.cursorFields || !Array.isArray(opts.cursorFields)) {
    throw new Error(
      'You should provide array of field(s) in `cursorFields` ' +
        `for composeWithConnection in opts.sort.${key}` +
        'Ideally this field(s) should be in unique index. ' +
        'Connection will work incorrectly, if some records have same values.'
    );
  }

  if (!opts.beforeCursorQuery || !isFunction(opts.beforeCursorQuery)) {
    throw new Error(
      'You should provide `beforeCursorQuery` function ' +
        `for composeWithConnection in opts.sort.${key}. ` +
        'Connections should have ability to filter ' +
        'backward records started from cursor.'
    );
  }

  if (!opts.afterCursorQuery || !isFunction(opts.afterCursorQuery)) {
    throw new Error(
      'You should provide `afterCursorQuery` function ' +
        `for composeWithConnection in opts.sort.${key}. ` +
        'Connections should have ability to filter ' +
        'forward records started from cursor.'
    );
  }
github graphql-compose / graphql-compose-elasticsearch / src / utils.js View on Github external
return schemaComposer.getOrSet(typeName, () => {
        const tc = schemaComposer.createObjectTC(
          isFunction(cfgOrThunk) ? (cfgOrThunk: any)() : cfgOrThunk
        );
        return tc;
      });
    },