@prose-reader/metadata-fetcher 1.339.0 → 1.341.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/fetchMetadata.d.ts +16 -16
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.js +362 -211
- package/dist/index.js.map +1 -1
- package/dist/match/scoreMetadataCandidate.d.ts +8 -5
- package/dist/providers/openLibrary/parse.d.ts +0 -1
- package/dist/providers/openLibrary/resolve.d.ts +1 -2
- package/dist/providers/projectGutenberg/createProjectGutenbergProvider.d.ts +17 -0
- package/dist/providers/projectGutenberg/identifier.d.ts +16 -0
- package/dist/providers/projectGutenberg/parse.d.ts +31 -0
- package/dist/providers/projectGutenberg/parse.test.d.ts +1 -0
- package/dist/providers/projectGutenberg/resolve.d.ts +26 -0
- package/dist/providers/projectGutenberg/resolve.test.d.ts +1 -0
- package/dist/types/fetchedMetadata.d.ts +5 -20
- package/dist/types/match.d.ts +9 -10
- package/dist/utils/hasSearchTerms.d.ts +2 -2
- package/package.json +5 -4
- package/dist/merge/mergeResolvedMetadata.d.ts +0 -21
- package/dist/providers/openLibrary/projectGutenbergIdentifier.d.ts +0 -15
- /package/dist/{merge/mergeResolvedMetadata.test.d.ts → providers/projectGutenberg/createProjectGutenbergProvider.test.d.ts} +0 -0
- /package/dist/providers/{openLibrary/projectGutenbergIdentifier.test.d.ts → projectGutenberg/identifier.test.d.ts} +0 -0
package/dist/types/match.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { ResolvedMetadata } from '@prose-reader/archive-reader';
|
|
|
3
3
|
* The fields the matcher compares — only ever when **both** sides state one,
|
|
4
4
|
* so what the query doesn't know cannot count against a candidate.
|
|
5
5
|
*/
|
|
6
|
-
export type MetadataMatchField = "isbn" | "gtin" | "identifiers" | "title" | "contributors" | "series" | "publisher" | "
|
|
6
|
+
export type MetadataMatchField = "isbn" | "gtin" | "identifiers" | "title" | "contributors" | "series" | "publication.original.date" | "publication.original.publisher" | "publication.edition.date" | "publication.edition.publisher" | "languages" | "numberOfPages";
|
|
7
7
|
/**
|
|
8
8
|
* One field comparison. The compared values sit next to the score so a match
|
|
9
|
-
* is explainable to a user — "same title, different publisher" —
|
|
10
|
-
* re-deriving anything.
|
|
9
|
+
* is explainable to a user — "same title, different edition publisher" —
|
|
10
|
+
* without re-deriving anything.
|
|
11
11
|
*/
|
|
12
12
|
export type MetadataMatchSignal = {
|
|
13
13
|
readonly field: MetadataMatchField;
|
|
@@ -28,17 +28,16 @@ export type MetadataMatch = {
|
|
|
28
28
|
readonly providerId: string;
|
|
29
29
|
/**
|
|
30
30
|
* Aggregate confidence, `0` to `1`: the weight-averaged score of every
|
|
31
|
-
* comparable field — except when
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* to compare.
|
|
31
|
+
* comparable field — except when an ISBN, GTIN or shared scheme-scoped
|
|
32
|
+
* identifier confirms identity, which settles it at `1`. A contradictory
|
|
33
|
+
* ISBN or GTIN settles it at `0`. `0` too when the two sides had no field in
|
|
34
|
+
* common to compare.
|
|
35
35
|
*/
|
|
36
36
|
readonly score: number;
|
|
37
37
|
readonly signals: ReadonlyArray<MetadataMatchSignal>;
|
|
38
38
|
/**
|
|
39
|
-
* Reached `minScore
|
|
40
|
-
*
|
|
41
|
-
* consumer to offer for manual confirmation.
|
|
39
|
+
* Reached `minScore`. Rejected matches are kept and ranked, for a consumer
|
|
40
|
+
* to offer for manual confirmation.
|
|
42
41
|
*/
|
|
43
42
|
readonly accepted: boolean;
|
|
44
43
|
readonly metadata: ResolvedMetadata;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolvedMetadata } from '@prose-reader/archive-reader';
|
|
2
2
|
/**
|
|
3
3
|
* Whether a catalog has anything to go on, so a lookup with nothing to ask
|
|
4
|
-
* about costs no round trip.
|
|
5
|
-
*
|
|
4
|
+
* about costs no round trip. Publication details, a language, or a page count
|
|
5
|
+
* narrow a search but cannot start one.
|
|
6
6
|
*/
|
|
7
7
|
export declare const hasSearchTerms: (metadata: ResolvedMetadata) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prose-reader/metadata-fetcher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.341.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,8 +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.341.0",
|
|
33
|
+
"@prose-reader/shared": "^1.341.0",
|
|
34
|
+
"xmldoc": "^2.0.0"
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "620bf290b88f12f2313f7b19aa4d4abdcf124ef1"
|
|
36
37
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ResolvedMetadata } from '@prose-reader/archive-reader';
|
|
2
|
-
/**
|
|
3
|
-
* Merges several {@link ResolvedMetadata} into one, **first defined wins**.
|
|
4
|
-
* Precedence is the caller's — pass the sources in the order you trust them.
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* // the book over the catalogs, catalogs filling the gaps
|
|
8
|
-
* const metadata = mergeResolvedMetadata(resolved.metadata, fetched.metadata)
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* Field-wise rather than object-wise, so a source knowing only a cover
|
|
12
|
-
* contributes it without hiding another's title. Two fields are additive
|
|
13
|
-
* instead: `identifiers` concatenate (deduped on scheme + value, mirroring
|
|
14
|
-
* `resolveMetadata`), and `belongsTo` merges `series` and `collection`
|
|
15
|
-
* independently.
|
|
16
|
-
*
|
|
17
|
-
* Everything else takes the first stated value whole. Unioning keyword lists
|
|
18
|
-
* across catalogs is a judgement call for the consumer, not for a merge that
|
|
19
|
-
* has to stay predictable.
|
|
20
|
-
*/
|
|
21
|
-
export declare const mergeResolvedMetadata: (...entries: ReadonlyArray<ResolvedMetadata | undefined>) => ResolvedMetadata;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ResolvedMetadata } from '@prose-reader/archive-reader';
|
|
2
|
-
export type OpenLibraryProjectGutenbergLookup = {
|
|
3
|
-
readonly id: string;
|
|
4
|
-
/** The book's exact identifier spelling, echoed only after OL confirms it. */
|
|
5
|
-
readonly identifier: {
|
|
6
|
-
readonly value: string;
|
|
7
|
-
readonly scheme?: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Open Library-specific crosswalk: its `id_project_gutenberg` search field
|
|
12
|
-
* stores the numeric id encoded by official Gutenberg URLs. Other providers
|
|
13
|
-
* own their own identifier conventions; this is intentionally not generic.
|
|
14
|
-
*/
|
|
15
|
-
export declare const projectGutenbergLookupFromMetadata: (metadata: ResolvedMetadata) => OpenLibraryProjectGutenbergLookup | undefined;
|
|
File without changes
|
|
File without changes
|