@sanity/media-library-types
Version:
Type definitions for common Sanity Media Library data structures
310 lines (290 loc) • 6.52 kB
text/typescript
export declare const internalGroqTypeReferenceTo: unique symbol
export type SanityAssetUploadSession = {
_id: string
_type: 'sanity.asset.upload-session'
_createdAt: string
_updatedAt: string
_rev: string
title: string
assets?: Array<{
_ref: string
_type: 'reference'
_weak?: boolean
_key: string
[internalGroqTypeReferenceTo]?: 'sanity.asset'
}>
_system?: SanitySystem
}
export type SanitySystem = {
_type: 'sanity.system'
createdBy?: string
}
export type SanityAssetCollection = {
_id: string
_type: 'sanity.asset.collection'
_createdAt: string
_updatedAt: string
_rev: string
title: string
description?: string
assets?: Array<{
_ref: string
_type: 'reference'
_weak?: boolean
_key: string
[internalGroqTypeReferenceTo]?: 'sanity.asset'
}>
}
export type SanityVideoMetadataPlayback = {
_type: 'sanity.videoMetadata.playback'
_id: string
name?: string
policy: 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 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 SanityImageDimensions = {
_type: 'sanity.imageDimensions'
height: number
width: number
aspectRatio: number
}
export type SanityAsset = {
_id: string
_type: 'sanity.asset'
_createdAt: string
_updatedAt: string
_rev: string
title?: string
aspects?: Record<string, unknown>
currentVersion: {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.asset.version'
}
versions: Array<
{
_key: string
} & SanityAssetVersion
>
assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
cdnAccessPolicy: 'public' | 'private'
}
export type SanityAssetVersion = {
_type: 'sanity.asset.version'
title?: string
instance:
| {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
}
| {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.fileAsset'
}
| {
_ref: string
_type: 'reference'
_weak?: boolean
[internalGroqTypeReferenceTo]?: 'sanity.videoAsset'
}
}
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: 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
}
export type SanityVideoMetadata = {
_type: 'sanity.videoMetadata'
aspectRatio?: string
duration?: number
framerate?: number
playbacks?: Array<
{
_key: string
} & SanityVideoMetadataPlayback
>
}
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: string
sha1hash?: string
mimeType?: string
originalFilename?: string
size?: number
uploadId?: string
path: string
extension?: string
url: string
}
export type SanityImageAsset = {
_id: string
_type: 'sanity.imageAsset'
_createdAt: string
_updatedAt: string
_rev: string
altText?: string
state: string
sha1hash?: string
mimeType?: string
originalFilename?: string
size?: number
uploadId?: string
path?: string
extension?: string
url: string
metadata: SanityImageMetadata
}
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 Geopoint = {
_type: 'geopoint'
lat?: number
lng?: number
alt?: number
}
export type SanityAssetInstanceState = string
export type AllSanitySchemaTypes =
| SanityAssetUploadSession
| SanitySystem
| SanityAssetCollection
| SanityVideoMetadataPlayback
| SanityImagePaletteSwatch
| SanityImagePalette
| SanityImageExifTags
| SanityImageExifMetadata
| SanityImageDimensions
| SanityAsset
| SanityAssetVersion
| SanityVideoAsset
| SanityVideoMetadata
| SanityFileAsset
| SanityImageAsset
| SanityImageMetadata
| Geopoint
| SanityAssetInstanceState