From a5ca1ee9f2fce86ddbb8497e251559af4cd8279a Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Sat, 13 Jul 2024 13:05:20 +0200 Subject: [PATCH] Use import type whenever possible --- analytics/sdk.ts | 2 +- meilisearch/sdk.ts | 2 +- meilisearch/types.ts | 8 +- payload/blocks.ts | 2 +- payload/endpoint-types.ts | 1034 +++++++++++++++++++------------------ payload/rich-text.ts | 20 +- payload/sdk.ts | 30 +- payload/webhooks.ts | 2 +- 8 files changed, 558 insertions(+), 542 deletions(-) diff --git a/analytics/sdk.ts b/analytics/sdk.ts index be40254..dc58385 100644 --- a/analytics/sdk.ts +++ b/analytics/sdk.ts @@ -1,4 +1,4 @@ -import { TrackRequestParams } from "./types"; +import type { TrackRequestParams } from "./types"; type AnalyticsBody = Record & { type: "event" | "request"; diff --git a/meilisearch/sdk.ts b/meilisearch/sdk.ts index 8a1c5d5..5a5e63d 100644 --- a/meilisearch/sdk.ts +++ b/meilisearch/sdk.ts @@ -1,4 +1,4 @@ -import { MeiliDocument, SearchRequest, SearchResponse } from "./types"; +import type { MeiliDocument, SearchRequest, SearchResponse } from "./types"; export class MeilisearchSDK { constructor( diff --git a/meilisearch/types.ts b/meilisearch/types.ts index 12c732c..acd3853 100644 --- a/meilisearch/types.ts +++ b/meilisearch/types.ts @@ -1,5 +1,4 @@ -import { Collections } from "../payload/constants"; -import { +import type { EndpointCollectible, EndpointPage, EndpointFolder, @@ -9,7 +8,8 @@ import { EndpointFile, EndpointRecorder, EndpointChronologyEvent, -} from "../payload/endpoint-types"; +} from "payload/endpoint-types"; +import { Collections } from "../payload/constants"; export type MeiliDocument = { meilid: string; @@ -74,4 +74,4 @@ export type SearchRequest = { q: string; page: number; types?: string[] | string | undefined; -}; \ No newline at end of file +}; diff --git a/payload/blocks.ts b/payload/blocks.ts index c3bfc20..9dc2d0d 100644 --- a/payload/blocks.ts +++ b/payload/blocks.ts @@ -1,4 +1,4 @@ -import { RichTextContent } from "./rich-text"; +import type { RichTextContent } from "./rich-text"; export interface TranscriptBlock extends GenericBlock { lines: (LineBlock | CueBlock)[]; diff --git a/payload/endpoint-types.ts b/payload/endpoint-types.ts index c40a395..14465be 100644 --- a/payload/endpoint-types.ts +++ b/payload/endpoint-types.ts @@ -1,5 +1,11 @@ -import { AttributeTypes, CollectibleBindingTypes, CollectibleNature, CollectiblePageOrders, Collections } from "./constants"; -import { RichTextContent } from "./rich-text"; +import type { + Collections, + AttributeTypes, + CollectibleNature, + CollectibleBindingTypes, + CollectiblePageOrders, +} from "./constants"; +import type { RichTextContent } from "./rich-text"; export interface EndpointCurrency { id: string; @@ -12,41 +18,232 @@ export interface EndpointLanguage { } export type EndpointFolderPreview = { - id: string; - slug: string; - icon?: string; - translations: { - language: string; - title: string; + id: string; + slug: string; + icon?: string; + translations: { + language: string; + title: string; + }[]; +}; + +export type EndpointFolder = Omit & { + translations: (EndpointFolderPreview["translations"][number] & { + description?: RichTextContent; + })[]; + sections: + | { type: "single"; subfolders: EndpointFolderPreview[] } + | { + type: "multiple"; + sections: { + translations: { language: string; name: string }[]; + subfolders: EndpointFolderPreview[]; + }[]; + }; + files: ( + | { + relationTo: Collections.Collectibles; + value: EndpointCollectiblePreview; + } + | { + relationTo: Collections.Pages; + value: EndpointPagePreview; + } + | { + relationTo: Collections.Images; + value: EndpointImagePreview; + } + | { + relationTo: Collections.Audios; + value: EndpointAudioPreview; + } + | { + relationTo: Collections.Videos; + value: EndpointVideoPreview; + } + | { + relationTo: Collections.Files; + value: EndpointFilePreview; + } + )[]; + parentPages: EndpointSource[]; +}; + +export type EndpointWebsiteConfig = { + home: { + backgroundImage?: EndpointPayloadImage; + folders: (EndpointFolderPreview & { + lightThumbnail?: EndpointPayloadImage; + darkThumbnail?: EndpointPayloadImage; + })[]; + }; + timeline: { + backgroundImage?: EndpointPayloadImage; + breaks: number[]; + eventCount: number; + eras: { + startingYear: number; + endingYear: number; + name: string; }[]; }; - - export type EndpointFolder = Omit & { - translations: (EndpointFolderPreview["translations"][number] & { - description?: RichTextContent; - })[]; - sections: - | { type: "single"; subfolders: EndpointFolderPreview[] } - | { - type: "multiple"; - sections: { - translations: { language: string; name: string }[]; - subfolders: EndpointFolderPreview[]; - }[]; - }; - files: ( - | { - relationTo: Collections.Collectibles; - value: EndpointCollectiblePreview; - } + defaultOpenGraphImage?: EndpointPayloadImage; +}; + +export type EndpointRecorderPreview = { + id: string; + username: string; +}; + +export type EndpointRecorder = EndpointRecorderPreview & { + avatar?: EndpointPayloadImage; + translations: { + language: string; + biography: RichTextContent; + }[]; + languages: string[]; +}; + +export type EndpointWording = { + name: string; + translations: { + language: string; + name: string; + }[]; +}; + +export type EndpointTag = { + id: string; + slug: string; + page?: { slug: string }; + translations: { + language: string; + name: string; + }[]; +}; + +export type EndpointGenericAttribute = { + id: string; + slug: string; + icon: string; + translations: { + language: string; + name: string; + }[]; +}; + +export type EndpointNumberAttribute = EndpointGenericAttribute & { + type: AttributeTypes.Number; + value: number; +}; + +export type EndpointTextAttribute = EndpointGenericAttribute & { + type: AttributeTypes.Text; + value: string; +}; + +export type EndpointTagsAttribute = EndpointGenericAttribute & { + type: AttributeTypes.Tags; + value: EndpointTag[]; +}; + +export type EndpointAttribute = + | EndpointNumberAttribute + | EndpointTextAttribute + | EndpointTagsAttribute; + +export type EndpointRole = { + id: string; + icon: string; + translations: { + language: string; + name: string; + }[]; +}; + +export type EndpointCredit = { + role: EndpointRole; + recorders: EndpointRecorderPreview[]; +}; + +export type EndpointPagePreview = { + id: string; + slug: string; + thumbnail?: EndpointPayloadImage; + attributes: EndpointAttribute[]; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + }[]; + updatedAt: string; +}; + +export type EndpointPage = Omit & { + backgroundImage?: EndpointPayloadImage; + translations: (EndpointPagePreview["translations"][number] & { + sourceLanguage: string; + summary?: RichTextContent; + content: RichTextContent; + credits: EndpointCredit[]; + toc: TableOfContentEntry[]; + })[]; + createdAt: string; + updatedBy?: EndpointRecorderPreview; + parentPages: EndpointSource[]; +}; + +export type EndpointCollectiblePreview = { + id: string; + slug: string; + thumbnail?: EndpointPayloadImage; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + }[]; + attributes: EndpointAttribute[]; + releaseDate?: string; + languages: string[]; + price?: { + amount: number; + currency: string; + }; +}; + +export type EndpointCollectible = Omit< + EndpointCollectiblePreview, + "translations" +> & { + translations: (EndpointCollectiblePreview["translations"][number] & { + description?: RichTextContent; + })[]; + backgroundImage?: EndpointPayloadImage; + nature: CollectibleNature; + gallery?: { count: number; thumbnail: EndpointPayloadImage }; + scans?: { count: number; thumbnail: EndpointPayloadImage }; + urls: { url: string; label: string }[]; + size?: { + width: number; + height: number; + thickness?: number; + }; + weight?: number; + pageInfo?: { + pageCount: number; + bindingType?: CollectibleBindingTypes; + pageOrder?: CollectiblePageOrders; + }; + subitems: EndpointCollectiblePreview[]; + files: EndpointFilePreview[]; + contents: { + content: | { relationTo: Collections.Pages; value: EndpointPagePreview; } - | { - relationTo: Collections.Images; - value: EndpointImagePreview; - } | { relationTo: Collections.Audios; value: EndpointAudioPreview; @@ -56,495 +253,314 @@ export type EndpointFolderPreview = { value: EndpointVideoPreview; } | { - relationTo: Collections.Files; - value: EndpointFilePreview; - } - )[]; - parentPages: EndpointSource[]; - }; - - export type EndpointWebsiteConfig = { - home: { - backgroundImage?: EndpointPayloadImage; - folders: (EndpointFolderPreview & { - lightThumbnail?: EndpointPayloadImage; - darkThumbnail?: EndpointPayloadImage; - })[]; - }; - timeline: { - backgroundImage?: EndpointPayloadImage; - breaks: number[]; - eventCount: number; - eras: { - startingYear: number; - endingYear: number; - name: string; - }[]; - }; - defaultOpenGraphImage?: EndpointPayloadImage; - }; - - export type EndpointRecorderPreview = { - id: string; - username: string; - }; - - export type EndpointRecorder = EndpointRecorderPreview & { - avatar?: EndpointPayloadImage; - translations: { - language: string; - biography: RichTextContent; - }[]; - languages: string[]; - }; - - export type EndpointWording = { - name: string; - translations: { - language: string; - name: string; - }[]; - }; - - export type EndpointTag = { - id: string; - slug: string; - page?: { slug: string }; - translations: { - language: string; - name: string; - }[]; - }; - - export type EndpointGenericAttribute = { - id: string; - slug: string; - icon: string; - translations: { - language: string; - name: string; - }[]; - }; - - export type EndpointNumberAttribute = EndpointGenericAttribute & { - type: AttributeTypes.Number; - value: number; - }; - - export type EndpointTextAttribute = EndpointGenericAttribute & { - type: AttributeTypes.Text; - value: string; - }; - - export type EndpointTagsAttribute = EndpointGenericAttribute & { - type: AttributeTypes.Tags; - value: EndpointTag[]; - }; - - export type EndpointAttribute = - | EndpointNumberAttribute - | EndpointTextAttribute - | EndpointTagsAttribute; - - export type EndpointRole = { - id: string; - icon: string; - translations: { - language: string; - name: string; - }[]; - }; - - export type EndpointCredit = { - role: EndpointRole; - recorders: EndpointRecorderPreview[]; - }; - - export type EndpointPagePreview = { - id: string; - slug: string; - thumbnail?: EndpointPayloadImage; - attributes: EndpointAttribute[]; - translations: { - language: string; - pretitle?: string; - title: string; - subtitle?: string; - }[]; - updatedAt: string; - }; - - export type EndpointPage = Omit & { - backgroundImage?: EndpointPayloadImage; - translations: (EndpointPagePreview["translations"][number] & { - sourceLanguage: string; - summary?: RichTextContent; - content: RichTextContent; - credits: EndpointCredit[]; - toc: TableOfContentEntry[]; - })[]; - createdAt: string; - updatedBy?: EndpointRecorderPreview; - parentPages: EndpointSource[]; - }; - - export type EndpointCollectiblePreview = { - id: string; - slug: string; - thumbnail?: EndpointPayloadImage; - translations: { - language: string; - pretitle?: string; - title: string; - subtitle?: string; - }[]; - attributes: EndpointAttribute[]; - releaseDate?: string; - languages: string[]; - price?: { - amount: number; - currency: string; - }; - }; - - export type EndpointCollectible = Omit & { - translations: (EndpointCollectiblePreview["translations"][number] & { - description?: RichTextContent; - })[]; - backgroundImage?: EndpointPayloadImage; - nature: CollectibleNature; - gallery?: { count: number; thumbnail: EndpointPayloadImage }; - scans?: { count: number; thumbnail: EndpointPayloadImage }; - urls: { url: string; label: string }[]; - size?: { - width: number; - height: number; - thickness?: number; - }; - weight?: number; - pageInfo?: { - pageCount: number; - bindingType?: CollectibleBindingTypes; - pageOrder?: CollectiblePageOrders; - }; - subitems: EndpointCollectiblePreview[]; - files: EndpointFilePreview[]; - contents: { - content: - | { - relationTo: Collections.Pages; - value: EndpointPagePreview; - } - | { - relationTo: Collections.Audios; - value: EndpointAudioPreview; - } - | { - relationTo: Collections.Videos; - value: EndpointVideoPreview; - } - | { - relationTo: Collections.GenericContents; - value: { - translations: { - language: string; - name: string; - }[]; - }; - }; - - range?: - | { - type: "pageRange"; - start: number; - end: number; - } - | { - type: "timeRange"; - start: string; - end: string; - } - | { - type: "other"; + relationTo: Collections.GenericContents; + value: { translations: { language: string; - note: RichTextContent; + name: string; }[]; }; - }[]; - createdAt: string; - updatedAt: string; - updatedBy?: EndpointRecorderPreview; - parentPages: EndpointSource[]; - }; - - export type EndpointCollectibleScans = { - slug: string; - thumbnail?: EndpointPayloadImage; - translations: { - language: string; - pretitle?: string; - title: string; - subtitle?: string; - description?: RichTextContent; - }[]; - credits: EndpointCredit[]; - cover?: { - front?: EndpointScanImage; - spine?: EndpointScanImage; - back?: EndpointScanImage; - insideFront?: EndpointScanImage; - insideBack?: EndpointScanImage; - flapFront?: EndpointScanImage; - flapBack?: EndpointScanImage; - insideFlapFront?: EndpointScanImage; - insideFlapBack?: EndpointScanImage; - }; - dustjacket?: { - front?: EndpointScanImage; - spine?: EndpointScanImage; - back?: EndpointScanImage; - insideFront?: EndpointScanImage; - insideSpine?: EndpointScanImage; - insideBack?: EndpointScanImage; - flapFront?: EndpointScanImage; - flapBack?: EndpointScanImage; - insideFlapFront?: EndpointScanImage; - insideFlapBack?: EndpointScanImage; - }; - obi?: { - front?: EndpointScanImage; - spine?: EndpointScanImage; - back?: EndpointScanImage; - insideFront?: EndpointScanImage; - insideSpine?: EndpointScanImage; - insideBack?: EndpointScanImage; - flapFront?: EndpointScanImage; - flapBack?: EndpointScanImage; - insideFlapFront?: EndpointScanImage; - insideFlapBack?: EndpointScanImage; - }; - pages: EndpointScanImage[]; - parentPages: EndpointSource[]; - }; - - export type EndpointCollectibleGallery = { - slug: string; - thumbnail?: EndpointPayloadImage; - translations: { - language: string; - pretitle?: string; - title: string; - subtitle?: string; - description?: RichTextContent; - }[]; - images: EndpointPayloadImage[]; - parentPages: EndpointSource[]; - }; - - export type EndpointCollectibleGalleryImage = { - slug: string; - translations: { - language: string; - pretitle?: string; - title: string; - subtitle?: string; - description?: RichTextContent; - }[]; - image: EndpointImage; - previousIndex?: string; - nextIndex?: string; - parentPages: EndpointSource[]; - }; - - export type EndpointCollectibleScanPage = { - slug: string; - translations: { - language: string; - pretitle?: string; - title: string; - subtitle?: string; - description?: RichTextContent; - }[]; - image: EndpointScanImage; - previousIndex?: string; - nextIndex?: string; - parentPages: EndpointSource[]; - }; - - export type EndpointScanImage = PayloadImage & { - index: string; - sizes: PayloadImage[]; - }; - - export type TableOfContentEntry = { - prefix: string; + }; + + range?: + | { + type: "pageRange"; + start: number; + end: number; + } + | { + type: "timeRange"; + start: string; + end: string; + } + | { + type: "other"; + translations: { + language: string; + note: RichTextContent; + }[]; + }; + }[]; + createdAt: string; + updatedAt: string; + updatedBy?: EndpointRecorderPreview; + parentPages: EndpointSource[]; +}; + +export type EndpointCollectibleScans = { + slug: string; + thumbnail?: EndpointPayloadImage; + translations: { + language: string; + pretitle?: string; title: string; - type: "sceneBreak" | "break" | "section"; - index: number; - children: TableOfContentEntry[]; + subtitle?: string; + description?: RichTextContent; + }[]; + credits: EndpointCredit[]; + cover?: { + front?: EndpointScanImage; + spine?: EndpointScanImage; + back?: EndpointScanImage; + insideFront?: EndpointScanImage; + insideBack?: EndpointScanImage; + flapFront?: EndpointScanImage; + flapBack?: EndpointScanImage; + insideFlapFront?: EndpointScanImage; + insideFlapBack?: EndpointScanImage; }; - - export type EndpointChronologyEvent = { - id: string; - date: { - year: number; - month?: number; - day?: number; - }; - events: { - sources: EndpointSource[]; - translations: { - language: string; - sourceLanguage: string; - title?: string; - description?: RichTextContent; - notes?: RichTextContent; - credits: EndpointCredit[]; - }[]; - }[]; + dustjacket?: { + front?: EndpointScanImage; + spine?: EndpointScanImage; + back?: EndpointScanImage; + insideFront?: EndpointScanImage; + insideSpine?: EndpointScanImage; + insideBack?: EndpointScanImage; + flapFront?: EndpointScanImage; + flapBack?: EndpointScanImage; + insideFlapFront?: EndpointScanImage; + insideFlapBack?: EndpointScanImage; }; - - export type EndpointSourcePreview = { - id: string; - slug: string; - translations: { language: string; pretitle?: string; title: string; subtitle?: string }[]; + obi?: { + front?: EndpointScanImage; + spine?: EndpointScanImage; + back?: EndpointScanImage; + insideFront?: EndpointScanImage; + insideSpine?: EndpointScanImage; + insideBack?: EndpointScanImage; + flapFront?: EndpointScanImage; + flapBack?: EndpointScanImage; + insideFlapFront?: EndpointScanImage; + insideFlapBack?: EndpointScanImage; }; - - export type EndpointSource = - | { type: "url"; url: string; label: string } - | { - type: "collectible"; - collectible: EndpointSourcePreview; - range?: - | { type: "page"; page: number } - | { type: "timestamp"; timestamp: string } - | { type: "custom"; translations: { language: string; note: string }[] }; - } - | { type: "page"; page: EndpointSourcePreview } - | { type: "folder"; folder: EndpointSourcePreview } - | { type: "scans"; collectible: EndpointSourcePreview } - | { type: "gallery"; collectible: EndpointSourcePreview }; - - export type EndpointMediaPreview = { - id: string; - url: string; - filename: string; - mimeType: string; - attributes: EndpointAttribute[]; + pages: EndpointScanImage[]; + parentPages: EndpointSource[]; +}; + +export type EndpointCollectibleGallery = { + slug: string; + thumbnail?: EndpointPayloadImage; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + description?: RichTextContent; + }[]; + images: EndpointPayloadImage[]; + parentPages: EndpointSource[]; +}; + +export type EndpointCollectibleGalleryImage = { + slug: string; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + description?: RichTextContent; + }[]; + image: EndpointImage; + previousIndex?: string; + nextIndex?: string; + parentPages: EndpointSource[]; +}; + +export type EndpointCollectibleScanPage = { + slug: string; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + description?: RichTextContent; + }[]; + image: EndpointScanImage; + previousIndex?: string; + nextIndex?: string; + parentPages: EndpointSource[]; +}; + +export type EndpointScanImage = PayloadImage & { + index: string; + sizes: PayloadImage[]; +}; + +export type TableOfContentEntry = { + prefix: string; + title: string; + type: "sceneBreak" | "break" | "section"; + index: number; + children: TableOfContentEntry[]; +}; + +export type EndpointChronologyEvent = { + id: string; + date: { + year: number; + month?: number; + day?: number; + }; + events: { + sources: EndpointSource[]; translations: { language: string; - pretitle?: string; - title: string; - subtitle?: string; - }[]; - }; - - export type EndpointMedia = Omit & { - filesize: number; - updatedAt: string; - createdAt: string; - translations: (EndpointMediaPreview["translations"][number] & { + sourceLanguage: string; + title?: string; description?: RichTextContent; - })[]; - credits: EndpointCredit[]; - }; - - export type EndpointImagePreview = EndpointMediaPreview & { - width: number; - height: number; - sizes: PayloadImage[]; - openGraph?: PayloadImage; - }; - - export type EndpointImage = EndpointMedia & { - width: number; - height: number; - sizes: PayloadImage[]; - openGraph?: PayloadImage; - }; - - export type EndpointAudioPreview = EndpointMediaPreview & { - thumbnail?: EndpointPayloadImage; - duration: number; - }; - - export type EndpointAudio = EndpointMedia & { - thumbnail?: EndpointPayloadImage; - duration: number; - }; - - export type EndpointVideoPreview = EndpointMediaPreview & { - thumbnail?: EndpointPayloadImage; - subtitles: { - language: string; - url: string; + notes?: RichTextContent; + credits: EndpointCredit[]; }[]; - duration: number; - }; - - export type EndpointVideo = EndpointMedia & { - thumbnail?: EndpointPayloadImage; - subtitles: { - language: string; - url: string; - }[]; - platform?: { - channel: { - url: string; - title: string; - subscribers: number; - }; - views?: number; - likes?: number; - dislikes?: number; - url: string; - publishedDate: string; - }; - duration: number; - }; - - export type EndpointFilePreview = EndpointMediaPreview & { - filesize: number; - thumbnail?: EndpointPayloadImage; - }; - - export type EndpointFile = EndpointMedia & { - filesize: number; - thumbnail?: EndpointPayloadImage; - }; - - export type EndpointPayloadImage = PayloadImage & { - sizes: PayloadImage[]; - openGraph?: PayloadImage; - }; - - export type PayloadMedia = { - id: string; + }[]; +}; + +export type EndpointSourcePreview = { + id: string; + slug: string; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + }[]; +}; + +export type EndpointSource = + | { type: "url"; url: string; label: string } + | { + type: "collectible"; + collectible: EndpointSourcePreview; + range?: + | { type: "page"; page: number } + | { type: "timestamp"; timestamp: string } + | { + type: "custom"; + translations: { language: string; note: string }[]; + }; + } + | { type: "page"; page: EndpointSourcePreview } + | { type: "folder"; folder: EndpointSourcePreview } + | { type: "scans"; collectible: EndpointSourcePreview } + | { type: "gallery"; collectible: EndpointSourcePreview }; + +export type EndpointMediaPreview = { + id: string; + url: string; + filename: string; + mimeType: string; + attributes: EndpointAttribute[]; + translations: { + language: string; + pretitle?: string; + title: string; + subtitle?: string; + }[]; +}; + +export type EndpointMedia = Omit & { + filesize: number; + updatedAt: string; + createdAt: string; + translations: (EndpointMediaPreview["translations"][number] & { + description?: RichTextContent; + })[]; + credits: EndpointCredit[]; +}; + +export type EndpointImagePreview = EndpointMediaPreview & { + width: number; + height: number; + sizes: PayloadImage[]; + openGraph?: PayloadImage; +}; + +export type EndpointImage = EndpointMedia & { + width: number; + height: number; + sizes: PayloadImage[]; + openGraph?: PayloadImage; +}; + +export type EndpointAudioPreview = EndpointMediaPreview & { + thumbnail?: EndpointPayloadImage; + duration: number; +}; + +export type EndpointAudio = EndpointMedia & { + thumbnail?: EndpointPayloadImage; + duration: number; +}; + +export type EndpointVideoPreview = EndpointMediaPreview & { + thumbnail?: EndpointPayloadImage; + subtitles: { + language: string; url: string; - mimeType: string; - filename: string; - filesize: number; + }[]; + duration: number; +}; + +export type EndpointVideo = EndpointMedia & { + thumbnail?: EndpointPayloadImage; + subtitles: { + language: string; + url: string; + }[]; + platform?: { + channel: { + url: string; + title: string; + subscribers: number; + }; + views?: number; + likes?: number; + dislikes?: number; + url: string; + publishedDate: string; }; - - export type PayloadImage = PayloadMedia & { - width: number; - height: number; - }; - - export type EndpointAllSDKUrls = { - urls: string[]; - }; - - export type EndpointAllIds = { - collectibles: { slugs: string[] }; - pages: { slugs: string[] }; - folders: { slugs: string[] }; - videos: { ids: string[] }; - audios: { ids: string[] }; - images: { ids: string[] }; - files: { ids: string[] }; - recorders: { ids: string[] }; - chronologyEvents: { ids: string[] }; - }; - \ No newline at end of file + duration: number; +}; + +export type EndpointFilePreview = EndpointMediaPreview & { + filesize: number; + thumbnail?: EndpointPayloadImage; +}; + +export type EndpointFile = EndpointMedia & { + filesize: number; + thumbnail?: EndpointPayloadImage; +}; + +export type EndpointPayloadImage = PayloadImage & { + sizes: PayloadImage[]; + openGraph?: PayloadImage; +}; + +export type PayloadMedia = { + id: string; + url: string; + mimeType: string; + filename: string; + filesize: number; +}; + +export type PayloadImage = PayloadMedia & { + width: number; + height: number; +}; + +export type EndpointAllSDKUrls = { + urls: string[]; +}; + +export type EndpointAllIds = { + collectibles: { slugs: string[] }; + pages: { slugs: string[] }; + folders: { slugs: string[] }; + videos: { ids: string[] }; + audios: { ids: string[] }; + images: { ids: string[] }; + files: { ids: string[] }; + recorders: { ids: string[] }; + chronologyEvents: { ids: string[] }; +}; diff --git a/payload/rich-text.ts b/payload/rich-text.ts index 6b5538a..f32db98 100644 --- a/payload/rich-text.ts +++ b/payload/rich-text.ts @@ -1,17 +1,17 @@ -import { Collections } from "./constants"; import { - EndpointAudioPreview, - EndpointImagePreview, - EndpointVideoPreview, -} from "./endpoint-types"; -import { - GenericBlock, - SectionBlock, - TranscriptBlock, - BreakBlock, + type GenericBlock, + type SectionBlock, + type TranscriptBlock, + type BreakBlock, isBlockTranscriptBlock, isBlockBreakBlock, } from "./blocks"; +import { Collections } from "./constants"; +import type { + EndpointImagePreview, + EndpointVideoPreview, + EndpointAudioPreview, +} from "./endpoint-types"; export type RichTextContent = { root: { diff --git a/payload/sdk.ts b/payload/sdk.ts index 9e77583..d1602b8 100644 --- a/payload/sdk.ts +++ b/payload/sdk.ts @@ -1,24 +1,24 @@ import { Collections } from "./constants"; -import { - EndpointAllIds, - EndpointAllSDKUrls, - EndpointAudio, - EndpointChronologyEvent, +import type { + EndpointWebsiteConfig, + EndpointFolder, + EndpointLanguage, + EndpointCurrency, + EndpointWording, + EndpointPage, EndpointCollectible, + EndpointCollectibleScans, + EndpointCollectibleScanPage, EndpointCollectibleGallery, EndpointCollectibleGalleryImage, - EndpointCollectibleScanPage, - EndpointCollectibleScans, - EndpointCurrency, - EndpointFile, - EndpointFolder, + EndpointChronologyEvent, EndpointImage, - EndpointLanguage, - EndpointPage, - EndpointRecorder, + EndpointAudio, EndpointVideo, - EndpointWebsiteConfig, - EndpointWording, + EndpointFile, + EndpointRecorder, + EndpointAllSDKUrls, + EndpointAllIds, } from "./endpoint-types"; export const getSDKEndpoint = { diff --git a/payload/webhooks.ts b/payload/webhooks.ts index aa631c9..fc24bc8 100644 --- a/payload/webhooks.ts +++ b/payload/webhooks.ts @@ -1,4 +1,4 @@ -import { Collections } from "./constants"; +import type { Collections } from "./constants"; export type AfterOperationWebHookMessage = { collection: Collections;