@sanity/media-library-types
Version:
Type definitions for common Sanity Media Library data structures
447 lines (413 loc) • 9.59 kB
text/typescript
export type SanitySystem = {
_type: 'sanity.system'
createdBy?: string
}
export type SanityAssetReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.asset'
}
export type SanityAssetUploadSession = {
_id: string
_type: 'sanity.asset.upload-session'
_createdAt: string
_updatedAt: string
_rev: string
title: string
assets?: Array<
{
_key: string
} & SanityAssetReference
>
_system?: SanitySystem
}
export type SanityDirectoryReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.directory'
}
export type SanitySymlink = {
_id: string
_type: 'sanity.symlink'
_createdAt: string
_updatedAt: string
_rev: string
parent?: SanityDirectoryReference
rootDirectory?: SanityDirectoryReference
target?: SanityAssetReference
_system?: SanitySystem
}
export type SanityTreeReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.tree'
}
export type SanityAssetCollection = {
_id: string
_type: 'sanity.asset.collection'
_createdAt: string
_updatedAt: string
_rev: string
title: string
description?: string
parent?: SanityDirectoryReference | SanityTreeReference
rootDirectory?: SanityDirectoryReference
assets?: Array<
{
_key: string
} & SanityAssetReference
>
_system?: SanitySystem
}
export type SanityVideoMetadataRendition = {
_type: 'sanity.videoMetadata.rendition'
name: string
resolution: string
}
export type SanityVideoMetadataPlayback = {
_type: 'sanity.videoMetadata.playback'
_id: string
name?: string
policy: string
}
export type SanityAssetSubtitleReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.asset.subtitle'
}
export type SanityVideoMetadata = {
_type: 'sanity.videoMetadata'
aspectRatio?: string
duration?: number
framerate?: number
playbacks?: Array<
{
_key: string
} & SanityVideoMetadataPlayback
>
renditions?: Array<
{
_key: string
} & SanityVideoMetadataRendition
>
subtitles?: Array<
{
_key: string
} & SanityAssetSubtitleReference
>
}
export type SanityImageExifTags = {
_type: 'sanity.imageExifTags'
Make?: string
Model?: string
Orientation?: number
XResolution?: number
YResolution?: number
ResolutionUnit?: number
Software?: string
ModifyDate?: string
ExifOffset?: number
GPSInfo?: number
}
export type SanityImageExifMetadata = {
_type: 'sanity.imageExifMetadata'
ApertureValue?: number
BrightnessValue?: number
DateTimeDigitized?: string
DateTimeOriginal?: string
ExposureBiasValue?: number
ExposureMode?: number
ExposureProgram?: number
ExposureTime?: number
FNumber?: number
Flash?: number
FocalLength?: number
FocalLengthIn35mmFormat?: number
ISO?: number
LensModel?: string
WhiteBalance?: number
GPSLatitude?: number
GPSLongitude?: number
GPSAltitude?: number
Copyright?: string
Artist?: string
}
export type SanityImagePaletteSwatch = {
_type: 'sanity.imagePaletteSwatch'
background?: string
foreground?: string
population?: number
title?: string
}
export type SanityImagePalette = {
_type: 'sanity.imagePalette'
darkMuted?: SanityImagePaletteSwatch
lightVibrant?: SanityImagePaletteSwatch
darkVibrant?: SanityImagePaletteSwatch
vibrant?: SanityImagePaletteSwatch
dominant?: SanityImagePaletteSwatch
lightMuted?: SanityImagePaletteSwatch
muted?: SanityImagePaletteSwatch
}
export type SanityImageDimensions = {
_type: 'sanity.imageDimensions'
height: number
width: number
aspectRatio: number
}
export type SanityImageMetadata = {
_type: 'sanity.imageMetadata'
location?: Geopoint
dimensions: SanityImageDimensions
exif?: SanityImageExifMetadata
image?: SanityImageExifTags
palette: SanityImagePalette
lqip: string
blurHash: string
hasAlpha: boolean
isOpaque: boolean
}
export type SanityFileMetadata = {
_type: 'sanity.fileMetadata'
}
export type SanityAssetVersionReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.asset.version'
}
export type SanityAsset = {
_id: string
_type: 'sanity.asset'
_createdAt: string
_updatedAt: string
_rev: string
title?: string
aspects?: Record<string, unknown>
currentVersion: SanityAssetVersionReference
versions: Array<
{
_key: string
} & SanityAssetVersion
>
assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
cdnAccessPolicy: 'public' | 'private'
parent?: SanityDirectoryReference | SanityTreeReference
rootDirectory?: SanityDirectoryReference
url?: string
_system?: SanitySystem
}
export type SanityImageAssetReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
export type SanityFileAssetReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.fileAsset'
}
export type SanityVideoAssetReference = {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.videoAsset'
}
export type SanityAssetVersion = {
_type: 'sanity.asset.version'
title?: string
instance: SanityImageAssetReference | SanityFileAssetReference | SanityVideoAssetReference
}
export type SanityVideoAsset = {
_id: string
_type: 'sanity.videoAsset'
_createdAt: string
_updatedAt: string
_rev: string
title?: string
description?: Array<{
children?: Array<{
marks?: Array<string>
text?: string
_type: 'span'
_key: string
}>
style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
listItem?: 'bullet' | 'number'
markDefs?: Array<{
href?: string
_type: 'link'
_key: string
}>
level?: number
_type: 'block'
_key: string
}>
state: SanityAssetInstanceState
error?: string
sha1hash?: string
mimeType?: string
originalFilename?: string
size?: number
uploadId?: string
path?: string
url?: string
extension?: string
source?: {
id?: string
name?: string
url?: string
}
metadata: SanityVideoMetadata
rootDirectory?: SanityDirectoryReference
_system?: SanitySystem
}
export type SanityAssetInstanceState = string
export type SanityFileAsset = {
_id: string
_type: 'sanity.fileAsset'
_createdAt: string
_updatedAt: string
_rev: string
title?: string
description?: Array<{
children?: Array<{
marks?: Array<string>
text?: string
_type: 'span'
_key: string
}>
style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
listItem?: 'bullet' | 'number'
markDefs?: Array<{
href?: string
_type: 'link'
_key: string
}>
level?: number
_type: 'block'
_key: string
}>
state: SanityAssetInstanceState
sha1hash?: string
mimeType?: string
originalFilename?: string
size?: number
uploadId?: string
path: string
extension?: string
url: string
previewUrl?: string
rootDirectory?: SanityDirectoryReference
_system?: SanitySystem
}
export type SanityImageAsset = {
_id: string
_type: 'sanity.imageAsset'
_createdAt: string
_updatedAt: string
_rev: string
altText?: string
state: SanityAssetInstanceState
sha1hash?: string
mimeType?: string
originalFilename?: string
size?: number
uploadId?: string
path?: string
extension?: string
url: string
metadata: SanityImageMetadata
rootDirectory?: SanityDirectoryReference
_system?: SanitySystem
}
export type Geopoint = {
_type: 'geopoint'
lat?: number
lng?: number
alt?: number
}
export type SanityAssetSubtitle = {
_id: string
_type: 'sanity.asset.subtitle'
_createdAt: string
_updatedAt: string
_rev: string
languageCode?: string
closedCaptions?: boolean
status?: string
origin?: string
source?: {
id?: string
name?: string
url?: string
}
segments?: Array<{
startTime?: number
endTime?: number
text?: string
_key: string
}>
error?: string
rootDirectory?: SanityDirectoryReference
}
export type SanityDirectory = {
_id: string
_type: 'sanity.directory'
_createdAt: string
_updatedAt: string
_rev: string
name?: string
parent?: SanityDirectoryReference | SanityTreeReference
rootDirectory?: SanityDirectoryReference
_system?: SanitySystem
}
export type SanityTree = {
_id: string
_type: 'sanity.tree'
_createdAt: string
_updatedAt: string
_rev: string
name?: string
_system?: SanitySystem
}
export type AllSanitySchemaTypes =
| SanitySystem
| SanityAssetReference
| SanityAssetUploadSession
| SanityDirectoryReference
| SanitySymlink
| SanityTreeReference
| SanityAssetCollection
| SanityVideoMetadataRendition
| SanityVideoMetadataPlayback
| SanityAssetSubtitleReference
| SanityVideoMetadata
| SanityImageExifTags
| SanityImageExifMetadata
| SanityImagePaletteSwatch
| SanityImagePalette
| SanityImageDimensions
| SanityImageMetadata
| SanityFileMetadata
| SanityAssetVersionReference
| SanityAsset
| SanityImageAssetReference
| SanityFileAssetReference
| SanityVideoAssetReference
| SanityAssetVersion
| SanityVideoAsset
| SanityAssetInstanceState
| SanityFileAsset
| SanityImageAsset
| Geopoint
| SanityAssetSubtitle
| SanityDirectory
| SanityTree
export declare const internalGroqTypeReferenceTo: unique symbol