UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

191 lines (190 loc) 7.92 kB
import type { ColorField } from "../types/value/color"; import type { ContentRelationshipField, EmptyContentRelationshipField } from "../types/value/contentRelationship"; import type { DateField } from "../types/value/date"; import type { AnyOEmbed, EmbedField } from "../types/value/embed"; import type { GeoPointField } from "../types/value/geoPoint"; import type { GroupField, NestedGroupField } from "../types/value/group"; import type { ImageField, ImageFieldImage } from "../types/value/image"; import type { IntegrationField } from "../types/value/integration"; import type { KeyTextField } from "../types/value/keyText"; import type { LinkField } from "../types/value/link"; import type { LinkToMediaField } from "../types/value/linkToMedia"; import type { NumberField } from "../types/value/number"; import type { RichTextField } from "../types/value/richText"; import type { SelectField } from "../types/value/select"; import type { SharedSlice } from "../types/value/sharedSlice"; import type { Slice } from "../types/value/slice"; import type { SliceZone } from "../types/value/sliceZone"; import type { TableField } from "../types/value/table"; import type { TimestampField } from "../types/value/timestamp"; import type { TitleField } from "../types/value/title"; import type { AnyRegularField, Repeatable } from "../types/value/types"; /** * Determines if a rich text field is filled. * * @param field - rich text field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const richText: (field: RichTextField | null | undefined) => field is RichTextField<"filled">; /** * Determines if a title field is filled. * * @param field - Title field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const title: (field: TitleField | null | undefined) => field is TitleField<"filled">; /** * Determines if an Image thumbnail is filled. * * @param thumbnail - Image thumbnail to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const imageThumbnail: (thumbnail: ImageFieldImage | null | undefined) => thumbnail is ImageFieldImage<"filled">; /** * Determines if an image field is filled. * * @param field - Image field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const image: <ThumbnailNames extends string | null = never>(field: ImageField<ThumbnailNames> | null | undefined) => field is ImageField<ThumbnailNames, "filled">; /** * Determines if a link field is filled. * * @param field - Link field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const link: <TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown>(field: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined) => field is LinkField<TypeEnum, LangEnum, DataInterface, "filled">; /** * Determines if a link to media field is filled. * * @param field - Link to media field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const linkToMedia: (field: LinkToMediaField | null | undefined) => field is LinkToMediaField<"filled">; /** * Determines if a content relationship field is filled. * * @param field - Content Relationship field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const contentRelationship: <Field extends ContentRelationshipField>(field: Field | null | undefined) => field is Exclude<Field, EmptyContentRelationshipField>; /** * Determines if a date field is filled. * * @param field - Date field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const date: (field: DateField | null | undefined) => field is DateField<"filled">; /** * Determines if a timestamp field is filled. * * @param field - Timestamp field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const timestamp: (field: TimestampField | null | undefined) => field is TimestampField<"filled">; /** * Determines if a color field is filled. * * @param field - Color field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const color: (field: ColorField | null | undefined) => field is ColorField<"filled">; /** * Determines if a number field is filled. * * @param field - Number field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const number: (field: NumberField | null | undefined) => field is NumberField<"filled">; /** * Determines if a key text field is filled. * * @param field - Key Text field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const keyText: (field: KeyTextField | null | undefined) => field is KeyTextField<"filled">; /** * Determines if a select field is filled. * * @param field - Select field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const select: <Enum extends string>(field: SelectField<Enum> | null | undefined) => field is SelectField<Enum, "filled">; /** * Determines if an embed field is filled. * * @param field - Embed field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const embed: <Field extends EmbedField<AnyOEmbed>>(field: Field | null | undefined) => field is Extract<Field, EmbedField<AnyOEmbed, "filled">>; /** * Determines if a geopoint field is filled. * * @param field - GeoPoint field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const geoPoint: (field: GeoPointField | null | undefined) => field is GeoPointField<"filled">; /** * Determines if a table field is filled. * * @param field - Table field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const table: (field: TableField | null | undefined) => field is TableField<"filled">; /** * Determines if an integration field is filled. * * @param field - Integration field to check. * * @returns `true` if `field` is filled, `false` otherwise. */ export declare const integration: <Data extends Record<string, unknown>>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">; /** * @deprecated Renamed to `integration`. */ export declare const integrationField: <Data extends Record<string, unknown>>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">; /** * @deprecated Renamed to `integrationField`. */ export declare const integrationFields: <Data extends Record<string, unknown>>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">; /** * Determines if a repeatable field has at least one item. * * @param repeatable - Repeatable to check. * * @returns `true` if `repeatable` contains at least one item, `false` * otherwise. */ export declare const repeatable: <T extends LinkField>(repeatable: Repeatable<T> | null | undefined) => repeatable is Repeatable<T, "filled">; /** * Determines if a Group has at least one item. * * @param group - Group to check. * * @returns `true` if `group` contains at least one item, `false` otherwise. */ export declare const group: <Fields extends Record<string, AnyRegularField | NestedGroupField>>(group: GroupField<Fields> | null | undefined) => group is GroupField<Fields, "filled">; /** * Determines if a Slice Zone has at least one Slice. * * @param slices - Slice Zone to check. * * @returns `true` if `slices` contains at least one Slice, `false` otherwise. */ export declare const sliceZone: <Slices extends Slice | SharedSlice>(slices: SliceZone<Slices> | null | undefined) => slices is SliceZone<Slices, "filled">;