UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

72 lines (71 loc) 2.85 kB
import type { MigrationImage, MigrationLinkToMedia, MigrationRTImageNode } from "../types/migration/Asset"; import type { MigrationContentRelationship } from "../types/migration/ContentRelationship"; import { type InjectMigrationSpecificTypes } from "../types/migration/Document"; import type { PrismicDocument } from "../types/value/document"; import type { GroupField } from "../types/value/group"; import type { OptionalLinkProperties } from "../types/value/link"; import type { SliceZone } from "../types/value/sliceZone"; import type { AnyRegularField } from "../types/value/types"; /** * Unknown value to check if it's a specific field type. * * @remarks * Explicit types are added to help ensure narrowing is done effectively. */ type UnknownValue = PrismicDocument | InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone> | unknown; /** * Checks if a value is a migration content relationship field. * * @remarks * `OptionalLinkProperties` is included because `MigrationContentRelationship` * may be a link field, not strictly a content relationship field. * * @param value - Value to check. * * @returns `true` if `value` is a migration content relationship field, `false` * otherwise. * * @internal * This is not an official helper function and it's only designed to work with internal processes. */ export declare const contentRelationship: (value: UnknownValue) => value is MigrationContentRelationship & OptionalLinkProperties; /** * Checks if a value is a migration image field. * * @param value - Value to check. * * @returns `true` if `value` is a migration image field, `false` otherwise. * * @internal * This is not an official helper function and it's only designed to work with internal processes. */ export declare const image: (value: UnknownValue) => value is MigrationImage; /** * Checks if a value is a migration link to media field. * * - @remarks `OptionalLinkProperties` is included because * `MigrationContentRelationship` may be a link field, not strictly a content * relationship field. * * @param value - Value to check. * * @returns `true` if `value` is a migration link to media field, `false` * otherwise. * * @internal * This is not an official helper function and it's only designed to work with internal processes. */ export declare const linkToMedia: (value: UnknownValue) => value is MigrationLinkToMedia & OptionalLinkProperties; /** * Checks if a value is a migration rich text image node. * * @param value - Value to check. * * @returns `true` if `value` is a migration rich text image node, `false` * otherwise. * * @internal * This is not an official helper function and it's only designed to work with internal processes. */ export declare const rtImageNode: (value: UnknownValue) => value is MigrationRTImageNode; export {};