@sanity/client 7.17.0 → 7.18.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.
@@ -1 +1 @@
1
- {"version":3,"file":"media-library.cjs","sources":["../src/media-library.ts"],"sourcesContent":["import type {\n VideoPlaybackInfo,\n VideoPlaybackInfoItem,\n VideoPlaybackInfoItemSigned,\n VideoPlaybackInfoSigned,\n VideoPlaybackTokens,\n} from './types'\n\n/**\n * Check if a playback info item (stream/thumbnail/etc) has a signed token\n * @internal\n */\nfunction isSignedPlayback(item: VideoPlaybackInfoItem): item is VideoPlaybackInfoItemSigned {\n return 'token' in item\n}\n\n/**\n * Check if the entire playback info response requires signed URLs\n * @public\n */\nexport function isSignedPlaybackInfo(\n playbackInfo: VideoPlaybackInfo,\n): playbackInfo is VideoPlaybackInfoSigned {\n return isSignedPlayback(playbackInfo.stream)\n}\n\n/**\n * Extract playback tokens from signed video playback info\n * @param playbackInfo - The video playback info\n * @returns The playback tokens or undefined if the response is not signed\n * @public\n * @example\n * const tokens = getPlaybackTokens(playbackInfo)\n * console.log(tokens)\n * ```json\n * {\n * stream: \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n * thumbnail: \"eyJ0a2VuIjoiVGh1bWJuYWlsVG9rZW4tMTIz...\",\n * animated: \"eyJ0a2VuIjoiQW5pbWF0ZWRUb2tlbi1kZWY...\",\n * storyboard: \"eyJ0a2VuIjoiU3Rvcnlib2FyZFRva2VuLTc4...\"\n * }\n * ```\n */\nexport function getPlaybackTokens(\n playbackInfo: VideoPlaybackInfo,\n): VideoPlaybackTokens | undefined {\n if (isSignedPlaybackInfo(playbackInfo)) {\n return {\n stream: playbackInfo.stream.token,\n thumbnail: playbackInfo.thumbnail.token,\n storyboard: playbackInfo.storyboard.token,\n animated: playbackInfo.animated.token,\n }\n }\n\n return undefined\n}\n"],"names":[],"mappings":";;AAYA,SAAS,iBAAiB,MAAkE;AAC1F,SAAO,WAAW;AACpB;AAMO,SAAS,qBACd,cACyC;AACzC,SAAO,iBAAiB,aAAa,MAAM;AAC7C;AAmBO,SAAS,kBACd,cACiC;AACjC,MAAI,qBAAqB,YAAY;AACnC,WAAO;AAAA,MACL,QAAQ,aAAa,OAAO;AAAA,MAC5B,WAAW,aAAa,UAAU;AAAA,MAClC,YAAY,aAAa,WAAW;AAAA,MACpC,UAAU,aAAa,SAAS;AAAA,IAAA;AAKtC;;;"}
1
+ {"version":3,"file":"media-library.cjs","sources":["../src/media-library.ts"],"sourcesContent":["import type {\n VideoPlaybackInfo,\n VideoPlaybackInfoItem,\n VideoPlaybackInfoItemSigned,\n VideoPlaybackInfoSigned,\n VideoPlaybackTokens,\n} from './types'\n\nexport type {VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned} from './types'\n\n/**\n * Check if a playback info item (stream/thumbnail/etc) has a signed token\n * @internal\n */\nfunction isSignedPlayback(item: VideoPlaybackInfoItem): item is VideoPlaybackInfoItemSigned {\n return 'token' in item\n}\n\n/**\n * Check if the entire playback info response requires signed URLs\n * @public\n */\nexport function isSignedPlaybackInfo(\n playbackInfo: VideoPlaybackInfo,\n): playbackInfo is VideoPlaybackInfoSigned {\n return isSignedPlayback(playbackInfo.stream)\n}\n\n/**\n * Extract playback tokens from signed video playback info\n * @param playbackInfo - The video playback info\n * @returns The playback tokens or undefined if the response is not signed\n * @public\n * @example\n * const tokens = getPlaybackTokens(playbackInfo)\n * console.log(tokens)\n * ```json\n * {\n * stream: \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n * thumbnail: \"eyJ0a2VuIjoiVGh1bWJuYWlsVG9rZW4tMTIz...\",\n * animated: \"eyJ0a2VuIjoiQW5pbWF0ZWRUb2tlbi1kZWY...\",\n * storyboard: \"eyJ0a2VuIjoiU3Rvcnlib2FyZFRva2VuLTc4...\"\n * }\n * ```\n */\nexport function getPlaybackTokens(\n playbackInfo: VideoPlaybackInfo,\n): VideoPlaybackTokens | undefined {\n if (isSignedPlaybackInfo(playbackInfo)) {\n return {\n stream: playbackInfo.stream.token,\n thumbnail: playbackInfo.thumbnail.token,\n storyboard: playbackInfo.storyboard.token,\n animated: playbackInfo.animated.token,\n }\n }\n\n return undefined\n}\n"],"names":[],"mappings":";;AAcA,SAAS,iBAAiB,MAAkE;AAC1F,SAAO,WAAW;AACpB;AAMO,SAAS,qBACd,cACyC;AACzC,SAAO,iBAAiB,aAAa,MAAM;AAC7C;AAmBO,SAAS,kBACd,cACiC;AACjC,MAAI,qBAAqB,YAAY;AACnC,WAAO;AAAA,MACL,QAAQ,aAAa,OAAO;AAAA,MAC5B,WAAW,aAAa,UAAU;AAAA,MAClC,YAAY,aAAa,WAAW;AAAA,MACpC,UAAU,aAAa,SAAS;AAAA,IAAA;AAKtC;;;"}
@@ -28,7 +28,12 @@ export declare function isSignedPlaybackInfo(
28
28
  ): playbackInfo is VideoPlaybackInfoSigned
29
29
 
30
30
  /** @public */
31
- declare interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem> {
31
+ declare interface VideoPlaybackInfo<
32
+ T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
33
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
34
+ ? VideoRenditionInfoSigned
35
+ : VideoRenditionInfo,
36
+ > {
32
37
  id: string
33
38
  thumbnail: T
34
39
  animated: T
@@ -36,6 +41,7 @@ declare interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlayb
36
41
  stream: T
37
42
  duration: number
38
43
  aspectRatio: number
44
+ renditions?: R[]
39
45
  }
40
46
 
41
47
  /** @public */
@@ -62,4 +68,23 @@ declare interface VideoPlaybackTokens {
62
68
  animated?: string
63
69
  }
64
70
 
71
+ /** @public */
72
+ export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
73
+
74
+ /** @public */
75
+ export declare interface VideoRenditionInfoPublic {
76
+ /** URL to the MP4 rendition (redirects to CDN) */
77
+ url: string
78
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
79
+ resolution: '1080p' | '480p' | '270p' | (string & {})
80
+ }
81
+
82
+ /** @public */
83
+ export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
84
+ /** Authentication token for signed playback */
85
+ token: string
86
+ /** Token expiration time in ISO 8601 format */
87
+ expiresAt: string
88
+ }
89
+
65
90
  export {}
@@ -28,7 +28,12 @@ export declare function isSignedPlaybackInfo(
28
28
  ): playbackInfo is VideoPlaybackInfoSigned
29
29
 
30
30
  /** @public */
31
- declare interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem> {
31
+ declare interface VideoPlaybackInfo<
32
+ T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
33
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
34
+ ? VideoRenditionInfoSigned
35
+ : VideoRenditionInfo,
36
+ > {
32
37
  id: string
33
38
  thumbnail: T
34
39
  animated: T
@@ -36,6 +41,7 @@ declare interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlayb
36
41
  stream: T
37
42
  duration: number
38
43
  aspectRatio: number
44
+ renditions?: R[]
39
45
  }
40
46
 
41
47
  /** @public */
@@ -62,4 +68,23 @@ declare interface VideoPlaybackTokens {
62
68
  animated?: string
63
69
  }
64
70
 
71
+ /** @public */
72
+ export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
73
+
74
+ /** @public */
75
+ export declare interface VideoRenditionInfoPublic {
76
+ /** URL to the MP4 rendition (redirects to CDN) */
77
+ url: string
78
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
79
+ resolution: '1080p' | '480p' | '270p' | (string & {})
80
+ }
81
+
82
+ /** @public */
83
+ export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
84
+ /** Authentication token for signed playback */
85
+ token: string
86
+ /** Token expiration time in ISO 8601 format */
87
+ expiresAt: string
88
+ }
89
+
65
90
  export {}
@@ -1 +1 @@
1
- {"version":3,"file":"media-library.js","sources":["../src/media-library.ts"],"sourcesContent":["import type {\n VideoPlaybackInfo,\n VideoPlaybackInfoItem,\n VideoPlaybackInfoItemSigned,\n VideoPlaybackInfoSigned,\n VideoPlaybackTokens,\n} from './types'\n\n/**\n * Check if a playback info item (stream/thumbnail/etc) has a signed token\n * @internal\n */\nfunction isSignedPlayback(item: VideoPlaybackInfoItem): item is VideoPlaybackInfoItemSigned {\n return 'token' in item\n}\n\n/**\n * Check if the entire playback info response requires signed URLs\n * @public\n */\nexport function isSignedPlaybackInfo(\n playbackInfo: VideoPlaybackInfo,\n): playbackInfo is VideoPlaybackInfoSigned {\n return isSignedPlayback(playbackInfo.stream)\n}\n\n/**\n * Extract playback tokens from signed video playback info\n * @param playbackInfo - The video playback info\n * @returns The playback tokens or undefined if the response is not signed\n * @public\n * @example\n * const tokens = getPlaybackTokens(playbackInfo)\n * console.log(tokens)\n * ```json\n * {\n * stream: \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n * thumbnail: \"eyJ0a2VuIjoiVGh1bWJuYWlsVG9rZW4tMTIz...\",\n * animated: \"eyJ0a2VuIjoiQW5pbWF0ZWRUb2tlbi1kZWY...\",\n * storyboard: \"eyJ0a2VuIjoiU3Rvcnlib2FyZFRva2VuLTc4...\"\n * }\n * ```\n */\nexport function getPlaybackTokens(\n playbackInfo: VideoPlaybackInfo,\n): VideoPlaybackTokens | undefined {\n if (isSignedPlaybackInfo(playbackInfo)) {\n return {\n stream: playbackInfo.stream.token,\n thumbnail: playbackInfo.thumbnail.token,\n storyboard: playbackInfo.storyboard.token,\n animated: playbackInfo.animated.token,\n }\n }\n\n return undefined\n}\n"],"names":[],"mappings":"AAYA,SAAS,iBAAiB,MAAkE;AAC1F,SAAO,WAAW;AACpB;AAMO,SAAS,qBACd,cACyC;AACzC,SAAO,iBAAiB,aAAa,MAAM;AAC7C;AAmBO,SAAS,kBACd,cACiC;AACjC,MAAI,qBAAqB,YAAY;AACnC,WAAO;AAAA,MACL,QAAQ,aAAa,OAAO;AAAA,MAC5B,WAAW,aAAa,UAAU;AAAA,MAClC,YAAY,aAAa,WAAW;AAAA,MACpC,UAAU,aAAa,SAAS;AAAA,IAAA;AAKtC;"}
1
+ {"version":3,"file":"media-library.js","sources":["../src/media-library.ts"],"sourcesContent":["import type {\n VideoPlaybackInfo,\n VideoPlaybackInfoItem,\n VideoPlaybackInfoItemSigned,\n VideoPlaybackInfoSigned,\n VideoPlaybackTokens,\n} from './types'\n\nexport type {VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned} from './types'\n\n/**\n * Check if a playback info item (stream/thumbnail/etc) has a signed token\n * @internal\n */\nfunction isSignedPlayback(item: VideoPlaybackInfoItem): item is VideoPlaybackInfoItemSigned {\n return 'token' in item\n}\n\n/**\n * Check if the entire playback info response requires signed URLs\n * @public\n */\nexport function isSignedPlaybackInfo(\n playbackInfo: VideoPlaybackInfo,\n): playbackInfo is VideoPlaybackInfoSigned {\n return isSignedPlayback(playbackInfo.stream)\n}\n\n/**\n * Extract playback tokens from signed video playback info\n * @param playbackInfo - The video playback info\n * @returns The playback tokens or undefined if the response is not signed\n * @public\n * @example\n * const tokens = getPlaybackTokens(playbackInfo)\n * console.log(tokens)\n * ```json\n * {\n * stream: \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n * thumbnail: \"eyJ0a2VuIjoiVGh1bWJuYWlsVG9rZW4tMTIz...\",\n * animated: \"eyJ0a2VuIjoiQW5pbWF0ZWRUb2tlbi1kZWY...\",\n * storyboard: \"eyJ0a2VuIjoiU3Rvcnlib2FyZFRva2VuLTc4...\"\n * }\n * ```\n */\nexport function getPlaybackTokens(\n playbackInfo: VideoPlaybackInfo,\n): VideoPlaybackTokens | undefined {\n if (isSignedPlaybackInfo(playbackInfo)) {\n return {\n stream: playbackInfo.stream.token,\n thumbnail: playbackInfo.thumbnail.token,\n storyboard: playbackInfo.storyboard.token,\n animated: playbackInfo.animated.token,\n }\n }\n\n return undefined\n}\n"],"names":[],"mappings":"AAcA,SAAS,iBAAiB,MAAkE;AAC1F,SAAO,WAAW;AACpB;AAMO,SAAS,qBACd,cACyC;AACzC,SAAO,iBAAiB,aAAa,MAAM;AAC7C;AAmBO,SAAS,kBACd,cACiC;AACjC,MAAI,qBAAqB,YAAY;AACnC,WAAO;AAAA,MACL,QAAQ,aAAa,OAAO;AAAA,MAC5B,WAAW,aAAa,UAAU;AAAA,MAClC,YAAY,aAAa,WAAW;AAAA,MACpC,UAAU,aAAa,SAAS;AAAA,IAAA;AAKtC;"}
@@ -6811,6 +6811,9 @@ export declare type VersionAction =
6811
6811
  /** @public */
6812
6812
  export declare interface VideoPlaybackInfo<
6813
6813
  T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
6814
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
6815
+ ? VideoRenditionInfoSigned
6816
+ : VideoRenditionInfo,
6814
6817
  > {
6815
6818
  id: string
6816
6819
  thumbnail: T
@@ -6819,6 +6822,7 @@ export declare interface VideoPlaybackInfo<
6819
6822
  stream: T
6820
6823
  duration: number
6821
6824
  aspectRatio: number
6825
+ renditions?: R[]
6822
6826
  }
6823
6827
 
6824
6828
  /** @public */
@@ -6850,6 +6854,25 @@ export declare interface VideoPlaybackTokens {
6850
6854
  animated?: string
6851
6855
  }
6852
6856
 
6857
+ /** @public */
6858
+ export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
6859
+
6860
+ /** @public */
6861
+ export declare interface VideoRenditionInfoPublic {
6862
+ /** URL to the MP4 rendition (redirects to CDN) */
6863
+ url: string
6864
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
6865
+ resolution: '1080p' | '480p' | '270p' | (string & {})
6866
+ }
6867
+
6868
+ /** @public */
6869
+ export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
6870
+ /** Authentication token for signed playback */
6871
+ token: string
6872
+ /** Token expiration time in ISO 8601 format */
6873
+ expiresAt: string
6874
+ }
6875
+
6853
6876
  /**
6854
6877
  * Emitted when the listener reconnects and successfully resumes from
6855
6878
  * its previous position.
@@ -6811,6 +6811,9 @@ export declare type VersionAction =
6811
6811
  /** @public */
6812
6812
  export declare interface VideoPlaybackInfo<
6813
6813
  T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
6814
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
6815
+ ? VideoRenditionInfoSigned
6816
+ : VideoRenditionInfo,
6814
6817
  > {
6815
6818
  id: string
6816
6819
  thumbnail: T
@@ -6819,6 +6822,7 @@ export declare interface VideoPlaybackInfo<
6819
6822
  stream: T
6820
6823
  duration: number
6821
6824
  aspectRatio: number
6825
+ renditions?: R[]
6822
6826
  }
6823
6827
 
6824
6828
  /** @public */
@@ -6850,6 +6854,25 @@ export declare interface VideoPlaybackTokens {
6850
6854
  animated?: string
6851
6855
  }
6852
6856
 
6857
+ /** @public */
6858
+ export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
6859
+
6860
+ /** @public */
6861
+ export declare interface VideoRenditionInfoPublic {
6862
+ /** URL to the MP4 rendition (redirects to CDN) */
6863
+ url: string
6864
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
6865
+ resolution: '1080p' | '480p' | '270p' | (string & {})
6866
+ }
6867
+
6868
+ /** @public */
6869
+ export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
6870
+ /** Authentication token for signed playback */
6871
+ token: string
6872
+ /** Token expiration time in ISO 8601 format */
6873
+ expiresAt: string
6874
+ }
6875
+
6853
6876
  /**
6854
6877
  * Emitted when the listener reconnects and successfully resumes from
6855
6878
  * its previous position.
package/dist/stega.d.cts CHANGED
@@ -6811,6 +6811,9 @@ export declare type VersionAction =
6811
6811
  /** @public */
6812
6812
  export declare interface VideoPlaybackInfo<
6813
6813
  T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
6814
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
6815
+ ? VideoRenditionInfoSigned
6816
+ : VideoRenditionInfo,
6814
6817
  > {
6815
6818
  id: string
6816
6819
  thumbnail: T
@@ -6819,6 +6822,7 @@ export declare interface VideoPlaybackInfo<
6819
6822
  stream: T
6820
6823
  duration: number
6821
6824
  aspectRatio: number
6825
+ renditions?: R[]
6822
6826
  }
6823
6827
 
6824
6828
  /** @public */
@@ -6850,6 +6854,25 @@ export declare interface VideoPlaybackTokens {
6850
6854
  animated?: string
6851
6855
  }
6852
6856
 
6857
+ /** @public */
6858
+ export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
6859
+
6860
+ /** @public */
6861
+ export declare interface VideoRenditionInfoPublic {
6862
+ /** URL to the MP4 rendition (redirects to CDN) */
6863
+ url: string
6864
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
6865
+ resolution: '1080p' | '480p' | '270p' | (string & {})
6866
+ }
6867
+
6868
+ /** @public */
6869
+ export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
6870
+ /** Authentication token for signed playback */
6871
+ token: string
6872
+ /** Token expiration time in ISO 8601 format */
6873
+ expiresAt: string
6874
+ }
6875
+
6853
6876
  /**
6854
6877
  * Emitted when the listener reconnects and successfully resumes from
6855
6878
  * its previous position.
package/dist/stega.d.ts CHANGED
@@ -6811,6 +6811,9 @@ export declare type VersionAction =
6811
6811
  /** @public */
6812
6812
  export declare interface VideoPlaybackInfo<
6813
6813
  T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
6814
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
6815
+ ? VideoRenditionInfoSigned
6816
+ : VideoRenditionInfo,
6814
6817
  > {
6815
6818
  id: string
6816
6819
  thumbnail: T
@@ -6819,6 +6822,7 @@ export declare interface VideoPlaybackInfo<
6819
6822
  stream: T
6820
6823
  duration: number
6821
6824
  aspectRatio: number
6825
+ renditions?: R[]
6822
6826
  }
6823
6827
 
6824
6828
  /** @public */
@@ -6850,6 +6854,25 @@ export declare interface VideoPlaybackTokens {
6850
6854
  animated?: string
6851
6855
  }
6852
6856
 
6857
+ /** @public */
6858
+ export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
6859
+
6860
+ /** @public */
6861
+ export declare interface VideoRenditionInfoPublic {
6862
+ /** URL to the MP4 rendition (redirects to CDN) */
6863
+ url: string
6864
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
6865
+ resolution: '1080p' | '480p' | '270p' | (string & {})
6866
+ }
6867
+
6868
+ /** @public */
6869
+ export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
6870
+ /** Authentication token for signed playback */
6871
+ token: string
6872
+ /** Token expiration time in ISO 8601 format */
6873
+ expiresAt: string
6874
+ }
6875
+
6853
6876
  /**
6854
6877
  * Emitted when the listener reconnects and successfully resumes from
6855
6878
  * its previous position.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "7.17.0",
3
+ "version": "7.18.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -147,7 +147,7 @@
147
147
  "@types/node": "^22.9.0",
148
148
  "@typescript-eslint/eslint-plugin": "^8.29.1",
149
149
  "@typescript-eslint/parser": "^8.29.1",
150
- "@vercel/stega": "0.1.2",
150
+ "@vercel/stega": "1.1.0",
151
151
  "@vitest/coverage-v8": "3.1.1",
152
152
  "eslint": "^9.24.0",
153
153
  "eslint-config-prettier": "^10.1.1",
@@ -6,6 +6,8 @@ import type {
6
6
  VideoPlaybackTokens,
7
7
  } from './types'
8
8
 
9
+ export type {VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned} from './types'
10
+
9
11
  /**
10
12
  * Check if a playback info item (stream/thumbnail/etc) has a signed token
11
13
  * @internal
@@ -1,10 +1,11 @@
1
+ import {vercelStegaCombine} from '@vercel/stega'
2
+
1
3
  import {createEditUrl} from '../csm/createEditUrl'
2
4
  import {jsonPathToStudioPath} from '../csm/jsonPath'
3
5
  import {resolveStudioBaseRoute} from '../csm/resolveEditInfo'
4
6
  import {reKeySegment, toString as studioPathToString} from '../csm/studioPath'
5
7
  import {encodeIntoResult} from './encodeIntoResult'
6
8
  import {filterDefault} from './filterDefault'
7
- import {stegaCombine} from './stega'
8
9
  import {
9
10
  type ContentSourceMap,
10
11
  type ContentSourceMapParsedPath,
@@ -89,7 +90,7 @@ export function stegaEncodeSourceMap<Result = unknown>(
89
90
  if (!baseUrl) return value
90
91
  const {_id: id, _type: type, _projectId: projectId, _dataset: dataset} = sourceDocument
91
92
 
92
- return stegaCombine(
93
+ return vercelStegaCombine(
93
94
  value,
94
95
  {
95
96
  origin: 'sanity.io',
@@ -104,7 +105,7 @@ export function stegaEncodeSourceMap<Result = unknown>(
104
105
  }),
105
106
  },
106
107
  // We use custom logic to determine if we should skip encoding
107
- true,
108
+ false,
108
109
  )
109
110
  },
110
111
  )
package/src/types.ts CHANGED
@@ -1978,7 +1978,31 @@ export interface VideoPlaybackInfoItemSigned extends VideoPlaybackInfoItemPublic
1978
1978
  export type VideoPlaybackInfoItem = VideoPlaybackInfoItemPublic | VideoPlaybackInfoItemSigned
1979
1979
 
1980
1980
  /** @public */
1981
- export interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem> {
1981
+ export interface VideoRenditionInfoPublic {
1982
+ /** URL to the MP4 rendition (redirects to CDN) */
1983
+ url: string
1984
+ /** Resolution identifier, e.g. "1080p", "480p", "270p" */
1985
+ resolution: '1080p' | '480p' | '270p' | (string & {})
1986
+ }
1987
+
1988
+ /** @public */
1989
+ export interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
1990
+ /** Authentication token for signed playback */
1991
+ token: string
1992
+ /** Token expiration time in ISO 8601 format */
1993
+ expiresAt: string
1994
+ }
1995
+
1996
+ /** @public */
1997
+ export type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
1998
+
1999
+ /** @public */
2000
+ export interface VideoPlaybackInfo<
2001
+ T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
2002
+ R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
2003
+ ? VideoRenditionInfoSigned
2004
+ : VideoRenditionInfo,
2005
+ > {
1982
2006
  id: string
1983
2007
  thumbnail: T
1984
2008
  animated: T
@@ -1986,6 +2010,7 @@ export interface VideoPlaybackInfo<T extends VideoPlaybackInfoItem = VideoPlayba
1986
2010
  stream: T
1987
2011
  duration: number
1988
2012
  aspectRatio: number
2013
+ renditions?: R[]
1989
2014
  }
1990
2015
 
1991
2016
  /** @public */