sanity-plugin-mux-input 2.18.0 → 2.19.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/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/actions/assets.ts +7 -1
- package/src/actions/secrets.ts +6 -0
- package/src/actions/upload.ts +5 -1
- package/src/hooks/useMuxPolling.ts +2 -0
- package/src/util/pluginVersion.ts +1 -0
package/package.json
CHANGED
package/src/actions/assets.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {SanityClient} from 'sanity'
|
|
2
2
|
|
|
3
|
+
import {PLUGIN_VERSION_QUERY} from '../util/pluginVersion'
|
|
3
4
|
import type {MuxAsset, VideoAssetDocument} from '../util/types'
|
|
4
5
|
|
|
5
6
|
export function deleteAssetOnMux(client: SanityClient, assetId: string) {
|
|
@@ -8,6 +9,7 @@ export function deleteAssetOnMux(client: SanityClient, assetId: string) {
|
|
|
8
9
|
url: `/addons/mux/assets/${dataset}/${assetId}`,
|
|
9
10
|
withCredentials: true,
|
|
10
11
|
method: 'DELETE',
|
|
12
|
+
query: PLUGIN_VERSION_QUERY,
|
|
11
13
|
})
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -45,6 +47,7 @@ export function getAsset(client: SanityClient, assetId: string) {
|
|
|
45
47
|
url: `/addons/mux/assets/${dataset}/data/${assetId}`,
|
|
46
48
|
withCredentials: true,
|
|
47
49
|
method: 'GET',
|
|
50
|
+
query: PLUGIN_VERSION_QUERY,
|
|
48
51
|
})
|
|
49
52
|
}
|
|
50
53
|
|
|
@@ -66,7 +69,7 @@ export function listAssets(
|
|
|
66
69
|
url: `/addons/mux/assets/${dataset}/data/list`,
|
|
67
70
|
withCredentials: true,
|
|
68
71
|
method: 'GET',
|
|
69
|
-
query,
|
|
72
|
+
query: {...query, ...PLUGIN_VERSION_QUERY},
|
|
70
73
|
})
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -99,6 +102,7 @@ export function addTextTrackFromUrl(
|
|
|
99
102
|
headers: {
|
|
100
103
|
'Content-Type': 'application/json',
|
|
101
104
|
},
|
|
105
|
+
query: PLUGIN_VERSION_QUERY,
|
|
102
106
|
})
|
|
103
107
|
}
|
|
104
108
|
|
|
@@ -130,6 +134,7 @@ export function generateSubtitles(
|
|
|
130
134
|
headers: {
|
|
131
135
|
'Content-Type': 'application/json',
|
|
132
136
|
},
|
|
137
|
+
query: PLUGIN_VERSION_QUERY,
|
|
133
138
|
})
|
|
134
139
|
}
|
|
135
140
|
|
|
@@ -142,5 +147,6 @@ export function deleteTextTrack(client: SanityClient, assetId: string, trackId:
|
|
|
142
147
|
url: `/addons/mux/assets/${dataset}/${assetId}/tracks/${trackId}`,
|
|
143
148
|
withCredentials: true,
|
|
144
149
|
method: 'DELETE',
|
|
150
|
+
query: PLUGIN_VERSION_QUERY,
|
|
145
151
|
})
|
|
146
152
|
}
|
package/src/actions/secrets.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {defer} from 'rxjs'
|
|
2
2
|
import type {SanityClient} from 'sanity'
|
|
3
3
|
|
|
4
|
+
import {PLUGIN_VERSION_QUERY} from '../util/pluginVersion'
|
|
5
|
+
|
|
4
6
|
interface SecretsDocument {
|
|
5
7
|
_id: 'secrets.mux'
|
|
6
8
|
_type: 'mux.apiKey'
|
|
@@ -46,6 +48,7 @@ export async function createSigningKeys(client: SanityClient) {
|
|
|
46
48
|
url: `/addons/mux/signing-keys/${dataset}`,
|
|
47
49
|
withCredentials: true,
|
|
48
50
|
method: 'POST',
|
|
51
|
+
query: PLUGIN_VERSION_QUERY,
|
|
49
52
|
})
|
|
50
53
|
return res
|
|
51
54
|
} catch (error: any) {
|
|
@@ -64,6 +67,7 @@ export function testSecrets(client: SanityClient) {
|
|
|
64
67
|
url: `/addons/mux/secrets/${dataset}/test`,
|
|
65
68
|
withCredentials: true,
|
|
66
69
|
method: 'GET',
|
|
70
|
+
query: PLUGIN_VERSION_QUERY,
|
|
67
71
|
})
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -82,6 +86,7 @@ export async function haveValidSigningKeys(
|
|
|
82
86
|
url: `/addons/mux/signing-keys/${dataset}/${signingKeyId}`,
|
|
83
87
|
withCredentials: true,
|
|
84
88
|
method: 'GET',
|
|
89
|
+
query: PLUGIN_VERSION_QUERY,
|
|
85
90
|
})
|
|
86
91
|
//
|
|
87
92
|
// if this signing key is valid it will return { data: { id: 'xxxx' } }
|
|
@@ -100,6 +105,7 @@ export function testSecretsObservable(client: SanityClient) {
|
|
|
100
105
|
url: `/addons/mux/secrets/${dataset}/test`,
|
|
101
106
|
withCredentials: true,
|
|
102
107
|
method: 'GET',
|
|
108
|
+
query: PLUGIN_VERSION_QUERY,
|
|
103
109
|
})
|
|
104
110
|
)
|
|
105
111
|
}
|
package/src/actions/upload.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {SanityClient} from 'sanity'
|
|
|
5
5
|
|
|
6
6
|
import {createUpChunkObservable} from '../clients/upChunkObservable'
|
|
7
7
|
import {formatDriveShareLink} from '../util/formatDriveShareLink'
|
|
8
|
+
import {PLUGIN_VERSION_QUERY} from '../util/pluginVersion'
|
|
8
9
|
import {roundPxString} from '../util/roundPxString'
|
|
9
10
|
import type {MuxAsset, MuxNewAssetSettings, WatermarkConfig} from '../util/types'
|
|
10
11
|
import {getAsset} from './assets'
|
|
@@ -42,6 +43,7 @@ export function cancelUpload(client: SanityClient, uuid: string) {
|
|
|
42
43
|
url: `/addons/mux/uploads/${client.config().dataset}/${uuid}`,
|
|
43
44
|
withCredentials: true,
|
|
44
45
|
method: 'DELETE',
|
|
46
|
+
query: PLUGIN_VERSION_QUERY,
|
|
45
47
|
})
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -86,7 +88,7 @@ export function uploadUrl({
|
|
|
86
88
|
'MUX-Proxy-UUID': uuid,
|
|
87
89
|
'Content-Type': 'application/json',
|
|
88
90
|
},
|
|
89
|
-
query,
|
|
91
|
+
query: {...query, ...PLUGIN_VERSION_QUERY},
|
|
90
92
|
})
|
|
91
93
|
).pipe(
|
|
92
94
|
mergeMap((result) => {
|
|
@@ -153,6 +155,7 @@ export function uploadFile({
|
|
|
153
155
|
'Content-Type': 'application/json',
|
|
154
156
|
},
|
|
155
157
|
body,
|
|
158
|
+
query: PLUGIN_VERSION_QUERY,
|
|
156
159
|
})
|
|
157
160
|
).pipe(
|
|
158
161
|
mergeMap((result) => {
|
|
@@ -205,6 +208,7 @@ export function getUpload(client: SanityClient, assetId: string) {
|
|
|
205
208
|
url: `/addons/mux/uploads/${dataset}/${assetId}`,
|
|
206
209
|
withCredentials: true,
|
|
207
210
|
method: 'GET',
|
|
211
|
+
query: PLUGIN_VERSION_QUERY,
|
|
208
212
|
})
|
|
209
213
|
}
|
|
210
214
|
|
|
@@ -3,6 +3,7 @@ import {useDataset, useProjectId} from 'sanity'
|
|
|
3
3
|
import useSWR from 'swr'
|
|
4
4
|
|
|
5
5
|
import {useClient} from '../hooks/useClient'
|
|
6
|
+
import {PLUGIN_VERSION_QUERY} from '../util/pluginVersion'
|
|
6
7
|
import type {MuxAsset, VideoAssetDocument} from '../util/types'
|
|
7
8
|
|
|
8
9
|
// Poll MUX if it's preparing the main document or its own static renditions
|
|
@@ -39,6 +40,7 @@ export const useMuxPolling = (asset?: VideoAssetDocument) => {
|
|
|
39
40
|
url: `/addons/mux/assets/${dataset}/data/${asset!.assetId}`,
|
|
40
41
|
withCredentials: true,
|
|
41
42
|
method: 'GET',
|
|
43
|
+
query: PLUGIN_VERSION_QUERY,
|
|
42
44
|
})
|
|
43
45
|
client.patch(asset!._id!).set({status: data.status, data}).commit({returnDocuments: false})
|
|
44
46
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PLUGIN_VERSION_QUERY = {sanityVersion: process.env.PKG_VERSION!}
|