@sanity/media-library-types 1.0.1 → 1.0.2

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
@@ -117,6 +117,7 @@ export declare interface Asset<
117
117
  _createdAt: string
118
118
  _updatedAt: string
119
119
  _rev: string
120
+ url?: string
120
121
  }
121
122
 
122
123
  /** @public */
@@ -144,6 +145,7 @@ export declare interface AssetAspectDocument extends BaseDocument {
144
145
  */
145
146
  assetType?: Asset['assetType']
146
147
  definition: FieldDefinition
148
+ public?: boolean
147
149
  }
148
150
 
149
151
  /** @public */
@@ -2002,6 +2004,7 @@ declare type SanityAsset = {
2002
2004
  >
2003
2005
  assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
2004
2006
  cdnAccessPolicy: 'public' | 'private'
2007
+ url?: string
2005
2008
  }
2006
2009
 
2007
2010
  declare type SanityAssetCollection = {
@@ -2021,6 +2024,8 @@ declare type SanityAssetCollection = {
2021
2024
  }>
2022
2025
  }
2023
2026
 
2027
+ declare type SanityAssetInstanceState = string
2028
+
2024
2029
  declare type SanityAssetVersion = {
2025
2030
  _type: 'sanity.asset.version'
2026
2031
  title?: string
@@ -2095,7 +2100,7 @@ declare type SanityFileAsset = {
2095
2100
  _type: 'block'
2096
2101
  _key: string
2097
2102
  }>
2098
- state: string
2103
+ state: SanityAssetInstanceState
2099
2104
  sha1hash?: string
2100
2105
  mimeType?: string
2101
2106
  originalFilename?: string
@@ -2113,7 +2118,7 @@ declare type SanityImageAsset = {
2113
2118
  _updatedAt: string
2114
2119
  _rev: string
2115
2120
  altText?: string
2116
- state: string
2121
+ state: SanityAssetInstanceState
2117
2122
  sha1hash?: string
2118
2123
  mimeType?: string
2119
2124
  originalFilename?: string
@@ -2232,7 +2237,7 @@ export declare type SanityVideoAsset = {
2232
2237
  _type: 'block'
2233
2238
  _key: string
2234
2239
  }>
2235
- state: string
2240
+ state: SanityAssetInstanceState
2236
2241
  sha1hash?: string
2237
2242
  mimeType?: string
2238
2243
  originalFilename?: string
package/lib/index.d.ts CHANGED
@@ -117,6 +117,7 @@ export declare interface Asset<
117
117
  _createdAt: string
118
118
  _updatedAt: string
119
119
  _rev: string
120
+ url?: string
120
121
  }
121
122
 
122
123
  /** @public */
@@ -144,6 +145,7 @@ export declare interface AssetAspectDocument extends BaseDocument {
144
145
  */
145
146
  assetType?: Asset['assetType']
146
147
  definition: FieldDefinition
148
+ public?: boolean
147
149
  }
148
150
 
149
151
  /** @public */
@@ -2002,6 +2004,7 @@ declare type SanityAsset = {
2002
2004
  >
2003
2005
  assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
2004
2006
  cdnAccessPolicy: 'public' | 'private'
2007
+ url?: string
2005
2008
  }
2006
2009
 
2007
2010
  declare type SanityAssetCollection = {
@@ -2021,6 +2024,8 @@ declare type SanityAssetCollection = {
2021
2024
  }>
2022
2025
  }
2023
2026
 
2027
+ declare type SanityAssetInstanceState = string
2028
+
2024
2029
  declare type SanityAssetVersion = {
2025
2030
  _type: 'sanity.asset.version'
2026
2031
  title?: string
@@ -2095,7 +2100,7 @@ declare type SanityFileAsset = {
2095
2100
  _type: 'block'
2096
2101
  _key: string
2097
2102
  }>
2098
- state: string
2103
+ state: SanityAssetInstanceState
2099
2104
  sha1hash?: string
2100
2105
  mimeType?: string
2101
2106
  originalFilename?: string
@@ -2113,7 +2118,7 @@ declare type SanityImageAsset = {
2113
2118
  _updatedAt: string
2114
2119
  _rev: string
2115
2120
  altText?: string
2116
- state: string
2121
+ state: SanityAssetInstanceState
2117
2122
  sha1hash?: string
2118
2123
  mimeType?: string
2119
2124
  originalFilename?: string
@@ -2232,7 +2237,7 @@ export declare type SanityVideoAsset = {
2232
2237
  _type: 'block'
2233
2238
  _key: string
2234
2239
  }>
2235
- state: string
2240
+ state: SanityAssetInstanceState
2236
2241
  sha1hash?: string
2237
2242
  mimeType?: string
2238
2243
  originalFilename?: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/media-library-types",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Type definitions for common Sanity Media Library data structures",
5
5
  "keywords": [
6
6
  "sanity",
@@ -37,8 +37,8 @@
37
37
  "src"
38
38
  ],
39
39
  "devDependencies": {
40
- "@sanity/pkg-utils": "^8.1.9",
41
- "@sanity/types": "^4.8.1",
40
+ "@sanity/pkg-utils": "^8.1.29",
41
+ "@sanity/types": "^4.15.0",
42
42
  "rimraf": "^5.0.10"
43
43
  },
44
44
  "scripts": {
package/src/assets.ts CHANGED
@@ -34,6 +34,7 @@ export interface Asset<AssetInstance extends AssetInstanceDocument = AssetInstan
34
34
  _createdAt: string
35
35
  _updatedAt: string
36
36
  _rev: string
37
+ url?: string
37
38
  }
38
39
 
39
40
  export type BaseDocument = {
@@ -53,4 +54,5 @@ export interface AssetAspectDocument extends BaseDocument {
53
54
  */
54
55
  assetType?: Asset['assetType']
55
56
  definition: FieldDefinition
57
+ public?: boolean
56
58
  }
@@ -1,5 +1,10 @@
1
1
  export declare const internalGroqTypeReferenceTo: unique symbol
2
2
 
3
+ export type SanitySystem = {
4
+ _type: 'sanity.system'
5
+ createdBy?: string
6
+ }
7
+
3
8
  export type SanityAssetUploadSession = {
4
9
  _id: string
5
10
  _type: 'sanity.asset.upload-session'
@@ -17,11 +22,6 @@ export type SanityAssetUploadSession = {
17
22
  _system?: SanitySystem
18
23
  }
19
24
 
20
- export type SanitySystem = {
21
- _type: 'sanity.system'
22
- createdBy?: string
23
- }
24
-
25
25
  export type SanityAssetCollection = {
26
26
  _id: string
27
27
  _type: 'sanity.asset.collection'
@@ -46,23 +46,16 @@ export type SanityVideoMetadataPlayback = {
46
46
  policy: string
47
47
  }
48
48
 
49
- export type SanityImagePaletteSwatch = {
50
- _type: 'sanity.imagePaletteSwatch'
51
- background?: string
52
- foreground?: string
53
- population?: number
54
- title?: string
55
- }
56
-
57
- export type SanityImagePalette = {
58
- _type: 'sanity.imagePalette'
59
- darkMuted?: SanityImagePaletteSwatch
60
- lightVibrant?: SanityImagePaletteSwatch
61
- darkVibrant?: SanityImagePaletteSwatch
62
- vibrant?: SanityImagePaletteSwatch
63
- dominant?: SanityImagePaletteSwatch
64
- lightMuted?: SanityImagePaletteSwatch
65
- muted?: SanityImagePaletteSwatch
49
+ export type SanityVideoMetadata = {
50
+ _type: 'sanity.videoMetadata'
51
+ aspectRatio?: string
52
+ duration?: number
53
+ framerate?: number
54
+ playbacks?: Array<
55
+ {
56
+ _key: string
57
+ } & SanityVideoMetadataPlayback
58
+ >
66
59
  }
67
60
 
68
61
  export type SanityImageExifTags = {
@@ -103,6 +96,25 @@ export type SanityImageExifMetadata = {
103
96
  Artist?: string
104
97
  }
105
98
 
99
+ export type SanityImagePaletteSwatch = {
100
+ _type: 'sanity.imagePaletteSwatch'
101
+ background?: string
102
+ foreground?: string
103
+ population?: number
104
+ title?: string
105
+ }
106
+
107
+ export type SanityImagePalette = {
108
+ _type: 'sanity.imagePalette'
109
+ darkMuted?: SanityImagePaletteSwatch
110
+ lightVibrant?: SanityImagePaletteSwatch
111
+ darkVibrant?: SanityImagePaletteSwatch
112
+ vibrant?: SanityImagePaletteSwatch
113
+ dominant?: SanityImagePaletteSwatch
114
+ lightMuted?: SanityImagePaletteSwatch
115
+ muted?: SanityImagePaletteSwatch
116
+ }
117
+
106
118
  export type SanityImageDimensions = {
107
119
  _type: 'sanity.imageDimensions'
108
120
  height: number
@@ -110,6 +122,19 @@ export type SanityImageDimensions = {
110
122
  aspectRatio: number
111
123
  }
112
124
 
125
+ export type SanityImageMetadata = {
126
+ _type: 'sanity.imageMetadata'
127
+ location?: Geopoint
128
+ dimensions: SanityImageDimensions
129
+ exif?: SanityImageExifMetadata
130
+ image?: SanityImageExifTags
131
+ palette: SanityImagePalette
132
+ lqip: string
133
+ blurHash: string
134
+ hasAlpha: boolean
135
+ isOpaque: boolean
136
+ }
137
+
113
138
  export type SanityAsset = {
114
139
  _id: string
115
140
  _type: 'sanity.asset'
@@ -131,6 +156,7 @@ export type SanityAsset = {
131
156
  >
132
157
  assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
133
158
  cdnAccessPolicy: 'public' | 'private'
159
+ url?: string
134
160
  }
135
161
 
136
162
  export type SanityAssetVersion = {
@@ -182,7 +208,7 @@ export type SanityVideoAsset = {
182
208
  _type: 'block'
183
209
  _key: string
184
210
  }>
185
- state: string
211
+ state: SanityAssetInstanceState
186
212
  sha1hash?: string
187
213
  mimeType?: string
188
214
  originalFilename?: string
@@ -199,17 +225,7 @@ export type SanityVideoAsset = {
199
225
  metadata: SanityVideoMetadata
200
226
  }
201
227
 
202
- export type SanityVideoMetadata = {
203
- _type: 'sanity.videoMetadata'
204
- aspectRatio?: string
205
- duration?: number
206
- framerate?: number
207
- playbacks?: Array<
208
- {
209
- _key: string
210
- } & SanityVideoMetadataPlayback
211
- >
212
- }
228
+ export type SanityAssetInstanceState = string
213
229
 
214
230
  export type SanityFileAsset = {
215
231
  _id: string
@@ -236,7 +252,7 @@ export type SanityFileAsset = {
236
252
  _type: 'block'
237
253
  _key: string
238
254
  }>
239
- state: string
255
+ state: SanityAssetInstanceState
240
256
  sha1hash?: string
241
257
  mimeType?: string
242
258
  originalFilename?: string
@@ -254,7 +270,7 @@ export type SanityImageAsset = {
254
270
  _updatedAt: string
255
271
  _rev: string
256
272
  altText?: string
257
- state: string
273
+ state: SanityAssetInstanceState
258
274
  sha1hash?: string
259
275
  mimeType?: string
260
276
  originalFilename?: string
@@ -266,19 +282,6 @@ export type SanityImageAsset = {
266
282
  metadata: SanityImageMetadata
267
283
  }
268
284
 
269
- export type SanityImageMetadata = {
270
- _type: 'sanity.imageMetadata'
271
- location?: Geopoint
272
- dimensions: SanityImageDimensions
273
- exif?: SanityImageExifMetadata
274
- image?: SanityImageExifTags
275
- palette: SanityImagePalette
276
- lqip: string
277
- blurHash: string
278
- hasAlpha: boolean
279
- isOpaque: boolean
280
- }
281
-
282
285
  export type Geopoint = {
283
286
  _type: 'geopoint'
284
287
  lat?: number
@@ -286,24 +289,22 @@ export type Geopoint = {
286
289
  alt?: number
287
290
  }
288
291
 
289
- export type SanityAssetInstanceState = string
290
-
291
292
  export type AllSanitySchemaTypes =
292
- | SanityAssetUploadSession
293
293
  | SanitySystem
294
+ | SanityAssetUploadSession
294
295
  | SanityAssetCollection
295
296
  | SanityVideoMetadataPlayback
296
- | SanityImagePaletteSwatch
297
- | SanityImagePalette
297
+ | SanityVideoMetadata
298
298
  | SanityImageExifTags
299
299
  | SanityImageExifMetadata
300
+ | SanityImagePaletteSwatch
301
+ | SanityImagePalette
300
302
  | SanityImageDimensions
303
+ | SanityImageMetadata
301
304
  | SanityAsset
302
305
  | SanityAssetVersion
303
306
  | SanityVideoAsset
304
- | SanityVideoMetadata
307
+ | SanityAssetInstanceState
305
308
  | SanityFileAsset
306
309
  | SanityImageAsset
307
- | SanityImageMetadata
308
310
  | Geopoint
309
- | SanityAssetInstanceState