@sanity/media-library-types 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -1910,7 +1910,7 @@ declare type SanityAsset = {
1910
1910
  _updatedAt: string
1911
1911
  _rev: string
1912
1912
  title?: string
1913
- aspects?: unknown
1913
+ aspects?: Record<string, unknown>
1914
1914
  currentVersion: {
1915
1915
  _ref: string
1916
1916
  _type: 'reference'
@@ -1992,7 +1992,7 @@ declare interface SanityDocument {
1992
1992
  [key: string]: unknown
1993
1993
  }
1994
1994
 
1995
- export declare type SanityFileAsset = {
1995
+ declare type SanityFileAsset = {
1996
1996
  _id: string
1997
1997
  _type: 'sanity.fileAsset'
1998
1998
  _createdAt: string
@@ -2028,7 +2028,7 @@ export declare type SanityFileAsset = {
2028
2028
  url: string
2029
2029
  }
2030
2030
 
2031
- export declare type SanityImageAsset = {
2031
+ declare type SanityImageAsset = {
2032
2032
  _id: string
2033
2033
  _type: 'sanity.imageAsset'
2034
2034
  _createdAt: string
@@ -2124,6 +2124,11 @@ declare type SanityImagePaletteSwatch = {
2124
2124
  title?: string
2125
2125
  }
2126
2126
 
2127
+ declare type SanitySystem = {
2128
+ _type: 'sanity.system'
2129
+ createdBy?: string
2130
+ }
2131
+
2127
2132
  export declare type SanityVideoAsset = {
2128
2133
  _id: string
2129
2134
  _type: 'sanity.videoAsset'
@@ -2158,18 +2163,31 @@ export declare type SanityVideoAsset = {
2158
2163
  path?: string
2159
2164
  url?: string
2160
2165
  extension?: string
2166
+ source?: {
2167
+ id?: string
2168
+ name?: string
2169
+ url?: string
2170
+ }
2161
2171
  metadata: SanityVideoMetadata
2162
2172
  }
2163
2173
 
2164
- export declare type SanityVideoMetadata = {
2174
+ declare type SanityVideoMetadata = {
2165
2175
  _type: 'sanity.videoMetadata'
2166
- muxAssetId: string
2167
- muxPlaybackIds: Array<{
2168
- _id: string
2169
- _type: string
2170
- policy: string
2171
- _key: string
2172
- }>
2176
+ aspectRatio?: string
2177
+ duration?: number
2178
+ framerate?: number
2179
+ playbacks?: Array<
2180
+ {
2181
+ _key: string
2182
+ } & SanityVideoMetadataPlayback
2183
+ >
2184
+ }
2185
+
2186
+ declare type SanityVideoMetadataPlayback = {
2187
+ _type: 'sanity.videoMetadata.playback'
2188
+ _id: string
2189
+ name?: string
2190
+ policy: string
2173
2191
  }
2174
2192
 
2175
2193
  /** @public */
@@ -2543,13 +2561,21 @@ declare interface TypeReference {
2543
2561
  }
2544
2562
  }
2545
2563
 
2546
- export declare interface UploadSession {
2564
+ export declare type UploadSession = {
2547
2565
  _id: string
2548
2566
  _type: 'sanity.asset.upload-session'
2549
- title: string
2550
- assets: Asset[]
2551
2567
  _createdAt: string
2552
2568
  _updatedAt: string
2569
+ _rev: string
2570
+ title: string
2571
+ assets?: Array<{
2572
+ _ref: string
2573
+ _type: 'reference'
2574
+ _weak?: boolean
2575
+ _key: string
2576
+ [internalGroqTypeReferenceTo]?: 'sanity.asset'
2577
+ }>
2578
+ _system?: SanitySystem
2553
2579
  }
2554
2580
 
2555
2581
  /** @public */
package/lib/index.d.ts CHANGED
@@ -1910,7 +1910,7 @@ declare type SanityAsset = {
1910
1910
  _updatedAt: string
1911
1911
  _rev: string
1912
1912
  title?: string
1913
- aspects?: unknown
1913
+ aspects?: Record<string, unknown>
1914
1914
  currentVersion: {
1915
1915
  _ref: string
1916
1916
  _type: 'reference'
@@ -1992,7 +1992,7 @@ declare interface SanityDocument {
1992
1992
  [key: string]: unknown
1993
1993
  }
1994
1994
 
1995
- export declare type SanityFileAsset = {
1995
+ declare type SanityFileAsset = {
1996
1996
  _id: string
1997
1997
  _type: 'sanity.fileAsset'
1998
1998
  _createdAt: string
@@ -2028,7 +2028,7 @@ export declare type SanityFileAsset = {
2028
2028
  url: string
2029
2029
  }
2030
2030
 
2031
- export declare type SanityImageAsset = {
2031
+ declare type SanityImageAsset = {
2032
2032
  _id: string
2033
2033
  _type: 'sanity.imageAsset'
2034
2034
  _createdAt: string
@@ -2124,6 +2124,11 @@ declare type SanityImagePaletteSwatch = {
2124
2124
  title?: string
2125
2125
  }
2126
2126
 
2127
+ declare type SanitySystem = {
2128
+ _type: 'sanity.system'
2129
+ createdBy?: string
2130
+ }
2131
+
2127
2132
  export declare type SanityVideoAsset = {
2128
2133
  _id: string
2129
2134
  _type: 'sanity.videoAsset'
@@ -2158,18 +2163,31 @@ export declare type SanityVideoAsset = {
2158
2163
  path?: string
2159
2164
  url?: string
2160
2165
  extension?: string
2166
+ source?: {
2167
+ id?: string
2168
+ name?: string
2169
+ url?: string
2170
+ }
2161
2171
  metadata: SanityVideoMetadata
2162
2172
  }
2163
2173
 
2164
- export declare type SanityVideoMetadata = {
2174
+ declare type SanityVideoMetadata = {
2165
2175
  _type: 'sanity.videoMetadata'
2166
- muxAssetId: string
2167
- muxPlaybackIds: Array<{
2168
- _id: string
2169
- _type: string
2170
- policy: string
2171
- _key: string
2172
- }>
2176
+ aspectRatio?: string
2177
+ duration?: number
2178
+ framerate?: number
2179
+ playbacks?: Array<
2180
+ {
2181
+ _key: string
2182
+ } & SanityVideoMetadataPlayback
2183
+ >
2184
+ }
2185
+
2186
+ declare type SanityVideoMetadataPlayback = {
2187
+ _type: 'sanity.videoMetadata.playback'
2188
+ _id: string
2189
+ name?: string
2190
+ policy: string
2173
2191
  }
2174
2192
 
2175
2193
  /** @public */
@@ -2543,13 +2561,21 @@ declare interface TypeReference {
2543
2561
  }
2544
2562
  }
2545
2563
 
2546
- export declare interface UploadSession {
2564
+ export declare type UploadSession = {
2547
2565
  _id: string
2548
2566
  _type: 'sanity.asset.upload-session'
2549
- title: string
2550
- assets: Asset[]
2551
2567
  _createdAt: string
2552
2568
  _updatedAt: string
2569
+ _rev: string
2570
+ title: string
2571
+ assets?: Array<{
2572
+ _ref: string
2573
+ _type: 'reference'
2574
+ _weak?: boolean
2575
+ _key: string
2576
+ [internalGroqTypeReferenceTo]?: 'sanity.asset'
2577
+ }>
2578
+ _system?: SanitySystem
2553
2579
  }
2554
2580
 
2555
2581
  /** @public */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/media-library-types",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "description": "Type definitions for common Sanity Media Library data structures",
5
5
  "keywords": [
6
6
  "sanity",
package/src/assets.ts CHANGED
@@ -1,108 +1,14 @@
1
- import { SanityAsset, SanityAssetCollection, SanityAssetVersion, SanityImageMetadata } from "./schema.types"
1
+ import {
2
+ SanityAsset,
3
+ SanityAssetCollection,
4
+ SanityAssetVersion,
5
+ SanityVideoAsset,
6
+ SanityFileAsset,
7
+ SanityImageAsset,
8
+ } from './schema.types'
2
9
  import {type FieldDefinition} from '@sanity/types'
3
10
 
4
- export type SanityVideoAsset = {
5
- _id: string
6
- _type: 'sanity.videoAsset'
7
- _createdAt: string
8
- _updatedAt: string
9
- _rev: string
10
- title?: string
11
- description?: Array<{
12
- children?: Array<{
13
- marks?: Array<string>
14
- text?: string
15
- _type: 'span'
16
- _key: string
17
- }>
18
- style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
19
- listItem?: 'bullet' | 'number'
20
- markDefs?: Array<{
21
- href?: string
22
- _type: 'link'
23
- _key: string
24
- }>
25
- level?: number
26
- _type: 'block'
27
- _key: string
28
- }>
29
- state: string
30
- sha1hash?: string
31
- mimeType?: string
32
- originalFilename?: string
33
- size?: number
34
- uploadId?: string
35
- path?: string
36
- url?: string
37
- extension?: string
38
- metadata: SanityVideoMetadata
39
- }
40
-
41
- export type SanityVideoMetadata = {
42
- _type: 'sanity.videoMetadata'
43
- muxAssetId: string
44
- muxPlaybackIds: Array<{
45
- _id: string
46
- _type: string
47
- policy: string
48
- _key: string
49
- }>
50
- }
51
-
52
- export type SanityFileAsset = {
53
- _id: string
54
- _type: 'sanity.fileAsset'
55
- _createdAt: string
56
- _updatedAt: string
57
- _rev: string
58
- title?: string
59
- description?: Array<{
60
- children?: Array<{
61
- marks?: Array<string>
62
- text?: string
63
- _type: 'span'
64
- _key: string
65
- }>
66
- style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
67
- listItem?: 'bullet' | 'number'
68
- markDefs?: Array<{
69
- href?: string
70
- _type: 'link'
71
- _key: string
72
- }>
73
- level?: number
74
- _type: 'block'
75
- _key: string
76
- }>
77
- state: string
78
- sha1hash?: string
79
- mimeType?: string
80
- originalFilename?: string
81
- size?: number
82
- uploadId?: string
83
- path: string
84
- extension?: string
85
- url: string
86
- }
87
-
88
- export type SanityImageAsset = {
89
- _id: string
90
- _type: 'sanity.imageAsset'
91
- _createdAt: string
92
- _updatedAt: string
93
- _rev: string
94
- altText?: string
95
- state: string
96
- sha1hash?: string
97
- mimeType?: string
98
- originalFilename?: string
99
- size?: number
100
- uploadId?: string
101
- path?: string
102
- extension?: string
103
- url: string
104
- metadata: SanityImageMetadata
105
- }
11
+ export type {SanityVideoAsset, SanityAssetUploadSession as UploadSession} from './schema.types'
106
12
 
107
13
  export interface AssetVersion<AssetInstance extends AssetInstanceDocument = AssetInstanceDocument> {
108
14
  _key: string
@@ -148,12 +54,3 @@ export interface AssetAspectDocument extends BaseDocument {
148
54
  assetType?: Asset['assetType']
149
55
  definition: FieldDefinition
150
56
  }
151
-
152
- export interface UploadSession {
153
- _id: string
154
- _type: 'sanity.asset.upload-session'
155
- title: string
156
- assets: Asset[]
157
- _createdAt: string
158
- _updatedAt: string
159
- }
@@ -39,6 +39,13 @@ export type SanityAssetCollection = {
39
39
  }>
40
40
  }
41
41
 
42
+ export type SanityVideoMetadataPlayback = {
43
+ _type: 'sanity.videoMetadata.playback'
44
+ _id: string
45
+ name?: string
46
+ policy: string
47
+ }
48
+
42
49
  export type SanityImagePaletteSwatch = {
43
50
  _type: 'sanity.imagePaletteSwatch'
44
51
  background?: string
@@ -110,7 +117,7 @@ export type SanityAsset = {
110
117
  _updatedAt: string
111
118
  _rev: string
112
119
  title?: string
113
- aspects?: unknown
120
+ aspects?: Record<string, unknown>
114
121
  currentVersion: {
115
122
  _ref: string
116
123
  _type: 'reference'
@@ -184,18 +191,24 @@ export type SanityVideoAsset = {
184
191
  path?: string
185
192
  url?: string
186
193
  extension?: string
194
+ source?: {
195
+ id?: string
196
+ name?: string
197
+ url?: string
198
+ }
187
199
  metadata: SanityVideoMetadata
188
200
  }
189
201
 
190
202
  export type SanityVideoMetadata = {
191
203
  _type: 'sanity.videoMetadata'
192
- muxAssetId: string
193
- muxPlaybackIds: Array<{
194
- _id: string
195
- _type: string
196
- policy: string
197
- _key: string
198
- }>
204
+ aspectRatio?: string
205
+ duration?: number
206
+ framerate?: number
207
+ playbacks?: Array<
208
+ {
209
+ _key: string
210
+ } & SanityVideoMetadataPlayback
211
+ >
199
212
  }
200
213
 
201
214
  export type SanityFileAsset = {
@@ -279,6 +292,7 @@ export type AllSanitySchemaTypes =
279
292
  | SanityAssetUploadSession
280
293
  | SanitySystem
281
294
  | SanityAssetCollection
295
+ | SanityVideoMetadataPlayback
282
296
  | SanityImagePaletteSwatch
283
297
  | SanityImagePalette
284
298
  | SanityImageExifTags