gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
24 lines (20 loc) • 687 B
text/typescript
import * as gatsby from "gatsby";
import * as RTE from "fp-ts/ReaderTaskEither";
import { pipe } from "fp-ts/function";
import { buildNamedInferredNodeType } from "../lib/buildNamedInferredNodeType";
import { Dependencies } from "../types";
/**
* Builds a GraphQL type used by Embed fields. The resulting type can be created
* using Gatsby's `createTypes` action.
*/
// TODO: Move typename to Dependencies (create in `buildDependencies.ts`).
export const buildEmbedType: RTE.ReaderTaskEither<
Dependencies,
never,
gatsby.GatsbyGraphQLType
> = pipe(
RTE.asks((deps: Dependencies) =>
deps.nodeHelpers.createTypeName("EmbedType"),
),
RTE.chain(buildNamedInferredNodeType),
);