gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
1 lines • 284 kB
Source Map (JSON)
{"version":3,"file":"gatsby-node.cjs","sources":["../src/lib/getTypeName.ts","../src/lib/buildUnionType.ts","../src/lib/createType.ts","../src/lib/createAllDocumentTypesType.ts","../src/constants.ts","../src/lib/buildObjectType.ts","../src/lib/mapRecordIndices.ts","../src/builders/buildBooleanFieldConfig.ts","../src/builders/buildColorFieldConfig.ts","../src/builders/buildDateFieldConfig.ts","../src/builders/buildEmbedFieldConfig.ts","../src/builders/buildGeoPointFieldConfig.ts","../src/lib/listTypeName.ts","../src/lib/buildSchemaRecordType.ts","../src/builders/buildGroupFieldConfig.ts","../src/lib/sanitizeImageURL.ts","../src/lib/stripURLParameters.ts","../src/builders/buildImageBaseFieldConfigMap.ts","../src/builders/buildImageFieldConfig.ts","../src/builders/buildLinkFieldConfig.ts","../src/builders/buildNumberFieldConfig.ts","../src/builders/buildSelectFieldConfig.ts","../src/builders/buildStructuredTextFieldConfig.ts","../src/lib/createTypes.ts","../src/lib/requiredTypeName.ts","../src/builders/buildSlicesFieldConfig.ts","../src/builders/buildTextFieldConfig.ts","../src/builders/buildTimestampFieldConfig.ts","../src/builders/buildUIDFieldConfig.ts","../src/lib/dotPath.ts","../src/lib/sprintf.ts","../src/lib/reportInfo.ts","../src/builders/buildUnknownFieldConfig.ts","../src/lib/buildNamedInferredNodeType.ts","../src/lib/buildInferredNodeType.ts","../src/builders/buildIntegrationFieldConfig.ts","../src/lib/toFieldConfig.ts","../src/lib/buildFieldConfigMap.ts","../src/lib/createCustomType.ts","../src/builders/buildSharedSliceVariationTypes.ts","../src/lib/createSharedSlice.ts","../src/lib/createNodeOfType.ts","../src/lib/createTypePath.ts","../src/lib/preparePluginOptions.ts","../src/lib/throwError.ts","../src/builders/buildAlternateLanguageType.ts","../src/builders/buildEmbedType.ts","../src/builders/buildGeoPointType.ts","../src/builders/buildImageDimensionsType.ts","../src/builders/buildImageThumbnailType.ts","../src/builders/buildImgixImageTypes.ts","../src/builders/buildLinkType.ts","../src/lib/buildEnumType.ts","../src/builders/buildLinkTypeEnumType.ts","../src/lib/buildInterfaceType.ts","../src/builders/buildSharedSliceInterface.ts","../src/builders/buildSliceInterface.ts","../src/lib/buildScalarType.ts","../src/builders/buildStructuredTextType.ts","../src/builders/buildTypePathType.ts","../src/types.ts","../src/runtime/createGetProxy.ts","../src/runtime/normalizers/alternateLanguages.ts","../src/runtime/normalizers/document.ts","../src/runtime/normalizers/documentData.ts","../src/runtime/normalizers/group.ts","../src/runtime/normalizers/image.ts","../src/runtime/normalizers/link.ts","../src/runtime/normalizers/structuredText.ts","../src/runtime/normalizers/slice.ts","../src/runtime/normalizers/slices.ts","../src/runtime/normalize.ts","../src/runtime/typePaths.ts","../src/runtime/serializePath.ts","../src/runtime/serializeTypePaths.ts","../src/runtime/runtime.ts","../src/buildDependencies.ts","../src/create-schema-customization.ts","../src/plugin-options-schema.ts","../src/lib/createGloballyUniqueNodeOfType.ts","../src/lib/createGloballyUniqueNode.ts","../src/lib/createGloballyUniqueNodes.ts","../src/lib/getTypePath.ts","../src/lib/shouldDownloadFile.ts","../src/lib/getFromCache.ts","../src/lib/setToCache.ts","../src/lib/getFromOrSetToCache.ts","../src/lib/touchNode.ts","../src/lib/reportVerbose.ts","../src/lib/createRemoteFileNode.ts","../src/lib/removeAutoURLParameter.ts","../src/lib/normalizeDocumentSubtree.ts","../src/lib/normalizeDocument.ts","../src/lib/normalizeDocuments.ts","../src/lib/queryAllDocuments.ts","../src/lib/sourceNodesForAllDocuments.ts","../src/lib/isPrismicURL.ts","../src/lib/isPrismicWebhookBody.ts","../src/lib/isPrismicWebhookBodyApiUpdate.ts","../src/lib/isPrismicWebhookBodyForRepository.ts","../src/lib/isPrismicWebhookBodyTestTrigger.ts","../src/lib/isValidWebhookSecret.ts","../src/lib/reportWarning.ts","../src/lib/getNode.ts","../src/lib/getNodes.ts","../src/lib/deleteNode.ts","../src/lib/deleteNodes.ts","../src/lib/deleteNodesForDocumentIds.ts","../src/lib/queryDocumentsByIds.ts","../src/lib/sourceNodesForDocumentIds.ts","../src/lib/getAllNodes.ts","../src/lib/touchNodes.ts","../src/lib/touchAllNodes.ts","../src/on-webhook-api-update.ts","../src/on-webhook-test-trigger.ts","../src/on-webhook.ts","../src/source-nodes.ts"],"sourcesContent":["import * as gatsby from \"gatsby\";\n\n/**\n * Returns the name of a GraphQL object type created by `graphql-compose`.\n *\n * @param type - GraphQL object type created by `graphql-compose`.\n *\n * @returns Name of the type.\n */\nexport const getTypeName = (type: gatsby.GatsbyGraphQLType): string =>\n\ttype.config.name;\n","import * as gatsby from \"gatsby\";\nimport * as gqlc from \"graphql-compose\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { Dependencies } from \"../types\";\n\n/**\n * Builds a GraphQL union type using the environment's `buildUnionType` function.\n *\n * @param config - Configuration for the union type.\n *\n * @returns Return value of the environment's `buildUnionType` function.\n */\nexport const buildUnionType = <TSource, TContext>(\n\tconfig: gqlc.UnionTypeComposerAsObjectDefinition<TSource, TContext>,\n): RTE.ReaderTaskEither<Dependencies, never, gatsby.GatsbyGraphQLUnionType> =>\n\tRTE.asks((deps) => deps.buildUnionType(config));\n","import * as gatsby from \"gatsby\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { Dependencies } from \"../types\";\n\n/**\n * Registers a type using the environment's `createTypes` function.\n *\n * @param type - GraphQL type to create.\n */\nexport const createType = <A extends gatsby.GatsbyGraphQLType>(\n\ttype: A,\n): RTE.ReaderTaskEither<Dependencies, never, void> =>\n\tRTE.asks((deps) => deps.createTypes(type));\n","import * as gatsby from \"gatsby\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport * as A from \"fp-ts/Array\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies } from \"../types\";\nimport { getTypeName } from \"./getTypeName\";\nimport { buildUnionType } from \"./buildUnionType\";\nimport { createType } from \"./createType\";\n\n/**\n * Registers the `AllDocumentTypes` GraphQL union type containing all provided\n * document types.\n *\n * @param types - List of document types to include in the created union type.\n *\n * @returns The registered `AllDocumentTypes` type.\n */\nexport const createAllDocumentTypesType = (\n\ttypes: gatsby.GatsbyGraphQLObjectType[],\n): RTE.ReaderTaskEither<Dependencies, never, gatsby.GatsbyGraphQLUnionType> =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.chain((deps) =>\n\t\t\tpipe(\n\t\t\t\ttypes,\n\t\t\t\tA.map(getTypeName),\n\t\t\t\t(types) =>\n\t\t\t\t\tbuildUnionType({\n\t\t\t\t\t\tname: deps.nodeHelpers.createTypeName(\"AllDocumentTypes\"),\n\t\t\t\t\t\ttypes,\n\t\t\t\t\t}),\n\t\t\t\tRTE.chainFirst(createType),\n\t\t\t),\n\t\t),\n\t);\n","/**\n * Name of the plugin used to identify Nodes owned by this plugin.\n *\n * Note: This should always be in sync with package.json's `name` field.\n */\nexport const PLUGIN_NAME = \"gatsby-source-prismic\";\n\n/**\n * Global prefix used for all GraphQL types and, where necessary, fields.\n */\nexport const GLOBAL_TYPE_PREFIX = \"Prismic\";\n\n/**\n * Default endpoint used to fetch custom type JSON schemas from Prismic's Custom Type API.\n *\n * @see https://prismic.io/docs/technologies/custom-types-api\n */\nexport const DEFAULT_CUSTOM_TYPES_API_ENDPOINT =\n\t\"https://customtypes.prismic.io/customtypes\";\n\n/**\n * Prismic API document fields returned for image fields that are **not** thumbnails.\n *\n * These fields are filtered out from the API response to extract the field's\n * thumbnails. The API includes thumbnails adjacent to these fields.\n */\nexport const PRISMIC_API_IMAGE_FIELDS = [\n\t\"alt\",\n\t\"copyright\",\n\t\"dimensions\",\n\t\"url\",\n];\n\n/**\n * Default Imgix URL parameters for `gatsby-plugin-image` fields.\n *\n * These defaults provide a good balance between image quality and filesize.\n *\n * @see https://docs.imgix.com/apis/rendering\n */\nexport const DEFAULT_IMGIX_PARAMS = {\n\tauto: \"compress,format\",\n\n\t// The following values are not included by Prismic's URLs by default.\n\tfit: \"max\",\n} as const;\n\n/**\n * Default Imgix URL parameters for `gatsby-plugin-image` placeholder images.\n *\n * These defaults provide a good balance between image quality and filesize.\n * They are merged with the `imageImgixParams` plugin option.\n *\n * @see https://docs.imgix.com/apis/rendering\n */\nexport const DEFAULT_PLACEHOLDER_IMGIX_PARAMS = {\n\tw: 100,\n\n\t// Makes the image appear less pixelated when stretched to large sizes.\n\t//\n\t// TODO: This value can be removed if `gatsby-plugin-image` implements\n\t// CSS-based blurring.\n\tblur: 15,\n} as const;\n\n/**\n * Default Prismic language option used when fetching documents. The current\n * default fetches all languages.\n *\n * @see https://prismic.io/docs/technologies/query-by-language-rest-api\n */\nexport const DEFAULT_LANG = \"*\";\n\n/**\n * Format used for all plugin reporting. Includes the plugin's name and the\n * instance's repository name (helpful when multiple repositories are configured).\n */\nexport const REPORTER_TEMPLATE = `gatsby-source-prismic(%s) - %s`;\n\n/**\n * Root node field used to compare static data with preview data. If values are\n * equal, the preview node can be treated as an updated version of the static node.\n *\n * This is an internal-use-only field used by `gatsby-plugin-prismic-previews`.\n */\nexport const PREVIEWABLE_NODE_ID_FIELD = \"_previewable\";\n\n/**\n * Message displayed to the user when a webhook's secret does not match the\n * secret configured in the site's `gatsby-config.js`.\n */\nexport const WEBHOOK_SECRET_MISMATCH_MSG =\n\t\"A webhook was received, but the webhook secret did not match the webhook secret provided in the plugin options. If this is unexpected, verify that the `webhookSecret` plugin option matches the webhook secret in your Prismic repository.\";\n\n/**\n * Message displayed to the user when a `test-trigger` webhook is received.\n */\nexport const WEBHOOK_TEST_TRIGGER_SUCCESS_MSG =\n\t\"Success! Received a test trigger webhook. When changes to your content are saved, Gatsby will automatically fetch the changes.\";\n\n/**\n * Message displayed to the user when a missing custom type schema is detected.\n */\nexport const MISSING_SCHEMAS_MSG =\n\t\"JSON schemas for all custom types are required\";\n\n/**\n * Format used to inform the user of a missing schema.\n */\nexport const MISSING_SCHEMA_MSG =\n\t'JSON model for \"%s\" is missing. If the Custom Type is no longer in use, you may provide \"{}\" as the JSON model.';\n\nexport const FORBIDDEN_ACCESS_WITHOUT_ACCESS_TOKEN =\n\t\"Unable to access the Prismic repository. Check the repository name. If the repository is secured, provide an access token.\";\n\nexport const FORBIDDEN_ACCESS_WITH_ACCESS_TOKEN =\n\t\"Unable to access the Prismic repository. Check that the correct repository name and access token are provided.\";\n\nexport const FORBIDDEN_CUSTOM_TYPES_API_ACCESS =\n\t\"Unable to access the Prismic Custom Types API. Check the customTypesApiToken option.\";\n\nexport const NON_EXISTENT_RELEASE_WITH_ACCESS_TOKEN_MSG =\n\t'The given Release ID (\"%s\") could not be found. If the Release ID is correct, check that your access token has permission to view Releases.';\n\nexport const NON_EXISTENT_RELEASE_WITHOUT_ACCESS_TOKEN_MSG =\n\t'The given Release ID (\"%s\") could not be found. If the Release ID is correct, you may need to provide an access token with permission to view Releases.';\n","import * as gatsby from \"gatsby\";\nimport * as gqlc from \"graphql-compose\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { Dependencies } from \"../types\";\n\n/**\n * Builds a GraphQL object type using the environment's `buildObjectType` function.\n *\n * @param config - Configuration for the object type.\n *\n * @returns Return value of the environment's `buildObjectType` function.\n */\nexport const buildObjectType = <TSource, TContext>(\n\tconfig: gqlc.ObjectTypeComposerAsObjectDefinition<TSource, TContext>,\n): RTE.ReaderTaskEither<Dependencies, never, gatsby.GatsbyGraphQLObjectType> =>\n\tRTE.asks((deps) => deps.buildObjectType(config));\n","import * as R from \"fp-ts/Record\";\nimport * as A from \"fp-ts/Array\";\nimport * as S from \"fp-ts/Semigroup\";\nimport { flow } from \"fp-ts/function\";\n\n/**\n * Maps indices of a record with a given function.\n *\n * @param f - Function mapping an index to a new index.\n *\n * @returns A function that accepts a record to be updated.\n */\nexport const mapRecordIndices = <K extends string, A>(\n\tf: (k: K) => string,\n): ((r: Record<K, A>) => Record<string, A>) =>\n\tflow(\n\t\tR.collect((index: K, value) => [f(index), value] as [string, A]),\n\t\tR.fromFoldable(S.last<A>(), A.Foldable),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Boolean Custom Type field.\n * The resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildBooleanFieldConfig: FieldConfigCreator = () =>\n\tRTE.right(\"Boolean\");\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Color Custom Type field.\n * The resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildColorFieldConfig: FieldConfigCreator = () =>\n\tRTE.right(\"String\");\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Date Custom Type field. It\n * includes Gatsby's `@dateformat` extension. The resulting configuration object\n * can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildDateFieldConfig: FieldConfigCreator = () =>\n\tRTE.right({\n\t\ttype: \"Date\",\n\t\textensions: { dateformat: {} },\n\t});\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for an Embed Custom Type field.\n * It uses a shared type and the `@link` extension to connect data to the field.\n * Data for each Embed field is created as a separate node to allow Gatsby to\n * infer the fields and types. The resulting configuration object can be used in\n * a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\n// TODO: Move typename to Dependencies (create in `buildDependencies.ts`).\nexport const buildEmbedFieldConfig: FieldConfigCreator = () =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.map((deps) => ({\n\t\t\ttype: deps.nodeHelpers.createTypeName(\"EmbedType\"),\n\t\t\textensions: { link: {} },\n\t\t})),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a GeoPoint Custom Type field.\n * The resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\n// TODO: Move typename to Dependencies (create in `buildDependencies.ts`).\nexport const buildGeoPointFieldConfig: FieldConfigCreator = () =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.map((deps) => deps.globalNodeHelpers.createTypeName(\"GeoPointType\")),\n\t);\n","/**\n * Converts a given GraphQL type name to a list type.\n *\n * @example\n *\n * ```ts\n * listTypeName(\"MyType\"); // => \"[MyType]\"\n * ```\n *\n * @param typeName - Type name to convert.\n *\n * @returns Type name wrapped as a list type.\n */\nexport const listTypeName = (typeName: string): string => `[${typeName}]`;\n","import * as gatsby from \"gatsby\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies } from \"../types\";\nimport { buildObjectType } from \"./buildObjectType\";\nimport { buildFieldConfigMap } from \"./buildFieldConfigMap\";\n\n/**\n * Builds a GraphQL type from a record mapping a Prismic field API ID to its\n * schema definition.\n *\n * @param path - Path to the schema record.\n * @param record - Record mapping a Prismic field API ID to its schema definition.\n * @param typeName - Type name of the resulting GraphQL type.\n *\n * @returns GraphQL type containing fields for each record property.\n */\nexport const buildSchemaRecordType = (\n\tpath: string[],\n\trecord: Record<string, prismicT.CustomTypeModelField>,\n\ttypeName: string | string[] = path,\n): RTE.ReaderTaskEither<Dependencies, Error, gatsby.GatsbyGraphQLObjectType> =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.bind(\"fields\", () => buildFieldConfigMap(path, record)),\n\t\tRTE.chainW((scope) =>\n\t\t\tbuildObjectType({\n\t\t\t\tname: scope.nodeHelpers.createTypeName(typeName),\n\t\t\t\tfields: scope.fields,\n\t\t\t}),\n\t\t),\n\t);\n","import * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { createType } from \"../lib/createType\";\nimport { getTypeName } from \"../lib/getTypeName\";\nimport { listTypeName } from \"../lib/listTypeName\";\nimport { buildSchemaRecordType } from \"../lib/buildSchemaRecordType\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Group Custom Type field. It\n * creates a GraphQL List type using the Group field's individual fields. Each\n * field is converted to their own GraphQL configuration object.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n * @param schema - Schema definition for the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildGroupFieldConfig: FieldConfigCreator<\n\tprismicT.CustomTypeModelGroupField\n> = (path, schema) =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.chain(() => buildSchemaRecordType(path, schema.config.fields)),\n\t\tRTE.chainFirstW(createType),\n\t\tRTE.map(getTypeName),\n\t\tRTE.map(listTypeName),\n\t);\n","/**\n * Sanitizes an image URL. The following steps are taken:\n *\n * - Replace `+` in filename with a space\n * - Decode the URL\n *\n * @param url - Image URL to sanitize.\n *\n * @returns Sanitized image URL.\n */\n// TODO: Remove once the Prismic API properly handles spaces in filenames\nexport const sanitizeImageURL = (url: string): string =>\n\tdecodeURIComponent(url.replace(/\\+/g, \" \"));\n","import * as O from \"fp-ts/Option\";\nimport { pipe } from \"fp-ts/function\";\n\n/**\n * Removes query parameters from a URL. If the URL is invalid, the input is\n * returned as is.\n *\n * @param url - URL from which to remove query parameters.\n *\n * @returns `url` without query parameters.\n */\nexport const stripURLQueryParameters = (url: string): string =>\n\tpipe(\n\t\tO.tryCatch(() => new URL(url)),\n\t\tO.map((instance) => `${instance.origin}${instance.pathname}`),\n\t\tO.getOrElse(() => url),\n\t);\n","import * as gqlc from \"graphql-compose\";\nimport * as imgixGatsby from \"@imgix/gatsby/dist/pluginHelpers\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport * as O from \"fp-ts/Option\";\nimport * as S from \"fp-ts/Semigroup\";\nimport * as A from \"fp-ts/Array\";\nimport * as R from \"fp-ts/Record\";\nimport { constNull, pipe } from \"fp-ts/function\";\n\nimport { sanitizeImageURL } from \"../lib/sanitizeImageURL\";\nimport { stripURLQueryParameters } from \"../lib/stripURLParameters\";\n\nimport { Dependencies } from \"../types\";\n\n/**\n * Returns the URL of an image from the value of an Image field.\n *\n * @param source - Image field data.\n *\n * @returns The URL of the image if an image is provided, `null` otherwise.\n */\nconst resolveUrl = (source: prismicT.ImageField): string | null =>\n\tsource.url\n\t\t? sanitizeImageURL(stripURLQueryParameters(source.url))\n\t\t: source.url ?? null;\n\n/**\n * Returns the width of an image from the value of an Image field.\n *\n * @param source - Image field data.\n *\n * @returns The width of the image if an image is provided, `undefined` otherwise.\n */\nconst resolveWidth = (source: prismicT.ImageField): number | undefined =>\n\tsource.dimensions?.width;\n\n/**\n * Returns the height of an image from the value of an Image field.\n *\n * @param source - Image field data.\n *\n * @returns The height of the image if an image is provided, `undefined` otherwise.\n */\nconst resolveHeight = (source: prismicT.ImageField): number | undefined =>\n\tsource.dimensions?.height;\n\n/**\n * The minimum required GraphQL argument properties for an `@imgix/gatsby` field.\n */\ninterface ImgixGatsbyFieldArgsLike {\n\timgixParams: Record<string, string | number | boolean>;\n}\n\n/**\n * Modifies an `@imgix/gatsby` GraphQL field config to retain existing Imgix\n * parameters set on the source URL.\n *\n * This is needed if the source URL contains parameters like `rect` (crops an\n * image). Without this config enhancer, the `rect` parameter would be removed.\n *\n * @param fieldConfig - GraphQL field config object to be enhanced.\n *\n * @returns `fieldConfig` with the ability to retain existing Imgix parameters\n * on the source URL.\n */\nconst withExistingURLImgixParameters = <\n\tTContext,\n\tTArgs extends ImgixGatsbyFieldArgsLike,\n>(\n\tfieldConfig: gqlc.ObjectTypeComposerFieldConfigAsObjectDefinition<\n\t\tprismicT.ImageField,\n\t\tTContext,\n\t\tTArgs\n\t>,\n): typeof fieldConfig => ({\n\t...fieldConfig,\n\tresolve: (source, args, ...rest) =>\n\t\tpipe(\n\t\t\tO.Do,\n\t\t\tO.bind(\"url\", () =>\n\t\t\t\tO.fromNullable(source.url ? new URL(source.url) : null),\n\t\t\t),\n\t\t\tO.bind(\"existingImgixParams\", (scope) =>\n\t\t\t\tpipe(\n\t\t\t\t\t[...scope.url.searchParams.entries()],\n\t\t\t\t\tR.fromFoldable(S.last<string>(), A.Foldable),\n\t\t\t\t\tO.of,\n\t\t\t\t),\n\t\t\t),\n\t\t\tO.map((scope) =>\n\t\t\t\tfieldConfig.resolve?.(\n\t\t\t\t\tsource,\n\t\t\t\t\t{\n\t\t\t\t\t\t...args,\n\t\t\t\t\t\timgixParams: {\n\t\t\t\t\t\t\t...scope.existingImgixParams,\n\t\t\t\t\t\t\t...args.imgixParams,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t...rest,\n\t\t\t\t),\n\t\t\t),\n\t\t\tO.getOrElseW(constNull),\n\t\t),\n});\n\n/**\n * Builds a GraphQL field configuration object to be used as part of another\n * Image field GraphQL configuration object. For example, this base\n * configuration object could be added to a config for the thumbnails of an Image field.\n */\nexport const buildImageBaseFieldConfigMap: RTE.ReaderTaskEither<\n\tDependencies,\n\tnever,\n\tgqlc.ObjectTypeComposerFieldConfigMapDefinition<prismicT.ImageField, unknown>\n> = pipe(\n\tRTE.ask<Dependencies>(),\n\tRTE.bind(\"imgixTypes\", (scope) =>\n\t\tRTE.right(\n\t\t\timgixGatsby.createImgixGatsbyTypes({\n\t\t\t\t// IMPORTANT: These options need to be kept in sync with the options at\n\t\t\t\t// packages/gatsby-source-prismic/src/builders/buildImgixImageTypes.ts\n\t\t\t\tcache: scope.cache,\n\t\t\t\tresolveUrl,\n\t\t\t\tresolveWidth,\n\t\t\t\tresolveHeight,\n\t\t\t\tdefaultParams: scope.pluginOptions.imageImgixParams,\n\t\t\t\tnamespace: \"Imgix\",\n\t\t\t}),\n\t\t),\n\t),\n\tRTE.bind(\"urlField\", (scope) =>\n\t\tRTE.right(withExistingURLImgixParameters(scope.imgixTypes.fields.url)),\n\t),\n\tRTE.bind(\"fixedField\", (scope) =>\n\t\tRTE.right(withExistingURLImgixParameters(scope.imgixTypes.fields.fixed)),\n\t),\n\tRTE.bind(\"fluidField\", (scope) =>\n\t\tRTE.right(withExistingURLImgixParameters(scope.imgixTypes.fields.fluid)),\n\t),\n\tRTE.bind(\"gatsbyImageDataField\", (scope) =>\n\t\tpipe(\n\t\t\tRTE.right(\n\t\t\t\twithExistingURLImgixParameters(scope.imgixTypes.fields.gatsbyImageData),\n\t\t\t),\n\t\t\t// This field is 'JSON!' by default (i.e. non-nullable). If an image is\n\t\t\t// not set in Prismic, however, this field throws a GraphQL error saying a\n\t\t\t// non-nullable field was returned a null value. This should not happen\n\t\t\t// since the field is nested in a nullable object type, but it happens\n\t\t\t// anyway.\n\t\t\t//\n\t\t\t// We're making the field nullable manually here.\n\t\t\tRTE.chainFirst((field) => RTE.fromIO(() => (field.type = \"JSON\"))),\n\t\t),\n\t),\n\tRTE.map((scope) => ({\n\t\talt: \"String\",\n\t\tcopyright: \"String\",\n\t\tdimensions: scope.globalNodeHelpers.createTypeName(\"ImageDimensionsType\"),\n\t\turl: scope.urlField,\n\t\tfixed: scope.fixedField,\n\t\tfluid: scope.fluidField,\n\t\tgatsbyImageData: scope.gatsbyImageDataField,\n\t\tlocalFile: {\n\t\t\ttype: \"File\",\n\t\t\textensions: { link: {} },\n\t\t},\n\t})),\n);\n","import * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport * as R from \"fp-ts/Record\";\nimport * as ReadonlyA from \"fp-ts/ReadonlyArray\";\nimport * as S from \"fp-ts/Semigroup\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { buildObjectType } from \"../lib/buildObjectType\";\nimport { getTypeName } from \"../lib/getTypeName\";\nimport { createType } from \"../lib/createType\";\n\nimport { buildImageBaseFieldConfigMap } from \"./buildImageBaseFieldConfigMap\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Creates a GraphQL type containing fields for thumbnails of an Image field.\n *\n * @param path - Path to the field.\n * @param schema - Schema definition for the field.\n *\n * @returns GraphQL type name for the created type.\n */\n// TODO: Move `fields` typename to Dependencies (create in `buildDependencies.ts`).\nconst createThumbnailsType = (\n\tpath: string[],\n\t// schema: PrismicSchemaImageField,\n\tschema: prismicT.CustomTypeModelImageField,\n): RTE.ReaderTaskEither<Dependencies, never, string> =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.bind(\"thumbnails\", () => RTE.right(schema.config?.thumbnails ?? [])),\n\t\tRTE.bind(\"fields\", (scope) =>\n\t\t\tpipe(\n\t\t\t\tR.fromFoldableMap(\n\t\t\t\t\tS.last<prismicT.CustomTypeModelImageThumbnail>(),\n\t\t\t\t\tReadonlyA.Foldable,\n\t\t\t\t)(scope.thumbnails, (thumbnail) => [thumbnail.name, thumbnail]),\n\t\t\t\tR.map(() => scope.nodeHelpers.createTypeName(\"ImageThumbnailType\")),\n\t\t\t\t(fields) => RTE.right(fields),\n\t\t\t),\n\t\t),\n\t\tRTE.chain((scope) =>\n\t\t\tbuildObjectType({\n\t\t\t\tname: scope.nodeHelpers.createTypeName([\n\t\t\t\t\t...path,\n\t\t\t\t\t\"ImageThumbnailsType\",\n\t\t\t\t]),\n\t\t\t\tfields: scope.fields,\n\t\t\t}),\n\t\t),\n\t\tRTE.chainFirst(createType),\n\t\tRTE.map(getTypeName),\n\t);\n\n/**\n * Builds a GraphQL field configuration object for an Image Custom Type field.\n * If the field is configured to have thumbnails, a field-specific type is\n * created for them.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n * @param schema - Schema definition for the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildImageFieldConfig: FieldConfigCreator<\n\tprismicT.CustomTypeModelImageField\n> = (path, schema) =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.bind(\"thumbnailsTypeName\", () =>\n\t\t\tReadonlyA.isEmpty(schema.config?.thumbnails ?? [])\n\t\t\t\t? RTE.right(undefined)\n\t\t\t\t: createThumbnailsType(path, schema),\n\t\t),\n\t\tRTE.bind(\"baseFields\", () => buildImageBaseFieldConfigMap),\n\t\tRTE.chain((scope) =>\n\t\t\tbuildObjectType({\n\t\t\t\tname: scope.nodeHelpers.createTypeName([...path, \"ImageType\"]),\n\t\t\t\tfields: scope.thumbnailsTypeName\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...scope.baseFields,\n\t\t\t\t\t\t\tthumbnails: {\n\t\t\t\t\t\t\t\ttype: scope.thumbnailsTypeName,\n\t\t\t\t\t\t\t\tresolve: (source: prismicT.ImageField) => source,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: scope.baseFields,\n\t\t\t}),\n\t\t),\n\t\tRTE.chainFirst(createType),\n\t\tRTE.map(getTypeName),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Link Custom Type field. The\n * resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\n// TODO: Move typename to Dependencies (create in `buildDependencies.ts`).\nexport const buildLinkFieldConfig: FieldConfigCreator = () =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.map((deps) => deps.nodeHelpers.createTypeName(\"LinkType\")),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Number Custom Type field.\n * The resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildNumberFieldConfig: FieldConfigCreator = () =>\n\tRTE.right(\"Float\");\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Select Custom Type field.\n * The resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildSelectFieldConfig: FieldConfigCreator = () =>\n\tRTE.right(\"String\");\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a StructuredText Custom Type\n * field. This is used for Rich Text and Title fields. The resulting\n * configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildStructuredTextFieldConfig: FieldConfigCreator = () =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.map((deps) => deps.nodeHelpers.createTypeName(\"StructuredTextType\")),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport * as A from \"fp-ts/Array\";\nimport { flow } from \"fp-ts/function\";\n\nimport { createType } from \"./createType\";\n\n/**\n * Registers one or more types.\n *\n * @see gatsby-source-prismic/lib/registerType.ts\n */\nexport const createTypes = flow(A.map(createType), RTE.sequenceArray);\n","/**\n * Converts a given GraphQL type name to a required type.\n *\n * @example\n *\n * ```ts\n * requiredTypeName(\"MyType\"); // => \"MyType!\"\n * ```\n *\n * @param typeName - Type name to convert.\n *\n * @returns Type name as a required type.\n */\nexport const requiredTypeName = (typeName: string): string => typeName + \"!\";\n","import * as gatsby from \"gatsby\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport * as R from \"fp-ts/Record\";\nimport * as A from \"fp-ts/Array\";\nimport * as ReadonlyA from \"fp-ts/ReadonlyArray\";\nimport * as E from \"fp-ts/Either\";\nimport * as O from \"fp-ts/Option\";\nimport { pipe, flow, identity } from \"fp-ts/function\";\n\nimport { buildObjectType } from \"../lib/buildObjectType\";\nimport { buildSchemaRecordType } from \"../lib/buildSchemaRecordType\";\nimport { buildUnionType } from \"../lib/buildUnionType\";\nimport { getTypeName } from \"../lib/getTypeName\";\nimport { listTypeName } from \"../lib/listTypeName\";\nimport { createType } from \"../lib/createType\";\nimport { createTypes } from \"../lib/createTypes\";\nimport { requiredTypeName } from \"../lib/requiredTypeName\";\n\nimport { Dependencies, FieldConfigCreator, UnknownRecord } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Slice zone's Slice. Both\n * `non-repeat` and `repeat` schemas will be converted to GraphQL field\n * configuration objects. The resulting type can be created using Gatsby's\n * `createTypes` action.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the Slice zone.\n * @param model - Schema definition for the Slice.\n *\n * @returns GraphQL object type.\n */\nconst buildSliceType = (\n\tpath: string[],\n\tmodel: prismicT.CustomTypeModelSlice,\n): RTE.ReaderTaskEither<Dependencies, Error, gatsby.GatsbyGraphQLObjectType> =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.chain((deps) =>\n\t\t\tpipe(\n\t\t\t\t{} as Record<\n\t\t\t\t\t\"primary\" | \"items\",\n\t\t\t\t\tRTE.ReaderTaskEither<\n\t\t\t\t\t\tDependencies,\n\t\t\t\t\t\tnever,\n\t\t\t\t\t\tgatsby.GatsbyGraphQLObjectType\n\t\t\t\t\t>\n\t\t\t\t>,\n\t\t\t\tR.isEmpty(model[\"non-repeat\"])\n\t\t\t\t\t? identity\n\t\t\t\t\t: R.upsertAt(\n\t\t\t\t\t\t\t\"primary\",\n\t\t\t\t\t\t\tbuildSchemaRecordType([...path, \"primary\"], model[\"non-repeat\"]),\n\t\t\t\t\t ),\n\t\t\t\tR.isEmpty(model.repeat)\n\t\t\t\t\t? identity\n\t\t\t\t\t: R.upsertAt(\n\t\t\t\t\t\t\t\"items\",\n\t\t\t\t\t\t\tbuildSchemaRecordType([...path, \"items\"], model.repeat, [\n\t\t\t\t\t\t\t\t...path,\n\t\t\t\t\t\t\t\t\"item\",\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t ),\n\t\t\t\tR.sequence(RTE.ApplicativeSeq),\n\t\t\t\tRTE.chainFirstW(\n\t\t\t\t\tflow(\n\t\t\t\t\t\tR.collect((_, type) => type),\n\t\t\t\t\t\tcreateTypes,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tRTE.map(\n\t\t\t\t\tR.mapWithIndex((field, type) =>\n\t\t\t\t\t\tfield === \"items\"\n\t\t\t\t\t\t\t? pipe(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tgetTypeName,\n\t\t\t\t\t\t\t\t\trequiredTypeName,\n\t\t\t\t\t\t\t\t\tlistTypeName,\n\t\t\t\t\t\t\t\t\trequiredTypeName,\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: pipe(type, getTypeName, requiredTypeName),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tRTE.chainW((fields) =>\n\t\t\t\t\tbuildObjectType({\n\t\t\t\t\t\tname: deps.nodeHelpers.createTypeName(path),\n\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\t\ttype: \"ID!\",\n\t\t\t\t\t\t\t\tresolve: (source: UnknownRecord): string =>\n\t\t\t\t\t\t\t\t\tdeps.nodeHelpers.createNodeId([\n\t\t\t\t\t\t\t\t\t\t...path,\n\t\t\t\t\t\t\t\t\t\tdeps.createContentDigest(source),\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tslice_type: \"String!\",\n\t\t\t\t\t\t\tslice_label: \"String\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinterfaces: [deps.globalNodeHelpers.createTypeName(\"SliceType\")],\n\t\t\t\t\t\textensions: { infer: false },\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t);\n\n/**\n * Builds GraphQL types for Slice Custom Type fields. The resulting types can be\n * created using Gatsby's `createTypes` action.\n *\n * @param path - Path to the fields.\n * @param choices - Record of Slice choices mapping a Slice API ID to its schema\n * definition.\n *\n * @returns List of GraphQL types for the provided Slice schemas.\n */\nconst buildSliceTypes = (\n\tpath: string[],\n\tchoices: prismicT.CustomTypeModelSliceZoneField[\"config\"][\"choices\"],\n): RTE.ReaderTaskEither<Dependencies, Error, string[]> =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.bindW(\"sliceModels\", () =>\n\t\t\tpipe(\n\t\t\t\tchoices,\n\t\t\t\tR.filter(\n\t\t\t\t\t(slice): slice is prismicT.CustomTypeModelSlice =>\n\t\t\t\t\t\tslice.type === prismicT.CustomTypeModelSliceType.Slice,\n\t\t\t\t),\n\t\t\t\tRTE.right,\n\t\t\t),\n\t\t),\n\t\tRTE.bindW(\"sliceTypeNames\", (scope) =>\n\t\t\tpipe(\n\t\t\t\tscope.sliceModels,\n\t\t\t\tR.mapWithIndex((sliceName, sliceModel) =>\n\t\t\t\t\tbuildSliceType([...path, sliceName], sliceModel),\n\t\t\t\t),\n\t\t\t\tR.sequence(RTE.ApplicativeSeq),\n\t\t\t\tRTE.map(R.collect((_, type) => type)),\n\t\t\t\tRTE.chainFirstW(createTypes),\n\t\t\t\tRTE.map(A.map(getTypeName)),\n\t\t\t),\n\t\t),\n\t\tRTE.bindW(\"sharedSliceModels\", () =>\n\t\t\tpipe(\n\t\t\t\tchoices,\n\t\t\t\tR.filter(\n\t\t\t\t\t(slice): slice is prismicT.CustomTypeModelSharedSlice =>\n\t\t\t\t\t\tslice.type === prismicT.CustomTypeModelSliceType.SharedSlice,\n\t\t\t\t),\n\t\t\t\tRTE.right,\n\t\t\t),\n\t\t),\n\t\tRTE.bindW(\"sharedSliceTypesNames\", (scope) =>\n\t\t\tpipe(\n\t\t\t\tscope.sharedSliceModels,\n\t\t\t\tR.keys,\n\t\t\t\tA.map((sharedSliceId) =>\n\t\t\t\t\tpipe(\n\t\t\t\t\t\tscope.pluginOptions.sharedSliceModels,\n\t\t\t\t\t\tA.findFirst(\n\t\t\t\t\t\t\t(sharedSliceModel) => sharedSliceModel.id === sharedSliceId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tE.fromOption(\n\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t\t\t`Could not find a Shared Slice model for a Shared Slice named \"${sharedSliceId}\"`,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tA.sequence(E.Applicative),\n\t\t\t\tRTE.fromEither,\n\t\t\t\tRTE.map(\n\t\t\t\t\tA.map((sharedSliceModel) =>\n\t\t\t\t\t\tpipe(\n\t\t\t\t\t\t\tsharedSliceModel.variations,\n\t\t\t\t\t\t\tReadonlyA.map((variation) =>\n\t\t\t\t\t\t\t\tscope.nodeHelpers.createTypeName([\n\t\t\t\t\t\t\t\t\tsharedSliceModel.id,\n\t\t\t\t\t\t\t\t\tvariation.id,\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tRTE.map(ReadonlyA.flatten),\n\t\t\t\tRTE.map(ReadonlyA.toArray),\n\t\t\t),\n\t\t),\n\t\tRTE.map((scope) => [\n\t\t\t...scope.sliceTypeNames,\n\t\t\t...scope.sharedSliceTypesNames,\n\t\t]),\n\t);\n\n/**\n * Builds a GraphQL field configuration object for a Slices Custom Type field\n * (also known as a Slice zone). The resulting configuration object can be used\n * in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n * @param schema - Schema definition for the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildSlicesFieldConfig: FieldConfigCreator<\n\tprismicT.CustomTypeModelSliceZoneField\n> = (path, schema) =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.chain((deps) =>\n\t\t\tpipe(\n\t\t\t\tbuildSliceTypes(path, schema.config.choices),\n\t\t\t\tRTE.chainW((types) =>\n\t\t\t\t\tbuildUnionType({\n\t\t\t\t\t\tname: deps.nodeHelpers.createTypeName([...path, \"SlicesType\"]),\n\t\t\t\t\t\ttypes,\n\t\t\t\t\t\tresolveType: (source: prismicT.Slice | prismicT.SharedSlice) =>\n\t\t\t\t\t\t\tpipe(\n\t\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\t\tO.fromPredicate(\n\t\t\t\t\t\t\t\t\t(source): source is prismicT.SharedSlice =>\n\t\t\t\t\t\t\t\t\t\t\"variation\" in source,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tO.map((source) =>\n\t\t\t\t\t\t\t\t\tdeps.nodeHelpers.createTypeName([\n\t\t\t\t\t\t\t\t\t\tsource.slice_type,\n\t\t\t\t\t\t\t\t\t\tsource.variation,\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tO.getOrElse(() =>\n\t\t\t\t\t\t\t\t\tdeps.nodeHelpers.createTypeName([...path, source.slice_type]),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\tRTE.chainFirstW(createType),\n\t\t\t\tRTE.map(\n\t\t\t\t\tflow(getTypeName, requiredTypeName, listTypeName, requiredTypeName),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Text Custom Type field. The\n * resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildTextFieldConfig: FieldConfigCreator = () =>\n\tRTE.right(\"String\");\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Timestamp Custom Type\n * field. It includes Gatsby's `@dateformat` extension. The resulting\n * configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildTimestampFieldConfig: FieldConfigCreator = () =>\n\tRTE.right({\n\t\ttype: \"Date\",\n\t\textensions: { dateformat: {} },\n\t});\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a UID Custom Type field. The\n * resulting configuration object can be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildUIDFieldConfig: FieldConfigCreator = () =>\n\tRTE.right(\"String!\");\n","/**\n * Converts a list of path edges to a string joined by dots (\"`.`\").\n *\n * @param path - List of path edges.\n *\n * @returns Paths joined by dots (\"`.`\").\n */\nexport const dotPath = (path: string[]): string => path.join(\".\");\n","/**\n * Interpolate values into a string using a `sprintf`-like syntax. Each instance\n * of \"`%s`\" in the string will be replaced with a given value in the order they\n * are given.\n *\n * @param string - String into which values will be interpolated.\n * @param args - Values which will be interpolated into `string`.\n *\n * @returns String with interpolated values.\n * @see https://gist.github.com/rmariuzzo/8761698#gistcomment-2375590\n */\nexport const sprintf = (string: string, ...args: string[]): string => {\n\tlet i = 0;\n\n\treturn string.replace(/%s/g, () => args[i++]);\n};\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies } from \"../types\";\nimport { REPORTER_TEMPLATE } from \"../constants\";\nimport { sprintf } from \"./sprintf\";\n\n/**\n * Reports a piece of text at the \"info\" importance level using the\n * environment's `reportInfo` function.\n *\n * @param text - Text to report.\n */\nexport const reportInfo = (\n\ttext: string,\n): RTE.ReaderTaskEither<Dependencies, never, void> =>\n\tRTE.asks((deps) =>\n\t\tpipe(\n\t\t\tsprintf(REPORTER_TEMPLATE, deps.pluginOptions.repositoryName, text),\n\t\t\tdeps.reportInfo,\n\t\t),\n\t);\n","import * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { identity, pipe } from \"fp-ts/function\";\n\nimport { dotPath } from \"../lib/dotPath\";\nimport { reportInfo } from \"../lib/reportInfo\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for a Custom Type field with an\n * unknown type. Because the type is unknown, a `JSON` field type is used as a\n * fallback type. The resulting configuration object can be used in a GraphQL type.\n *\n * Use of this function will be reported to the user's Gatsby log. This informs\n * the user that the field will not act like other fields since its type is\n * unknown. This should only happen if a new Prismic field type is introduced\n * before this plugin supports it.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n * @param schema - Schema definition for the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildUnknownFieldConfig: FieldConfigCreator = (\n\tpath: string[],\n\tschema: prismicT.CustomTypeModelField,\n) =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.chainFirst(() =>\n\t\t\treportInfo(\n\t\t\t\t`An unknown field type \"${schema.type}\" was found at ${dotPath(\n\t\t\t\t\tpath,\n\t\t\t\t)}. A generic JSON type will be used. You can manually override the type using Gatsby's createSchemaCustomization API in your site's gatsby-node.js.`,\n\t\t\t),\n\t\t),\n\t\tRTE.map(() => ({\n\t\t\ttype: \"JSON\",\n\t\t\tresolve: identity,\n\t\t})),\n\t);\n","import * as gatsby from \"gatsby\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { Dependencies } from \"../types\";\n\nimport { buildObjectType } from \"./buildObjectType\";\n\n/**\n * Builds a GraphQL object type using Gatsby's Node interface with field\n * inference enabled using the environment's `buildObjectType` function.\n *\n * @param name - Name of type.\n *\n * @returns Return type of the envionrment's `buildObjectType` function.\n */\nexport const buildNamedInferredNodeType = (\n\tname: string,\n): RTE.ReaderTaskEither<Dependencies, never, gatsby.GatsbyGraphQLObjectType> =>\n\tbuildObjectType({\n\t\tname,\n\t\tinterfaces: [\"Node\"],\n\t\tfields: {},\n\t\textensions: { infer: true },\n\t});\n","import * as gatsby from \"gatsby\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { Dependencies } from \"../types\";\n\nimport { buildNamedInferredNodeType } from \"./buildNamedInferredNodeType\";\n\n/**\n * Builds a GraphQL object type using Gatsby's Node interface with field\n * inference enabled using the environment's `buildObjectType` function. The\n * type name is generated using the environment's node helpers and the `path` parameter.\n *\n * @param path - List of field names from the root object to the field to which\n * the inferred node type will be assigned. Determines the type's name.\n *\n * @returns Return type of the envionrment's `buildObjectType` function.\n */\nexport const buildInferredNodeType = (\n\tpath: string[],\n): RTE.ReaderTaskEither<Dependencies, never, gatsby.GatsbyGraphQLObjectType> =>\n\tpipe(\n\t\tRTE.asks((deps: Dependencies) => deps.nodeHelpers.createTypeName(path)),\n\t\tRTE.chain(buildNamedInferredNodeType),\n\t);\n","import * as RTE from \"fp-ts/ReaderTaskEither\";\nimport { pipe } from \"fp-ts/function\";\n\nimport { buildInferredNodeType } from \"../lib/buildInferredNodeType\";\nimport { createType } from \"../lib/createType\";\nimport { getTypeName } from \"../lib/getTypeName\";\n\nimport { Dependencies, FieldConfigCreator } from \"../types\";\n\n/**\n * Builds a GraphQL field configuration object for an Integration Fields Custom\n * Type field. It uses the `@link` extension to connect data to the field. Data\n * for each Integration Fields field is created as a separate node to allow\n * Gatsby to infer the fields and types. The resulting configuration object can\n * be used in a GraphQL type.\n *\n * This function registers a typepath for the field.\n *\n * @param path - Path to the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const buildIntegrationFieldConfig: FieldConfigCreator = (\n\tpath: string[],\n) =>\n\tpipe(\n\t\tRTE.ask<Dependencies>(),\n\t\tRTE.chain(() => buildInferredNodeType([...path, \"IntegrationType\"])),\n\t\tRTE.chainFirst(createType),\n\t\tRTE.map(getTypeName),\n\t\tRTE.map((type) => ({\n\t\t\ttype,\n\t\t\textensions: { link: {} },\n\t\t})),\n\t);\n","import * as gqlc from \"graphql-compose\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as RTE from \"fp-ts/ReaderTaskEither\";\n\nimport { Dependencies } from \"../types\";\n\nimport { buildBooleanFieldConfig } from \"../builders/buildBooleanFieldConfig\";\nimport { buildColorFieldConfig } from \"../builders/buildColorFieldConfig\";\nimport { buildDateFieldConfig } from \"../builders/buildDateFieldConfig\";\nimport { buildEmbedFieldConfig } from \"../builders/buildEmbedFieldConfig\";\nimport { buildGeoPointFieldConfig } from \"../builders/buildGeoPointFieldConfig\";\nimport { buildGroupFieldConfig } from \"../builders/buildGroupFieldConfig\";\nimport { buildImageFieldConfig } from \"../builders/buildImageFieldConfig\";\nimport { buildLinkFieldConfig } from \"../builders/buildLinkFieldConfig\";\nimport { buildNumberFieldConfig } from \"../builders/buildNumberFieldConfig\";\nimport { buildSelectFieldConfig } from \"../builders/buildSelectFieldConfig\";\nimport { buildStructuredTextFieldConfig } from \"../builders/buildStructuredTextFieldConfig\";\nimport { buildSlicesFieldConfig } from \"../builders/buildSlicesFieldConfig\";\nimport { buildTextFieldConfig } from \"../builders/buildTextFieldConfig\";\nimport { buildTimestampFieldConfig } from \"../builders/buildTimestampFieldConfig\";\nimport { buildUIDFieldConfig } from \"../builders/buildUIDFieldConfig\";\nimport { buildUnknownFieldConfig } from \"../builders/buildUnknownFieldConfig\";\nimport { buildIntegrationFieldConfig } from \"../builders/buildIntegrationFieldConfig\";\n\n/**\n * Returns a GraphQL field configuration object for a Custom Type field. The\n * resulting configuration object can be used in a GraphQL type.\n *\n * In some cases, `undefined` will be returned. Fields that return `undefined`\n * should be omitted from the GraphQL schema.\n *\n * @param path - Path to the field.\n * @param schema - Schema definition for the field.\n *\n * @returns GraphQL field configuration object.\n */\nexport const toFieldConfig = (\n\tpath: string[],\n\tschema: prismicT.CustomTypeModelField,\n): RTE.ReaderTaskEither<\n\tDependencies,\n\tError,\n\tgqlc.ObjectTypeC