Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@prismicio/types

Package Overview
Dependencies
Maintainers
19
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismicio/types - npm Package Compare versions

Comparing version 0.1.23 to 0.1.24

228

dist/index.d.ts

@@ -320,2 +320,166 @@ declare type EmptyObjectField = Record<string, never>;

/**
* oEmbed 1.0 possible types.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare const OEmbedType: {
readonly Photo: "photo";
readonly Video: "video";
readonly Link: "link";
readonly Rich: "rich";
};
/**
* oEmbed response base fields. Those are every mandatory fields an oEmbed
* response must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type OEmbedBase<TType extends typeof OEmbedType[keyof typeof OEmbedType]> = {
/**
* oEmbed resource type.
*/
type: TType;
/**
* oEmbed version number, this must be "1.0".
*/
version: string;
};
/**
* oEmbed response extra fields. Those are every non-mandatory and unknown
* fields an oEmbed response can feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type OEmbedExtra = {
/**
* oEmbed text title, describing the resource.
*/
title?: string | null;
/**
* oEmbed resource author/owner name.
*/
author_name?: string | null;
/**
* oEmbed resource author/owner URL.
*/
author_url?: string | null;
/**
* oEmbed resource provider name.
*/
provider_name?: string | null;
/**
* oEmbed resource provider URL.
*/
provider_url?: string | null;
/**
* oEmbed suggested cache lifetime for the resource, in seconds.
*/
cache_age?: number | null;
/**
* oEmbed resource thumbnail URL.
*/
thumbnail_url?: string | null;
/**
* oEmbed resource thumbnail width.
*/
thumbnail_width?: number | null;
/**
* oEmbed resource thumbnail height.
*/
thumbnail_height?: number | null;
/**
* Providers may optionally include any parameters not specified in this
* document (so long as they use the same key-value format) and consumers may
* choose to ignore these. Consumers must ignore parameters they do not understand.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
[key: string]: unknown | null;
};
/**
* oEmbed photo type. Those are every mandatory fields an oEmbed photo response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {
/**
* oEmbed source URL of the image.
*/
url: string;
/**
* oEmbed width in pixels of the image.
*/
width: number;
/**
* oEmbed height in pixels of the image.
*/
height: number;
};
/**
* oEmbed video type. Those are every mandatory fields an oEmbed video response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {
/**
* oEmbed HTML required to embed a video player.
*/
html: string;
/**
* oEmbed width in pixels required to display the HTML.
*/
width: number;
/**
* oEmbed height in pixels required to display the HTML.
*/
height: number;
};
/**
* oEmbed link type. Those are every mandatory fields an oEmbed link response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>;
/**
* oEmbed rich type. Those are every mandatory fields an oEmbed rich response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {
/**
* oEmbed HTML required to display the resource.
*/
html: string;
/**
* oEmbed width in pixels required to display the HTML.
*/
width: number;
/**
* oEmbed height in pixels required to display the HTML.
*/
height: number;
};
/**
* Any of the possible types of oEmbed response. Those contains only mandatory
* fields their respective oEmbed response type must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
declare type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;
/**
* An Embed field.
*
* @typeParam Data - Data provided by the URL's oEmbed provider.
* @typeParam State - State of the field which determines its shape.
* @see More details: {@link https://prismic.io/docs/core-concepts/embed}
*/
declare type EmbedField<Data extends AnyOEmbed = AnyOEmbed & OEmbedExtra, State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : Data & {
embed_url: string;
html: string | null;
};
/**
* A Date field.

@@ -369,42 +533,2 @@ *

/**
* Embed Type - Link or RichText Field
*/
declare const EmbedType: {
readonly Link: "link";
readonly Rich: "rich";
};
/**
* A common set of oEmbed data supported by most providers.
*
* @see More details: {@link https://prismic.io/docs/core-concepts/embed}
*/
declare type CommonEmbedData = {
url?: string;
version?: string;
title?: string | null;
description?: string | null;
html?: string | null;
width?: number | null;
height?: number | null;
author_name?: string | null;
author_url?: string | null;
provider_name?: string;
cache_age?: number | null;
thumbnail_url?: string | null;
thumbnail_width?: number | null;
thumbnail_height?: number | null;
[key: string]: unknown | null;
};
/**
* An Embed field.
*
* @typeParam Data - Data provided by the URL's oEmbed provider.
* @typeParam State - State of the field which determines its shape.
* @see More details: {@link https://prismic.io/docs/core-concepts/embed}
*/
declare type EmbedField<Data extends Record<string, unknown> = CommonEmbedData, State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : {
embed_url: string;
type: typeof EmbedType[keyof typeof EmbedType];
} & Data;
/**
* A Geopoint field.

@@ -546,3 +670,3 @@ *

*/
interface PrismicDocument<DataInterface = Record<string, AnyRegularField | GroupField | SliceZone>, TypeEnum = string, LangEnum = string> extends PrismicDocumentHeader<TypeEnum, LangEnum> {
interface PrismicDocument<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocumentHeader<TypeEnum, LangEnum> {
/**

@@ -560,3 +684,3 @@ * Data contained in the document.

*/
interface PrismicDocumentWithoutUID<DataInterface = Record<string, AnyRegularField | GroupField | SliceZone>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
interface PrismicDocumentWithoutUID<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
/**

@@ -576,3 +700,3 @@ * This document does not have a UID field. This property will always be `null`.

*/
interface PrismicDocumentWithUID<DataInterface = Record<string, AnyRegularField | GroupField | SliceZone>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
interface PrismicDocumentWithUID<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
/**

@@ -1294,2 +1418,18 @@ * The unique identifier for the document. Guaranteed to be unique among all

export { AlternateLanguage, AnyRegularField, BooleanField, ColorField, CommonEmbedData, CustomTypeModel, CustomTypeModelBooleanField, CustomTypeModelColorField, CustomTypeModelContentRelationshipField, CustomTypeModelDateField, CustomTypeModelDefinition, CustomTypeModelEmbedField, CustomTypeModelField, CustomTypeModelFieldForGroup, CustomTypeModelFieldType, CustomTypeModelGeoPointField, CustomTypeModelGroupField, CustomTypeModelImageConstraint, CustomTypeModelImageField, CustomTypeModelImageThumbnail, CustomTypeModelIntegrationFieldsField, CustomTypeModelKeyTextField, CustomTypeModelLinkField, CustomTypeModelLinkSelectType, CustomTypeModelLinkToMediaField, CustomTypeModelNumberField, CustomTypeModelRichTextField, CustomTypeModelRichTextMultiField, CustomTypeModelRichTextSingleField, CustomTypeModelSelectField, 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, LinkToMediaField, LinkType, NumberField, 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, RichTextField, RichTextNodeType, SelectField, SharedSlice, SharedSliceModel, SharedSliceModelVariation, SharedSliceVariation, Slice, SliceZone, Tags, TimestampField, TitleField, WebhookBody, WebhookBodyAPIUpdate, WebhookBodyTestTrigger, WebhookType };
/**
* @deprecated Use {@link OEmbedType} instead.
*/
declare const EmbedType: {
readonly Photo: "photo";
readonly Video: "video";
readonly Link: "link";
readonly Rich: "rich";
};
/**
* @deprecated Use {@link PhotoOEmbed}, {@link VideoOEmbed}, {@link LinkOEmbed},
* {@link RichOEmbed}, or {@link AnyOEmbed} instead.
*/
declare type CommonEmbedData = AnyOEmbed & OEmbedExtra;
export { AlternateLanguage, AnyOEmbed, AnyRegularField, BooleanField, ColorField, CommonEmbedData, CustomTypeModel, CustomTypeModelBooleanField, CustomTypeModelColorField, CustomTypeModelContentRelationshipField, CustomTypeModelDateField, CustomTypeModelDefinition, CustomTypeModelEmbedField, CustomTypeModelField, CustomTypeModelFieldForGroup, CustomTypeModelFieldType, CustomTypeModelGeoPointField, CustomTypeModelGroupField, CustomTypeModelImageConstraint, CustomTypeModelImageField, CustomTypeModelImageThumbnail, CustomTypeModelIntegrationFieldsField, CustomTypeModelKeyTextField, CustomTypeModelLinkField, CustomTypeModelLinkSelectType, CustomTypeModelLinkToMediaField, CustomTypeModelNumberField, CustomTypeModelRichTextField, CustomTypeModelRichTextMultiField, CustomTypeModelRichTextSingleField, CustomTypeModelSelectField, 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 };

8

dist/index.js

@@ -28,3 +28,5 @@ const RichTextNodeType = {

};
const EmbedType = {
const OEmbedType = {
Photo: "photo",
Video: "video",
Link: "link",

@@ -70,3 +72,5 @@ Rich: "rich"

export { CustomTypeModelFieldType, CustomTypeModelLinkSelectType, CustomTypeModelSliceDisplay, CustomTypeModelSliceType, EmbedType, LinkType, RichTextNodeType, WebhookType };
const EmbedType = OEmbedType;
export { CustomTypeModelFieldType, CustomTypeModelLinkSelectType, CustomTypeModelSliceDisplay, CustomTypeModelSliceType, EmbedType, LinkType, OEmbedType, RichTextNodeType, WebhookType };
//# sourceMappingURL=index.js.map
{
"name": "@prismicio/types",
"version": "0.1.23",
"version": "0.1.24",
"description": "Type definitions for Prismic related structure",

@@ -5,0 +5,0 @@ "keywords": [

@@ -75,3 +75,7 @@ import { AnyRegularField, GroupField, SliceZone } from "./fields";

export interface PrismicDocument<
DataInterface = Record<string, AnyRegularField | GroupField | SliceZone>,
DataInterface extends Record<
string,
AnyRegularField | GroupField | SliceZone
// eslint-disable-next-line @typescript-eslint/no-explicit-any
> = Record<string, any>,
TypeEnum = string,

@@ -94,3 +98,7 @@ LangEnum = string,

export interface PrismicDocumentWithoutUID<
DataInterface = Record<string, AnyRegularField | GroupField | SliceZone>,
DataInterface extends Record<
string,
AnyRegularField | GroupField | SliceZone
// eslint-disable-next-line @typescript-eslint/no-explicit-any
> = Record<string, any>,
TypeEnum = string,

@@ -115,3 +123,7 @@ LangEnum = string,

export interface PrismicDocumentWithUID<
DataInterface = Record<string, AnyRegularField | GroupField | SliceZone>,
DataInterface extends Record<
string,
AnyRegularField | GroupField | SliceZone
// eslint-disable-next-line @typescript-eslint/no-explicit-any
> = Record<string, any>,
TypeEnum = string,

@@ -118,0 +130,0 @@ LangEnum = string,

@@ -355,2 +355,3 @@ type EmptyObjectField = Record<string, never>;

// Links
/**

@@ -477,2 +478,198 @@ * Link Types

// Embed
/**
* oEmbed 1.0 possible types.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export const OEmbedType = {
Photo: "photo",
Video: "video",
Link: "link",
Rich: "rich",
} as const;
/**
* oEmbed response base fields. Those are every mandatory fields an oEmbed
* response must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
type OEmbedBase<TType extends typeof OEmbedType[keyof typeof OEmbedType]> = {
/**
* oEmbed resource type.
*/
type: TType;
/**
* oEmbed version number, this must be "1.0".
*/
version: string;
};
/**
* oEmbed response extra fields. Those are every non-mandatory and unknown
* fields an oEmbed response can feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export type OEmbedExtra = {
/**
* oEmbed text title, describing the resource.
*/
title?: string | null;
/**
* oEmbed resource author/owner name.
*/
author_name?: string | null;
/**
* oEmbed resource author/owner URL.
*/
author_url?: string | null;
/**
* oEmbed resource provider name.
*/
provider_name?: string | null;
/**
* oEmbed resource provider URL.
*/
provider_url?: string | null;
/**
* oEmbed suggested cache lifetime for the resource, in seconds.
*/
cache_age?: number | null;
/**
* oEmbed resource thumbnail URL.
*/
thumbnail_url?: string | null;
/**
* oEmbed resource thumbnail width.
*/
thumbnail_width?: number | null;
/**
* oEmbed resource thumbnail height.
*/
thumbnail_height?: number | null;
/**
* Providers may optionally include any parameters not specified in this
* document (so long as they use the same key-value format) and consumers may
* choose to ignore these. Consumers must ignore parameters they do not understand.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
[key: string]: unknown | null;
};
/**
* oEmbed photo type. Those are every mandatory fields an oEmbed photo response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {
/**
* oEmbed source URL of the image.
*/
url: string;
/**
* oEmbed width in pixels of the image.
*/
width: number;
/**
* oEmbed height in pixels of the image.
*/
height: number;
};
/**
* oEmbed video type. Those are every mandatory fields an oEmbed video response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {
/**
* oEmbed HTML required to embed a video player.
*/
html: string;
/**
* oEmbed width in pixels required to display the HTML.
*/
width: number;
/**
* oEmbed height in pixels required to display the HTML.
*/
height: number;
};
/**
* oEmbed link type. Those are every mandatory fields an oEmbed link response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>;
/**
* oEmbed rich type. Those are every mandatory fields an oEmbed rich response
* must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {
/**
* oEmbed HTML required to display the resource.
*/
html: string;
/**
* oEmbed width in pixels required to display the HTML.
*/
width: number;
/**
* oEmbed height in pixels required to display the HTML.
*/
height: number;
};
/**
* Any of the possible types of oEmbed response. Those contains only mandatory
* fields their respective oEmbed response type must feature.
*
* @see oEmbed specification: {@link https://oembed.com}
*/
export type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;
/**
* An Embed field.
*
* @typeParam Data - Data provided by the URL's oEmbed provider.
* @typeParam State - State of the field which determines its shape.
* @see More details: {@link https://prismic.io/docs/core-concepts/embed}
*/
export type EmbedField<
Data extends AnyOEmbed = AnyOEmbed & OEmbedExtra,
State extends FieldState = FieldState,
> = State extends "empty"
? EmptyObjectField
: Data & {
embed_url: string;
html: string | null;
};
// Simple Fields

@@ -546,56 +743,2 @@

/**
* Embed Type - Link or RichText Field
*/
export const EmbedType = {
Link: "link",
Rich: "rich",
} as const;
/**
* A common set of oEmbed data supported by most providers.
*
* @see More details: {@link https://prismic.io/docs/core-concepts/embed}
*/
export type CommonEmbedData = {
url?: string;
version?: string;
title?: string | null;
description?: string | null;
html?: string | null;
width?: number | null;
height?: number | null;
author_name?: string | null;
author_url?: string | null;
provider_name?: string;
cache_age?: number | null;
thumbnail_url?: string | null;
thumbnail_width?: number | null;
thumbnail_height?: number | null;
[key: string]: unknown | null;
};
/**
* An Embed field.
*
* @typeParam Data - Data provided by the URL's oEmbed provider.
* @typeParam State - State of the field which determines its shape.
* @see More details: {@link https://prismic.io/docs/core-concepts/embed}
*/
export type EmbedField<
Data extends Record<string, unknown> = CommonEmbedData,
State extends FieldState = FieldState,
> = State extends "empty"
? EmptyObjectField
: {
embed_url: string;
type: typeof EmbedType[keyof typeof EmbedType];
} & Data;
/**
* A Geopoint field.

@@ -602,0 +745,0 @@ *

@@ -9,4 +9,11 @@ export type {

export { RichTextNodeType, LinkType, EmbedType } from "./fields";
export { RichTextNodeType, LinkType, OEmbedType } from "./fields";
// Deprecations
import { OEmbedType } from "./fields";
/**
* @deprecated Use {@link OEmbedType} instead.
*/
export const EmbedType = OEmbedType;
export type {

@@ -61,2 +68,10 @@ // RichText & Title

LinkToMediaField,
// Embed
OEmbedExtra,
PhotoOEmbed,
VideoOEmbed,
LinkOEmbed,
RichOEmbed,
AnyOEmbed,
EmbedField,
// Simple

@@ -70,4 +85,2 @@ DateField,

BooleanField,
EmbedField,
CommonEmbedData,
GeoPointField,

@@ -87,2 +100,21 @@ // Complex

// 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 {

@@ -89,0 +121,0 @@ CustomTypeModelFieldType,

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc