@prismicio/types
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -0,0 +0,0 @@ declare const LinkType: { |
1415
dist/index.d.ts
@@ -1,201 +0,4 @@ | ||
declare type EmptyObjectField = Record<string, never>; | ||
/** | ||
* Valid states for fields. Not all fields use this type (e.g. BooleanField). | ||
*/ | ||
declare type FieldState = "empty" | "filled"; | ||
/** | ||
* Types for RichTextNodes | ||
* Title Field | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
declare const RichTextNodeType: { | ||
readonly heading1: "heading1"; | ||
readonly heading2: "heading2"; | ||
readonly heading3: "heading3"; | ||
readonly heading4: "heading4"; | ||
readonly heading5: "heading5"; | ||
readonly heading6: "heading6"; | ||
readonly paragraph: "paragraph"; | ||
readonly preformatted: "preformatted"; | ||
readonly strong: "strong"; | ||
readonly em: "em"; | ||
readonly listItem: "list-item"; | ||
readonly oListItem: "o-list-item"; | ||
readonly list: "group-list-item"; | ||
readonly oList: "group-o-list-item"; | ||
readonly image: "image"; | ||
readonly embed: "embed"; | ||
readonly hyperlink: "hyperlink"; | ||
readonly label: "label"; | ||
readonly span: "span"; | ||
}; | ||
/** | ||
* Base to be extended by other RT Nodes. | ||
*/ | ||
interface RTTextNodeBase { | ||
text: string; | ||
spans: RTInlineNode[]; | ||
} | ||
/** | ||
* Rich Text `heading1` node | ||
*/ | ||
interface RTHeading1Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading1; | ||
} | ||
/** | ||
* Rich Text `heading2` node | ||
*/ | ||
interface RTHeading2Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading2; | ||
} | ||
/** | ||
* Rich Text `heading3` node | ||
*/ | ||
interface RTHeading3Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading3; | ||
} | ||
/** | ||
* Rich Text `heading4` node | ||
*/ | ||
interface RTHeading4Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading4; | ||
} | ||
/** | ||
* Rich Text `heading5` node | ||
*/ | ||
interface RTHeading5Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading5; | ||
} | ||
/** | ||
* Rich Text `heading6` node | ||
*/ | ||
interface RTHeading6Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading6; | ||
} | ||
/** | ||
* Rich Text `paragraph` node | ||
*/ | ||
interface RTParagraphNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.paragraph; | ||
} | ||
/** | ||
* Rich Text `preformatted` node | ||
*/ | ||
interface RTPreformattedNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.preformatted; | ||
} | ||
/** | ||
* Rich Text `list-item` node | ||
*/ | ||
interface RTListItemNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.listItem; | ||
} | ||
/** | ||
* Rich Text `o-list-item` node for ordered lists | ||
*/ | ||
interface RTOListItemNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.oListItem; | ||
} | ||
/** | ||
* @internal Span Node base to be extended for other Span nodes | ||
*/ | ||
interface RTSpanNodeBase { | ||
start: number; | ||
end: number; | ||
} | ||
/** | ||
* Rich Text `strong` node | ||
*/ | ||
interface RTStrongNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.strong; | ||
} | ||
/** | ||
* Rich Text `embed` node | ||
*/ | ||
interface RTEmNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.em; | ||
} | ||
/** | ||
* Rich Text `label` node | ||
*/ | ||
interface RTLabelNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.label; | ||
data: { | ||
label: string; | ||
}; | ||
} | ||
/** | ||
* Rich Text `image` nodes. They could link to other documents, external web | ||
* links and media fields | ||
*/ | ||
declare type RTImageNode = { | ||
type: typeof RichTextNodeType.image; | ||
url: string; | ||
alt: string | null; | ||
copyright: string | null; | ||
dimensions: { | ||
width: number; | ||
height: number; | ||
}; | ||
linkTo?: FilledLinkToDocumentField | FilledLinkToWebField | FilledLinkToMediaField; | ||
}; | ||
/** | ||
* Rich Text `embed` node | ||
*/ | ||
declare type RTEmbedNode = { | ||
type: typeof RichTextNodeType.embed; | ||
oembed: EmbedField; | ||
}; | ||
/** | ||
* Rich Text `a` node | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/edit-rich-text#add-links} | ||
*/ | ||
interface RTLinkNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.hyperlink; | ||
data: FilledLinkToDocumentField | FilledLinkToWebField | FilledLinkToMediaField; | ||
} | ||
/** | ||
* Rich Text `list` node | ||
*/ | ||
interface RTListNode { | ||
type: typeof RichTextNodeType.list; | ||
items: RTListItemNode[]; | ||
} | ||
/** | ||
* Rich Text o-lost node | ||
*/ | ||
interface RTOListNode { | ||
type: typeof RichTextNodeType.oList; | ||
items: RTOListItemNode[]; | ||
} | ||
/** | ||
* Rich Text `span` node | ||
*/ | ||
interface RTSpanNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.span; | ||
} | ||
/** | ||
* Nodes from a Rich Text Field | ||
*/ | ||
declare type RTNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTImageNode | RTEmbedNode; | ||
/** | ||
* Rich text nodes with text | ||
*/ | ||
declare type RTTextNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode; | ||
/** | ||
* Rich Text block nodes | ||
*/ | ||
declare type RTBlockNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTListNode | RTOListNode | RTImageNode | RTEmbedNode; | ||
/** | ||
* Inline Rich Text Nodes | ||
*/ | ||
declare type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode; | ||
/** | ||
* All Rich Text nodes | ||
*/ | ||
declare type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode; | ||
/** | ||
* All Rich Text Title Nodes | ||
* | ||
* @see Title field documentation: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
@@ -208,3 +11,3 @@ */ | ||
]; | ||
declare type RichTextField<State extends FieldState = FieldState> = State extends "empty" ? [] : [RTNode, ...RTNode[]]; | ||
/** | ||
@@ -234,14 +37,2 @@ * An individual image within an Image field. The base image and each thumbnail | ||
/** | ||
* Useful to flatten the type output to improve type hints shown in editors. And | ||
* also to transform an interface into a type to aide with assignability. | ||
* | ||
* Taken from the `type-fest` package. | ||
* | ||
* @typeParam T - The type to simplify. | ||
* @see https://github.com/sindresorhus/type-fest/blob/cbd7ec510bd136ac045bbc74e391ee686b8a9a2f/source/simplify.d.ts | ||
*/ | ||
declare type Simplify<T> = { | ||
[P in keyof T]: T[P]; | ||
}; | ||
/** | ||
* Image Field | ||
@@ -258,3 +49,71 @@ * | ||
declare type ImageField<ThumbnailNames extends string | null = never, State extends FieldState = FieldState> = Simplify<ImageFieldImage<State> & Record<Exclude<Extract<ThumbnailNames, string>, keyof ImageFieldImage>, ImageFieldImage<State>>>; | ||
/** | ||
* A Group field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/group} | ||
*/ | ||
declare type GroupField<Fields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, State extends FieldState = FieldState> = State extends "empty" ? [] : [Fields, ...Fields[]]; | ||
interface SharedSliceVariation<Variation = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> { | ||
variation: Variation; | ||
version: string; | ||
primary: PrimaryFields; | ||
items: ItemsFields[]; | ||
} | ||
/** | ||
* Shared Slice | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/reusing-slices#shared-slices} | ||
*/ | ||
declare type SharedSlice<SliceType = string, Variations extends SharedSliceVariation = SharedSliceVariation> = { | ||
slice_type: SliceType; | ||
slice_label: null; | ||
id?: string; | ||
} & Variations; | ||
/** | ||
* Slice - Sections of your website | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/slices} | ||
*/ | ||
interface Slice<SliceType = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> { | ||
slice_type: SliceType; | ||
slice_label: string | null; | ||
id?: string; | ||
primary: PrimaryFields; | ||
items: ItemsFields[]; | ||
} | ||
/** | ||
* Prismic Slices are sections of your website. Prismic documents contain a | ||
* dynamic "Slice Zone" that allows content creators to add, edit, and rearrange | ||
* Slices to compose dynamic layouts for any page design, such as blog posts, | ||
* landing pages, case studies, and tutorials. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/technologies/adding-the-slicezone-component-nextjs} | ||
*/ | ||
declare type SliceZone<Slices extends Slice | SharedSlice = Slice | SharedSlice, State extends FieldState = FieldState> = State extends "empty" ? [] : [Slices, ...Slices[]]; | ||
/** | ||
* Link field that points to media | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
*/ | ||
declare type LinkToMediaField<State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Media> : FilledLinkToMediaField; | ||
/** | ||
* Link that points to media | ||
*/ | ||
interface FilledLinkToMediaField { | ||
link_type: typeof LinkType.Media; | ||
name: string; | ||
kind: string; | ||
url: string; | ||
size: string; | ||
height?: string | null; | ||
width?: string | null; | ||
} | ||
/** | ||
* Link Types | ||
@@ -277,5 +136,34 @@ */ | ||
/** | ||
* Link that points to external website | ||
*/ | ||
interface FilledLinkToWebField { | ||
link_type: typeof LinkType.Web; | ||
url: string; | ||
target?: string; | ||
} | ||
/** | ||
* Link Field | ||
* | ||
* @typeParam TypeEnum - Type API ID of the document. | ||
* @typeParam LangEnum - Language API ID of the document. | ||
* @typeParam DataInterface - Data fields for the document (filled in via | ||
* GraphQuery of `fetchLinks`). | ||
* @typeParam State - State of the field which determines its shape. | ||
*/ | ||
declare type LinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Any> : ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State> | FilledLinkToWebField | LinkToMediaField<State>; | ||
/** | ||
* Field for related documents | ||
* | ||
* @typeParam TypeEnum - Type API ID of the document. | ||
* @typeParam LangEnum - Language API ID of the document. | ||
* @typeParam DataInterface - Data fields for the document (filled in via | ||
* GraphQuery of `fetchLinks`). | ||
* @typeParam State - State of the field which determines its shape. | ||
*/ | ||
declare type ContentRelationshipField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Document> : FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>; | ||
/** | ||
* Links that refer to Documents | ||
*/ | ||
interface FilledLinkToDocumentField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never> { | ||
interface FilledContentRelationshipField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never> { | ||
link_type: typeof LinkType.Document; | ||
@@ -292,49 +180,104 @@ id: string; | ||
} | ||
/** | ||
* Link that points to external website | ||
* A Boolean field. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/boolean} | ||
*/ | ||
interface FilledLinkToWebField { | ||
link_type: typeof LinkType.Web; | ||
url: string; | ||
target?: string; | ||
} | ||
declare type BooleanField = boolean; | ||
/** | ||
* Link that points to media | ||
* A Color field. | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/color} | ||
*/ | ||
interface FilledLinkToMediaField { | ||
link_type: typeof LinkType.Media; | ||
name: string; | ||
kind: string; | ||
url: string; | ||
size: string; | ||
height?: string | null; | ||
width?: string | null; | ||
} | ||
declare type ColorField<State extends FieldState = FieldState> = State extends "empty" ? null : `#${string}`; | ||
/** | ||
* Field for related documents | ||
* A Date field. | ||
* | ||
* @typeParam TypeEnum - Type API ID of the document. | ||
* @typeParam LangEnum - Language API ID of the document. | ||
* @typeParam DataInterface - Data fields for the document (filled in via | ||
* GraphQuery of `fetchLinks`). | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/date} | ||
*/ | ||
declare type RelationField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Document> : FilledLinkToDocumentField<TypeEnum, LangEnum, DataInterface>; | ||
declare type DateField<State extends FieldState = FieldState> = State extends "empty" ? null : `${number}-${number}-${number}`; | ||
/** | ||
* Link Field | ||
* A Key text field | ||
* | ||
* @typeParam TypeEnum - Type API ID of the document. | ||
* @typeParam LangEnum - Language API ID of the document. | ||
* @typeParam DataInterface - Data fields for the document (filled in via | ||
* GraphQuery of `fetchLinks`). | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/key-text} | ||
*/ | ||
declare type LinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Any> : RelationField<TypeEnum, LangEnum, DataInterface, State> | FilledLinkToWebField | LinkToMediaField<State>; | ||
declare type KeyTextField<State extends FieldState = FieldState> = State extends "empty" ? null | "" : string; | ||
/** | ||
* Link field that points to media | ||
* A Number field | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/number} | ||
*/ | ||
declare type LinkToMediaField<State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Media> : FilledLinkToMediaField; | ||
declare type NumberField<State extends FieldState = FieldState> = State extends "empty" ? null : number; | ||
/** | ||
* A Select field | ||
* | ||
* @typeParam Enum - Selectable options for the field. | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/select} | ||
*/ | ||
declare type SelectField<Enum extends string = string, State extends FieldState = FieldState> = State extends "empty" ? null : Enum; | ||
/** | ||
* Simple Timestamp Field | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
*/ | ||
declare type TimestampField<State extends FieldState = FieldState> = State extends "empty" ? null : `${DateField<"filled">}T${number}:${number}:${number}+${number}`; | ||
/** | ||
* A Geopoint field. | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/geopoint} | ||
*/ | ||
declare type GeoPointField<State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : { | ||
latitude: number; | ||
longitude: number; | ||
}; | ||
/** | ||
* Integration Fields for Custom APIs | ||
* | ||
* @typeParam Data - Data from the integrated API. | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/integration-fields-setup} | ||
*/ | ||
declare type IntegrationFields<Data extends Record<string, unknown> = Record<string, unknown>, State extends FieldState = FieldState> = State extends "empty" ? null : Data; | ||
/** | ||
* Empty state for object-shaped fields. | ||
*/ | ||
declare type EmptyObjectField = Record<string, never>; | ||
/** | ||
* Valid states for fields. Not all fields use this type (e.g. BooleanField). | ||
*/ | ||
declare type FieldState = "empty" | "filled"; | ||
/** | ||
* Any regular field that can be nested in a group-like field. | ||
*/ | ||
declare type AnyRegularField = TitleField | RichTextField | ImageField | ContentRelationshipField | LinkField | LinkToMediaField | EmbedField | DateField | TimestampField | ColorField | NumberField | KeyTextField | SelectField | BooleanField | GeoPointField | IntegrationFields; | ||
/** | ||
* Useful to flatten the type output to improve type hints shown in editors. And | ||
* also to transform an interface into a type to aide with assignability. | ||
* | ||
* Taken from the `type-fest` package. | ||
* | ||
* @typeParam T - The type to simplify. | ||
* @see https://github.com/sindresorhus/type-fest/blob/cbd7ec510bd136ac045bbc74e391ee686b8a9a2f/source/simplify.d.ts | ||
*/ | ||
declare type Simplify<T> = { | ||
[P in keyof T]: T[P]; | ||
}; | ||
/** | ||
* oEmbed 1.0 possible types. | ||
@@ -503,112 +446,201 @@ * | ||
}; | ||
/** | ||
* A Date field. | ||
* Types for RichTextNodes | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/date} | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
declare type DateField<State extends FieldState = FieldState> = State extends "empty" ? null : `${number}-${number}-${number}`; | ||
declare const RichTextNodeType: { | ||
readonly heading1: "heading1"; | ||
readonly heading2: "heading2"; | ||
readonly heading3: "heading3"; | ||
readonly heading4: "heading4"; | ||
readonly heading5: "heading5"; | ||
readonly heading6: "heading6"; | ||
readonly paragraph: "paragraph"; | ||
readonly preformatted: "preformatted"; | ||
readonly strong: "strong"; | ||
readonly em: "em"; | ||
readonly listItem: "list-item"; | ||
readonly oListItem: "o-list-item"; | ||
readonly list: "group-list-item"; | ||
readonly oList: "group-o-list-item"; | ||
readonly image: "image"; | ||
readonly embed: "embed"; | ||
readonly hyperlink: "hyperlink"; | ||
readonly label: "label"; | ||
readonly span: "span"; | ||
}; | ||
/** | ||
* Simple Timestamp Field | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* Base to be extended by other RT Nodes. | ||
*/ | ||
declare type TimestampField<State extends FieldState = FieldState> = State extends "empty" ? null : `${DateField<"filled">}T${number}:${number}:${number}+${number}`; | ||
interface RTTextNodeBase { | ||
text: string; | ||
spans: RTInlineNode[]; | ||
} | ||
/** | ||
* A Color field. | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/color} | ||
* Rich Text `heading1` node | ||
*/ | ||
declare type ColorField<State extends FieldState = FieldState> = State extends "empty" ? null : `#${string}`; | ||
interface RTHeading1Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading1; | ||
} | ||
/** | ||
* A Number field | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/number} | ||
* Rich Text `heading2` node | ||
*/ | ||
declare type NumberField<State extends FieldState = FieldState> = State extends "empty" ? null : number; | ||
interface RTHeading2Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading2; | ||
} | ||
/** | ||
* A Key text field | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/key-text} | ||
* Rich Text `heading3` node | ||
*/ | ||
declare type KeyTextField<State extends FieldState = FieldState> = State extends "empty" ? null | "" : string; | ||
interface RTHeading3Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading3; | ||
} | ||
/** | ||
* A Select field | ||
* | ||
* @typeParam Enum - Selectable options for the field. | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/select} | ||
* Rich Text `heading4` node | ||
*/ | ||
declare type SelectField<Enum extends string = string, State extends FieldState = FieldState> = State extends "empty" ? null : Enum; | ||
interface RTHeading4Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading4; | ||
} | ||
/** | ||
* A Boolean field. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/boolean} | ||
* Rich Text `heading5` node | ||
*/ | ||
declare type BooleanField = boolean; | ||
interface RTHeading5Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading5; | ||
} | ||
/** | ||
* A Geopoint field. | ||
* | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/geopoint} | ||
* Rich Text `heading6` node | ||
*/ | ||
declare type GeoPointField<State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : { | ||
latitude: number; | ||
longitude: number; | ||
interface RTHeading6Node extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.heading6; | ||
} | ||
/** | ||
* Rich Text `paragraph` node | ||
*/ | ||
interface RTParagraphNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.paragraph; | ||
} | ||
/** | ||
* Rich Text `preformatted` node | ||
*/ | ||
interface RTPreformattedNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.preformatted; | ||
} | ||
/** | ||
* Rich Text `list-item` node | ||
*/ | ||
interface RTListItemNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.listItem; | ||
} | ||
/** | ||
* Rich Text `o-list-item` node for ordered lists | ||
*/ | ||
interface RTOListItemNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.oListItem; | ||
} | ||
/** | ||
* @internal Span Node base to be extended for other Span nodes | ||
*/ | ||
interface RTSpanNodeBase { | ||
start: number; | ||
end: number; | ||
} | ||
/** | ||
* Rich Text `strong` node | ||
*/ | ||
interface RTStrongNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.strong; | ||
} | ||
/** | ||
* Rich Text `embed` node | ||
*/ | ||
interface RTEmNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.em; | ||
} | ||
/** | ||
* Rich Text `label` node | ||
*/ | ||
interface RTLabelNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.label; | ||
data: { | ||
label: string; | ||
}; | ||
} | ||
/** | ||
* Rich Text `image` nodes. They could link to other documents, external web | ||
* links and media fields | ||
*/ | ||
declare type RTImageNode = { | ||
type: typeof RichTextNodeType.image; | ||
url: string; | ||
alt: string | null; | ||
copyright: string | null; | ||
dimensions: { | ||
width: number; | ||
height: number; | ||
}; | ||
linkTo?: FilledContentRelationshipField | FilledLinkToWebField | FilledLinkToMediaField; | ||
}; | ||
/** | ||
* A Group field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/group} | ||
* Rich Text `embed` node | ||
*/ | ||
declare type GroupField<Fields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, State extends FieldState = FieldState> = State extends "empty" ? [] : [Fields, ...Fields[]]; | ||
declare type RTEmbedNode = { | ||
type: typeof RichTextNodeType.embed; | ||
oembed: EmbedField; | ||
}; | ||
/** | ||
* Integration Fields for Custom APIs | ||
* Rich Text `a` node | ||
* | ||
* @typeParam Data - Data from the integrated API. | ||
* @typeParam State - State of the field which determines its shape. | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/integration-fields-setup} | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/edit-rich-text#add-links} | ||
*/ | ||
declare type IntegrationFields<Data extends Record<string, unknown> = Record<string, unknown>, State extends FieldState = FieldState> = State extends "empty" ? null : Data; | ||
interface RTLinkNode extends RTSpanNodeBase { | ||
type: typeof RichTextNodeType.hyperlink; | ||
data: FilledContentRelationshipField | FilledLinkToWebField | FilledLinkToMediaField; | ||
} | ||
/** | ||
* Slice - Sections of your website | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/slices} | ||
* Rich Text `list` node | ||
*/ | ||
interface Slice<SliceType = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> { | ||
slice_type: SliceType; | ||
slice_label: string | null; | ||
id?: string; | ||
primary: PrimaryFields; | ||
items: ItemsFields[]; | ||
interface RTListNode { | ||
type: typeof RichTextNodeType.list; | ||
items: RTListItemNode[]; | ||
} | ||
/** | ||
* Shared Slice | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/reusing-slices#shared-slices} | ||
* Rich Text o-lost node | ||
*/ | ||
declare type SharedSlice<SliceType = string, Variations extends SharedSliceVariation = SharedSliceVariation> = { | ||
slice_type: SliceType; | ||
slice_label: null; | ||
id?: string; | ||
} & Variations; | ||
interface SharedSliceVariation<Variation = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> { | ||
variation: Variation; | ||
version: string; | ||
primary: PrimaryFields; | ||
items: ItemsFields[]; | ||
interface RTOListNode { | ||
type: typeof RichTextNodeType.oList; | ||
items: RTOListItemNode[]; | ||
} | ||
/** | ||
* Prismic Slices are sections of your website. Prismic documents contain a | ||
* dynamic "Slice Zone" that allows content creators to add, edit, and rearrange | ||
* Slices to compose dynamic layouts for any page design, such as blog posts, | ||
* landing pages, case studies, and tutorials. | ||
* Rich Text `span` node | ||
*/ | ||
interface RTSpanNode extends RTTextNodeBase { | ||
type: typeof RichTextNodeType.span; | ||
} | ||
/** | ||
* Nodes from a Rich Text Field | ||
*/ | ||
declare type RTNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTImageNode | RTEmbedNode; | ||
/** | ||
* Rich text nodes with text | ||
*/ | ||
declare type RTTextNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode; | ||
/** | ||
* Rich Text block nodes | ||
*/ | ||
declare type RTBlockNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTListNode | RTOListNode | RTImageNode | RTEmbedNode; | ||
/** | ||
* Inline Rich Text Nodes | ||
*/ | ||
declare type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode; | ||
/** | ||
* All Rich Text nodes | ||
*/ | ||
declare type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode; | ||
/** | ||
* Rich Text Field | ||
* | ||
* @see More details: {@link https://prismic.io/docs/technologies/adding-the-slicezone-component-nextjs} | ||
* @see Rich Text field documentation: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
declare type SliceZone<Slices extends Slice | SharedSlice = Slice | SharedSlice, State extends FieldState = FieldState> = State extends "empty" ? [] : [Slices, ...Slices[]]; | ||
declare type AnyRegularField = TitleField | RichTextField | ImageField | RelationField | LinkField | LinkToMediaField | DateField | TimestampField | ColorField | NumberField | KeyTextField | SelectField | BooleanField | EmbedField | GeoPointField | IntegrationFields; | ||
declare type RichTextField<State extends FieldState = FieldState> = State extends "empty" ? [] : [RTNode, ...RTNode[]]; | ||
@@ -725,122 +757,42 @@ /** | ||
/** | ||
* A Prismic Custom Type model. | ||
* A Link Custom Type field. | ||
* | ||
* @typeParam ID - API ID of the Custom Type. | ||
* @typeParam Definition - The Custom Type's tabs and their fields. | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
*/ | ||
interface CustomTypeModel<ID extends string = string, Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition> { | ||
/** | ||
* The ID of the Custom Type model. | ||
*/ | ||
id: ID; | ||
/** | ||
* The human readable name of the Custom Type Model. | ||
*/ | ||
label: string | null | undefined; | ||
/** | ||
* Determines if more than one document for the Custom Type can be created. | ||
*/ | ||
repeatable: boolean; | ||
/** | ||
* The Custom Type model definition. | ||
*/ | ||
json: Definition; | ||
/** | ||
* Determines if new documents for the Custom Type can be created. | ||
*/ | ||
status: boolean; | ||
} | ||
/** | ||
* A Prismic Custom Type's tabs and their fields. | ||
* | ||
* @typeParam TabName - Names of Custom Type tabs. | ||
*/ | ||
declare type CustomTypeModelDefinition<TabName extends string = string> = Record<TabName, CustomTypeModelTab>; | ||
/** | ||
* A Custom Type's tab. Each tab can contain any number of fields but is limited | ||
* to one Slice Zone. | ||
* | ||
* @typeParam FieldName - API IDs of the fields. | ||
*/ | ||
declare type CustomTypeModelTab<Fields extends Record<string, CustomTypeModelField> = Record<string, CustomTypeModelField>> = Fields; | ||
/** | ||
* A Custom Type field. | ||
*/ | ||
declare type CustomTypeModelField = CustomTypeModelUIDField | CustomTypeModelGroupField | CustomTypeModelSliceZoneField | CustomTypeModelFieldForGroup; | ||
/** | ||
* Any Custom Type field that is valid for a Group field. | ||
*/ | ||
declare type CustomTypeModelFieldForGroup = CustomTypeModelBooleanField | CustomTypeModelColorField | CustomTypeModelDateField | CustomTypeModelEmbedField | CustomTypeModelGeoPointField | CustomTypeModelImageField | CustomTypeModelIntegrationFieldsField | CustomTypeModelContentRelationshipField | CustomTypeModelLinkField | CustomTypeModelLinkToMediaField | CustomTypeModelNumberField | CustomTypeModelRangeField | CustomTypeModelSelectField | CustomTypeModelRichTextField | CustomTypeModelTitleField | CustomTypeModelKeyTextField | CustomTypeModelTimestampField | CustomTypeModelSeparatorField; | ||
/** | ||
* Type identifier for a Custom Type field. | ||
*/ | ||
declare const CustomTypeModelFieldType: { | ||
readonly Boolean: "Boolean"; | ||
readonly Color: "Color"; | ||
readonly Date: "Date"; | ||
readonly Embed: "Embed"; | ||
readonly GeoPoint: "GeoPoint"; | ||
readonly Group: "Group"; | ||
readonly Image: "Image"; | ||
readonly IntegrationFields: "IntegrationFields"; | ||
readonly Link: "Link"; | ||
readonly Number: "Number"; | ||
readonly Select: "Select"; | ||
readonly Slices: "Slices"; | ||
readonly StructuredText: "StructuredText"; | ||
readonly Text: "Text"; | ||
readonly Timestamp: "Timestamp"; | ||
readonly UID: "UID"; | ||
/** | ||
* @deprecated - Legacy field type. Use `Number` instead. | ||
*/ | ||
readonly Range: "Range"; | ||
/** | ||
* @deprecated - Legacy field type. Do not use. | ||
*/ | ||
readonly Separator: "Separator"; | ||
/** | ||
* @deprecated - Legacy field type. Use `Slices` instead. | ||
*/ | ||
readonly LegacySlices: "Choice"; | ||
}; | ||
/** | ||
* A Boolean Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/boolean} | ||
*/ | ||
interface CustomTypeModelBooleanField { | ||
type: typeof CustomTypeModelFieldType.Boolean; | ||
interface CustomTypeModelLinkField { | ||
type: typeof CustomTypeModelFieldType.Link; | ||
config?: { | ||
label?: string | null; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
placeholder?: string; | ||
select?: null | typeof CustomTypeModelLinkSelectType[keyof typeof CustomTypeModelLinkSelectType]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
} | ||
/** | ||
* A Color Custom Type field. | ||
* Type of a Link Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/color} | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
*/ | ||
interface CustomTypeModelColorField { | ||
type: typeof CustomTypeModelFieldType.Color; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
}; | ||
} | ||
declare const CustomTypeModelLinkSelectType: { | ||
readonly Document: "document"; | ||
readonly Media: "media"; | ||
readonly Web: "web"; | ||
}; | ||
/** | ||
* A Date Custom Type field. | ||
* A Content Relationship Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/date} | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
*/ | ||
interface CustomTypeModelDateField { | ||
type: typeof CustomTypeModelFieldType.Date; | ||
interface CustomTypeModelContentRelationshipField<CustomTypeIDs extends string = string, Tags extends string = string> { | ||
type: typeof CustomTypeModelFieldType.Link; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
default?: string; | ||
select: typeof CustomTypeModelLinkSelectType.Document; | ||
customtypes?: readonly CustomTypeIDs[]; | ||
tags?: readonly Tags[]; | ||
}; | ||
} | ||
/** | ||
@@ -858,26 +810,19 @@ * An Embed Custom Type field. | ||
} | ||
/** | ||
* A GeoPoint Custom Type field. | ||
* Dimension constraints for an Image Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/geopoint} | ||
* More details: {@link https://prismic.io/docs/core-concepts/image} | ||
*/ | ||
interface CustomTypeModelGeoPointField { | ||
type: typeof CustomTypeModelFieldType.GeoPoint; | ||
config?: { | ||
label?: string | null; | ||
}; | ||
interface CustomTypeModelImageConstraint { | ||
width?: number | null; | ||
height?: number | null; | ||
} | ||
/** | ||
* A Group Custom Type field. | ||
* A thumbnail for an Image Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/group} | ||
* | ||
* @typeParam Fields - A record of fields that can be repeated. | ||
* More details: {@link https://prismic.io/docs/core-concepts/image} | ||
*/ | ||
interface CustomTypeModelGroupField<Fields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>> { | ||
type: typeof CustomTypeModelFieldType.Group; | ||
config?: { | ||
label?: string | null; | ||
fields?: Fields; | ||
}; | ||
interface CustomTypeModelImageThumbnail<Name extends string = string> extends CustomTypeModelImageConstraint { | ||
name: Name; | ||
} | ||
@@ -897,103 +842,121 @@ /** | ||
} | ||
/** | ||
* Dimension constraints for an Image Custom Type field. | ||
* A Link to Media Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/image} | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
*/ | ||
interface CustomTypeModelImageConstraint { | ||
width?: number | null; | ||
height?: number | null; | ||
interface CustomTypeModelLinkToMediaField { | ||
type: typeof CustomTypeModelFieldType.Link; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
select: typeof CustomTypeModelLinkSelectType.Media; | ||
}; | ||
} | ||
/** | ||
* A thumbnail for an Image Custom Type field. | ||
* A Rich Text Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/image} | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
interface CustomTypeModelImageThumbnail<Name extends string = string> extends CustomTypeModelImageConstraint { | ||
name: Name; | ||
declare type CustomTypeModelRichTextField = CustomTypeModelRichTextMultiField | CustomTypeModelRichTextSingleField; | ||
/** | ||
* A Rich Text Custom Type field which supports multiple blocks of content. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
interface CustomTypeModelRichTextMultiField { | ||
type: typeof CustomTypeModelFieldType.StructuredText; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
allowTargetBlank?: boolean; | ||
multi?: string; | ||
}; | ||
} | ||
/** | ||
* An Integration Fields Custom Type field. | ||
* A Rich Text Custom Type field which supports one block of content. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/integration-fields} | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
interface CustomTypeModelIntegrationFieldsField { | ||
type: typeof CustomTypeModelFieldType.IntegrationFields; | ||
interface CustomTypeModelRichTextSingleField { | ||
type: typeof CustomTypeModelFieldType.StructuredText; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
catalog?: string; | ||
allowTargetBlank?: boolean; | ||
single?: string; | ||
}; | ||
} | ||
/** | ||
* Type of a Link Custom Type field. | ||
* A Title Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
declare const CustomTypeModelLinkSelectType: { | ||
readonly Document: "document"; | ||
readonly Media: "media"; | ||
readonly Web: "web"; | ||
}; | ||
declare type CustomTypeModelTitleField = CustomTypeModelRichTextSingleField; | ||
/** | ||
* A Content Relationship Custom Type field. | ||
* A Boolean Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
* More details: {@link https://prismic.io/docs/core-concepts/boolean} | ||
*/ | ||
interface CustomTypeModelContentRelationshipField<CustomTypeIDs extends string = string, Tags extends string = string> { | ||
type: typeof CustomTypeModelFieldType.Link; | ||
interface CustomTypeModelBooleanField { | ||
type: typeof CustomTypeModelFieldType.Boolean; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
select: typeof CustomTypeModelLinkSelectType.Document; | ||
customtypes?: readonly CustomTypeIDs[]; | ||
tags?: readonly Tags[]; | ||
default_value?: boolean; | ||
placeholder_true?: string; | ||
placeholder_false?: string; | ||
}; | ||
} | ||
/** | ||
* A Link Custom Type field. | ||
* A Color Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
* More details: {@link https://prismic.io/docs/core-concepts/color} | ||
*/ | ||
interface CustomTypeModelLinkField { | ||
type: typeof CustomTypeModelFieldType.Link; | ||
interface CustomTypeModelColorField { | ||
type: typeof CustomTypeModelFieldType.Color; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
select?: null | typeof CustomTypeModelLinkSelectType[keyof typeof CustomTypeModelLinkSelectType]; | ||
allowTargetBlank?: boolean; | ||
}; | ||
} | ||
/** | ||
* A Link to Media Custom Type field. | ||
* A Date Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/link-content-relationship} | ||
* More details: {@link https://prismic.io/docs/core-concepts/date} | ||
*/ | ||
interface CustomTypeModelLinkToMediaField { | ||
type: typeof CustomTypeModelFieldType.Link; | ||
interface CustomTypeModelDateField { | ||
type: typeof CustomTypeModelFieldType.Date; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
select: typeof CustomTypeModelLinkSelectType.Media; | ||
default?: string; | ||
}; | ||
} | ||
/** | ||
* A Number Custom Type field. | ||
* A Key Text Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/number} | ||
* More details: {@link https://prismic.io/docs/core-concepts/key-text} | ||
*/ | ||
interface CustomTypeModelNumberField { | ||
type: typeof CustomTypeModelFieldType.Number; | ||
interface CustomTypeModelKeyTextField { | ||
type: typeof CustomTypeModelFieldType.Text; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
}; | ||
} | ||
/** | ||
* @deprecated - Legacy field. Use `CustomTypeModelNumberField` instead. | ||
* A Number Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/number} | ||
*/ | ||
interface CustomTypeModelRangeField { | ||
type: typeof CustomTypeModelFieldType.Range; | ||
interface CustomTypeModelNumberField { | ||
type: typeof CustomTypeModelFieldType.Number; | ||
config?: { | ||
@@ -1004,5 +967,5 @@ label?: string | null; | ||
max?: number; | ||
step?: number; | ||
}; | ||
} | ||
/** | ||
@@ -1025,89 +988,90 @@ * A Select Custom Type field. | ||
} | ||
/** | ||
* A Rich Text Custom Type field. | ||
* A Timestamp Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
* More details: {@link https://prismic.io/docs/core-concepts/timestamp} | ||
*/ | ||
declare type CustomTypeModelRichTextField = CustomTypeModelRichTextMultiField | CustomTypeModelRichTextSingleField; | ||
/** | ||
* A Rich Text Custom Type field which supports multiple blocks of content. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
*/ | ||
interface CustomTypeModelRichTextMultiField { | ||
type: typeof CustomTypeModelFieldType.StructuredText; | ||
interface CustomTypeModelTimestampField { | ||
type: typeof CustomTypeModelFieldType.Timestamp; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
allowTargetBlank?: boolean; | ||
multi?: string; | ||
default?: string; | ||
}; | ||
} | ||
/** | ||
* A Rich Text Custom Type field which supports one block of content. | ||
* A GeoPoint Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
* More details: {@link https://prismic.io/docs/core-concepts/geopoint} | ||
*/ | ||
interface CustomTypeModelRichTextSingleField { | ||
type: typeof CustomTypeModelFieldType.StructuredText; | ||
interface CustomTypeModelGeoPointField { | ||
type: typeof CustomTypeModelFieldType.GeoPoint; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
allowTargetBlank?: boolean; | ||
single?: string; | ||
}; | ||
} | ||
/** | ||
* A Title Custom Type field. | ||
* An Integration Fields Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title} | ||
* More details: {@link https://prismic.io/docs/core-concepts/integration-fields} | ||
*/ | ||
declare type CustomTypeModelTitleField = CustomTypeModelRichTextSingleField; | ||
/** | ||
* A Key Text Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/key-text} | ||
*/ | ||
interface CustomTypeModelKeyTextField { | ||
type: typeof CustomTypeModelFieldType.Text; | ||
interface CustomTypeModelIntegrationFieldsField { | ||
type: typeof CustomTypeModelFieldType.IntegrationFields; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
catalog?: string; | ||
}; | ||
} | ||
/** | ||
* A Timestamp Custom Type field. | ||
* A Group Custom Type field. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/timestamp} | ||
* More details: {@link https://prismic.io/docs/core-concepts/group} | ||
* | ||
* @typeParam Fields - A record of fields that can be repeated. | ||
*/ | ||
interface CustomTypeModelTimestampField { | ||
type: typeof CustomTypeModelFieldType.Timestamp; | ||
interface CustomTypeModelGroupField<Fields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>> { | ||
type: typeof CustomTypeModelFieldType.Group; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
default?: string; | ||
fields?: Fields; | ||
}; | ||
} | ||
/** | ||
* A UID Custom Type field. | ||
* A Slice for a Custom Type. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/uid} | ||
* More details: {@link https://prismic.io/docs/core-concepts/slices} | ||
* | ||
* @typeParam NonRepeatFields - A record of fields that cannnot be repeated. | ||
* @typeParam RepeatFields - A record of fields that can be repeated. | ||
*/ | ||
interface CustomTypeModelUIDField { | ||
type: typeof CustomTypeModelFieldType.UID; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
}; | ||
interface CustomTypeModelSlice<NonRepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>, RepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>> { | ||
type: typeof CustomTypeModelSliceType.Slice; | ||
fieldset?: string | null; | ||
description?: string; | ||
icon?: string; | ||
display?: typeof CustomTypeModelSliceDisplay[keyof typeof CustomTypeModelSliceDisplay] | string; | ||
"non-repeat"?: NonRepeatFields; | ||
repeat?: RepeatFields; | ||
} | ||
/** | ||
* @deprecated - Legacy field. Do not use. | ||
* Display type for a Slice. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/slices} | ||
*/ | ||
interface CustomTypeModelSeparatorField { | ||
type: typeof CustomTypeModelFieldType.Separator; | ||
config?: { | ||
label?: string | null; | ||
}; | ||
} | ||
declare const CustomTypeModelSliceDisplay: { | ||
readonly List: "list"; | ||
readonly Grid: "grid"; | ||
}; | ||
/** | ||
* @deprecated - Legacy slice type. Do not use. | ||
*/ | ||
declare type CustomTypeModelLegacySlice = CustomTypeModelGroupField | CustomTypeModelFieldForGroup; | ||
/** | ||
* A Slice Zone Custom Type field. | ||
@@ -1135,11 +1099,2 @@ * | ||
/** | ||
* Display type for a Slice. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/slices} | ||
*/ | ||
declare const CustomTypeModelSliceDisplay: { | ||
readonly List: "list"; | ||
readonly Grid: "grid"; | ||
}; | ||
/** | ||
* Type identifier for a Slice. | ||
@@ -1154,19 +1109,2 @@ * | ||
/** | ||
* A Slice for a Custom Type. | ||
* | ||
* More details: {@link https://prismic.io/docs/core-concepts/slices} | ||
* | ||
* @typeParam NonRepeatFields - A record of fields that cannnot be repeated. | ||
* @typeParam RepeatFields - A record of fields that can be repeated. | ||
*/ | ||
interface CustomTypeModelSlice<NonRepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>, RepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>> { | ||
type: typeof CustomTypeModelSliceType.Slice; | ||
fieldset?: string | null; | ||
description?: string; | ||
icon?: string; | ||
display?: typeof CustomTypeModelSliceDisplay[keyof typeof CustomTypeModelSliceDisplay] | string; | ||
"non-repeat"?: NonRepeatFields; | ||
repeat?: RepeatFields; | ||
} | ||
/** | ||
* A Shared Slice for a Custom Type. | ||
@@ -1182,20 +1120,125 @@ * | ||
} | ||
/** | ||
* A Prismic Shared Slice model. | ||
* A UID Custom Type field. | ||
* | ||
* More details: | ||
* More details: {@link https://prismic.io/docs/core-concepts/uid} | ||
*/ | ||
interface CustomTypeModelUIDField { | ||
type: typeof CustomTypeModelFieldType.UID; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
}; | ||
} | ||
/** | ||
* @deprecated - Legacy field. Use `CustomTypeModelNumberField` instead. | ||
*/ | ||
interface CustomTypeModelRangeField { | ||
type: typeof CustomTypeModelFieldType.Range; | ||
config?: { | ||
label?: string | null; | ||
placeholder?: string; | ||
min?: number; | ||
max?: number; | ||
step?: number; | ||
}; | ||
} | ||
/** | ||
* @deprecated - Legacy field. Do not use. | ||
*/ | ||
interface CustomTypeModelSeparatorField { | ||
type: typeof CustomTypeModelFieldType.Separator; | ||
config?: { | ||
label?: string | null; | ||
}; | ||
} | ||
/** | ||
* Type identifier for a Custom Type field. | ||
*/ | ||
declare const CustomTypeModelFieldType: { | ||
readonly Boolean: "Boolean"; | ||
readonly Color: "Color"; | ||
readonly Date: "Date"; | ||
readonly Embed: "Embed"; | ||
readonly GeoPoint: "GeoPoint"; | ||
readonly Group: "Group"; | ||
readonly Image: "Image"; | ||
readonly IntegrationFields: "IntegrationFields"; | ||
readonly Link: "Link"; | ||
readonly Number: "Number"; | ||
readonly Select: "Select"; | ||
readonly Slices: "Slices"; | ||
readonly StructuredText: "StructuredText"; | ||
readonly Text: "Text"; | ||
readonly Timestamp: "Timestamp"; | ||
readonly UID: "UID"; | ||
/** | ||
* @deprecated - Legacy field type. Use `Number` instead. | ||
*/ | ||
readonly Range: "Range"; | ||
/** | ||
* @deprecated - Legacy field type. Do not use. | ||
*/ | ||
readonly Separator: "Separator"; | ||
/** | ||
* @deprecated - Legacy field type. Use `Slices` instead. | ||
*/ | ||
readonly LegacySlices: "Choice"; | ||
}; | ||
/** | ||
* A Custom Type field. | ||
*/ | ||
declare type CustomTypeModelField = CustomTypeModelUIDField | CustomTypeModelGroupField | CustomTypeModelSliceZoneField | CustomTypeModelFieldForGroup; | ||
/** | ||
* Any Custom Type field that is valid for a Group field. | ||
*/ | ||
declare type CustomTypeModelFieldForGroup = CustomTypeModelBooleanField | CustomTypeModelColorField | CustomTypeModelDateField | CustomTypeModelEmbedField | CustomTypeModelGeoPointField | CustomTypeModelImageField | CustomTypeModelIntegrationFieldsField | CustomTypeModelContentRelationshipField | CustomTypeModelLinkField | CustomTypeModelLinkToMediaField | CustomTypeModelNumberField | CustomTypeModelRangeField | CustomTypeModelSelectField | CustomTypeModelRichTextField | CustomTypeModelTitleField | CustomTypeModelKeyTextField | CustomTypeModelTimestampField | CustomTypeModelSeparatorField; | ||
/** | ||
* A Prismic Custom Type model. | ||
* | ||
* - {@link https://prismic.io/docs/core-concepts/slices} | ||
* - {@link https://prismic.io/docs/core-concepts/reusing-slices} | ||
* | ||
* @typeParam Variation - A variation for the Shared Slice. | ||
* @typeParam ID - API ID of the Custom Type. | ||
* @typeParam Definition - The Custom Type's tabs and their fields. | ||
*/ | ||
interface SharedSliceModel<ID extends string = string, Variation extends SharedSliceModelVariation = SharedSliceModelVariation> { | ||
type: typeof CustomTypeModelSliceType.SharedSlice; | ||
interface CustomTypeModel<ID extends string = string, Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition> { | ||
/** | ||
* The ID of the Custom Type model. | ||
*/ | ||
id: ID; | ||
name: string; | ||
description?: string; | ||
variations: readonly Variation[]; | ||
/** | ||
* The human readable name of the Custom Type Model. | ||
*/ | ||
label: string | null | undefined; | ||
/** | ||
* Determines if more than one document for the Custom Type can be created. | ||
*/ | ||
repeatable: boolean; | ||
/** | ||
* The Custom Type model definition. | ||
*/ | ||
json: Definition; | ||
/** | ||
* Determines if new documents for the Custom Type can be created. | ||
*/ | ||
status: boolean; | ||
} | ||
/** | ||
* A Prismic Custom Type's tabs and their fields. | ||
* | ||
* @typeParam TabName - Names of Custom Type tabs. | ||
*/ | ||
declare type CustomTypeModelDefinition<TabName extends string = string> = Record<TabName, CustomTypeModelTab>; | ||
/** | ||
* A Custom Type's tab. Each tab can contain any number of fields but is limited | ||
* to one Slice Zone. | ||
* | ||
* @typeParam FieldName - API IDs of the fields. | ||
*/ | ||
declare type CustomTypeModelTab<Fields extends Record<string, CustomTypeModelField> = Record<string, CustomTypeModelField>> = Fields; | ||
/** | ||
* A Shared Slice variation. | ||
@@ -1221,66 +1264,63 @@ * | ||
} | ||
/** | ||
* @deprecated - Legacy slice type. Do not use. | ||
* A Prismic Shared Slice model. | ||
* | ||
* More details: | ||
* | ||
* - {@link https://prismic.io/docs/core-concepts/slices} | ||
* - {@link https://prismic.io/docs/core-concepts/reusing-slices} | ||
* | ||
* @typeParam Variation - A variation for the Shared Slice. | ||
*/ | ||
declare type CustomTypeModelLegacySlice = CustomTypeModelGroupField | CustomTypeModelFieldForGroup; | ||
interface SharedSliceModel<ID extends string = string, Variation extends SharedSliceModelVariation = SharedSliceModelVariation> { | ||
type: typeof CustomTypeModelSliceType.SharedSlice; | ||
id: ID; | ||
name: string; | ||
description?: string; | ||
variations: readonly Variation[]; | ||
} | ||
/** | ||
* Repository metadata returned from the Prismic REST API V2. This data can be | ||
* fetched by sending a `GET` a request to a repository's `/api/v2` endpoint. | ||
* A query response from the Prismic REST API V2. The response contains | ||
* paginated metadata and a list of matching results for the query. | ||
* | ||
* @see More details on the `/api/v2` endpoint: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#the-api-endpoint-2} | ||
* @typeParam Document - The type(s) of Prismic document that can be returned. | ||
* @see More details on querying: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api} | ||
*/ | ||
interface Repository { | ||
interface Query<Document extends PrismicDocument = PrismicDocument> { | ||
/** | ||
* A list of refs for the repository. | ||
* | ||
* @see {@link Ref} | ||
* The page number for this page of results. | ||
*/ | ||
refs: Ref[]; | ||
page: number; | ||
/** | ||
* An identifier used to query content with the latest Integration Fields data. | ||
* Maximum number of results per page. | ||
*/ | ||
integrationFieldsRef: string | null; | ||
results_per_page: number; | ||
/** | ||
* A list of languages for the repository. | ||
* | ||
* @see {@link Language} | ||
* Number of results in this page. | ||
*/ | ||
languages: Language[]; | ||
results_size: number; | ||
/** | ||
* A list of the repository's Custom Type API IDs mapped to their human-readable name. | ||
* Total number of results within all pages. | ||
*/ | ||
types: Record<string, string>; | ||
total_results_size: number; | ||
/** | ||
* A list of tags for the repository. | ||
* Total number of pages. | ||
*/ | ||
tags: string[]; | ||
total_pages: number; | ||
/** | ||
* An internally-used list of REST API features for the repository. | ||
* | ||
* @internal | ||
* The Prismic REST API V2 URL to the next page, if one exists. | ||
*/ | ||
forms: Record<string, Form>; | ||
next_page: string | null; | ||
/** | ||
* The URL used to begin the OAuth process for the repository. | ||
* The Prismic REST API V2 URL to the previous page, if one exists. | ||
*/ | ||
oauth_initiate: string; | ||
oauth_token: string; | ||
prev_page: string | null; | ||
/** | ||
* The version of the API. | ||
* A paginated list of documents matching the query. | ||
*/ | ||
version: string; | ||
/** | ||
* Licensing information for the repository content. | ||
*/ | ||
license: string; | ||
/** | ||
* @deprecated Experiments are no longer part of Prismic. | ||
*/ | ||
experiments: unknown; | ||
/** | ||
* @deprecated Bookmarks are not longer part of Prismic. | ||
*/ | ||
bookmarks: Record<string, string>; | ||
results: Document[]; | ||
} | ||
/** | ||
@@ -1317,2 +1357,3 @@ * Metadata for a reference to a version of a repository's content. | ||
} | ||
/** | ||
@@ -1327,57 +1368,76 @@ * Metadata for a Release. | ||
declare type Release = Ref; | ||
/** | ||
* Metadata for a language that has been configured for a repository. | ||
* Repository metadata returned from the Prismic REST API V2. This data can be | ||
* fetched by sending a `GET` a request to a repository's `/api/v2` endpoint. | ||
* | ||
* @see More details on the `/api/v2` endpoint: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#the-api-endpoint-2} | ||
*/ | ||
interface Language { | ||
interface Repository { | ||
/** | ||
* A unique identifier for the language. | ||
* A list of refs for the repository. | ||
* | ||
* @see {@link Ref} | ||
*/ | ||
id: string; | ||
refs: Ref[]; | ||
/** | ||
* The name of the language. | ||
* An identifier used to query content with the latest Integration Fields data. | ||
*/ | ||
name: string; | ||
} | ||
/** | ||
* A query response from the Prismic REST API V2. The response contains | ||
* paginated metadata and a list of matching results for the query. | ||
* | ||
* @typeParam Document - The type(s) of Prismic document that can be returned. | ||
* @see More details on querying: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api} | ||
*/ | ||
interface Query<Document extends PrismicDocument = PrismicDocument> { | ||
integrationFieldsRef: string | null; | ||
/** | ||
* The page number for this page of results. | ||
* A list of languages for the repository. | ||
* | ||
* @see {@link Language} | ||
*/ | ||
page: number; | ||
languages: Language[]; | ||
/** | ||
* Maximum number of results per page. | ||
* A list of the repository's Custom Type API IDs mapped to their human-readable name. | ||
*/ | ||
results_per_page: number; | ||
types: Record<string, string>; | ||
/** | ||
* Number of results in this page. | ||
* A list of tags for the repository. | ||
*/ | ||
results_size: number; | ||
tags: string[]; | ||
/** | ||
* Total number of results within all pages. | ||
* An internally-used list of REST API features for the repository. | ||
* | ||
* @internal | ||
*/ | ||
total_results_size: number; | ||
forms: Record<string, Form>; | ||
/** | ||
* Total number of pages. | ||
* The URL used to begin the OAuth process for the repository. | ||
*/ | ||
total_pages: number; | ||
oauth_initiate: string; | ||
oauth_token: string; | ||
/** | ||
* The Prismic REST API V2 URL to the next page, if one exists. | ||
* The version of the API. | ||
*/ | ||
next_page: string | null; | ||
version: string; | ||
/** | ||
* The Prismic REST API V2 URL to the previous page, if one exists. | ||
* Licensing information for the repository content. | ||
*/ | ||
prev_page: string | null; | ||
license: string; | ||
/** | ||
* A paginated list of documents matching the query. | ||
* @deprecated Experiments are no longer part of Prismic. | ||
*/ | ||
results: Document[]; | ||
experiments: unknown; | ||
/** | ||
* @deprecated Bookmarks are not longer part of Prismic. | ||
*/ | ||
bookmarks: Record<string, string>; | ||
} | ||
/** | ||
* Metadata for a language that has been configured for a repository. | ||
*/ | ||
interface Language { | ||
/** | ||
* A unique identifier for the language. | ||
*/ | ||
id: string; | ||
/** | ||
* The name of the language. | ||
*/ | ||
name: string; | ||
} | ||
/** | ||
* A Prismic REST API V2 feature supported by the repository. It contains | ||
@@ -1407,2 +1467,3 @@ * metadata about the feature and how to interact with it via the API. | ||
} | ||
/** | ||
@@ -1417,19 +1478,3 @@ * List of tags returned from the Prismic Tags API. This data can be fetched by | ||
declare type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger; | ||
/** | ||
* Types of Prismic Webhooks. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks} | ||
*/ | ||
declare const WebhookType: { | ||
readonly APIUpdate: "api-update"; | ||
readonly TestTrigger: "test-trigger"; | ||
}; | ||
interface WebhookBodyBase { | ||
type: typeof WebhookType[keyof typeof WebhookType]; | ||
domain: string; | ||
apiUrl: string; | ||
secret: string | null; | ||
} | ||
/** | ||
* Webhook payload sent when a Prismic repository content is updated. | ||
@@ -1451,10 +1496,2 @@ * | ||
} | ||
/** | ||
* Webhook payload sent when a test webhook action is triggered. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks} | ||
*/ | ||
interface WebhookBodyTestTrigger extends WebhookBodyBase { | ||
type: typeof WebhookType.TestTrigger; | ||
} | ||
interface WebhookBodyAPIUpdateOperations<T> { | ||
@@ -1495,17 +1532,27 @@ update?: T[]; | ||
/** | ||
* @deprecated Use {@link OEmbedType} instead. | ||
* Webhook payload sent when a test webhook action is triggered. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks} | ||
*/ | ||
declare const EmbedType: { | ||
readonly Photo: "photo"; | ||
readonly Video: "video"; | ||
readonly Link: "link"; | ||
readonly Rich: "rich"; | ||
}; | ||
interface WebhookBodyTestTrigger extends WebhookBodyBase { | ||
type: typeof WebhookType.TestTrigger; | ||
} | ||
declare type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger; | ||
/** | ||
* @deprecated Use {@link PhotoOEmbed}, {@link VideoOEmbed}, {@link LinkOEmbed}, | ||
* {@link RichOEmbed}, or {@link AnyOEmbed} instead. | ||
* Types of Prismic Webhooks. | ||
* | ||
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks} | ||
*/ | ||
declare type CommonEmbedData = AnyOEmbed & OEmbedExtra; | ||
declare const WebhookType: { | ||
readonly APIUpdate: "api-update"; | ||
readonly TestTrigger: "test-trigger"; | ||
}; | ||
interface WebhookBodyBase { | ||
type: typeof WebhookType[keyof typeof WebhookType]; | ||
domain: string; | ||
apiUrl: string; | ||
secret: string | null; | ||
} | ||
export { AlternateLanguage, AnyOEmbed, AnyRegularField, BooleanField, ColorField, CommonEmbedData, CustomTypeModel, CustomTypeModelBooleanField, CustomTypeModelColorField, CustomTypeModelContentRelationshipField, CustomTypeModelDateField, CustomTypeModelDefinition, CustomTypeModelEmbedField, CustomTypeModelField, CustomTypeModelFieldForGroup, CustomTypeModelFieldType, CustomTypeModelGeoPointField, CustomTypeModelGroupField, CustomTypeModelImageConstraint, CustomTypeModelImageField, CustomTypeModelImageThumbnail, CustomTypeModelIntegrationFieldsField, CustomTypeModelKeyTextField, CustomTypeModelLegacySlice, CustomTypeModelLinkField, CustomTypeModelLinkSelectType, CustomTypeModelLinkToMediaField, CustomTypeModelNumberField, CustomTypeModelRangeField, CustomTypeModelRichTextField, CustomTypeModelRichTextMultiField, CustomTypeModelRichTextSingleField, CustomTypeModelSelectField, CustomTypeModelSeparatorField, CustomTypeModelSharedSlice, CustomTypeModelSlice, CustomTypeModelSliceDisplay, CustomTypeModelSliceLabel, CustomTypeModelSliceType, CustomTypeModelSliceZoneField, CustomTypeModelTab, CustomTypeModelTimestampField, CustomTypeModelTitleField, CustomTypeModelUIDField, DateField, EmbedField, EmbedType, EmptyImageFieldImage, EmptyLinkField, FieldState, FilledImageFieldImage, FilledLinkToDocumentField, FilledLinkToMediaField, FilledLinkToWebField, Form, FormField, GeoPointField, GroupField, ImageField, ImageFieldImage, IntegrationFields, KeyTextField, Language, LinkField, LinkOEmbed, LinkToMediaField, LinkType, NumberField, OEmbedExtra, OEmbedType, PhotoOEmbed, PrismicDocument, PrismicDocumentHeader, PrismicDocumentWithUID, PrismicDocumentWithoutUID, Query, RTAnyNode, RTBlockNode, RTEmNode, RTEmbedNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTImageNode, RTInlineNode, RTLabelNode, RTLinkNode, RTListItemNode, RTListNode, RTNode, RTOListItemNode, RTOListNode, RTParagraphNode, RTPreformattedNode, RTSpanNode, RTSpanNodeBase, RTStrongNode, RTTextNode, RTTextNodeBase, Ref, RelationField, Release, Repository, RichOEmbed, RichTextField, RichTextNodeType, SelectField, SharedSlice, SharedSliceModel, SharedSliceModelVariation, SharedSliceVariation, Slice, SliceZone, Tags, TimestampField, TitleField, VideoOEmbed, WebhookBody, WebhookBodyAPIUpdate, WebhookBodyTestTrigger, WebhookType }; | ||
export { AlternateLanguage, AnyOEmbed, AnyRegularField, BooleanField, ColorField, ContentRelationshipField, CustomTypeModel, CustomTypeModelBooleanField, CustomTypeModelColorField, CustomTypeModelContentRelationshipField, CustomTypeModelDateField, CustomTypeModelDefinition, CustomTypeModelEmbedField, CustomTypeModelField, CustomTypeModelFieldForGroup, CustomTypeModelFieldType, CustomTypeModelGeoPointField, CustomTypeModelGroupField, CustomTypeModelImageConstraint, CustomTypeModelImageField, CustomTypeModelImageThumbnail, CustomTypeModelIntegrationFieldsField, CustomTypeModelKeyTextField, CustomTypeModelLegacySlice, CustomTypeModelLinkField, CustomTypeModelLinkSelectType, CustomTypeModelLinkToMediaField, CustomTypeModelNumberField, CustomTypeModelRangeField, CustomTypeModelRichTextField, CustomTypeModelRichTextMultiField, CustomTypeModelRichTextSingleField, CustomTypeModelSelectField, CustomTypeModelSeparatorField, CustomTypeModelSharedSlice, CustomTypeModelSlice, CustomTypeModelSliceDisplay, CustomTypeModelSliceLabel, CustomTypeModelSliceType, CustomTypeModelSliceZoneField, CustomTypeModelTab, CustomTypeModelTimestampField, CustomTypeModelTitleField, CustomTypeModelUIDField, DateField, EmbedField, EmptyImageFieldImage, EmptyLinkField, FieldState, FilledContentRelationshipField, FilledImageFieldImage, FilledContentRelationshipField as FilledLinkToDocumentField, FilledLinkToMediaField, FilledLinkToWebField, Form, FormField, GeoPointField, GroupField, ImageField, ImageFieldImage, IntegrationFields, KeyTextField, Language, LinkField, LinkOEmbed, LinkToMediaField, LinkType, NumberField, OEmbedExtra, OEmbedType, PhotoOEmbed, PrismicDocument, PrismicDocumentHeader, PrismicDocumentWithUID, PrismicDocumentWithoutUID, Query, RTAnyNode, RTBlockNode, RTEmNode, RTEmbedNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTImageNode, RTInlineNode, RTLabelNode, RTLinkNode, RTListItemNode, RTListNode, RTNode, RTOListItemNode, RTOListNode, RTParagraphNode, RTPreformattedNode, RTSpanNode, RTSpanNodeBase, RTStrongNode, RTTextNode, RTTextNodeBase, Ref, ContentRelationshipField as RelationField, Release, Repository, RichOEmbed, RichTextField, RichTextNodeType, SelectField, SharedSlice, SharedSliceModel, SharedSliceModelVariation, SharedSliceVariation, Slice, SliceZone, Tags, TimestampField, TitleField, VideoOEmbed, WebhookBody, WebhookBodyAPIUpdate, WebhookBodyTestTrigger, WebhookType }; |
@@ -22,2 +22,3 @@ const RichTextNodeType = { | ||
}; | ||
const LinkType = { | ||
@@ -29,2 +30,3 @@ Any: "Any", | ||
}; | ||
const OEmbedType = { | ||
@@ -58,2 +60,3 @@ Photo: "photo", | ||
}; | ||
const CustomTypeModelLinkSelectType = { | ||
@@ -64,6 +67,3 @@ Document: "document", | ||
}; | ||
const CustomTypeModelSliceDisplay = { | ||
List: "list", | ||
Grid: "grid" | ||
}; | ||
const CustomTypeModelSliceType = { | ||
@@ -74,2 +74,7 @@ Slice: "Slice", | ||
const CustomTypeModelSliceDisplay = { | ||
List: "list", | ||
Grid: "grid" | ||
}; | ||
const WebhookType = { | ||
@@ -80,5 +85,3 @@ APIUpdate: "api-update", | ||
const EmbedType = OEmbedType; | ||
export { CustomTypeModelFieldType, CustomTypeModelLinkSelectType, CustomTypeModelSliceDisplay, CustomTypeModelSliceType, EmbedType, LinkType, OEmbedType, RichTextNodeType, WebhookType }; | ||
export { CustomTypeModelFieldType, CustomTypeModelLinkSelectType, CustomTypeModelSliceDisplay, CustomTypeModelSliceType, LinkType, OEmbedType, RichTextNodeType, WebhookType }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@prismicio/types", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Type definitions for Prismic related structure", | ||
@@ -60,10 +60,10 @@ "keywords": [ | ||
"devDependencies": { | ||
"@prismicio/types-internal": "^1.0.0-alpha.0", | ||
"@size-limit/preset-small-lib": "^7.0.8", | ||
"@typescript-eslint/eslint-plugin": "^5.30.0", | ||
"@typescript-eslint/parser": "^5.30.0", | ||
"c8": "^7.11.3", | ||
"eslint": "^8.18.0", | ||
"@prismicio/types-internal": "^1.1.1", | ||
"@size-limit/preset-small-lib": "^8.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.34.0", | ||
"@typescript-eslint/parser": "^5.34.0", | ||
"@vitest/coverage-c8": "^0.22.1", | ||
"eslint": "^8.22.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-tsdoc": "^0.2.16", | ||
@@ -73,7 +73,7 @@ "prettier": "^2.7.1", | ||
"siroc": "^0.16.0", | ||
"size-limit": "^7.0.8", | ||
"size-limit": "^8.0.1", | ||
"standard-version": "^9.5.0", | ||
"ts-expect": "^1.3.0", | ||
"typescript": "^4.7.4", | ||
"vitest": "^0.16.0" | ||
"vitest": "^0.22.1" | ||
}, | ||
@@ -80,0 +80,0 @@ "engines": { |
241
src/index.ts
@@ -0,21 +1,22 @@ | ||
// NOTE: The GraphQL exports are purposely not included in the root-level API. | ||
// Instead, they are provided under their own `/graphql` entry. | ||
//============================================================================= | ||
// Value - Types representing Prismic document and field values. | ||
//============================================================================= | ||
export { RichTextNodeType } from "./value/richText"; | ||
export { LinkType } from "./value/link"; | ||
export { OEmbedType } from "./value/embed"; | ||
export type { | ||
PrismicDocumentHeader, | ||
PrismicDocument, | ||
PrismicDocumentWithUID, | ||
PrismicDocumentWithoutUID, | ||
PrismicDocumentHeader, | ||
AlternateLanguage, | ||
} from "./document"; | ||
} from "./value/document"; | ||
export { RichTextNodeType, LinkType, OEmbedType } from "./fields"; | ||
// Deprecations | ||
import { OEmbedType } from "./fields"; | ||
/** | ||
* @deprecated Use {@link OEmbedType} instead. | ||
*/ | ||
export const EmbedType = OEmbedType; | ||
export type { | ||
// RichText & Title | ||
TitleField, | ||
RichTextField, | ||
@@ -54,3 +55,6 @@ // RichText & Title (block nodes) | ||
RTAnyNode, | ||
// Image | ||
} from "./value/richText"; | ||
export type { TitleField } from "./value/title"; | ||
export type { | ||
ImageField, | ||
@@ -60,11 +64,23 @@ ImageFieldImage, | ||
EmptyImageFieldImage, | ||
// Links | ||
} from "./value/image"; | ||
export type { | ||
EmptyLinkField, | ||
FilledLinkToDocumentField, | ||
LinkField, | ||
FilledLinkToWebField, | ||
} from "./value/link"; | ||
export type { | ||
ContentRelationshipField, | ||
// TODO: Remove in v1 | ||
ContentRelationshipField as RelationField, | ||
FilledContentRelationshipField, | ||
// TODO: Remove in v1 | ||
FilledContentRelationshipField as FilledLinkToDocumentField, | ||
} from "./value/contentRelationship"; | ||
export type { | ||
LinkToMediaField, | ||
FilledLinkToMediaField, | ||
RelationField, | ||
LinkField, | ||
LinkToMediaField, | ||
// Embed | ||
} from "./value/linkToMedia"; | ||
export type { | ||
OEmbedExtra, | ||
@@ -77,50 +93,33 @@ PhotoOEmbed, | ||
EmbedField, | ||
// Simple | ||
DateField, | ||
TimestampField, | ||
ColorField, | ||
NumberField, | ||
KeyTextField, | ||
SelectField, | ||
BooleanField, | ||
GeoPointField, | ||
// Complex | ||
GroupField, | ||
IntegrationFields, | ||
Slice, | ||
SharedSlice, | ||
SharedSliceVariation, | ||
SliceZone, | ||
// Misc | ||
AnyRegularField, | ||
// Meta | ||
FieldState, | ||
} from "./fields"; | ||
} from "./value/embed"; | ||
// Deprecations (unused import for @link references) | ||
import type { | ||
OEmbedExtra, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
PhotoOEmbed, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
VideoOEmbed, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
LinkOEmbed, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
RichOEmbed, | ||
AnyOEmbed, | ||
} from "./fields"; | ||
/** | ||
* @deprecated Use {@link PhotoOEmbed}, {@link VideoOEmbed}, {@link LinkOEmbed}, | ||
* {@link RichOEmbed}, or {@link AnyOEmbed} instead. | ||
*/ | ||
export type CommonEmbedData = AnyOEmbed & OEmbedExtra; | ||
export type { BooleanField } from "./value/boolean"; | ||
export type { ColorField } from "./value/color"; | ||
export type { DateField } from "./value/date"; | ||
export type { KeyTextField } from "./value/keyText"; | ||
export type { NumberField } from "./value/number"; | ||
export type { SelectField } from "./value/select"; | ||
export type { TimestampField } from "./value/timestamp"; | ||
export type { GeoPointField } from "./value/geoPoint"; | ||
export { | ||
CustomTypeModelFieldType, | ||
CustomTypeModelLinkSelectType, | ||
CustomTypeModelSliceDisplay, | ||
CustomTypeModelSliceType, | ||
} from "./customType"; | ||
export type { IntegrationFields } from "./value/integrationFields"; | ||
export type { GroupField } from "./value/group"; | ||
export type { SliceZone } from "./value/sliceZone"; | ||
export type { Slice } from "./value/slice"; | ||
export type { SharedSlice } from "./value/sharedSlice"; | ||
export type { SharedSliceVariation } from "./value/sharedSliceVariation"; | ||
export type { FieldState, AnyRegularField } from "./value/types"; | ||
//============================================================================= | ||
// Model - Types representing Prismic Custom Type and Shared Slice models. | ||
//============================================================================= | ||
export { CustomTypeModelFieldType } from "./model/types"; | ||
export { CustomTypeModelLinkSelectType } from "./model/link"; | ||
export { CustomTypeModelSliceType } from "./model/sliceZone"; | ||
export { CustomTypeModelSliceDisplay } from "./model/slice"; | ||
export type { | ||
@@ -130,58 +129,80 @@ CustomTypeModel, | ||
CustomTypeModelTab, | ||
// Fields | ||
CustomTypeModelField, | ||
CustomTypeModelFieldForGroup, | ||
// Individual Fields | ||
CustomTypeModelBooleanField, | ||
CustomTypeModelColorField, | ||
CustomTypeModelContentRelationshipField, | ||
CustomTypeModelDateField, | ||
CustomTypeModelEmbedField, | ||
CustomTypeModelGeoPointField, | ||
CustomTypeModelGroupField, | ||
CustomTypeModelImageConstraint, | ||
CustomTypeModelImageField, | ||
CustomTypeModelImageThumbnail, | ||
CustomTypeModelIntegrationFieldsField, | ||
CustomTypeModelKeyTextField, | ||
CustomTypeModelLinkField, | ||
CustomTypeModelLinkToMediaField, | ||
CustomTypeModelNumberField, | ||
CustomTypeModelRangeField, | ||
} from "./model/customType"; | ||
export type { | ||
CustomTypeModelRichTextField, | ||
CustomTypeModelRichTextMultiField, | ||
CustomTypeModelRichTextSingleField, | ||
CustomTypeModelSelectField, | ||
CustomTypeModelTimestampField, | ||
CustomTypeModelTitleField, | ||
CustomTypeModelUIDField, | ||
CustomTypeModelSeparatorField, | ||
// Slices | ||
} from "./model/richText"; | ||
export type { CustomTypeModelTitleField } from "./model/title"; | ||
export type { | ||
CustomTypeModelImageField, | ||
CustomTypeModelImageConstraint, | ||
CustomTypeModelImageThumbnail, | ||
} from "./model/image"; | ||
export type { CustomTypeModelContentRelationshipField } from "./model/contentRelationship"; | ||
export type { CustomTypeModelLinkField } from "./model/link"; | ||
export type { CustomTypeModelLinkToMediaField } from "./model/linkToMedia"; | ||
export type { CustomTypeModelEmbedField } from "./model/embed"; | ||
export type { CustomTypeModelBooleanField } from "./model/boolean"; | ||
export type { CustomTypeModelColorField } from "./model/color"; | ||
export type { CustomTypeModelDateField } from "./model/date"; | ||
export type { CustomTypeModelKeyTextField } from "./model/keyText"; | ||
export type { CustomTypeModelNumberField } from "./model/number"; | ||
export type { CustomTypeModelSelectField } from "./model/select"; | ||
export type { CustomTypeModelTimestampField } from "./model/timestamp"; | ||
export type { CustomTypeModelGeoPointField } from "./model/geoPoint"; | ||
export type { CustomTypeModelIntegrationFieldsField } from "./model/integrationFields"; | ||
export type { CustomTypeModelGroupField } from "./model/group"; | ||
export type { | ||
CustomTypeModelSliceZoneField, | ||
CustomTypeModelSlice, | ||
CustomTypeModelSliceLabel, | ||
CustomTypeModelSharedSlice, | ||
} from "./model/sliceZone"; | ||
export type { | ||
CustomTypeModelSlice, | ||
CustomTypeModelLegacySlice, | ||
// SharedSlices | ||
SharedSliceModel, | ||
SharedSliceModelVariation, | ||
} from "./customType"; | ||
} from "./model/slice"; | ||
export type { SharedSliceModel } from "./model/sharedSlice"; | ||
export type { SharedSliceModelVariation } from "./model/sharedSliceVariation"; | ||
export type { CustomTypeModelUIDField } from "./model/uid"; | ||
export type { CustomTypeModelRangeField } from "./model/range"; | ||
export type { CustomTypeModelSeparatorField } from "./model/separator"; | ||
export type { | ||
Repository, | ||
Ref, | ||
Release, | ||
Language, | ||
Query, | ||
Form, | ||
FormField, | ||
Tags, | ||
} from "./api"; | ||
CustomTypeModelField, | ||
CustomTypeModelFieldForGroup, | ||
} from "./model/types"; | ||
export { WebhookType } from "./webhook"; | ||
//============================================================================= | ||
// API - Types representing Prismic Rest API V2 responses. | ||
//============================================================================= | ||
export type { | ||
WebhookBody, | ||
WebhookBodyAPIUpdate, | ||
WebhookBodyTestTrigger, | ||
} from "./webhook"; | ||
export type { Query } from "./api/query"; | ||
export type { Ref } from "./api/ref"; | ||
export type { Release } from "./api/release"; | ||
export type { Repository, Language, Form, FormField } from "./api/repository"; | ||
export type { Tags } from "./api/tags"; | ||
//============================================================================= | ||
// Webhook - Types representing Prismic webhooks. | ||
//============================================================================= | ||
export { WebhookType } from "./webhook/types"; | ||
export type { WebhookBody } from "./webhook/types"; | ||
export type { WebhookBodyAPIUpdate } from "./webhook/apiUpdate"; | ||
export type { WebhookBodyTestTrigger } from "./webhook/testTrigger"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74
3846
182046
1