How to use the GraphQLUnionType function from graphql

Find comprehensive JavaScript graphql.GraphQLUnionType code examples handpicked from public code repositorys.

3
4
5
6
7
8
9
10
11

const InputObjectType = graphql.GraphQLInputObjectType;
const InterfaceType = graphql.GraphQLInterfaceType;
const ScalarType = graphql.GraphQLScalarType;
const ObjectType = graphql.GraphQLObjectType;
const UnionType = graphql.GraphQLUnionType;
const NonNullType = graphql.GraphQLNonNull;
const EnumType = graphql.GraphQLEnumType;
const ListType = graphql.GraphQLList;
fork icon13
star icon203
watch icon10

+ 3 other calls in file

370
371
372
373
374
375
376
377
378
379
}
else if (((_d = relation.meta) === null || _d === void 0 ? void 0 : _d.one_allowed_collections) && action === 'read') {
    // NOTE: There are no union input types in GraphQL, so this only applies to Read actions
    (_e = CollectionTypes[relation.collection]) === null || _e === void 0 ? void 0 : _e.addFields({
        [relation.field]: {
            type: new graphql_1.GraphQLUnionType({
                name: `${relation.collection}_${relation.field}_union`,
                types: relation.meta.one_allowed_collections.map((collection) => CollectionTypes[collection].getType()),
                resolveType(value, context, info) {
                    let path = [];
fork icon0
star icon0
watch icon1

+ 42 other calls in file

3
4
5
6
7
8
9
10
11
12
global.__base = path.normalize(__dirname + '/..');
global.GraphqlSchema = global.GraphQLSchema = graphql.GraphQLSchema;
global.GraphqlObjectType = global.GraphQLObjectType = graphql.GraphQLObjectType;
global.GraphqlList = global.GraphQLList = graphql.GraphQLList;
global.GraphqlNonNull = global.GraphQLNonNull = graphql.GraphQLNonNull;
global.GraphqlUnionType = global.GraphQLUnionType = graphql.GraphQLUnionType;
global.GraphqlInterfaceType = global.GraphQLInterfaceType = graphql.GraphQLInterfaceType;
global.GraphqlEnumType = global.GraphQLEnumType = graphql.GraphQLEnumType;
global.GraphqlInt = global.GraphQLInt = graphql.GraphQLInt;
global.GraphqlFloat = global.GraphQLFloat = graphql.GraphQLFloat;
fork icon0
star icon0
watch icon5