UNPKG

gatsby-source-prismic

Version:

Gatsby source plugin for building websites using Prismic as a data source

30 lines (26 loc) 754 B
import * as gatsby from "gatsby"; import * as RTE from "fp-ts/ReaderTaskEither"; import { pipe } from "fp-ts/function"; import { buildObjectType } from "../lib/buildObjectType"; import { Dependencies } from "../types"; /** * Builds a GraphQL type used by GeoPoint fields. The resulting type can be * created using Gatsby's `createTypes` action. */ // TODO: Move typename to Dependencies (create in `buildDependencies.ts`). export const buildGeoPointType: RTE.ReaderTaskEither< Dependencies, never, gatsby.GatsbyGraphQLType > = pipe( RTE.ask<Dependencies>(), RTE.chain((deps) => buildObjectType({ name: deps.globalNodeHelpers.createTypeName("GeoPointType"), fields: { longitude: "Float!", latitude: "Float!", }, }), ), );