Reduced media data sent by endpoints
This commit is contained in:
parent
6e0e8a1831
commit
48cc52ac24
|
@ -1,6 +1,6 @@
|
||||||
import payload from "payload";
|
import payload from "payload";
|
||||||
import { Collections } from "../../../constants";
|
import { Collections } from "../../../constants";
|
||||||
import { EndpointAudio, PayloadMedia } from "../../../sdk";
|
import { EndpointAudio, EndpointAudioPreview, PayloadMedia } from "../../../sdk";
|
||||||
import { Audio } from "../../../types/collections";
|
import { Audio } from "../../../types/collections";
|
||||||
import { CollectionEndpoint } from "../../../types/payload";
|
import { CollectionEndpoint } from "../../../types/payload";
|
||||||
import { isAudio, isMediaThumbnail, isNotEmpty } from "../../../utils/asserts";
|
import { isAudio, isMediaThumbnail, isNotEmpty } from "../../../utils/asserts";
|
||||||
|
@ -47,27 +47,40 @@ export const getByID: CollectionEndpoint = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const convertAudioToEndpointAudio = ({
|
export const convertAudioToEndpointAudioPreview = ({
|
||||||
url,
|
url,
|
||||||
attributes,
|
attributes,
|
||||||
translations,
|
translations,
|
||||||
mimeType,
|
mimeType,
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
filename,
|
filename,
|
||||||
filesize,
|
|
||||||
duration,
|
duration,
|
||||||
id,
|
id,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
credits,
|
}: Audio & PayloadMedia): EndpointAudioPreview => ({
|
||||||
}: Audio & PayloadMedia): EndpointAudio => ({
|
|
||||||
url,
|
|
||||||
attributes: convertAttributesToEndpointAttributes(attributes),
|
|
||||||
createdAt,
|
|
||||||
filename,
|
|
||||||
filesize,
|
|
||||||
id,
|
id,
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
mimeType,
|
mimeType,
|
||||||
|
attributes: convertAttributesToEndpointAttributes(attributes),
|
||||||
|
translations:
|
||||||
|
translations?.map(({ language, title, pretitle, subtitle }) => ({
|
||||||
|
language: getLanguageId(language),
|
||||||
|
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
||||||
|
title,
|
||||||
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
|
})) ?? [],
|
||||||
|
duration,
|
||||||
|
...(isMediaThumbnail(thumbnail)
|
||||||
|
? { thumbnail: convertMediaThumbnailToEndpointPayloadImage(thumbnail) }
|
||||||
|
: {}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const convertAudioToEndpointAudio = (audio: Audio & PayloadMedia): EndpointAudio => {
|
||||||
|
const { translations, createdAt, updatedAt, filesize, credits } = audio;
|
||||||
|
return {
|
||||||
|
...convertAudioToEndpointAudioPreview(audio),
|
||||||
|
createdAt,
|
||||||
|
filesize,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
translations:
|
translations:
|
||||||
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
|
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
|
||||||
|
@ -77,9 +90,6 @@ export const convertAudioToEndpointAudio = ({
|
||||||
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
|
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
duration,
|
|
||||||
...(isMediaThumbnail(thumbnail)
|
|
||||||
? { thumbnail: convertMediaThumbnailToEndpointPayloadImage(thumbnail) }
|
|
||||||
: {}),
|
|
||||||
credits: convertCreditsToEndpointCredits(credits),
|
credits: convertCreditsToEndpointCredits(credits),
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -20,10 +20,10 @@ import {
|
||||||
convertSourceToEndpointSource,
|
convertSourceToEndpointSource,
|
||||||
getDomainFromUrl,
|
getDomainFromUrl,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertAudioToEndpointAudio } from "../../Audios/endpoints/getByID";
|
import { convertAudioToEndpointAudioPreview } from "../../Audios/endpoints/getByID";
|
||||||
import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint";
|
import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint";
|
||||||
import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID";
|
import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID";
|
||||||
import { convertVideoToEndpointVideo } from "../../Videos/endpoints/getByID";
|
import { convertVideoToEndpointVideoPreview } from "../../Videos/endpoints/getByID";
|
||||||
|
|
||||||
export const getBySlugEndpoint = createGetByEndpoint({
|
export const getBySlugEndpoint = createGetByEndpoint({
|
||||||
collection: Collections.Collectibles,
|
collection: Collections.Collectibles,
|
||||||
|
@ -256,12 +256,18 @@ const handleContents = (contents: Collectible["contents"]): EndpointCollectible[
|
||||||
|
|
||||||
case Collections.Audios:
|
case Collections.Audios:
|
||||||
return isAudio(content.value)
|
return isAudio(content.value)
|
||||||
? { relationTo: Collections.Audios, value: convertAudioToEndpointAudio(content.value) }
|
? {
|
||||||
|
relationTo: Collections.Audios,
|
||||||
|
value: convertAudioToEndpointAudioPreview(content.value),
|
||||||
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
case Collections.Videos:
|
case Collections.Videos:
|
||||||
return isVideo(content.value)
|
return isVideo(content.value)
|
||||||
? { relationTo: Collections.Videos, value: convertVideoToEndpointVideo(content.value) }
|
? {
|
||||||
|
relationTo: Collections.Videos,
|
||||||
|
value: convertVideoToEndpointVideoPreview(content.value),
|
||||||
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -12,11 +12,11 @@ import {
|
||||||
isVideo,
|
isVideo,
|
||||||
} from "../../../utils/asserts";
|
} from "../../../utils/asserts";
|
||||||
import { convertSourceToEndpointSource, getLanguageId } from "../../../utils/endpoints";
|
import { convertSourceToEndpointSource, getLanguageId } from "../../../utils/endpoints";
|
||||||
import { convertAudioToEndpointAudio } from "../../Audios/endpoints/getByID";
|
import { convertAudioToEndpointAudioPreview } from "../../Audios/endpoints/getByID";
|
||||||
import { convertCollectibleToEndpointCollectiblePreview } from "../../Collectibles/endpoints/getBySlugEndpoint";
|
import { convertCollectibleToEndpointCollectiblePreview } from "../../Collectibles/endpoints/getBySlugEndpoint";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
import { convertImageToEndpointImagePreview } from "../../Images/endpoints/getByID";
|
||||||
import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint";
|
import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint";
|
||||||
import { convertVideoToEndpointVideo } from "../../Videos/endpoints/getByID";
|
import { convertVideoToEndpointVideoPreview } from "../../Videos/endpoints/getByID";
|
||||||
|
|
||||||
export const getBySlugEndpoint = createGetByEndpoint({
|
export const getBySlugEndpoint = createGetByEndpoint({
|
||||||
collection: Collections.Folders,
|
collection: Collections.Folders,
|
||||||
|
@ -92,13 +92,19 @@ const convertFolderToEndpointFolder = (folder: Folder): EndpointFolder => {
|
||||||
];
|
];
|
||||||
case Collections.Images:
|
case Collections.Images:
|
||||||
if (!isImage(value)) return [];
|
if (!isImage(value)) return [];
|
||||||
return [{ relationTo: Collections.Images, value: convertImageToEndpointImage(value) }];
|
return [
|
||||||
|
{ relationTo: Collections.Images, value: convertImageToEndpointImagePreview(value) },
|
||||||
|
];
|
||||||
case Collections.Audios:
|
case Collections.Audios:
|
||||||
if (!isAudio(value)) return [];
|
if (!isAudio(value)) return [];
|
||||||
return [{ relationTo: Collections.Audios, value: convertAudioToEndpointAudio(value) }];
|
return [
|
||||||
|
{ relationTo: Collections.Audios, value: convertAudioToEndpointAudioPreview(value) },
|
||||||
|
];
|
||||||
case Collections.Videos:
|
case Collections.Videos:
|
||||||
if (!isVideo(value)) return [];
|
if (!isVideo(value)) return [];
|
||||||
return [{ relationTo: Collections.Videos, value: convertVideoToEndpointVideo(value) }];
|
return [
|
||||||
|
{ relationTo: Collections.Videos, value: convertVideoToEndpointVideoPreview(value) },
|
||||||
|
];
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import payload from "payload";
|
import payload from "payload";
|
||||||
import { Collections } from "../../../constants";
|
import { Collections } from "../../../constants";
|
||||||
import { EndpointImage, PayloadImage } from "../../../sdk";
|
import { EndpointImage, EndpointImagePreview, PayloadImage } from "../../../sdk";
|
||||||
import { Image } from "../../../types/collections";
|
import { Image } from "../../../types/collections";
|
||||||
import { CollectionEndpoint } from "../../../types/payload";
|
import { CollectionEndpoint } from "../../../types/payload";
|
||||||
import { isImage, isNotEmpty, isPayloadImage } from "../../../utils/asserts";
|
import { isImage, isNotEmpty, isPayloadImage } from "../../../utils/asserts";
|
||||||
|
@ -47,40 +47,32 @@ export const getByID: CollectionEndpoint = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const convertImageToEndpointImage = ({
|
export const convertImageToEndpointImagePreview = ({
|
||||||
url,
|
url,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
attributes,
|
attributes,
|
||||||
translations,
|
translations,
|
||||||
mimeType,
|
mimeType,
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
filename,
|
filename,
|
||||||
filesize,
|
filesize,
|
||||||
id,
|
id,
|
||||||
credits,
|
|
||||||
sizes,
|
sizes,
|
||||||
}: Image & PayloadImage): EndpointImage => ({
|
}: Image & PayloadImage): EndpointImagePreview => ({
|
||||||
url,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
attributes: convertAttributesToEndpointAttributes(attributes),
|
|
||||||
createdAt,
|
|
||||||
filename,
|
|
||||||
filesize,
|
|
||||||
id,
|
id,
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
mimeType,
|
mimeType,
|
||||||
updatedAt,
|
attributes: convertAttributesToEndpointAttributes(attributes),
|
||||||
translations:
|
translations:
|
||||||
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
|
translations?.map(({ language, title, pretitle, subtitle }) => ({
|
||||||
language: getLanguageId(language),
|
language: getLanguageId(language),
|
||||||
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
||||||
title,
|
title,
|
||||||
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
|
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
credits: convertCreditsToEndpointCredits(credits),
|
width,
|
||||||
|
height,
|
||||||
sizes: convertSizesToPayloadImages(
|
sizes: convertSizesToPayloadImages(
|
||||||
[
|
[
|
||||||
sizes?.["200w"],
|
sizes?.["200w"],
|
||||||
|
@ -96,3 +88,22 @@ export const convertImageToEndpointImage = ({
|
||||||
),
|
),
|
||||||
...(isPayloadImage(sizes?.og) ? { openGraph: sizes.og } : {}),
|
...(isPayloadImage(sizes?.og) ? { openGraph: sizes.og } : {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const convertImageToEndpointImage = (image: Image & PayloadImage): EndpointImage => {
|
||||||
|
const { translations, createdAt, updatedAt, filesize, credits } = image;
|
||||||
|
return {
|
||||||
|
...convertImageToEndpointImagePreview(image),
|
||||||
|
createdAt,
|
||||||
|
filesize,
|
||||||
|
updatedAt,
|
||||||
|
translations:
|
||||||
|
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
|
||||||
|
language: getLanguageId(language),
|
||||||
|
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
||||||
|
title,
|
||||||
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
|
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
|
||||||
|
})) ?? [],
|
||||||
|
credits: convertCreditsToEndpointCredits(credits),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import payload from "payload";
|
import payload from "payload";
|
||||||
import { Collections } from "../../../constants";
|
import { Collections } from "../../../constants";
|
||||||
import { EndpointVideo, PayloadMedia } from "../../../sdk";
|
import { EndpointVideo, EndpointVideoPreview, PayloadMedia } from "../../../sdk";
|
||||||
import { Video } from "../../../types/collections";
|
import { Video } from "../../../types/collections";
|
||||||
import { CollectionEndpoint } from "../../../types/payload";
|
import { CollectionEndpoint } from "../../../types/payload";
|
||||||
import {
|
import {
|
||||||
|
@ -55,52 +55,32 @@ export const getByID: CollectionEndpoint = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const convertVideoToEndpointVideo = ({
|
export const convertVideoToEndpointVideoPreview = ({
|
||||||
url,
|
url,
|
||||||
attributes,
|
attributes,
|
||||||
translations,
|
translations,
|
||||||
mimeType,
|
mimeType,
|
||||||
createdAt,
|
|
||||||
updatedAt,
|
|
||||||
filename,
|
filename,
|
||||||
filesize,
|
|
||||||
duration,
|
duration,
|
||||||
id,
|
id,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
platform,
|
}: Video & PayloadMedia): EndpointVideoPreview => ({
|
||||||
platformEnabled,
|
|
||||||
credits,
|
|
||||||
}: Video & PayloadMedia): EndpointVideo => ({
|
|
||||||
url,
|
|
||||||
attributes: convertAttributesToEndpointAttributes(attributes),
|
|
||||||
createdAt,
|
|
||||||
filename,
|
|
||||||
filesize,
|
|
||||||
id,
|
id,
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
mimeType,
|
mimeType,
|
||||||
updatedAt,
|
attributes: convertAttributesToEndpointAttributes(attributes),
|
||||||
translations:
|
translations:
|
||||||
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
|
translations?.map(({ language, title, pretitle, subtitle }) => ({
|
||||||
language: getLanguageId(language),
|
language: getLanguageId(language),
|
||||||
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
||||||
title,
|
title,
|
||||||
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
|
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
|
|
||||||
duration,
|
duration,
|
||||||
...(isMediaThumbnail(thumbnail)
|
...(isMediaThumbnail(thumbnail)
|
||||||
? { thumbnail: convertMediaThumbnailToEndpointPayloadImage(thumbnail) }
|
? { thumbnail: convertMediaThumbnailToEndpointPayloadImage(thumbnail) }
|
||||||
: {}),
|
: {}),
|
||||||
...(platformEnabled && isDefined(platform) && isPayloadType(platform.channel)
|
|
||||||
? {
|
|
||||||
platform: {
|
|
||||||
channel: platform.channel,
|
|
||||||
publishedDate: platform.publishedDate,
|
|
||||||
url: platform.url,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
subtitles:
|
subtitles:
|
||||||
translations.flatMap(({ language, subfile }) => {
|
translations.flatMap(({ language, subfile }) => {
|
||||||
if (
|
if (
|
||||||
|
@ -112,5 +92,34 @@ export const convertVideoToEndpointVideo = ({
|
||||||
return [];
|
return [];
|
||||||
return { language: getLanguageId(language), url: subfile.url };
|
return { language: getLanguageId(language), url: subfile.url };
|
||||||
}) ?? [],
|
}) ?? [],
|
||||||
credits: convertCreditsToEndpointCredits(credits),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const convertVideoToEndpointVideo = (video: Video & PayloadMedia): EndpointVideo => {
|
||||||
|
const { translations, createdAt, updatedAt, filesize, platform, platformEnabled, credits } =
|
||||||
|
video;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...convertVideoToEndpointVideoPreview(video),
|
||||||
|
createdAt,
|
||||||
|
filesize,
|
||||||
|
updatedAt,
|
||||||
|
translations:
|
||||||
|
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
|
||||||
|
language: getLanguageId(language),
|
||||||
|
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
||||||
|
title,
|
||||||
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
|
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
|
||||||
|
})) ?? [],
|
||||||
|
...(platformEnabled && isDefined(platform) && isPayloadType(platform.channel)
|
||||||
|
? {
|
||||||
|
platform: {
|
||||||
|
channel: platform.channel,
|
||||||
|
publishedDate: platform.publishedDate,
|
||||||
|
url: platform.url,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
credits: convertCreditsToEndpointCredits(credits),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { EndpointAudio, EndpointImage, EndpointVideo } from "./sdk";
|
import { EndpointAudioPreview, EndpointImagePreview, EndpointVideoPreview } from "./sdk";
|
||||||
import type { BreakBlock, SectionBlock, TranscriptBlock } from "./types/collections";
|
import type { BreakBlock, SectionBlock, TranscriptBlock } from "./types/collections";
|
||||||
|
|
||||||
// END MOCKING SECTION
|
// END MOCKING SECTION
|
||||||
|
@ -144,17 +144,17 @@ export interface RichTextUploadNode extends RichTextNode {
|
||||||
|
|
||||||
export interface RichTextUploadImageNode extends RichTextUploadNode {
|
export interface RichTextUploadImageNode extends RichTextUploadNode {
|
||||||
relationTo: Collections.Images;
|
relationTo: Collections.Images;
|
||||||
value: EndpointImage;
|
value: EndpointImagePreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RichTextUploadVideoNode extends RichTextUploadNode {
|
export interface RichTextUploadVideoNode extends RichTextUploadNode {
|
||||||
relationTo: Collections.Videos;
|
relationTo: Collections.Videos;
|
||||||
value: EndpointVideo;
|
value: EndpointVideoPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RichTextUploadAudioNode extends RichTextUploadNode {
|
export interface RichTextUploadAudioNode extends RichTextUploadNode {
|
||||||
relationTo: Collections.Audios;
|
relationTo: Collections.Audios;
|
||||||
value: EndpointAudio;
|
value: EndpointAudioPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RichTextTextNode extends RichTextNode {
|
export interface RichTextTextNode extends RichTextNode {
|
||||||
|
|
46
src/sdk.ts
46
src/sdk.ts
|
@ -44,15 +44,15 @@ export type EndpointFolder = EndpointFolderPreview & {
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
relationTo: Collections.Images;
|
relationTo: Collections.Images;
|
||||||
value: EndpointImage;
|
value: EndpointImagePreview;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
relationTo: Collections.Audios;
|
relationTo: Collections.Audios;
|
||||||
value: EndpointAudio;
|
value: EndpointAudioPreview;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
relationTo: Collections.Videos;
|
relationTo: Collections.Videos;
|
||||||
value: EndpointVideo;
|
value: EndpointVideoPreview;
|
||||||
}
|
}
|
||||||
)[];
|
)[];
|
||||||
parentPages: EndpointSource[];
|
parentPages: EndpointSource[];
|
||||||
|
@ -231,11 +231,11 @@ export type EndpointCollectible = EndpointCollectiblePreview & {
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
relationTo: Collections.Audios;
|
relationTo: Collections.Audios;
|
||||||
value: EndpointAudio;
|
value: EndpointAudioPreview;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
relationTo: Collections.Videos;
|
relationTo: Collections.Videos;
|
||||||
value: EndpointVideo;
|
value: EndpointVideoPreview;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
relationTo: Collections.GenericContents;
|
relationTo: Collections.GenericContents;
|
||||||
|
@ -420,25 +420,37 @@ export type EndpointSource =
|
||||||
| { type: "scans"; collectible: EndpointSourcePreview }
|
| { type: "scans"; collectible: EndpointSourcePreview }
|
||||||
| { type: "gallery"; collectible: EndpointSourcePreview };
|
| { type: "gallery"; collectible: EndpointSourcePreview };
|
||||||
|
|
||||||
export type EndpointMedia = {
|
export type EndpointMediaPreview = {
|
||||||
id: string;
|
id: string;
|
||||||
url: string;
|
url: string;
|
||||||
filename: string;
|
filename: string;
|
||||||
mimeType: string;
|
mimeType: string;
|
||||||
filesize: number;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
attributes: EndpointAttribute[];
|
attributes: EndpointAttribute[];
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
description?: RichTextContent;
|
|
||||||
}[];
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EndpointMedia = EndpointMediaPreview & {
|
||||||
|
filesize: number;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
translations: (EndpointMediaPreview["translations"][number] & {
|
||||||
|
description?: RichTextContent;
|
||||||
|
})[];
|
||||||
credits: EndpointCredit[];
|
credits: EndpointCredit[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EndpointImagePreview = EndpointMediaPreview & {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
sizes: PayloadImage[];
|
||||||
|
openGraph?: PayloadImage;
|
||||||
|
};
|
||||||
|
|
||||||
export type EndpointImage = EndpointMedia & {
|
export type EndpointImage = EndpointMedia & {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
|
@ -446,11 +458,25 @@ export type EndpointImage = EndpointMedia & {
|
||||||
openGraph?: PayloadImage;
|
openGraph?: PayloadImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EndpointAudioPreview = EndpointMediaPreview & {
|
||||||
|
thumbnail?: EndpointPayloadImage;
|
||||||
|
duration: number;
|
||||||
|
};
|
||||||
|
|
||||||
export type EndpointAudio = EndpointMedia & {
|
export type EndpointAudio = EndpointMedia & {
|
||||||
thumbnail?: EndpointPayloadImage;
|
thumbnail?: EndpointPayloadImage;
|
||||||
duration: number;
|
duration: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EndpointVideoPreview = EndpointMediaPreview & {
|
||||||
|
thumbnail?: EndpointPayloadImage;
|
||||||
|
subtitles: {
|
||||||
|
language: string;
|
||||||
|
url: string;
|
||||||
|
}[];
|
||||||
|
duration: number;
|
||||||
|
};
|
||||||
|
|
||||||
export type EndpointVideo = EndpointMedia & {
|
export type EndpointVideo = EndpointMedia & {
|
||||||
thumbnail?: EndpointPayloadImage;
|
thumbnail?: EndpointPayloadImage;
|
||||||
subtitles: {
|
subtitles: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { convertAudioToEndpointAudio } from "../collections/Audios/endpoints/getByID";
|
import { convertAudioToEndpointAudioPreview } from "../collections/Audios/endpoints/getByID";
|
||||||
import { convertImageToEndpointImage } from "../collections/Images/endpoints/getByID";
|
import { convertImageToEndpointImagePreview } from "../collections/Images/endpoints/getByID";
|
||||||
import { convertRecorderToEndpointRecorderPreview } from "../collections/Recorders/endpoints/getByID";
|
import { convertRecorderToEndpointRecorderPreview } from "../collections/Recorders/endpoints/getByID";
|
||||||
import { convertVideoToEndpointVideo } from "../collections/Videos/endpoints/getByID";
|
import { convertVideoToEndpointVideoPreview } from "../collections/Videos/endpoints/getByID";
|
||||||
import {
|
import {
|
||||||
AttributeTypes,
|
AttributeTypes,
|
||||||
RichTextBreakBlock,
|
RichTextBreakBlock,
|
||||||
|
@ -110,21 +110,21 @@ export const convertRTCToEndpointRTC = (
|
||||||
if (!isImage(value)) return errorUploadNode;
|
if (!isImage(value)) return errorUploadNode;
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
value: convertImageToEndpointImage(value),
|
value: convertImageToEndpointImagePreview(value),
|
||||||
};
|
};
|
||||||
} else if (isUploadNodeAudioNode(node)) {
|
} else if (isUploadNodeAudioNode(node)) {
|
||||||
const value = node.value as unknown as Audio | string;
|
const value = node.value as unknown as Audio | string;
|
||||||
if (!isAudio(value)) return errorUploadNode;
|
if (!isAudio(value)) return errorUploadNode;
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
value: convertAudioToEndpointAudio(value),
|
value: convertAudioToEndpointAudioPreview(value),
|
||||||
};
|
};
|
||||||
} else if (isUploadNodeVideoNode(node)) {
|
} else if (isUploadNodeVideoNode(node)) {
|
||||||
const value = node.value as unknown as Video | string;
|
const value = node.value as unknown as Video | string;
|
||||||
if (!isVideo(value)) return errorUploadNode;
|
if (!isVideo(value)) return errorUploadNode;
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
value: convertVideoToEndpointVideo(value),
|
value: convertVideoToEndpointVideoPreview(value),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue