@sanity/media-library-types 0.0.2 → 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
@@ -109,7 +109,7 @@ export declare interface Asset<
109
109
  currentVersion: {
110
110
  _ref: string
111
111
  }
112
- aspects?: Record<string, unknown>
112
+ aspects?: unknown
113
113
  versions: AssetVersion<AssetInstance>[]
114
114
  collections: SanityAssetCollection[]
115
115
  _createdAt: string
@@ -2124,7 +2124,12 @@ declare type SanityImagePaletteSwatch = {
2124
2124
  title?: string
2125
2125
  }
2126
2126
 
2127
- declare type SanityVideoAsset = {
2127
+ declare type SanitySystem = {
2128
+ _type: 'sanity.system'
2129
+ createdBy?: string
2130
+ }
2131
+
2132
+ export declare type SanityVideoAsset = {
2128
2133
  _id: string
2129
2134
  _type: 'sanity.videoAsset'
2130
2135
  _createdAt: string
@@ -2158,18 +2163,31 @@ 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
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
@@ -109,7 +109,7 @@ export declare interface Asset<
109
109
  currentVersion: {
110
110
  _ref: string
111
111
  }
112
- aspects?: Record<string, unknown>
112
+ aspects?: unknown
113
113
  versions: AssetVersion<AssetInstance>[]
114
114
  collections: SanityAssetCollection[]
115
115
  _createdAt: string
@@ -2124,7 +2124,12 @@ declare type SanityImagePaletteSwatch = {
2124
2124
  title?: string
2125
2125
  }
2126
2126
 
2127
- declare type SanityVideoAsset = {
2127
+ declare type SanitySystem = {
2128
+ _type: 'sanity.system'
2129
+ createdBy?: string
2130
+ }
2131
+
2132
+ export declare type SanityVideoAsset = {
2128
2133
  _id: string
2129
2134
  _type: 'sanity.videoAsset'
2130
2135
  _createdAt: string
@@ -2158,18 +2163,31 @@ 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
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.2",
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,6 +1,15 @@
1
- import { SanityAsset, SanityAssetCollection, SanityAssetVersion, SanityFileAsset, SanityImageAsset, SanityImageMetadata, SanityVideoAsset } 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
 
11
+ export type {SanityVideoAsset, SanityAssetUploadSession as UploadSession} from './schema.types'
12
+
4
13
  export interface AssetVersion<AssetInstance extends AssetInstanceDocument = AssetInstanceDocument> {
5
14
  _key: string
6
15
  _type: SanityAssetVersion['_type']
@@ -19,7 +28,7 @@ export interface Asset<AssetInstance extends AssetInstanceDocument = AssetInstan
19
28
  currentVersion: {
20
29
  _ref: string
21
30
  }
22
- aspects?: Record<string, unknown>
31
+ aspects?: unknown
23
32
  versions: AssetVersion<AssetInstance>[]
24
33
  collections: SanityAssetCollection[]
25
34
  _createdAt: string
@@ -45,12 +54,3 @@ export interface AssetAspectDocument extends BaseDocument {
45
54
  assetType?: Asset['assetType']
46
55
  definition: FieldDefinition
47
56
  }
48
-
49
- export interface UploadSession {
50
- _id: string
51
- _type: 'sanity.asset.upload-session'
52
- title: string
53
- assets: Asset[]
54
- _createdAt: string
55
- _updatedAt: string
56
- }
@@ -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
@@ -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