feat(media): add Convex media archive with backfill and mixed-media library
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
type MediaPreviewReference<TStorageId extends string = string> = {
|
||||
storageId: TStorageId;
|
||||
kind?: "image" | "video" | "asset";
|
||||
storageId?: TStorageId;
|
||||
previewStorageId?: TStorageId;
|
||||
previewUrl?: string;
|
||||
originalUrl?: string;
|
||||
sourceUrl?: string;
|
||||
url?: string;
|
||||
};
|
||||
|
||||
export function collectMediaStorageIdsForResolution<TStorageId extends string>(
|
||||
@@ -25,6 +30,10 @@ export function resolveMediaPreviewUrl(
|
||||
item: MediaPreviewReference,
|
||||
urlMap: Record<string, string | undefined>,
|
||||
): string | undefined {
|
||||
if (item.previewUrl) {
|
||||
return item.previewUrl;
|
||||
}
|
||||
|
||||
if (item.previewStorageId) {
|
||||
const previewUrl = urlMap[item.previewStorageId];
|
||||
if (previewUrl) {
|
||||
@@ -32,5 +41,21 @@ export function resolveMediaPreviewUrl(
|
||||
}
|
||||
}
|
||||
|
||||
if (item.originalUrl) {
|
||||
return item.originalUrl;
|
||||
}
|
||||
|
||||
if (item.sourceUrl) {
|
||||
return item.sourceUrl;
|
||||
}
|
||||
|
||||
if (item.url) {
|
||||
return item.url;
|
||||
}
|
||||
|
||||
if (!item.storageId) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return urlMap[item.storageId];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user