Reduced image data sent by endpoints
This commit is contained in:
parent
bf5b98b690
commit
6e0e8a1831
|
@ -7,7 +7,7 @@ import { isAudio, isMediaThumbnail, isNotEmpty } from "../../../utils/asserts";
|
||||||
import {
|
import {
|
||||||
convertAttributesToEndpointAttributes,
|
convertAttributesToEndpointAttributes,
|
||||||
convertCreditsToEndpointCredits,
|
convertCreditsToEndpointCredits,
|
||||||
convertMediaThumbnailToEndpointMediaThumbnail,
|
convertMediaThumbnailToEndpointPayloadImage,
|
||||||
convertRTCToEndpointRTC,
|
convertRTCToEndpointRTC,
|
||||||
getLanguageId,
|
getLanguageId,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
|
@ -79,7 +79,7 @@ export const convertAudioToEndpointAudio = ({
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
duration,
|
duration,
|
||||||
...(isMediaThumbnail(thumbnail)
|
...(isMediaThumbnail(thumbnail)
|
||||||
? { thumbnail: convertMediaThumbnailToEndpointMediaThumbnail(thumbnail) }
|
? { thumbnail: convertMediaThumbnailToEndpointPayloadImage(thumbnail) }
|
||||||
: {}),
|
: {}),
|
||||||
credits: convertCreditsToEndpointCredits(credits),
|
credits: convertCreditsToEndpointCredits(credits),
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,12 +15,12 @@ import {
|
||||||
} from "../../../utils/asserts";
|
} from "../../../utils/asserts";
|
||||||
import {
|
import {
|
||||||
convertAttributesToEndpointAttributes,
|
convertAttributesToEndpointAttributes,
|
||||||
|
convertImageToEndpointPayloadImage,
|
||||||
convertScanToEndpointScanImage,
|
convertScanToEndpointScanImage,
|
||||||
convertSourceToEndpointSource,
|
convertSourceToEndpointSource,
|
||||||
getDomainFromUrl,
|
getDomainFromUrl,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertAudioToEndpointAudio } from "../../Audios/endpoints/getByID";
|
import { convertAudioToEndpointAudio } from "../../Audios/endpoints/getByID";
|
||||||
import { convertImageToEndpointImage } from "../../Images/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 { convertVideoToEndpointVideo } from "../../Videos/endpoints/getByID";
|
||||||
|
@ -45,7 +45,7 @@ export const convertCollectibleToEndpointCollectiblePreview = ({
|
||||||
}: Collectible): EndpointCollectiblePreview => ({
|
}: Collectible): EndpointCollectiblePreview => ({
|
||||||
id,
|
id,
|
||||||
slug,
|
slug,
|
||||||
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointImage(thumbnail) } : {}),
|
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointPayloadImage(thumbnail) } : {}),
|
||||||
translations:
|
translations:
|
||||||
translations?.map(({ language, title, pretitle, subtitle }) => ({
|
translations?.map(({ language, title, pretitle, subtitle }) => ({
|
||||||
language: isPayloadType(language) ? language.id : language,
|
language: isPayloadType(language) ? language.id : language,
|
||||||
|
@ -98,7 +98,7 @@ const convertCollectibleToEndpointCollectible = (collectible: Collectible): Endp
|
||||||
...(isNotEmpty(description) ? { description } : {}),
|
...(isNotEmpty(description) ? { description } : {}),
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
...(isImage(backgroundImage)
|
...(isImage(backgroundImage)
|
||||||
? { backgroundImage: convertImageToEndpointImage(backgroundImage) }
|
? { backgroundImage: convertImageToEndpointPayloadImage(backgroundImage) }
|
||||||
: {}),
|
: {}),
|
||||||
nature: nature === "Physical" ? CollectibleNature.Physical : CollectibleNature.Digital,
|
nature: nature === "Physical" ? CollectibleNature.Physical : CollectibleNature.Digital,
|
||||||
...(gallery ? { gallery } : {}),
|
...(gallery ? { gallery } : {}),
|
||||||
|
@ -162,7 +162,7 @@ const handlePageInfo = (
|
||||||
const handleGallery = (gallery: Collectible["gallery"]): EndpointCollectible["gallery"] => {
|
const handleGallery = (gallery: Collectible["gallery"]): EndpointCollectible["gallery"] => {
|
||||||
const thumbnail = gallery?.[0]?.image;
|
const thumbnail = gallery?.[0]?.image;
|
||||||
if (!thumbnail || !isImage(thumbnail)) return;
|
if (!thumbnail || !isImage(thumbnail)) return;
|
||||||
return { count: gallery.length, thumbnail: convertImageToEndpointImage(thumbnail) };
|
return { count: gallery.length, thumbnail: convertImageToEndpointPayloadImage(thumbnail) };
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleScans = (scans: Collectible["scans"]): EndpointCollectible["scans"] => {
|
const handleScans = (scans: Collectible["scans"]): EndpointCollectible["scans"] => {
|
||||||
|
|
|
@ -2,8 +2,10 @@ import { Collections } from "../../../constants";
|
||||||
import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint";
|
import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint";
|
||||||
import { EndpointCollectibleGallery } from "../../../sdk";
|
import { EndpointCollectibleGallery } from "../../../sdk";
|
||||||
import { isImage, isNotEmpty, isPayloadType } from "../../../utils/asserts";
|
import { isImage, isNotEmpty, isPayloadType } from "../../../utils/asserts";
|
||||||
import { convertSourceToEndpointSource } from "../../../utils/endpoints";
|
import {
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
convertImageToEndpointPayloadImage,
|
||||||
|
convertSourceToEndpointSource,
|
||||||
|
} from "../../../utils/endpoints";
|
||||||
|
|
||||||
export const getBySlugEndpointGallery = createGetByEndpoint({
|
export const getBySlugEndpointGallery = createGetByEndpoint({
|
||||||
collection: Collections.Collectibles,
|
collection: Collections.Collectibles,
|
||||||
|
@ -22,10 +24,10 @@ export const getBySlugEndpointGallery = createGetByEndpoint({
|
||||||
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
...(isNotEmpty(description) ? { description } : {}),
|
...(isNotEmpty(description) ? { description } : {}),
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointImage(thumbnail) } : {}),
|
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointPayloadImage(thumbnail) } : {}),
|
||||||
images:
|
images:
|
||||||
gallery?.flatMap(({ image }) =>
|
gallery?.flatMap(({ image }) =>
|
||||||
isImage(image) ? convertImageToEndpointImage(image) : []
|
isImage(image) ? convertImageToEndpointPayloadImage(image) : []
|
||||||
) ?? [],
|
) ?? [],
|
||||||
parentPages: convertSourceToEndpointSource({ collectibles: [collectible] }),
|
parentPages: convertSourceToEndpointSource({ collectibles: [collectible] }),
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,9 +54,6 @@ export const getBySlugEndpointGalleryImage: CollectionEndpoint = {
|
||||||
image: convertImageToEndpointImage(image),
|
image: convertImageToEndpointImage(image),
|
||||||
parentPages: convertSourceToEndpointSource({ gallery: [collectible] }),
|
parentPages: convertSourceToEndpointSource({ gallery: [collectible] }),
|
||||||
slug,
|
slug,
|
||||||
...(isImage(collectible.thumbnail)
|
|
||||||
? { thumbnail: convertImageToEndpointImage(collectible.thumbnail) }
|
|
||||||
: {}),
|
|
||||||
translations:
|
translations:
|
||||||
collectible.translations?.map(({ language, title, description, pretitle, subtitle }) => ({
|
collectible.translations?.map(({ language, title, description, pretitle, subtitle }) => ({
|
||||||
language: isPayloadType(language) ? language.id : language,
|
language: isPayloadType(language) ? language.id : language,
|
||||||
|
|
|
@ -3,12 +3,11 @@ import { Collections } from "../../../constants";
|
||||||
import { EndpointCollectibleScanPage } from "../../../sdk";
|
import { EndpointCollectibleScanPage } from "../../../sdk";
|
||||||
import { Collectible, Scan } from "../../../types/collections";
|
import { Collectible, Scan } from "../../../types/collections";
|
||||||
import { CollectionEndpoint } from "../../../types/payload";
|
import { CollectionEndpoint } from "../../../types/payload";
|
||||||
import { isDefined, isImage, isNotEmpty, isPayloadType, isScan } from "../../../utils/asserts";
|
import { isDefined, isNotEmpty, isPayloadType, isScan } from "../../../utils/asserts";
|
||||||
import {
|
import {
|
||||||
convertScanToEndpointScanImage,
|
convertScanToEndpointScanImage,
|
||||||
convertSourceToEndpointSource,
|
convertSourceToEndpointSource,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
|
||||||
|
|
||||||
export const getBySlugEndpointScanPage: CollectionEndpoint = {
|
export const getBySlugEndpointScanPage: CollectionEndpoint = {
|
||||||
path: "/slug/:slug/scans/:index",
|
path: "/slug/:slug/scans/:index",
|
||||||
|
@ -57,9 +56,6 @@ export const getBySlugEndpointScanPage: CollectionEndpoint = {
|
||||||
image: convertScanToEndpointScanImage(scan, index),
|
image: convertScanToEndpointScanImage(scan, index),
|
||||||
parentPages: convertSourceToEndpointSource({ scans: [collectible] }),
|
parentPages: convertSourceToEndpointSource({ scans: [collectible] }),
|
||||||
slug,
|
slug,
|
||||||
...(isImage(collectible.thumbnail)
|
|
||||||
? { thumbnail: convertImageToEndpointImage(collectible.thumbnail) }
|
|
||||||
: {}),
|
|
||||||
translations:
|
translations:
|
||||||
collectible.translations?.map(({ language, title, description, pretitle, subtitle }) => ({
|
collectible.translations?.map(({ language, title, description, pretitle, subtitle }) => ({
|
||||||
language: isPayloadType(language) ? language.id : language,
|
language: isPayloadType(language) ? language.id : language,
|
||||||
|
|
|
@ -5,10 +5,10 @@ import { Collectible } from "../../../types/collections";
|
||||||
import { isImage, isNotEmpty, isPayloadType, isScan } from "../../../utils/asserts";
|
import { isImage, isNotEmpty, isPayloadType, isScan } from "../../../utils/asserts";
|
||||||
import {
|
import {
|
||||||
convertCreditsToEndpointCredits,
|
convertCreditsToEndpointCredits,
|
||||||
|
convertImageToEndpointPayloadImage,
|
||||||
convertScanToEndpointScanImage,
|
convertScanToEndpointScanImage,
|
||||||
convertSourceToEndpointSource,
|
convertSourceToEndpointSource,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
|
||||||
|
|
||||||
export const getBySlugEndpointScans = createGetByEndpoint({
|
export const getBySlugEndpointScans = createGetByEndpoint({
|
||||||
collection: Collections.Collectibles,
|
collection: Collections.Collectibles,
|
||||||
|
@ -27,7 +27,7 @@ export const getBySlugEndpointScans = createGetByEndpoint({
|
||||||
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
...(isNotEmpty(subtitle) ? { subtitle } : {}),
|
||||||
...(isNotEmpty(description) ? { description } : {}),
|
...(isNotEmpty(description) ? { description } : {}),
|
||||||
})) ?? [],
|
})) ?? [],
|
||||||
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointImage(thumbnail) } : {}),
|
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointPayloadImage(thumbnail) } : {}),
|
||||||
...(scansEnabled && scans ? handleScans(scans) : { credits: [], pages: [] }),
|
...(scansEnabled && scans ? handleScans(scans) : { credits: [], pages: [] }),
|
||||||
parentPages: convertSourceToEndpointSource({ collectibles: [collectible] }),
|
parentPages: convertSourceToEndpointSource({ collectibles: [collectible] }),
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,10 +13,10 @@ import { isImage, isNotEmpty, isPayloadType } from "../../../utils/asserts";
|
||||||
import {
|
import {
|
||||||
convertAttributesToEndpointAttributes,
|
convertAttributesToEndpointAttributes,
|
||||||
convertCreditsToEndpointCredits,
|
convertCreditsToEndpointCredits,
|
||||||
|
convertImageToEndpointPayloadImage,
|
||||||
convertRTCToEndpointRTC,
|
convertRTCToEndpointRTC,
|
||||||
convertSourceToEndpointSource,
|
convertSourceToEndpointSource,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
|
||||||
import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID";
|
import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID";
|
||||||
|
|
||||||
export const getBySlugEndpoint = createGetByEndpoint({
|
export const getBySlugEndpoint = createGetByEndpoint({
|
||||||
|
@ -35,7 +35,7 @@ export const convertPageToEndpointPagePreview = ({
|
||||||
}: Page): EndpointPagePreview => ({
|
}: Page): EndpointPagePreview => ({
|
||||||
id,
|
id,
|
||||||
slug,
|
slug,
|
||||||
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointImage(thumbnail) } : {}),
|
...(isImage(thumbnail) ? { thumbnail: convertImageToEndpointPayloadImage(thumbnail) } : {}),
|
||||||
attributes: convertAttributesToEndpointAttributes(attributes),
|
attributes: convertAttributesToEndpointAttributes(attributes),
|
||||||
translations: translations.map(({ language, title, pretitle, subtitle }) => ({
|
translations: translations.map(({ language, title, pretitle, subtitle }) => ({
|
||||||
language: isPayloadType(language) ? language.id : language,
|
language: isPayloadType(language) ? language.id : language,
|
||||||
|
@ -52,7 +52,7 @@ const convertPageToEndpointPage = (page: Page): EndpointPage => {
|
||||||
return {
|
return {
|
||||||
...convertPageToEndpointPagePreview(page),
|
...convertPageToEndpointPagePreview(page),
|
||||||
...(isImage(backgroundImage)
|
...(isImage(backgroundImage)
|
||||||
? { backgroundImage: convertImageToEndpointImage(backgroundImage) }
|
? { backgroundImage: convertImageToEndpointPayloadImage(backgroundImage) }
|
||||||
: {}),
|
: {}),
|
||||||
translations: translations.map(
|
translations: translations.map(
|
||||||
({ content, language, sourceLanguage, title, pretitle, subtitle, summary, credits }) => ({
|
({ content, language, sourceLanguage, title, pretitle, subtitle, summary, credits }) => ({
|
||||||
|
|
|
@ -4,8 +4,10 @@ import { EndpointRecorder, EndpointRecorderPreview } from "../../../sdk";
|
||||||
import { Recorder } from "../../../types/collections";
|
import { Recorder } from "../../../types/collections";
|
||||||
import { CollectionEndpoint } from "../../../types/payload";
|
import { CollectionEndpoint } from "../../../types/payload";
|
||||||
import { isImage, isPayloadType } from "../../../utils/asserts";
|
import { isImage, isPayloadType } from "../../../utils/asserts";
|
||||||
import { convertRTCToEndpointRTC } from "../../../utils/endpoints";
|
import {
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
convertImageToEndpointPayloadImage,
|
||||||
|
convertRTCToEndpointRTC,
|
||||||
|
} from "../../../utils/endpoints";
|
||||||
|
|
||||||
export const getByID: CollectionEndpoint = {
|
export const getByID: CollectionEndpoint = {
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -53,7 +55,7 @@ const convertRecorderToEndpointRecorder = (recorder: Recorder): EndpointRecorder
|
||||||
...convertRecorderToEndpointRecorderPreview(recorder),
|
...convertRecorderToEndpointRecorderPreview(recorder),
|
||||||
languages:
|
languages:
|
||||||
languages?.map((language) => (isPayloadType(language) ? language.id : language)) ?? [],
|
languages?.map((language) => (isPayloadType(language) ? language.id : language)) ?? [],
|
||||||
...(isImage(avatar) ? { avatar: convertImageToEndpointImage(avatar) } : {}),
|
...(isImage(avatar) ? { avatar: convertImageToEndpointPayloadImage(avatar) } : {}),
|
||||||
translations:
|
translations:
|
||||||
translations?.map(({ language, biography }) => ({
|
translations?.map(({ language, biography }) => ({
|
||||||
language: isPayloadType(language) ? language.id : language,
|
language: isPayloadType(language) ? language.id : language,
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
import {
|
import {
|
||||||
convertAttributesToEndpointAttributes,
|
convertAttributesToEndpointAttributes,
|
||||||
convertCreditsToEndpointCredits,
|
convertCreditsToEndpointCredits,
|
||||||
convertMediaThumbnailToEndpointMediaThumbnail,
|
convertMediaThumbnailToEndpointPayloadImage,
|
||||||
convertRTCToEndpointRTC,
|
convertRTCToEndpointRTC,
|
||||||
getLanguageId,
|
getLanguageId,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
|
@ -90,7 +90,7 @@ export const convertVideoToEndpointVideo = ({
|
||||||
|
|
||||||
duration,
|
duration,
|
||||||
...(isMediaThumbnail(thumbnail)
|
...(isMediaThumbnail(thumbnail)
|
||||||
? { thumbnail: convertMediaThumbnailToEndpointMediaThumbnail(thumbnail) }
|
? { thumbnail: convertMediaThumbnailToEndpointPayloadImage(thumbnail) }
|
||||||
: {}),
|
: {}),
|
||||||
...(platformEnabled && isDefined(platform) && isPayloadType(platform.channel)
|
...(platformEnabled && isDefined(platform) && isPayloadType(platform.channel)
|
||||||
? {
|
? {
|
||||||
|
|
|
@ -3,8 +3,8 @@ import { Collections } from "../../../constants";
|
||||||
import { EndpointWebsiteConfig } from "../../../sdk";
|
import { EndpointWebsiteConfig } from "../../../sdk";
|
||||||
import { CollectionEndpoint } from "../../../types/payload";
|
import { CollectionEndpoint } from "../../../types/payload";
|
||||||
import { isImage, isPayloadType } from "../../../utils/asserts";
|
import { isImage, isPayloadType } from "../../../utils/asserts";
|
||||||
|
import { convertImageToEndpointPayloadImage } from "../../../utils/endpoints";
|
||||||
import { convertFolderToEndpointFolderPreview } from "../../Folders/endpoints/getBySlugEndpoint";
|
import { convertFolderToEndpointFolderPreview } from "../../Folders/endpoints/getBySlugEndpoint";
|
||||||
import { convertImageToEndpointImage } from "../../Images/endpoints/getByID";
|
|
||||||
|
|
||||||
export const getConfigEndpoint: CollectionEndpoint = {
|
export const getConfigEndpoint: CollectionEndpoint = {
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -51,7 +51,7 @@ export const getConfigEndpoint: CollectionEndpoint = {
|
||||||
const endpointWebsiteConfig: EndpointWebsiteConfig = {
|
const endpointWebsiteConfig: EndpointWebsiteConfig = {
|
||||||
home: {
|
home: {
|
||||||
...(isImage(homeBackgroundImage)
|
...(isImage(homeBackgroundImage)
|
||||||
? { backgroundImage: convertImageToEndpointImage(homeBackgroundImage) }
|
? { backgroundImage: convertImageToEndpointPayloadImage(homeBackgroundImage) }
|
||||||
: {}),
|
: {}),
|
||||||
folders:
|
folders:
|
||||||
homeFolders?.flatMap(({ folder, darkThumbnail, lightThumbnail }) => {
|
homeFolders?.flatMap(({ folder, darkThumbnail, lightThumbnail }) => {
|
||||||
|
@ -59,17 +59,17 @@ export const getConfigEndpoint: CollectionEndpoint = {
|
||||||
return {
|
return {
|
||||||
...convertFolderToEndpointFolderPreview(folder),
|
...convertFolderToEndpointFolderPreview(folder),
|
||||||
...(isImage(darkThumbnail)
|
...(isImage(darkThumbnail)
|
||||||
? { darkThumbnail: convertImageToEndpointImage(darkThumbnail) }
|
? { darkThumbnail: convertImageToEndpointPayloadImage(darkThumbnail) }
|
||||||
: {}),
|
: {}),
|
||||||
...(isImage(lightThumbnail)
|
...(isImage(lightThumbnail)
|
||||||
? { lightThumbnail: convertImageToEndpointImage(lightThumbnail) }
|
? { lightThumbnail: convertImageToEndpointPayloadImage(lightThumbnail) }
|
||||||
: {}),
|
: {}),
|
||||||
};
|
};
|
||||||
}) ?? [],
|
}) ?? [],
|
||||||
},
|
},
|
||||||
timeline: {
|
timeline: {
|
||||||
...(isImage(timelineBackgroundImage)
|
...(isImage(timelineBackgroundImage)
|
||||||
? { backgroundImage: convertImageToEndpointImage(timelineBackgroundImage) }
|
? { backgroundImage: convertImageToEndpointPayloadImage(timelineBackgroundImage) }
|
||||||
: {}),
|
: {}),
|
||||||
breaks: timeline?.breaks ?? [],
|
breaks: timeline?.breaks ?? [],
|
||||||
eventCount,
|
eventCount,
|
||||||
|
@ -84,7 +84,7 @@ export const getConfigEndpoint: CollectionEndpoint = {
|
||||||
}) ?? [],
|
}) ?? [],
|
||||||
},
|
},
|
||||||
...(isImage(defaultOpenGraphImage)
|
...(isImage(defaultOpenGraphImage)
|
||||||
? { defaultOpenGraphImage: convertImageToEndpointImage(defaultOpenGraphImage) }
|
? { defaultOpenGraphImage: convertImageToEndpointPayloadImage(defaultOpenGraphImage) }
|
||||||
: {}),
|
: {}),
|
||||||
};
|
};
|
||||||
res.status(200).json(endpointWebsiteConfig);
|
res.status(200).json(endpointWebsiteConfig);
|
||||||
|
|
38
src/sdk.ts
38
src/sdk.ts
|
@ -60,14 +60,14 @@ export type EndpointFolder = EndpointFolderPreview & {
|
||||||
|
|
||||||
export type EndpointWebsiteConfig = {
|
export type EndpointWebsiteConfig = {
|
||||||
home: {
|
home: {
|
||||||
backgroundImage?: EndpointImage;
|
backgroundImage?: EndpointPayloadImage;
|
||||||
folders: (EndpointFolderPreview & {
|
folders: (EndpointFolderPreview & {
|
||||||
lightThumbnail?: EndpointImage;
|
lightThumbnail?: EndpointPayloadImage;
|
||||||
darkThumbnail?: EndpointImage;
|
darkThumbnail?: EndpointPayloadImage;
|
||||||
})[];
|
})[];
|
||||||
};
|
};
|
||||||
timeline: {
|
timeline: {
|
||||||
backgroundImage?: EndpointImage;
|
backgroundImage?: EndpointPayloadImage;
|
||||||
breaks: number[];
|
breaks: number[];
|
||||||
eventCount: number;
|
eventCount: number;
|
||||||
eras: {
|
eras: {
|
||||||
|
@ -76,7 +76,7 @@ export type EndpointWebsiteConfig = {
|
||||||
name: string;
|
name: string;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
defaultOpenGraphImage?: EndpointImage;
|
defaultOpenGraphImage?: EndpointPayloadImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointRecorderPreview = {
|
export type EndpointRecorderPreview = {
|
||||||
|
@ -85,7 +85,7 @@ export type EndpointRecorderPreview = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointRecorder = EndpointRecorderPreview & {
|
export type EndpointRecorder = EndpointRecorderPreview & {
|
||||||
avatar?: EndpointImage;
|
avatar?: EndpointPayloadImage;
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
biography: RichTextContent;
|
biography: RichTextContent;
|
||||||
|
@ -158,7 +158,7 @@ export type EndpointCredit = {
|
||||||
export type EndpointPagePreview = {
|
export type EndpointPagePreview = {
|
||||||
id: string;
|
id: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
thumbnail?: EndpointImage;
|
thumbnail?: EndpointPayloadImage;
|
||||||
attributes: EndpointAttribute[];
|
attributes: EndpointAttribute[];
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
|
@ -170,7 +170,7 @@ export type EndpointPagePreview = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointPage = EndpointPagePreview & {
|
export type EndpointPage = EndpointPagePreview & {
|
||||||
backgroundImage?: EndpointImage;
|
backgroundImage?: EndpointPayloadImage;
|
||||||
translations: (EndpointPagePreview["translations"][number] & {
|
translations: (EndpointPagePreview["translations"][number] & {
|
||||||
sourceLanguage: string;
|
sourceLanguage: string;
|
||||||
summary?: RichTextContent;
|
summary?: RichTextContent;
|
||||||
|
@ -186,7 +186,7 @@ export type EndpointPage = EndpointPagePreview & {
|
||||||
export type EndpointCollectiblePreview = {
|
export type EndpointCollectiblePreview = {
|
||||||
id: string;
|
id: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
thumbnail?: EndpointImage;
|
thumbnail?: EndpointPayloadImage;
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
|
@ -206,10 +206,10 @@ export type EndpointCollectible = EndpointCollectiblePreview & {
|
||||||
translations: (EndpointCollectiblePreview["translations"][number] & {
|
translations: (EndpointCollectiblePreview["translations"][number] & {
|
||||||
description?: RichTextContent;
|
description?: RichTextContent;
|
||||||
})[];
|
})[];
|
||||||
backgroundImage?: EndpointImage;
|
backgroundImage?: EndpointPayloadImage;
|
||||||
nature: CollectibleNature;
|
nature: CollectibleNature;
|
||||||
gallery?: { count: number; thumbnail: EndpointImage };
|
gallery?: { count: number; thumbnail: EndpointPayloadImage };
|
||||||
scans?: { count: number; thumbnail: EndpointScanImage };
|
scans?: { count: number; thumbnail: EndpointPayloadImage };
|
||||||
urls: { url: string; label: string }[];
|
urls: { url: string; label: string }[];
|
||||||
size?: {
|
size?: {
|
||||||
width: number;
|
width: number;
|
||||||
|
@ -274,7 +274,7 @@ export type EndpointCollectible = EndpointCollectiblePreview & {
|
||||||
|
|
||||||
export type EndpointCollectibleScans = {
|
export type EndpointCollectibleScans = {
|
||||||
slug: string;
|
slug: string;
|
||||||
thumbnail?: EndpointImage;
|
thumbnail?: EndpointPayloadImage;
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
|
@ -324,7 +324,7 @@ export type EndpointCollectibleScans = {
|
||||||
|
|
||||||
export type EndpointCollectibleGallery = {
|
export type EndpointCollectibleGallery = {
|
||||||
slug: string;
|
slug: string;
|
||||||
thumbnail?: EndpointImage;
|
thumbnail?: EndpointPayloadImage;
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
|
@ -332,13 +332,12 @@ export type EndpointCollectibleGallery = {
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
description?: RichTextContent;
|
description?: RichTextContent;
|
||||||
}[];
|
}[];
|
||||||
images: EndpointImage[];
|
images: EndpointPayloadImage[];
|
||||||
parentPages: EndpointSource[];
|
parentPages: EndpointSource[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointCollectibleGalleryImage = {
|
export type EndpointCollectibleGalleryImage = {
|
||||||
slug: string;
|
slug: string;
|
||||||
thumbnail?: EndpointImage;
|
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
|
@ -354,7 +353,6 @@ export type EndpointCollectibleGalleryImage = {
|
||||||
|
|
||||||
export type EndpointCollectibleScanPage = {
|
export type EndpointCollectibleScanPage = {
|
||||||
slug: string;
|
slug: string;
|
||||||
thumbnail?: EndpointImage;
|
|
||||||
translations: {
|
translations: {
|
||||||
language: string;
|
language: string;
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
|
@ -449,12 +447,12 @@ export type EndpointImage = EndpointMedia & {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointAudio = EndpointMedia & {
|
export type EndpointAudio = EndpointMedia & {
|
||||||
thumbnail?: EndpointMediaThumbnail;
|
thumbnail?: EndpointPayloadImage;
|
||||||
duration: number;
|
duration: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointVideo = EndpointMedia & {
|
export type EndpointVideo = EndpointMedia & {
|
||||||
thumbnail?: EndpointMediaThumbnail;
|
thumbnail?: EndpointPayloadImage;
|
||||||
subtitles: {
|
subtitles: {
|
||||||
language: string;
|
language: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -474,7 +472,7 @@ export type EndpointVideo = EndpointMedia & {
|
||||||
duration: number;
|
duration: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointMediaThumbnail = PayloadImage & {
|
export type EndpointPayloadImage = PayloadImage & {
|
||||||
sizes: PayloadImage[];
|
sizes: PayloadImage[];
|
||||||
openGraph?: PayloadImage;
|
openGraph?: PayloadImage;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {
|
||||||
import {
|
import {
|
||||||
EndpointAttribute,
|
EndpointAttribute,
|
||||||
EndpointCredit,
|
EndpointCredit,
|
||||||
EndpointMediaThumbnail,
|
EndpointPayloadImage,
|
||||||
EndpointRole,
|
EndpointRole,
|
||||||
EndpointScanImage,
|
EndpointScanImage,
|
||||||
EndpointSource,
|
EndpointSource,
|
||||||
|
@ -367,7 +367,40 @@ export const convertScanToEndpointScanImage = (
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const convertMediaThumbnailToEndpointMediaThumbnail = ({
|
export const convertImageToEndpointPayloadImage = ({
|
||||||
|
url,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
mimeType,
|
||||||
|
filename,
|
||||||
|
filesize,
|
||||||
|
id,
|
||||||
|
sizes,
|
||||||
|
}: Image & PayloadImage): EndpointPayloadImage => ({
|
||||||
|
filename,
|
||||||
|
filesize,
|
||||||
|
height,
|
||||||
|
id,
|
||||||
|
mimeType,
|
||||||
|
sizes: convertSizesToPayloadImages(
|
||||||
|
[
|
||||||
|
sizes?.["200w"],
|
||||||
|
sizes?.["320w"],
|
||||||
|
sizes?.["480w"],
|
||||||
|
sizes?.["800w"],
|
||||||
|
sizes?.["1280w"],
|
||||||
|
sizes?.["1920w"],
|
||||||
|
sizes?.["2560w"],
|
||||||
|
{ url, width, height, filename, filesize, mimeType },
|
||||||
|
],
|
||||||
|
[200, 320, 480, 800, 1280, 1920, 2560]
|
||||||
|
),
|
||||||
|
url,
|
||||||
|
width,
|
||||||
|
...(isPayloadImage(sizes?.og) ? { openGraph: sizes.og } : {}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const convertMediaThumbnailToEndpointPayloadImage = ({
|
||||||
id,
|
id,
|
||||||
url,
|
url,
|
||||||
width,
|
width,
|
||||||
|
@ -376,7 +409,7 @@ export const convertMediaThumbnailToEndpointMediaThumbnail = ({
|
||||||
filename,
|
filename,
|
||||||
filesize,
|
filesize,
|
||||||
sizes,
|
sizes,
|
||||||
}: MediaThumbnail & PayloadImage): EndpointMediaThumbnail => ({
|
}: MediaThumbnail & PayloadImage): EndpointPayloadImage => ({
|
||||||
id,
|
id,
|
||||||
url,
|
url,
|
||||||
width,
|
width,
|
||||||
|
|
Loading…
Reference in New Issue