@prose-reader/metadata-fetcher 1.349.0 → 1.350.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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +188 -173
- package/dist/index.js.map +1 -1
- package/dist/providers/googleBooks/parse.d.ts +3 -0
- package/dist/providers/openLibrary/parse.d.ts +3 -0
- package/dist/utils/aggregateRating.d.ts +12 -0
- package/dist/utils/aggregateRating.test.d.ts +1 -0
- package/package.json +4 -4
|
@@ -37,6 +37,9 @@ export type GoogleBooksVolumeInfo = {
|
|
|
37
37
|
readonly industryIdentifiers?: ReadonlyArray<GoogleBooksIndustryIdentifier>;
|
|
38
38
|
readonly pageCount?: number;
|
|
39
39
|
readonly categories?: ReadonlyArray<string>;
|
|
40
|
+
/** Mean review rating; Google states it on a 1–5 scale, rounded to a half. */
|
|
41
|
+
readonly averageRating?: number;
|
|
42
|
+
readonly ratingsCount?: number;
|
|
40
43
|
readonly language?: string;
|
|
41
44
|
readonly imageLinks?: GoogleBooksImageLinks;
|
|
42
45
|
readonly infoLink?: string;
|
|
@@ -17,6 +17,9 @@ export type OpenLibraryDoc = {
|
|
|
17
17
|
readonly language?: ReadonlyArray<string>;
|
|
18
18
|
readonly subject?: ReadonlyArray<string>;
|
|
19
19
|
readonly number_of_pages_median?: number;
|
|
20
|
+
/** Mean of the work's star ratings, on the catalog's 1–5 scale. */
|
|
21
|
+
readonly ratings_average?: number;
|
|
22
|
+
readonly ratings_count?: number;
|
|
20
23
|
/** Cover id, addressing `covers.openlibrary.org`. */
|
|
21
24
|
readonly cover_i?: number;
|
|
22
25
|
/** Project Gutenberg ebook ids attached to the work's editions. */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResolvedAggregateRating } from '@prose-reader/archive-reader';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the cross-format aggregate rating from a catalog's mean and count.
|
|
4
|
+
* Both Google Books and Open Library state the mean on a 1–5 star scale, which
|
|
5
|
+
* is the scale {@link ResolvedAggregateRating} promises, so neither needs
|
|
6
|
+
* rescaling — a source on another scale divides before calling this.
|
|
7
|
+
*
|
|
8
|
+
* A mean outside 0–5, a count that isn't a non-negative integer, and a mean
|
|
9
|
+
* announced over zero ratings are all dropped: a catalog contradicting itself
|
|
10
|
+
* would otherwise render as a real star count.
|
|
11
|
+
*/
|
|
12
|
+
export declare const resolvedAggregateRating: (mean: number | undefined, count: number | undefined) => ResolvedAggregateRating | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prose-reader/metadata-fetcher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.350.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"test:watch": "vitest watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@prose-reader/archive-reader": "^1.
|
|
33
|
-
"@prose-reader/shared": "^1.
|
|
32
|
+
"@prose-reader/archive-reader": "^1.350.0",
|
|
33
|
+
"@prose-reader/shared": "^1.350.0",
|
|
34
34
|
"xmldoc": "^2.0.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "966d33cf742c8a8d130753fb47e4c17b890ccc9d"
|
|
37
37
|
}
|