@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.
@@ -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" | "published" | "languages" | "numberOfPages";
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" — without
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 both sides state an identifier, which
32
- * settles it outright: `1` if it agrees (an ISBN/GTIN match *is* the book),
33
- * `0` if it contradicts. `0` too when the two sides had no field in common
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`, and so contributed to the merged
40
- * `FetchedMetadata.metadata`. Rejected matches are kept and ranked, for a
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. Descriptive fields alone — a publisher, a
5
- * language, a page count — narrow a search but cannot start one.
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.339.0",
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.339.0",
33
- "@prose-reader/shared": "^1.339.0"
32
+ "@prose-reader/archive-reader": "^1.341.0",
33
+ "@prose-reader/shared": "^1.341.0",
34
+ "xmldoc": "^2.0.0"
34
35
  },
35
- "gitHead": "6f3954f75cc72da91902eb091d5600575f6eaabb"
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;