Files
ERitors-Scribe-Desktop/lib/models/Book.ts
natreex b4eafca3bc Add comprehensive models and script for handling inline scripts and structured data
- Implement `remove-inline-scripts.js` to externalize Next.js inline scripts, enhancing CSP compliance.
- Add models for `Book`, `Character`, `Story`, `Editor`, `System`, and `BookSerie` with relevant properties and utilities.
- Include macOS entitlements plist for app development with advanced permissions.
- Add utility functions to handle script hashing, cookie management, and content formatting.
2025-11-16 19:56:14 -05:00

136 lines
3.1 KiB
TypeScript

import {Author} from './User';
import {ActChapter, ChapterProps} from "@/lib/models/Chapter";
import {SelectBoxProps} from "@/shared/interface";
export interface BookProps {
bookId: string;
type: string;
title: string;
author?: Author;
serie?: number;
subTitle?: string;
summary?: string;
publicationDate?: string;
desiredWordCount?: number;
totalWordCount?: number;
coverImage?: string;
chapters?: ChapterProps[];
}
export interface BookListProps {
id: string;
type: string;
authorId: string;
title: string;
subTitle?: string;
summary?: string;
serieId?: number;
desiredReleaseDate?: string;
desiredWordCount?: number;
wordCount?: number;
coverImage?: string;
bookMeta?: string;
}
export interface GuideLine {
tone: string;
atmosphere: string;
writingStyle: string;
themes: string;
symbolism: string;
motifs: string;
narrativeVoice: string;
pacing: string;
intendedAudience: string;
keyMessages: string;
}
export interface GuideLineAI {
narrativeType: number;
dialogueType: number;
globalResume: string;
atmosphere: string;
verbeTense: number;
langue: number;
themes: string;
}
export interface PlotPoint {
plotPointId: string;
title: string;
summary: string;
linkedIncidentId: string;
chapters?: ActChapter[];
}
export interface Incident {
incidentId: string;
title: string;
summary: string;
chapters?: ActChapter[];
}
export interface Issue {
name: string;
id: string;
}
export interface Act {
id: number;
summary: string | null;
incidents?: Incident[];
plotPoints?: PlotPoint[];
chapters?: ActChapter[];
}
export interface Tag {
label: string,
value: string,
}
export interface BookTags {
characters: Tag[];
locations: Tag[];
objects: Tag[];
worldElements: Tag[];
}
export const bookTypes: SelectBoxProps[] = [
{label: 'bookTypes.short', value: 'short'},
{label: 'bookTypes.novelette', value: 'novelette'},
{label: 'bookTypes.novella', value: 'long'},
{label: 'bookTypes.chapbook', value: 'chapbook'},
{label: 'bookTypes.novel', value: 'novel'},
]
export default class Book {
constructor() {
}
static booksToSelectBox(books: BookProps[]): SelectBoxProps[] {
return books.map((book: BookProps) => {
return {
label: book.title,
value: book.bookId,
}
});
}
static getBookTypeLabel(value: string): string {
switch (value) {
case 'short':
return 'bookTypes.short';
case 'novelette':
return 'bookTypes.novelette';
case 'long':
return 'bookTypes.novella';
case 'chapbook':
return 'bookTypes.chapbook';
case 'novel':
return 'bookTypes.novel';
default:
return 'bookTypes.novel';
}
}
}