@wzyjs/utils 0.3.31 → 0.3.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import type { FanqieLibraryCategories, ResolveFanqieLibraryCategoryParams } from '../types';
2
+ export declare const getFanqieLibraryFilters: (gender: -1 | 0 | 1) => Promise<FanqieLibraryCategories>;
3
+ export declare const resolveFanqieLibraryCategoryId: ({ gender, categoryGroup, categoryId, }: ResolveFanqieLibraryCategoryParams) => Promise<number>;
@@ -0,0 +1,2 @@
1
+ import type { FanqieBookItem } from '../types';
2
+ export declare const getFanqieBookDetailById: (fanqieBookId: string) => Promise<FanqieBookItem>;
@@ -0,0 +1,5 @@
1
+ export * from './categories';
2
+ export * from './detail';
3
+ export * from './library';
4
+ export * from './normalize';
5
+ export * from './search';
@@ -0,0 +1,5 @@
1
+ import type { FanqieBookItem, ListFanqieLibraryBooksParams } from '../types';
2
+ export declare const listFanqieLibraryBooks: ({ gender, categoryId, creationStatus, wordCount, sort, pageIndex, pageSize, }: ListFanqieLibraryBooksParams) => Promise<{
3
+ results: FanqieBookItem[];
4
+ total: number;
5
+ }>;
@@ -0,0 +1,22 @@
1
+ import type { FanqieBookItem } from '../types';
2
+ interface FanqieBookSourcePayload {
3
+ book_name?: unknown;
4
+ book_id?: unknown;
5
+ author?: unknown;
6
+ score?: unknown;
7
+ thumb_url?: unknown;
8
+ abstract?: unknown;
9
+ category?: unknown;
10
+ tags?: unknown;
11
+ word_number?: unknown;
12
+ read_count?: unknown;
13
+ read_count_all?: unknown;
14
+ status?: unknown;
15
+ last_chapter_update_time?: unknown;
16
+ }
17
+ export declare const normalizeFanqieBookStatus: (value: unknown) => 0 | 1 | null;
18
+ export declare const normalizeFanqieBookTags: (value: unknown) => string[];
19
+ export declare const normalizeFanqieBookSearchItem: (payload: FanqieBookSourcePayload) => FanqieBookItem | null;
20
+ export declare const normalizeFanqieBookDetailItem: (fanqieBookId: string, payload: FanqieBookSourcePayload) => FanqieBookItem;
21
+ export declare const normalizeFanqieOfficialLibraryItem: (payload: any) => FanqieBookItem | null;
22
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { FanqieBookItem } from '../types';
2
+ export interface SearchFanqieBooksOptions {
3
+ baseUrl?: string;
4
+ source?: string;
5
+ tab?: string;
6
+ page?: number;
7
+ disabledSources?: string;
8
+ }
9
+ export declare const normalizeFanqieSearchResults: (payload: unknown) => FanqieBookItem[];
10
+ export declare const createFanqieSearchUrl: (query: string, options?: SearchFanqieBooksOptions) => string;
11
+ export declare const searchFanqieBooks: (query: string, options?: SearchFanqieBooksOptions) => Promise<FanqieBookItem[]>;
@@ -0,0 +1,2 @@
1
+ import type { FanqieChapterDirectoryItem } from '../types';
2
+ export declare const getFanqieChapterDirectory: (fanqieBookId: string) => Promise<FanqieChapterDirectoryItem[]>;
@@ -0,0 +1 @@
1
+ export * from './directory';
@@ -0,0 +1 @@
1
+ export * from './sidecar';
@@ -0,0 +1,2 @@
1
+ import type { FanqieChapterContentItem, FanqieOfficialSidecarOptions } from '../types';
2
+ export declare const getFanqieChapterContents: (fanqieBookId: string, chapterIds: string[], sidecarOptions?: FanqieOfficialSidecarOptions) => Promise<Map<string, FanqieChapterContentItem>>;
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * as fanqieBook from './book';
3
+ export * as fanqieChapter from './chapter';
4
+ export * as fanqieContent from './content';
@@ -0,0 +1,74 @@
1
+ export interface FanqieBookItem {
2
+ id: string;
3
+ title: string;
4
+ author: string | null;
5
+ coverUrl: string | null;
6
+ description: string | null;
7
+ category: string | null;
8
+ tags: string[];
9
+ score?: string | null;
10
+ wordCount?: string | null;
11
+ readCount?: string | null;
12
+ readCountAll?: string | null;
13
+ creationStatus?: 0 | 1 | null;
14
+ lastChapterTime?: string | null;
15
+ rawTitle?: string | null;
16
+ rawAuthor?: string | null;
17
+ rawDescription?: string | null;
18
+ rawCategory?: string | null;
19
+ rawScore?: string | null;
20
+ rawWordCount?: string | null;
21
+ rawReadCount?: string | null;
22
+ rawReadCountAll?: string | null;
23
+ }
24
+ export type FanqieLibraryGender = -1 | 0 | 1;
25
+ export type FanqieLibraryCategoryGroupKey = 'topic' | 'role' | 'plot';
26
+ export type FanqieLibraryCategoryFilter = 'all' | FanqieLibraryCategoryGroupKey;
27
+ export type FanqieCreationStatus = -1 | 0 | 1;
28
+ export type FanqieWordCount = -1 | 0 | 1 | 2 | 3 | 4;
29
+ export type FanqieLibrarySort = 0 | 1;
30
+ export interface FanqieLibraryCategoryItem {
31
+ categoryId: number;
32
+ label: string;
33
+ name: string;
34
+ coverUrl: string | null;
35
+ }
36
+ export interface FanqieLibraryCategories {
37
+ topic: FanqieLibraryCategoryItem[];
38
+ role: FanqieLibraryCategoryItem[];
39
+ plot: FanqieLibraryCategoryItem[];
40
+ }
41
+ export interface ListFanqieLibraryBooksParams {
42
+ gender: FanqieLibraryGender;
43
+ categoryId: number;
44
+ creationStatus: FanqieCreationStatus;
45
+ wordCount: FanqieWordCount;
46
+ sort: FanqieLibrarySort;
47
+ pageIndex: number;
48
+ pageSize: number;
49
+ }
50
+ export interface ResolveFanqieLibraryCategoryParams {
51
+ gender: FanqieLibraryGender;
52
+ categoryGroup: FanqieLibraryCategoryFilter;
53
+ categoryId?: number;
54
+ }
55
+ export interface FanqieChapterDirectoryItem {
56
+ fanqieChapterId: string;
57
+ title: string;
58
+ chapterOrder: number;
59
+ volumeName: string | null;
60
+ }
61
+ export interface FanqieChapterContentItem {
62
+ title: string;
63
+ content: string;
64
+ chapterOrder: number | null;
65
+ }
66
+ export interface FanqieOfficialSidecarOptions {
67
+ baseUrl?: string;
68
+ container?: string;
69
+ password?: string;
70
+ jobTimeoutMs?: number;
71
+ jobPollIntervalMs?: number;
72
+ statusTimeoutMs?: number;
73
+ statusPollIntervalMs?: number;
74
+ }
@@ -0,0 +1,12 @@
1
+ export declare const getFanqieBookSourceBaseUrls: () => string[];
2
+ export declare const encodeFanqieBookSourceBookId: (fanqieBookId: string) => string;
3
+ export declare const decodeFanqieBookSourceBookId: (encodedBookId: unknown) => string;
4
+ export declare const createFanqieBookSourceUrl: (baseUrl: string, path: string, searchParams: Record<string, string>) => string;
5
+ export declare const requestFanqieBookSourceJson: <T>({ path, searchParams, init, baseUrl, errorPrefix, validate, }: {
6
+ path: string;
7
+ searchParams: Record<string, string>;
8
+ init?: RequestInit;
9
+ baseUrl?: string;
10
+ errorPrefix: string;
11
+ validate?: (response: T) => void;
12
+ }) => Promise<T>;
@@ -0,0 +1,40 @@
1
+ export declare const FANQIE_LIBRARY_LIST_URL = "https://fanqienovel.com/api/author/library/book_list/v0/";
2
+ export declare const FANQIE_LIBRARY_CATEGORY_URL = "https://fanqienovel.com/api/author/book/category_list/v0/";
3
+ export declare const FANQIE_BOOK_SOURCE_SEARCH_PATH = "/search";
4
+ export declare const FANQIE_BOOK_SOURCE_SEARCH_DEFAULT_SOURCE = "\u756A\u8304";
5
+ export declare const FANQIE_BOOK_SOURCE_SEARCH_DEFAULT_TAB = "\u5C0F\u8BF4";
6
+ export declare const FANQIE_BOOK_SOURCE_SEARCH_DEFAULT_DISABLED_SOURCES = "0";
7
+ export declare const FANQIE_BOOK_SOURCE_CATALOG_PATH = "/catalog";
8
+ export declare const FANQIE_BOOK_SOURCE_CATALOG_SOURCE = "\u756A\u8304";
9
+ export declare const FANQIE_BOOK_SOURCE_CATALOG_TAB = "\u5C0F\u8BF4";
10
+ export declare const FANQIE_BOOK_SOURCE_CATALOG_VARIABLE: {
11
+ custom: string;
12
+ };
13
+ export declare const FANQIE_BOOK_SOURCE_DETAIL_PATH = "/detail";
14
+ export declare const FANQIE_BOOK_SOURCE_DETAIL_SOURCE = "\u756A\u8304";
15
+ export declare const FANQIE_BOOK_SOURCE_DETAIL_TAB = "\u5C0F\u8BF4";
16
+ export declare const FANQIE_BOOK_SOURCE_DETAIL_VARIABLE: {
17
+ custom: string;
18
+ };
19
+ export declare const DEFAULT_FANQIE_BOOK_SOURCE_BASE_URLS: readonly ["https://api.langge.cf", "https://v2.czyl.cf", "http://219.154.201.122:5006"];
20
+ export declare const FANQIE_PAGE_HEADERS: {
21
+ 'User-Agent': string;
22
+ Referer: string;
23
+ };
24
+ export declare const FANQIE_BOOK_SOURCE_SEARCH_HEADERS: {
25
+ 'user-agent': string;
26
+ };
27
+ export declare const FANQIE_BOOK_SOURCE_CATALOG_HEADERS: {
28
+ 'content-type': string;
29
+ 'user-agent': string;
30
+ };
31
+ export declare const FANQIE_BOOK_SOURCE_DETAIL_HEADERS: {
32
+ 'content-type': string;
33
+ 'user-agent': string;
34
+ };
35
+ export declare const DEFAULT_FANQIE_OFFICIAL_SIDECAR_BASE_URL = "http://127.0.0.1:18423";
36
+ export declare const DEFAULT_FANQIE_OFFICIAL_SIDECAR_CONTAINER = "tomato-novel-webui";
37
+ export declare const DEFAULT_FANQIE_OFFICIAL_SIDECAR_JOB_TIMEOUT_MS: number;
38
+ export declare const DEFAULT_FANQIE_OFFICIAL_SIDECAR_JOB_POLL_INTERVAL_MS = 1500;
39
+ export declare const DEFAULT_FANQIE_OFFICIAL_SIDECAR_STATUS_TIMEOUT_MS: number;
40
+ export declare const DEFAULT_FANQIE_OFFICIAL_SIDECAR_STATUS_POLL_INTERVAL_MS = 1000;
@@ -0,0 +1,2 @@
1
+ export declare const FANQIE_OBFUSCATED_FONT_MAP: Record<string, string>;
2
+ export declare const restoreFanqieObfuscatedText: (content: string) => string;
@@ -0,0 +1 @@
1
+ export declare const fetchFanqieJson: <T>(url: string, init?: RequestInit) => Promise<T>;
@@ -0,0 +1,2 @@
1
+ export * from './font-map';
2
+ export * from './normalize';
@@ -0,0 +1,2 @@
1
+ export declare const normalizeFanqieText: (value: unknown) => string;
2
+ export declare const normalizeFanqieCoverUrl: (value: unknown) => string;
@@ -0,0 +1 @@
1
+ export * as fanqie from './fanqie';