-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
123 lines (119 loc) · 3.77 KB
/
types.ts
File metadata and controls
123 lines (119 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/** One discovered Calibre library rooted at a directory containing metadata.db. */
export type Library = {
/** Stable slug derived from the library path. */
slug: string;
/** Human-readable library name. */
name: string;
/** Absolute path to the library root. */
root: string;
/** Absolute path to metadata.db. */
dbPath: string;
};
/** One downloadable book entry merged from a Calibre library. */
export type BookEntry = {
/** Stable unique identifier `${librarySlug}:${bookId}`. */
uid: string;
/** Owning library slug. */
librarySlug: string;
/** Owning library display name. */
libraryName: string;
/** Raw Calibre book id. */
bookId: number;
/** Title from metadata.db. */
title: string;
/** Ordered list of author names. */
authors: string[];
/** Optional series name from Calibre metadata. */
series?: string;
/** Optional short description/comments text. */
description?: string;
/** Optional published timestamp as ISO string. */
publishedAt?: string;
/** Tags derived from Calibre metadata. */
tags: string[];
/** Relative Calibre book path from `books.path`. */
bookPath: string;
/** Available download formats for this entry. */
formats: string[];
/** Optional EPUB file path on disk. */
epubPath?: string;
/** Optional PDF file path on disk. */
pdfPath?: string;
/** Optional CBZ file path on disk. */
cbzPath?: string;
/** Optional CBR file path on disk. */
cbrPath?: string;
/** Optional cover file path on disk. */
coverPath?: string;
/** Added timestamp as ISO string if present. */
addedAt?: string;
/** Updated timestamp as ISO string if present. */
updatedAt?: string;
};
/** Config for the OPDS server. */
export type AppConfig = {
/** Root tree to scan recursively for Calibre libraries. */
calibreRoot: string;
/** Bind host for Bun.serve. */
host: string;
/** TCP port for Bun.serve. */
port: number;
/** Public base URL used in feed links. */
baseUrl: string;
/** Max entries returned in recent/updated feeds. */
feedLimit: number;
/** Interval in ms for background refresh. */
refreshMs: number;
/** Optional basic auth username. */
basicAuthUser?: string;
/** Optional basic auth password. */
basicAuthPass?: string;
/** SQLite path for KOReader progress sync state. */
koSyncDbPath: string;
};
/** Aggregated in-memory view of all discovered libraries and books. */
export type AppState = {
/** Refresh timestamp in ISO format. */
refreshedAt?: string;
/** Discovered libraries. */
libraries: Library[];
/** All EPUB books. */
books: BookEntry[];
/** Recent additions sorted descending. */
recentAdded: BookEntry[];
/** Recently updated sorted descending. */
recentUpdated: BookEntry[];
};
/** Raw row returned from the merged Calibre EPUB query. */
export type CalibreBookRow = {
/** Calibre book id. */
book_id: number;
/** Book title. */
title: string;
/** Relative book path. */
book_path: string;
/** Added timestamp. */
added_at?: string | null;
/** Updated timestamp. */
updated_at?: string | null;
/** Optional publication timestamp. */
published_at?: string | null;
/** EPUB file stem in the library, if present. */
epub_file_stem?: string | null;
/** PDF file stem in the library, if present. */
pdf_file_stem?: string | null;
/** CBZ file stem in the library, if present. */
cbz_file_stem?: string | null;
/** CBR file stem in the library, if present. */
cbr_file_stem?: string | null;
/** Comma-separated available formats. */
formats?: string | null;
/** Comma-separated authors list. */
authors?: string | null;
/** Optional series name. */
series?: string | null;
/** Optional comma-separated tag list. */
tags?: string | null;
/** Optional comments / description text. */
description?: string | null;
};