/* tslint:disable */ /* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, * and re-run `payload generate:types` to regenerate this file. */ /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "Credits". */ export type Credits = | { role: string | CreditsRole; recorders: (string | Recorder)[]; id?: string | null; }[] | null; export interface Config { collections: { pages: Page; collectibles: Collectible; folders: Folder; "chronology-events": ChronologyEvent; images: Image; audios: Audio; "media-thumbnails": MediaThumbnail; videos: Video; "videos-subtitles": VideoSubtitle; "videos-channels": VideosChannel; scans: Scan; tags: Tag; attributes: Attribute; "credits-roles": CreditsRole; recorders: Recorder; languages: Language; currencies: Currency; wordings: Wording; "generic-contents": GenericContent; "payload-preferences": PayloadPreference; "payload-migrations": PayloadMigration; }; globals: { "website-config": WebsiteConfig; }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pages". */ export interface Page { id: string; slug: string; thumbnail?: string | Image | null; backgroundImage?: string | Image | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; translations: { language: string | Language; sourceLanguage: string | Language; pretitle?: string | null; title: string; subtitle?: string | null; summary?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; content: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; }; credits?: Credits; id?: string | null; }[]; folders?: (string | Folder)[] | null; collectibles?: (string | Collectible)[] | null; updatedBy: string | Recorder; updatedAt: string; createdAt: string; _status?: ("draft" | "published") | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "images". */ export interface Image { id: string; translations?: | { language: string | Language; pretitle?: string | null; title: string; subtitle?: string | null; description?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; id?: string | null; }[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; credits?: Credits; updatedAt: string; createdAt: string; url?: string | null; filename?: string | null; mimeType?: string | null; filesize?: number | null; width?: number | null; height?: number | null; focalX?: number | null; focalY?: number | null; sizes?: { thumb?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; og?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "200w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "320w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "480w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "800w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "1280w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "1920w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "2560w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "languages". */ export interface Language { id: string; name: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "TagsBlock". */ export interface TagsBlock { name: string | Attribute; tags: (string | Tag)[]; id?: string | null; blockName?: string | null; blockType: "tagsBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "attributes". */ export interface Attribute { id: string; slug: string; icon?: string | null; type: "Number" | "Text" | "Tags"; translations: { language: string | Language; name: string; id?: string | null; }[]; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "tags". */ export interface Tag { id: string; slug: string; page?: (string | null) | Page; translations: { language: string | Language; name: string; id?: string | null; }[]; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "NumberBlock". */ export interface NumberBlock { name: string | Attribute; number: number; id?: string | null; blockName?: string | null; blockType: "numberBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "TextBlock". */ export interface TextBlock { name: string | Attribute; text: string; id?: string | null; blockName?: string | null; blockType: "textBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "credits-roles". */ export interface CreditsRole { id: string; slug: string; icon?: string | null; translations: { language: string | Language; name: string; id?: string | null; }[]; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "recorders". */ export interface Recorder { id: string; username: string; avatar?: string | Image | null; languages?: (string | Language)[] | null; translations?: | { language: string | Language; biography: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; }; id?: string | null; }[] | null; role?: ("Admin" | "Recorder" | "Api")[] | null; anonymize: boolean; email: string; resetPasswordToken?: string | null; resetPasswordExpiration?: string | null; salt?: string | null; hash?: string | null; loginAttempts?: number | null; lockUntil?: string | null; password?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "folders". */ export interface Folder { id: string; slug: string; icon?: string | null; parentFolders?: (string | Folder)[] | null; translations: { language: string | Language; name: string; description?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; id?: string | null; }[]; sections?: | { translations?: | { language: string | Language; name: string; id?: string | null; }[] | null; subfolders?: (string | Folder)[] | null; id?: string | null; }[] | null; files?: | ( | { relationTo: "collectibles"; value: string | Collectible; } | { relationTo: "pages"; value: string | Page; } | { relationTo: "videos"; value: string | Video; } | { relationTo: "images"; value: string | Image; } | { relationTo: "audios"; value: string | Audio; } )[] | null; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "collectibles". */ export interface Collectible { id: string; slug: string; thumbnail?: string | Image | null; nature: "Physical" | "Digital"; languages?: (string | Language)[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; translations: { language: string | Language; pretitle?: string | null; title: string; subtitle?: string | null; description?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; id?: string | null; }[]; backgroundImage?: string | Image | null; gallery?: | { image: string | Image; id?: string | null; }[] | null; scansEnabled?: boolean | null; scans?: { credits?: Credits; coverEnabled?: boolean | null; cover?: { front?: string | Scan | null; spine?: string | Scan | null; back?: string | Scan | null; insideFront?: string | Scan | null; insideBack?: string | Scan | null; flapFront?: string | Scan | null; flapBack?: string | Scan | null; insideFlapFront?: string | Scan | null; insideFlapBack?: string | Scan | null; }; dustjacketEnabled?: boolean | null; dustjacket?: { front?: string | Scan | null; spine?: string | Scan | null; back?: string | Scan | null; insideFront?: string | Scan | null; insideSpine?: string | Scan | null; insideBack?: string | Scan | null; flapFront?: string | Scan | null; flapBack?: string | Scan | null; insideFlapFront?: string | Scan | null; insideFlapBack?: string | Scan | null; }; obiEnabled?: boolean | null; obi?: { front?: string | Scan | null; spine?: string | Scan | null; back?: string | Scan | null; insideFront?: string | Scan | null; insideSpine?: string | Scan | null; insideBack?: string | Scan | null; flapFront?: string | Scan | null; flapBack?: string | Scan | null; insideFlapFront?: string | Scan | null; insideFlapBack?: string | Scan | null; }; pages?: | { page: number; image: string | Scan; id?: string | null; }[] | null; }; urls?: | { url: string; id?: string | null; }[] | null; releaseDate?: string | null; priceEnabled?: boolean | null; price?: { amount: number; currency: string | Currency; }; sizeEnabled?: boolean | null; size?: { width: number; height: number; thickness?: number | null; }; weightEnabled?: boolean | null; weight?: { amount: number; }; pageInfoEnabled?: boolean | null; pageInfo?: { pageCount: number; bindingType?: ("Paperback" | "Hardcover") | null; pageOrder?: ("Left to right" | "Right to left") | null; }; folders?: (string | Folder)[] | null; parentItems?: (string | Collectible)[] | null; subitems?: (string | Collectible)[] | null; contents?: | { content: | { relationTo: "pages"; value: string | Page; } | { relationTo: "generic-contents"; value: string | GenericContent; } | { relationTo: "audios"; value: string | Audio; } | { relationTo: "videos"; value: string | Video; }; range?: | ( | { start: number; end: number; id?: string | null; blockName?: string | null; blockType: "pageRange"; } | { start: string; end: string; id?: string | null; blockName?: string | null; blockType: "timeRange"; } | { translations: { language: string | Language; note: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; }; id?: string | null; }[]; id?: string | null; blockName?: string | null; blockType: "other"; } )[] | null; id?: string | null; }[] | null; updatedBy: string | Recorder; updatedAt: string; createdAt: string; _status?: ("draft" | "published") | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "scans". */ export interface Scan { id: string; updatedAt: string; createdAt: string; url?: string | null; filename?: string | null; mimeType?: string | null; filesize?: number | null; width?: number | null; height?: number | null; focalX?: number | null; focalY?: number | null; sizes?: { thumb?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "200w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "320w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "480w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "800w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "currencies". */ export interface Currency { id: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "generic-contents". */ export interface GenericContent { id: string; name: string; translations: { language: string | Language; name: string; id?: string | null; }[]; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "audios". */ export interface Audio { id: string; duration: number; thumbnail?: string | MediaThumbnail | null; translations: { language: string | Language; pretitle?: string | null; title: string; subtitle?: string | null; description?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; id?: string | null; }[]; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; credits?: Credits; updatedAt: string; createdAt: string; url?: string | null; filename?: string | null; mimeType?: string | null; filesize?: number | null; width?: number | null; height?: number | null; focalX?: number | null; focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "media-thumbnails". */ export interface MediaThumbnail { id: string; updatedAt: string; createdAt: string; url?: string | null; filename?: string | null; mimeType?: string | null; filesize?: number | null; width?: number | null; height?: number | null; focalX?: number | null; focalY?: number | null; sizes?: { thumb?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; og?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "200w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "320w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "480w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "800w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "1280w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "1920w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; "2560w"?: { url?: string | null; width?: number | null; height?: number | null; mimeType?: string | null; filesize?: number | null; filename?: string | null; }; }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "videos". */ export interface Video { id: string; duration: number; thumbnail?: string | MediaThumbnail | null; translations: { language: string | Language; pretitle?: string | null; title: string; subtitle?: string | null; description?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; subfile?: string | VideoSubtitle | null; id?: string | null; }[]; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; credits?: Credits; platformEnabled?: boolean | null; platform?: { channel: string | VideosChannel; views?: number | null; likes?: number | null; dislikes?: number | null; url: string; publishedDate: string; }; updatedAt: string; createdAt: string; url?: string | null; filename?: string | null; mimeType?: string | null; filesize?: number | null; width?: number | null; height?: number | null; focalX?: number | null; focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "videos-subtitles". */ export interface VideoSubtitle { id: string; url?: string | null; filename?: string | null; mimeType?: string | null; filesize?: number | null; width?: number | null; height?: number | null; focalX?: number | null; focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "videos-channels". */ export interface VideosChannel { id: string; url: string; title: string; subscribers: number; videos?: (string | Video)[] | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "chronology-events". */ export interface ChronologyEvent { id: string; name?: string | null; date: { year: number; month?: number | null; day?: number | null; }; events: { sources?: (UrlBlock | CollectibleBlock | PageBlock)[] | null; translations: { language: string | Language; sourceLanguage: string | Language; title?: string | null; description?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; notes?: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; } | null; credits?: Credits; id?: string | null; }[]; id?: string | null; }[]; updatedBy: string | Recorder; updatedAt: string; createdAt: string; _status?: ("draft" | "published") | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "UrlBlock". */ export interface UrlBlock { url: string; id?: string | null; blockName?: string | null; blockType: "urlBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "CollectibleBlock". */ export interface CollectibleBlock { collectible: string | Collectible; range?: | ( | { page: number; id?: string | null; blockName?: string | null; blockType: "page"; } | { timestamp: string; id?: string | null; blockName?: string | null; blockType: "timestamp"; } | { translations: { language: string | Language; note: string; id?: string | null; }[]; id?: string | null; blockName?: string | null; blockType: "other"; } )[] | null; id?: string | null; blockName?: string | null; blockType: "collectibleBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "PageBlock". */ export interface PageBlock { page: string | Page; id?: string | null; blockName?: string | null; blockType: "pageBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "wordings". */ export interface Wording { id: string; name: string; translations: { language: string | Language; name: string; id?: string | null; }[]; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-preferences". */ export interface PayloadPreference { id: string; user: { relationTo: "recorders"; value: string | Recorder; }; key?: string | null; value?: | { [k: string]: unknown; } | unknown[] | string | number | boolean | null; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-migrations". */ export interface PayloadMigration { id: string; name?: string | null; batch?: number | null; updatedAt: string; createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "website-config". */ export interface WebsiteConfig { id: string; homeBackgroundImage: string | Image; timelineBackgroundImage: string | Image; defaultOpenGraphImage: string | Image; homeFolders?: | { lightThumbnail?: string | Image | null; darkThumbnail?: string | Image | null; folder: string | Folder; id?: string | null; }[] | null; timeline?: { breaks?: number[] | null; eras?: | { name: string | Wording; startingYear: number; endingYear: number; id?: string | null; }[] | null; }; updatedAt?: string | null; createdAt?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "LineBlock". */ export interface LineBlock { content: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; }; id?: string | null; blockName?: string | null; blockType: "lineBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "CueBlock". */ export interface CueBlock { content: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; }; id?: string | null; blockName?: string | null; blockType: "cueBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "TranscriptBlock". */ export interface TranscriptBlock { lines: (LineBlock | CueBlock)[]; id?: string | null; blockName?: string | null; blockType: "transcriptBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "BreakBlock". */ export interface BreakBlock { type: "Scene break" | "Empty space" | "Solid line" | "Dotted line"; id?: string | null; blockName?: string | null; blockType: "breakBlock"; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "SectionBlock". */ export interface SectionBlock { content: { root: { type: string; children: { type: string; version: number; [k: string]: unknown; }[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; version: number; }; [k: string]: unknown; }; id?: string | null; blockName?: string | null; blockType: "sectionBlock"; } /////////////// CONSTANTS /////////////// export enum Collections { Attributes = "attributes", Audios = "audios", ChronologyEvents = "chronology-events", Collectibles = "collectibles", CreditsRole = "credits-roles", Currencies = "currencies", Folders = "folders", GenericContents = "generic-contents", Images = "images", Languages = "languages", MediaThumbnails = "media-thumbnails", Pages = "pages", Recorders = "recorders", Scans = "scans", Tags = "tags", Videos = "videos", VideosChannels = "videos-channels", VideosSubtitles = "videos-subtitles", Wordings = "wordings", WebsiteConfig = "website-config", } export enum CollectionGroups { Collections = "Collections", Media = "Media", Meta = "Meta", } export enum LanguageCodes { en = "English", fr = "French", ja = "Japan", es = "Spanish", "pt-br" = "Portuguese", "zh" = "Chinese", } export enum BreakBlockType { sceneBreak = "Scene break", space = "Empty space", solidLine = "Solid line", dottedLine = "Dotted line", } export enum CollectibleBindingTypes { Paperback = "Paperback", Hardcover = "Hardcover", } export enum CollectiblePageOrders { LeftToRight = "Left to right", RightToLeft = "Right to left", } export enum CollectibleNature { Physical = "Physical", Digital = "Digital", } export enum CollectibleContentType { None = "None", Indexes = "Index-based", Pages = "Page-based", } export enum RecordersRoles { Admin = "Admin", Recorder = "Recorder", Api = "Api", } export enum CollectionStatus { Draft = "draft", Published = "published", } export enum AttributeTypes { Number = "Number", Text = "Text", Tags = "Tags", } /* WEB HOOKS */ export interface WebHookMessage { collection: Collections; operation: WebHookOperationType; id?: string; } export enum WebHookOperationType { create = "create", update = "update", delete = "delete", } /* RICH TEXT */ export type RichTextContent = { root: { children: RichTextNode[]; direction: ("ltr" | "rtl") | null; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; indent: number; type: string; version: number; }; [k: string]: unknown; }; export type RichTextNode = { type: string; version: number; [k: string]: unknown; }; export interface RichTextNodeWithChildren extends RichTextNode { children: RichTextNode[]; } export interface RichTextParagraphNode extends RichTextNodeWithChildren { type: "paragraph"; format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; } export interface RichTextListNode extends RichTextNode { type: "list"; children: RichTextNodeWithChildren[]; listType: string; } export interface RichTextListNumberNode extends RichTextListNode { listType: "number"; } export interface RichTextListBulletNode extends RichTextListNode { listType: "bullet"; } export interface RichTextListCheckNode extends RichTextListNode { listType: "check"; } export interface RichTextLinebreakNode extends RichTextNode { type: "linebreak"; } export interface RichTextUploadNode extends RichTextNode { type: "upload"; relationTo: string; } export interface RichTextUploadImageNode extends RichTextUploadNode { relationTo: Collections.Images; value: EndpointImagePreview; } export interface RichTextUploadVideoNode extends RichTextUploadNode { relationTo: Collections.Videos; value: EndpointVideoPreview; } export interface RichTextUploadAudioNode extends RichTextUploadNode { relationTo: Collections.Audios; value: EndpointAudioPreview; } export interface RichTextTextNode extends RichTextNode { type: "text"; format: number; text: string; } export interface RichTextTabNode extends RichTextNode { type: "tab"; format: number; } export interface RichTextLinkNode extends RichTextNodeWithChildren { type: "link"; fields: { linkType: "internal" | "custom"; }; } export interface RichTextLinkInternalNode extends RichTextLinkNode { fields: { linkType: "internal"; newTab: boolean; doc: { relationTo: string; value: any; }; }; } export interface RichTextLinkCustomNode extends RichTextLinkNode { fields: { linkType: "custom"; newTab: boolean; url: string; }; } export interface RichTextBlockNode extends RichTextNode { type: "block"; fields: { blockType: string; }; } export interface RichTextSectionBlock extends RichTextBlockNode { fields: SectionBlock; anchorHash: string; } export interface RichTextTranscriptBlock extends RichTextBlockNode { fields: TranscriptBlock; } export interface RichTextBreakBlock extends RichTextBlockNode { fields: BreakBlock; anchorHash: string; } export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode => node.type === "paragraph"; export const isNodeUploadNode = (node: RichTextNode): node is RichTextUploadNode => node.type === "upload"; export const isUploadNodeImageNode = (node: RichTextUploadNode): node is RichTextUploadImageNode => node.relationTo === Collections.Images; export const isUploadNodeVideoNode = (node: RichTextUploadNode): node is RichTextUploadVideoNode => node.relationTo === Collections.Videos; export const isUploadNodeAudioNode = (node: RichTextUploadNode): node is RichTextUploadAudioNode => node.relationTo === Collections.Audios; export const isNodeListNode = (node: RichTextNode): node is RichTextListNode => node.type === "list"; export const isListNodeNumberListNode = (node: RichTextListNode): node is RichTextListNumberNode => node.listType === "number"; export const isListNodeBulletListNode = (node: RichTextListNode): node is RichTextListBulletNode => node.listType === "bullet"; export const isListNodeCheckListNode = (node: RichTextListNode): node is RichTextListCheckNode => node.listType === "check"; export const isNodeLinebreakNode = (node: RichTextNode): node is RichTextLinebreakNode => node.type === "linebreak"; export const isNodeTextNode = (node: RichTextNode): node is RichTextTextNode => node.type === "text"; export const isNodeTabNode = (node: RichTextNode): node is RichTextTabNode => node.type === "tab"; export const isNodeLinkNode = (node: RichTextNode): node is RichTextLinkNode => node.type === "link"; export const isLinkNodeInternalLinkNode = ( node: RichTextLinkNode ): node is RichTextLinkInternalNode => node.fields.linkType === "internal"; export const isLinkNodeCustomLinkNode = (node: RichTextLinkNode): node is RichTextLinkCustomNode => node.fields.linkType === "custom"; export const isNodeBlockNode = (node: RichTextNode): node is RichTextBlockNode => node.type === "block"; export const isBlockNodeSectionBlock = (node: RichTextBlockNode): node is RichTextSectionBlock => node.fields.blockType === "sectionBlock"; export const isBlockNodeTranscriptBlock = ( node: RichTextBlockNode ): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock"; export const isBlockNodeBreakBlock = (node: RichTextBlockNode): node is RichTextBreakBlock => node.fields.blockType === "breakBlock"; /* BLOCKS */ /* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */ export interface CueBlock { content: RichTextContent; blockType: "cueBlock"; id?: string | null; blockName?: string | null; } export interface LineBlock { content: RichTextContent; blockType: "lineBlock"; id?: string | null; blockName?: string | null; } export interface GenericBlock { id?: string | null; blockName?: string | null; blockType: string; } export const isBlockCueBlock = (block: GenericBlock): block is CueBlock => block.blockType === "cueBlock"; export const isBlockLineBlock = (block: GenericBlock): block is LineBlock => block.blockType === "lineBlock"; ////////////////// SDK ////////////////// export type EndpointFolderPreview = { id: string; slug: string; icon?: string; translations: { language: string; title: string; }[]; }; export type EndpointFolder = EndpointFolderPreview & { 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; } )[]; 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 = EndpointPagePreview & { 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 = EndpointCollectiblePreview & { 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[]; 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"; 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; 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; 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; sourceLanguage: string; title?: string; description?: RichTextContent; notes?: RichTextContent; credits: EndpointCredit[]; }[]; }[]; }; 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 = EndpointMediaPreview & { 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; }[]; 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 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; }; // SDK type GetPayloadSDKParams = { apiURL: string; email: string; password: string; tokenCache?: { set: (token: string, expirationTimestamp: number) => void; get: () => string | undefined; }; responseCache?: { set: (url: string, response: any) => void; get: (url: string) => any | undefined; }; }; const logResponse = (res: Response) => console.log(res.status, res.statusText, res.url); export const getPayloadSDK = ({ apiURL, email, password, tokenCache, responseCache, }: GetPayloadSDKParams) => { const refreshToken = async () => { const loginUrl = payloadApiUrl(Collections.Recorders, "login"); const loginResult = await fetch(loginUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password }), }); logResponse(loginResult); if (loginResult.status !== 200) { throw new Error("Unable to login"); } const { token, exp } = (await loginResult.json()) as { token: string; exp: number; }; tokenCache?.set(token, exp); return token; }; const payloadApiUrl = (collection: Collections, endpoint?: string, isGlobal?: boolean): string => `${apiURL}/${isGlobal === undefined ? "" : "globals/"}${collection}${endpoint === undefined ? "" : `/${endpoint}`}`; const request = async (url: string): Promise => { const cachedResponse = responseCache?.get(url); if (cachedResponse) { return cachedResponse; } const result = await fetch(url, { headers: { Authorization: `JWT ${tokenCache?.get() ?? (await refreshToken())}`, }, }); logResponse(result); if (!result.ok) { throw new Error("Unhandled fetch error"); } const data = await result.json(); responseCache?.set(url, data); return data; }; return { getConfig: async (): Promise => await request(payloadApiUrl(Collections.WebsiteConfig, `config`, true)), getFolder: async (slug: string): Promise => await request(payloadApiUrl(Collections.Folders, `slug/${slug}`)), getLanguages: async (): Promise => await request(payloadApiUrl(Collections.Languages, `all`)), getCurrencies: async (): Promise => await request(payloadApiUrl(Collections.Currencies, `all`)), getWordings: async (): Promise => await request(payloadApiUrl(Collections.Wordings, `all`)), getPage: async (slug: string): Promise => await request(payloadApiUrl(Collections.Pages, `slug/${slug}`)), getCollectible: async (slug: string): Promise => await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}`)), getCollectibleScans: async (slug: string): Promise => await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/scans`)), getCollectibleScanPage: async ( slug: string, index: string ): Promise => await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/scans/${index}`)), getCollectibleGallery: async (slug: string): Promise => await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/gallery`)), getCollectibleGalleryImage: async ( slug: string, index: string ): Promise => await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/gallery/${index}`)), getChronologyEvents: async (): Promise => await request(payloadApiUrl(Collections.ChronologyEvents, `all`)), getChronologyEventByID: async (id: string): Promise => await request(payloadApiUrl(Collections.ChronologyEvents, `id/${id}`)), getImageByID: async (id: string): Promise => await request(payloadApiUrl(Collections.Images, `id/${id}`)), getAudioByID: async (id: string): Promise => await request(payloadApiUrl(Collections.Audios, `id/${id}`)), getVideoByID: async (id: string): Promise => await request(payloadApiUrl(Collections.Videos, `id/${id}`)), getRecorderByID: async (id: string): Promise => await request(payloadApiUrl(Collections.Recorders, `id/${id}`)), request: async (url: string): Promise => await request(url), }; };