import type { GroupField } from "./group" import type { SliceZone } from "./sliceZone" import type { TimestampField } from "./timestamp" import type { AnyRegularField } from "./types" /** Document metadata for a translation of a Prismic document. */ export interface AlternateLanguage { id: string uid?: string type: TypeEnum lang: LangEnum } /** Metadata for Prismic document */ export interface PrismicDocumentHeader { /** * The unique identifier for the document. Guaranteed to be unique among all documents in the * Prismic repository. */ id: string /** * The unique identifier for the document. Guaranteed to be unique among all Prismic documents of * the same type. */ uid: string | null /** Url that refers to document. */ url: string | null /** Type of the document. */ type: TypeEnum /** Href for document. */ href: string /** Tags associated with document. */ tags: string[] /** The timestamp at which the document was first published. */ first_publication_date: TimestampField<"filled"> /** The timestamp at which the document was last published. */ last_publication_date: TimestampField<"filled"> /** * Slugs associated with document. * * @deprecated Slugs are a deprecated feature used before the UID field was * introduced. Migrate to the UID field. For more details, see * https://community.prismic.io/t/what-are-slugs/6493 */ slugs: string[] /** Documents that are related to this document. */ linked_documents: unknown[] // TODO: Not sure of the type for this one /** Language of document. */ lang: LangEnum /** Array to access alternate language versions for document. */ alternate_languages: AlternateLanguage[] } /** * A Prismic document served through REST API v2. * * @see More details on custom types: {@link https://prismic.io/docs/custom-types} */ export interface PrismicDocument< DataInterface extends Record< string, AnyRegularField | GroupField | SliceZone // oxlint-disable-next-line no-explicit-any > = Record, TypeEnum = string, LangEnum = string, > extends PrismicDocumentHeader { /** Data contained in the document. */ data: DataInterface } /** * A Prismic document served through REST API v2. Does not contain a UID (a unique identifier). * * @see More details on custom types: {@link https://prismic.io/docs/custom-types} * @see More details on the UID field: {@link https://prismic.io/docs/uid} */ export interface PrismicDocumentWithoutUID< DataInterface extends Record< string, AnyRegularField | GroupField | SliceZone // oxlint-disable-next-line no-explicit-any > = Record, TypeEnum = string, LangEnum = string, > extends PrismicDocument { /** * This document does not have a UID field. This property will always be `null`. * * The unique identifier for the document. Guaranteed to be unique among all Prismic documents of * the same type. */ uid: null } /** * A Prismic document served through REST API v2. Contains a UID (a unique identifier). * * @see More details on custom types: {@link https://prismic.io/docs/custom-types} * @see More details on the UID field: {@link https://prismic.io/docs/uid} */ export interface PrismicDocumentWithUID< DataInterface extends Record< string, AnyRegularField | GroupField | SliceZone // oxlint-disable-next-line no-explicit-any > = Record, TypeEnum = string, LangEnum = string, > extends PrismicDocument { /** * The unique identifier for the document. Guaranteed to be unique among all Prismic documents of * the same type. */ uid: string }