1894 lines
47 KiB
TypeScript

/* 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;
tags?: (string | Tag)[] | 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;
tags?: (string | Tag)[] | 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;
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;
};
};
}
/**
* 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` "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` "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` "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;
tags?: (string | Tag)[] | 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;
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;
};
};
}
/**
* 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;
}[];
tags?: (string | Tag)[] | 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;
}
/**
* 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;
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;
};
};
}
/**
* 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;
}[];
tags?: (string | Tag)[] | 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;
}
/**
* 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;
}
/**
* 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;
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",
}
/* 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: EndpointImage;
}
export interface RichTextUploadVideoNode extends RichTextUploadNode {
relationTo: Collections.Videos;
value: EndpointVideo;
}
export interface RichTextUploadAudioNode extends RichTextUploadNode {
relationTo: Collections.Audios;
value: EndpointAudio;
}
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 EndpointFolder = {
slug: string;
icon?: string;
translations: {
language: string;
name: string;
description?: RichTextContent;
}[];
sections:
| { type: "single"; subfolders: EndpointFolder[] }
| {
type: "multiple";
sections: {
translations: { language: string; name: string }[];
subfolders: EndpointFolder[];
}[];
};
files: (
| {
relationTo: Collections.Collectibles;
value: EndpointCollectible;
}
| {
relationTo: Collections.Pages;
value: EndpointPage;
}
| {
relationTo: Collections.Images;
value: EndpointImage;
}
| {
relationTo: Collections.Audios;
value: EndpointAudio;
}
| {
relationTo: Collections.Videos;
value: EndpointVideo;
}
)[];
parentPages: EndpointSource[];
};
export type EndpointWebsiteConfig = {
homeFolders: (EndpointFolder & {
lightThumbnail?: EndpointImage;
darkThumbnail?: EndpointImage;
})[];
timeline: {
breaks: number[];
eventCount: number;
eras: {
startingYear: number;
endingYear: number;
name: string;
}[];
};
};
export type EndpointRecorder = {
id: string;
username: string;
avatar?: EndpointImage;
translations: {
language: string;
biography: RichTextContent;
}[];
languages: string[];
};
export type EndpointWording = {
name: string;
translations: {
language: string;
name: string;
}[];
};
export type EndpointTag = {
slug: string;
page?: EndpointPage;
translations: {
language: string;
name: string;
}[];
};
export type EndpointGenericAttribute = {
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 = {
icon: string;
translations: {
language: string;
name: string;
}[];
};
export type EndpointCredit = {
role: EndpointRole;
recorders: EndpointRecorder[];
};
export type EndpointPage = {
slug: string;
thumbnail?: EndpointImage;
attributes: EndpointAttribute[];
backgroundImage?: EndpointImage;
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
sourceLanguage: string;
summary?: RichTextContent;
content: RichTextContent;
credits: EndpointCredit[];
toc: TableOfContentEntry[];
}[];
createdAt: string;
updatedAt: string;
updatedBy?: EndpointRecorder;
parentPages: EndpointSource[];
};
export type EndpointCollectible = {
slug: string;
thumbnail?: EndpointImage;
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
description?: RichTextContent;
}[];
attributes: EndpointAttribute[];
releaseDate?: string;
languages: string[];
backgroundImage?: EndpointImage;
nature: CollectibleNature;
gallery?: { count: number; thumbnail: EndpointImage };
scans?: { count: number; thumbnail: PayloadImage };
urls: { url: string; label: string }[];
price?: {
amount: number;
currency: string;
};
size?: {
width: number;
height: number;
thickness?: number;
};
weight?: number;
pageInfo?: {
pageCount: number;
bindingType?: CollectibleBindingTypes;
pageOrder?: CollectiblePageOrders;
};
subitems: EndpointCollectible[];
contents: {
content:
| {
relationTo: Collections.Pages;
value: EndpointPage;
}
| {
relationTo: Collections.Audios;
value: EndpointAudio;
}
| {
relationTo: Collections.Videos;
value: EndpointVideo;
}
| {
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?: EndpointRecorder;
parentPages: EndpointSource[];
};
export type EndpointCollectibleScans = {
slug: string;
thumbnail?: EndpointImage;
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?: EndpointImage;
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
description?: RichTextContent;
}[];
images: EndpointImage[];
parentPages: EndpointSource[];
};
export type EndpointCollectibleGalleryImage = {
slug: string;
thumbnail?: EndpointImage;
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
description?: RichTextContent;
}[];
image: EndpointImage;
previousIndex?: string;
nextIndex?: string;
parentPages: EndpointSource[];
};
export type EndpointCollectibleScanPage = {
slug: string;
thumbnail?: EndpointImage;
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;
};
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 EndpointSource =
| { type: "url"; url: string; label: string }
| {
type: "collectible";
collectible: EndpointCollectible;
range?:
| { type: "page"; page: number }
| { type: "timestamp"; timestamp: string }
| { type: "custom"; translations: { language: string; note: string }[] };
}
| { type: "page"; page: EndpointPage }
| { type: "folder"; folder: EndpointFolder }
| { type: "scans"; collectible: EndpointCollectible }
| { type: "gallery"; collectible: EndpointCollectible };
export type EndpointMedia = {
id: string;
url: string;
filename: string;
mimeType: string;
filesize: number;
updatedAt: string;
createdAt: string;
attributes: EndpointAttribute[];
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
description?: RichTextContent;
}[];
credits: EndpointCredit[];
};
export type EndpointImage = EndpointMedia & {
width: number;
height: number;
};
export type EndpointAudio = EndpointMedia & {
thumbnail?: PayloadImage;
duration: number;
};
export type EndpointVideo = EndpointMedia & {
thumbnail?: PayloadImage;
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 PayloadMedia = {
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;
cache: Cache;
};
type Cache = {
set: (token: string, expirationTimestamp: number) => void;
get: () => string | undefined;
};
const logResponse = (res: Response) => console.log(res.status, res.statusText, res.url);
export const getPayloadSDK = ({ apiURL, email, password, cache }: 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;
};
cache.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<Response> => {
const result = await fetch(url, {
headers: {
Authorization: `JWT ${cache.get() ?? (await refreshToken())}`,
},
});
logResponse(result);
if (result.status !== 200) {
throw new Error("Unhandled fetch error");
}
return result;
};
return {
getConfig: async (): Promise<EndpointWebsiteConfig> =>
await (await request(payloadApiUrl(Collections.WebsiteConfig, `config`, true))).json(),
getFolder: async (slug: string): Promise<EndpointFolder> =>
await (await request(payloadApiUrl(Collections.Folders, `slug/${slug}`))).json(),
getLanguages: async (): Promise<Language[]> =>
await (await request(payloadApiUrl(Collections.Languages, `all`))).json(),
getCurrencies: async (): Promise<Currency[]> =>
await (await request(payloadApiUrl(Collections.Currencies, `all`))).json(),
getWordings: async (): Promise<EndpointWording[]> =>
await (await request(payloadApiUrl(Collections.Wordings, `all`))).json(),
getPage: async (slug: string): Promise<EndpointPage> =>
await (await request(payloadApiUrl(Collections.Pages, `slug/${slug}`))).json(),
getCollectible: async (slug: string): Promise<EndpointCollectible> =>
await (await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}`))).json(),
getCollectibleScans: async (slug: string): Promise<EndpointCollectibleScans> =>
await (await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/scans`))).json(),
getCollectibleScanPage: async (
slug: string,
index: string
): Promise<EndpointCollectibleScanPage> =>
await (
await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/scans/${index}`))
).json(),
getCollectibleGallery: async (slug: string): Promise<EndpointCollectibleGallery> =>
await (await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/gallery`))).json(),
getCollectibleGalleryImage: async (
slug: string,
index: string
): Promise<EndpointCollectibleGalleryImage> =>
await (
await request(payloadApiUrl(Collections.Collectibles, `slug/${slug}/gallery/${index}`))
).json(),
getChronologyEvents: async (): Promise<EndpointChronologyEvent[]> =>
await (await request(payloadApiUrl(Collections.ChronologyEvents, `all`))).json(),
getChronologyEventByID: async (id: string): Promise<EndpointChronologyEvent> =>
await (await request(payloadApiUrl(Collections.ChronologyEvents, `id/${id}`))).json(),
getImageByID: async (id: string): Promise<EndpointImage> =>
await (await request(payloadApiUrl(Collections.Images, `id/${id}`))).json(),
getAudioByID: async (id: string): Promise<EndpointAudio> =>
await (await request(payloadApiUrl(Collections.Audios, `id/${id}`))).json(),
getVideoByID: async (id: string): Promise<EndpointVideo> =>
await (await request(payloadApiUrl(Collections.Videos, `id/${id}`))).json(),
getRecorderByID: async (id: string): Promise<EndpointRecorder> =>
await (await request(payloadApiUrl(Collections.Recorders, `id/${id}`))).json(),
};
};