@prose-reader/archive-reader 1.321.0 → 1.323.0
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.
- package/dist/apple/readArchiveApple.d.ts +3 -0
- package/dist/apple/readArchiveApple.test.d.ts +1 -0
- package/dist/apple/resolve.d.ts +5 -2
- package/dist/archives/createArchiveFromJszip/index.cjs +1 -1
- package/dist/archives/createArchiveFromJszip/index.js +1 -1
- package/dist/archives/createArchiveFromLibArchive/index.cjs +1 -1
- package/dist/archives/createArchiveFromLibArchive/index.js +1 -1
- package/dist/archives/createArchiveFromNodeUnrarJs/index.cjs +1 -1
- package/dist/archives/createArchiveFromNodeUnrarJs/index.js +1 -1
- package/dist/archives/createArchiveFromUnzipper/index.cjs +1 -1
- package/dist/archives/createArchiveFromUnzipper/index.js +1 -1
- package/dist/archives/createArchiveFromZipJs/index.cjs +1 -1
- package/dist/archives/createArchiveFromZipJs/index.js +1 -1
- package/dist/comicInfo/parse.d.ts +3 -43
- package/dist/comicInfo/readArchiveComicInfo.d.ts +3 -0
- package/dist/comicInfo/readArchiveComicInfo.test.d.ts +1 -0
- package/dist/comicInfo/resolve.d.ts +47 -2
- package/dist/{createArchiveFromEntries-Bal1_O58.js → createArchiveFromEntries-CFG3evXM.js} +2 -2
- package/dist/{createArchiveFromEntries-Bal1_O58.js.map → createArchiveFromEntries-CFG3evXM.js.map} +1 -1
- package/dist/{createArchiveFromEntries-Du93RwlN.cjs → createArchiveFromEntries-DcPCGgZW.cjs} +2 -2
- package/dist/{createArchiveFromEntries-Du93RwlN.cjs.map → createArchiveFromEntries-DcPCGgZW.cjs.map} +1 -1
- package/dist/index/index.cjs +3 -3
- package/dist/index/index.cjs.map +1 -1
- package/dist/index/index.js +622 -219
- package/dist/index/index.js.map +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/kobo/readArchiveKobo.d.ts +3 -0
- package/dist/kobo/readArchiveKobo.test.d.ts +1 -0
- package/dist/kobo/resolve.d.ts +5 -2
- package/dist/layout/scanReadingOrderDocumentsViewport.d.ts +3 -0
- package/dist/layout/scanReadingOrderDocumentsViewport.test.d.ts +1 -0
- package/dist/opf/parse.d.ts +19 -0
- package/dist/opf/resolve.d.ts +24 -2
- package/dist/readingOrder/resolveArchiveReadingOrder.d.ts +16 -0
- package/dist/readingOrder/resolveArchiveReadingOrder.test.d.ts +1 -0
- package/dist/resolve.d.ts +2 -2
- package/dist/resolveArchive.d.ts +29 -0
- package/dist/resolveArchive.test.d.ts +1 -0
- package/dist/resolveMetadata.d.ts +12 -0
- package/dist/resolveMetadata.test.d.ts +1 -0
- package/dist/types/resolvedMetadata.d.ts +84 -0
- package/dist/utils/omitUndefined.d.ts +1 -0
- package/package.json +3 -3
- package/dist/types/archiveResolve.d.ts +0 -17
package/dist/opf/parse.d.ts
CHANGED
|
@@ -24,6 +24,22 @@ export type OpfGuideReference = {
|
|
|
24
24
|
readonly title: string;
|
|
25
25
|
readonly type: string;
|
|
26
26
|
};
|
|
27
|
+
export type OpfMetaEntry = {
|
|
28
|
+
readonly property?: string;
|
|
29
|
+
readonly refines?: string;
|
|
30
|
+
readonly scheme?: string;
|
|
31
|
+
readonly id?: string;
|
|
32
|
+
readonly name?: string;
|
|
33
|
+
readonly content?: string;
|
|
34
|
+
readonly value?: string;
|
|
35
|
+
};
|
|
36
|
+
export type OpfContributor = {
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly source: "creator" | "contributor";
|
|
39
|
+
readonly id?: string;
|
|
40
|
+
readonly roles: ReadonlyArray<string>;
|
|
41
|
+
readonly fileAs?: string;
|
|
42
|
+
};
|
|
27
43
|
export type OpfMetadata = {
|
|
28
44
|
readonly kind: "opf";
|
|
29
45
|
readonly manifestItems: ReadonlyArray<OpfSpineManifestItem>;
|
|
@@ -32,7 +48,9 @@ export type OpfMetadata = {
|
|
|
32
48
|
readonly identifiers: ReadonlyArray<OpfIdentifier>;
|
|
33
49
|
readonly title: string | undefined;
|
|
34
50
|
readonly creators: ReadonlyArray<string>;
|
|
51
|
+
readonly contributors: ReadonlyArray<OpfContributor>;
|
|
35
52
|
readonly publisher: string | undefined;
|
|
53
|
+
readonly description: string | undefined;
|
|
36
54
|
readonly rights: string | undefined;
|
|
37
55
|
readonly languages: ReadonlyArray<string>;
|
|
38
56
|
readonly subjects: ReadonlyArray<string>;
|
|
@@ -43,5 +61,6 @@ export type OpfMetadata = {
|
|
|
43
61
|
readonly renditionSpreadMeta: string | undefined;
|
|
44
62
|
readonly pageProgressionDirection: string | undefined;
|
|
45
63
|
readonly guide: ReadonlyArray<OpfGuideReference>;
|
|
64
|
+
readonly metas: ReadonlyArray<OpfMetaEntry>;
|
|
46
65
|
};
|
|
47
66
|
export declare const parseOpf: (opfXml: string) => OpfMetadata;
|
package/dist/opf/resolve.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResolvedMetadata } from '../types/resolvedMetadata';
|
|
2
2
|
import { OpfMetadata } from './parse';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const opfMetadataHomes: {
|
|
4
|
+
readonly manifestItems: "readingOrder";
|
|
5
|
+
readonly spineRows: "readingOrder";
|
|
6
|
+
readonly spineTocIdref: "toc";
|
|
7
|
+
readonly identifiers: "identifiers";
|
|
8
|
+
readonly title: "title";
|
|
9
|
+
readonly creators: "contributors";
|
|
10
|
+
readonly contributors: "contributors";
|
|
11
|
+
readonly publisher: "publisher";
|
|
12
|
+
readonly description: "description";
|
|
13
|
+
readonly rights: "rights";
|
|
14
|
+
readonly languages: "languages";
|
|
15
|
+
readonly subjects: "subjects";
|
|
16
|
+
readonly date: "published";
|
|
17
|
+
readonly coverHref: "cover";
|
|
18
|
+
readonly renditionLayoutMeta: "renditionLayout";
|
|
19
|
+
readonly renditionFlowMeta: "renditionFlow";
|
|
20
|
+
readonly renditionSpreadMeta: "renditionSpread";
|
|
21
|
+
readonly pageProgressionDirection: "readingDirection";
|
|
22
|
+
readonly guide: "guide";
|
|
23
|
+
readonly metas: "properties";
|
|
24
|
+
};
|
|
25
|
+
export declare const resolveOpf: (input: OpfMetadata) => ResolvedMetadata;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Archive } from '../archives/types';
|
|
2
|
+
import { ArchiveOpfParsed } from '../opf/readArchiveOpf';
|
|
3
|
+
export type ArchiveReadingOrderItem = {
|
|
4
|
+
readonly uri: string;
|
|
5
|
+
readonly id?: string;
|
|
6
|
+
readonly mediaType?: string;
|
|
7
|
+
readonly size?: number;
|
|
8
|
+
readonly renditionLayout?: "reflowable" | "pre-paginated";
|
|
9
|
+
readonly renditionFlow?: "scrolled-continuous" | "scrolled-doc" | "paginated" | "auto";
|
|
10
|
+
readonly pageSpreadLeft?: true;
|
|
11
|
+
readonly pageSpreadRight?: true;
|
|
12
|
+
readonly progressionWeight: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const resolveArchiveReadingOrder: (archive: Archive, { opf }?: {
|
|
15
|
+
opf?: ArchiveOpfParsed;
|
|
16
|
+
}) => Promise<ArchiveReadingOrderItem[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/resolve.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { AppleMetadata } from './apple/parse';
|
|
|
2
2
|
import { ComicInfo } from './comicInfo/parse';
|
|
3
3
|
import { KoboMetadata } from './kobo/parse';
|
|
4
4
|
import { OpfMetadata } from './opf/parse';
|
|
5
|
-
import {
|
|
5
|
+
import { ResolvedMetadata } from './types/resolvedMetadata';
|
|
6
6
|
export type ResolvedArchiveInput = ComicInfo | KoboMetadata | AppleMetadata | OpfMetadata;
|
|
7
|
-
export declare const resolveArchiveMetadata: (input: ResolvedArchiveInput) =>
|
|
7
|
+
export declare const resolveArchiveMetadata: (input: ResolvedArchiveInput) => ResolvedMetadata;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppleMetadata } from './apple/parse';
|
|
2
|
+
import { Archive } from './archives/types';
|
|
3
|
+
import { ComicInfo } from './comicInfo/parse';
|
|
4
|
+
import { KoboMetadata } from './kobo/parse';
|
|
5
|
+
import { ArchiveOpfParsed } from './opf/readArchiveOpf';
|
|
6
|
+
import { ArchiveReadingOrderItem } from './readingOrder/resolveArchiveReadingOrder';
|
|
7
|
+
import { ArchiveTocItem } from './toc/types';
|
|
8
|
+
import { ResolvedMetadata } from './types/resolvedMetadata';
|
|
9
|
+
export type ResolvedArchiveSources = {
|
|
10
|
+
readonly opf?: ArchiveOpfParsed;
|
|
11
|
+
readonly comicInfo?: ComicInfo;
|
|
12
|
+
readonly apple?: AppleMetadata;
|
|
13
|
+
readonly kobo?: KoboMetadata;
|
|
14
|
+
};
|
|
15
|
+
export type ResolvedArchive = {
|
|
16
|
+
readonly version: number;
|
|
17
|
+
readonly metadata: ResolvedMetadata;
|
|
18
|
+
readonly readingOrder: ArchiveReadingOrderItem[];
|
|
19
|
+
readonly toc?: ArchiveTocItem[];
|
|
20
|
+
readonly sources: ResolvedArchiveSources;
|
|
21
|
+
};
|
|
22
|
+
export type ResolveArchiveToken = keyof ResolvedArchive;
|
|
23
|
+
declare const DEFAULT_INCLUDE: readonly ["metadata", "readingOrder", "toc"];
|
|
24
|
+
export type ResolveArchiveOptions<T extends ReadonlyArray<ResolveArchiveToken>> = {
|
|
25
|
+
include?: T;
|
|
26
|
+
layoutScan?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare const resolveArchive: <T extends ReadonlyArray<ResolveArchiveToken> = typeof DEFAULT_INCLUDE>(archive: Archive, options?: ResolveArchiveOptions<T>) => Promise<Pick<ResolvedArchive, T[number] | "version">>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppleMetadata } from './apple/parse';
|
|
2
|
+
import { ComicInfo } from './comicInfo/parse';
|
|
3
|
+
import { KoboMetadata } from './kobo/parse';
|
|
4
|
+
import { OpfMetadata } from './opf/parse';
|
|
5
|
+
import { ResolvedMetadata } from './types/resolvedMetadata';
|
|
6
|
+
export type ResolveMetadataSources = {
|
|
7
|
+
opf?: OpfMetadata;
|
|
8
|
+
comicInfo?: ComicInfo;
|
|
9
|
+
apple?: AppleMetadata;
|
|
10
|
+
kobo?: KoboMetadata;
|
|
11
|
+
};
|
|
12
|
+
export declare const resolveMetadata: (sources: ResolveMetadataSources) => ResolvedMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type ResolvedContributorRole = "author" | "translator" | "editor" | "artist" | "illustrator" | "letterer" | "penciler" | "colorist" | "inker" | "narrator" | "contributor" | "coverArtist";
|
|
2
|
+
export type ResolvedContributor = {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly roles: ReadonlyArray<ResolvedContributorRole | (string & {})>;
|
|
5
|
+
readonly sortAs?: string;
|
|
6
|
+
};
|
|
7
|
+
export type ResolvedCollection = {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly position?: number;
|
|
10
|
+
readonly total?: number;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedDate = {
|
|
13
|
+
readonly year?: number;
|
|
14
|
+
readonly month?: number;
|
|
15
|
+
readonly day?: number;
|
|
16
|
+
};
|
|
17
|
+
export type ResolvedProperty = {
|
|
18
|
+
readonly property?: string;
|
|
19
|
+
readonly refines?: string;
|
|
20
|
+
readonly scheme?: string;
|
|
21
|
+
readonly id?: string;
|
|
22
|
+
readonly name?: string;
|
|
23
|
+
readonly content?: string;
|
|
24
|
+
readonly value?: string;
|
|
25
|
+
};
|
|
26
|
+
export type ResolvedComicMetadata = {
|
|
27
|
+
readonly manga?: boolean;
|
|
28
|
+
readonly blackAndWhite?: boolean;
|
|
29
|
+
readonly volume?: number;
|
|
30
|
+
readonly format?: string;
|
|
31
|
+
readonly ageRating?: string;
|
|
32
|
+
readonly communityRating?: number;
|
|
33
|
+
readonly notes?: string;
|
|
34
|
+
readonly review?: string;
|
|
35
|
+
readonly web?: ReadonlyArray<string>;
|
|
36
|
+
readonly scanInformation?: string;
|
|
37
|
+
readonly mainCharacterOrTeam?: string;
|
|
38
|
+
readonly characters?: ReadonlyArray<string>;
|
|
39
|
+
readonly teams?: ReadonlyArray<string>;
|
|
40
|
+
readonly locations?: ReadonlyArray<string>;
|
|
41
|
+
readonly storyArcs?: ReadonlyArray<ResolvedCollection>;
|
|
42
|
+
readonly alternateSeries?: ResolvedCollection;
|
|
43
|
+
};
|
|
44
|
+
export type ResolvedAppleMetadata = {
|
|
45
|
+
readonly fixedLayout?: boolean;
|
|
46
|
+
readonly options?: ReadonlyArray<{
|
|
47
|
+
readonly name?: string;
|
|
48
|
+
readonly value: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
export type ResolvedKoboMetadata = {
|
|
52
|
+
readonly fixedLayout?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export type ResolvedMetadata = {
|
|
55
|
+
readonly title?: string;
|
|
56
|
+
readonly description?: string;
|
|
57
|
+
readonly publisher?: string;
|
|
58
|
+
readonly imprint?: string;
|
|
59
|
+
readonly rights?: string;
|
|
60
|
+
readonly languages?: ReadonlyArray<string>;
|
|
61
|
+
readonly subjects?: ReadonlyArray<string>;
|
|
62
|
+
readonly contributors?: ReadonlyArray<ResolvedContributor>;
|
|
63
|
+
readonly published?: ResolvedDate;
|
|
64
|
+
readonly readingDirection?: "ltr" | "rtl";
|
|
65
|
+
readonly renditionLayout?: "reflowable" | "pre-paginated";
|
|
66
|
+
readonly renditionFlow?: "scrolled-continuous" | "scrolled-doc" | "paginated" | "auto";
|
|
67
|
+
readonly renditionSpread?: "none" | "landscape" | "portrait" | "both" | "auto";
|
|
68
|
+
readonly numberOfPages?: number;
|
|
69
|
+
readonly gtin?: string;
|
|
70
|
+
readonly isbn?: string;
|
|
71
|
+
readonly identifiers?: ReadonlyArray<{
|
|
72
|
+
readonly value: string;
|
|
73
|
+
readonly scheme?: string;
|
|
74
|
+
}>;
|
|
75
|
+
readonly belongsTo?: {
|
|
76
|
+
readonly series?: ReadonlyArray<ResolvedCollection>;
|
|
77
|
+
readonly collection?: ReadonlyArray<ResolvedCollection>;
|
|
78
|
+
};
|
|
79
|
+
readonly properties?: ReadonlyArray<ResolvedProperty>;
|
|
80
|
+
readonly comic?: ResolvedComicMetadata;
|
|
81
|
+
readonly apple?: ResolvedAppleMetadata;
|
|
82
|
+
readonly kobo?: ResolvedKoboMetadata;
|
|
83
|
+
};
|
|
84
|
+
export type ResolvedMetadataHome = Exclude<keyof ResolvedMetadata, "comic" | "apple" | "kobo" | "belongsTo"> | `comic.${keyof ResolvedComicMetadata}` | `apple.${keyof ResolvedAppleMetadata}` | `kobo.${keyof ResolvedKoboMetadata}` | `belongsTo.${"series" | "collection"}` | "readingOrder" | "toc" | "cover" | "guide";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const omitUndefined: <T extends object>(obj: T) => T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prose-reader/archive-reader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.323.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index/index.cjs",
|
|
6
6
|
"module": "./dist/index/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"test:watch": "vitest watch"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@prose-reader/shared": "^1.
|
|
56
|
+
"@prose-reader/shared": "^1.323.0",
|
|
57
57
|
"xmldoc": "^2.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"node-unrar-js": "^2.0.2",
|
|
94
94
|
"unzipper": "^0.12.3"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "a4b2ecb1190781afe7cd2516a20f936fc82e93ca"
|
|
97
97
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type ArchiveResolveResult = {
|
|
2
|
-
gtin?: string;
|
|
3
|
-
isbn?: string;
|
|
4
|
-
readingDirection?: "ltr" | "rtl";
|
|
5
|
-
renditionLayout?: "reflowable" | "pre-paginated";
|
|
6
|
-
title?: string;
|
|
7
|
-
authors?: string[];
|
|
8
|
-
publisher?: string;
|
|
9
|
-
rights?: string;
|
|
10
|
-
languages?: string[];
|
|
11
|
-
date?: {
|
|
12
|
-
year?: number;
|
|
13
|
-
month?: number;
|
|
14
|
-
day?: number;
|
|
15
|
-
};
|
|
16
|
-
subjects?: string[];
|
|
17
|
-
};
|