gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
22 lines (19 loc) • 690 B
text/typescript
import * as RTE from "fp-ts/ReaderTaskEither";
import { pipe } from "fp-ts/function";
import { Dependencies, FieldConfigCreator } from "../types";
/**
* Builds a GraphQL field configuration object for a Link Custom Type field. The
* resulting configuration object can be used in a GraphQL type.
*
* This function registers a typepath for the field.
*
* @param path - Path to the field.
*
* @returns GraphQL field configuration object.
*/
// TODO: Move typename to Dependencies (create in `buildDependencies.ts`).
export const buildLinkFieldConfig: FieldConfigCreator = () =>
pipe(
RTE.ask<Dependencies>(),
RTE.map((deps) => deps.nodeHelpers.createTypeName("LinkType")),
);