gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
18 lines (15 loc) • 637 B
text/typescript
import * as gatsby from "gatsby";
import * as gqlc from "graphql-compose";
import * as RTE from "fp-ts/ReaderTaskEither";
import { Dependencies } from "../types";
/**
* Builds a GraphQL union type using the environment's `buildUnionType` function.
*
* @param config - Configuration for the union type.
*
* @returns Return value of the environment's `buildUnionType` function.
*/
export const buildUnionType = <TSource, TContext>(
config: gqlc.UnionTypeComposerAsObjectDefinition<TSource, TContext>,
): RTE.ReaderTaskEither<Dependencies, never, gatsby.GatsbyGraphQLUnionType> =>
RTE.asks((deps) => deps.buildUnionType(config));