@library-pals/isbn 0.2.0 → 1.0.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/README.md CHANGED
@@ -5,7 +5,6 @@ following providers:
5
5
 
6
6
  - [Google Books API](https://developers.google.com/books/)
7
7
  - [Open Library Books API](https://openlibrary.org/dev/docs/api/books)
8
- - [WorldCat xISBN API](http://xisbn.worldcat.org/xisbnadmin/doc/api.htm)
9
8
  - [ISBNdb API](https://isbndb.com/apidocs/v2) using API key in the environment
10
9
  variable `ISBNDB_API_KEY`
11
10
 
@@ -25,9 +24,10 @@ Supports Node.js versions 20.x and greater.
25
24
  ## Examples
26
25
 
27
26
  ```javascript
28
- import isbn from "@library-pals/isbn";
27
+ import Isbn from "@library-pals/isbn";
29
28
 
30
29
  try {
30
+ const isbn = new Isbn();
31
31
  const book = await isbn.resolve("9780374104092");
32
32
  console.log("Book found %j", book);
33
33
  } catch (err) {
@@ -38,9 +38,10 @@ try {
38
38
  ### Setting a timeout
39
39
 
40
40
  ```javascript
41
- import isbn from "@library-pals/isbn";
41
+ import Isbn from "@library-pals/isbn";
42
42
 
43
43
  try {
44
+ const isbn = new Isbn();
44
45
  const book = await isbn.resolve("9780374104092", { timeout: 15000 });
45
46
  console.log("Book found %j", book);
46
47
  } catch (err) {
@@ -56,37 +57,15 @@ information.
56
57
 
57
58
  ```json
58
59
  {
60
+ "isbn": 9780374104092,
59
61
  "title": "Annihilation",
60
- "subtitle": "A Novel",
61
62
  "authors": ["Jeff VanderMeer"],
62
- "publisher": "Macmillan",
63
- "publishedDate": "2014-02-04",
64
63
  "description": "Describes the 12th expedition to “Area X,” a region cut off from the continent for decades, by a group of intrepid women scientists who try to ignore the high mortality rates of those on the previous 11 missions. Original. 75,000 first printing.",
65
- "industryIdentifiers": [
66
- { "type": "ISBN_13", "identifier": "9780374104092" },
67
- { "type": "ISBN_10", "identifier": "0374104093" }
68
- ],
69
- "readingModes": { "text": false, "image": false },
70
64
  "pageCount": 209,
71
65
  "printType": "BOOK",
72
66
  "categories": ["Fiction"],
73
- "averageRating": 5,
74
- "ratingsCount": 1,
75
- "maturityRating": "NOT_MATURE",
76
- "allowAnonLogging": false,
77
- "contentVersion": "0.5.1.0.preview.0",
78
- "panelizationSummary": {
79
- "containsEpubBubbles": false,
80
- "containsImageBubbles": false
81
- },
82
- "imageLinks": {
83
- "smallThumbnail": "http://books.google.com/books/content?id=2cl7AgAAQBAJ&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api",
84
- "thumbnail": "http://books.google.com/books/content?id=2cl7AgAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
85
- },
86
- "language": "en",
87
- "previewLink": "http://books.google.com/books?id=2cl7AgAAQBAJ&printsec=frontcover&dq=isbn:9780374104092&hl=&cd=1&source=gbs_api",
88
- "infoLink": "http://books.google.com/books?id=2cl7AgAAQBAJ&dq=isbn:9780374104092&hl=&source=gbs_api",
89
- "canonicalVolumeLink": "https://books.google.com/books/about/Annihilation.html?hl=&id=2cl7AgAAQBAJ"
67
+ "thumbnail": "http://books.google.com/books/content?id=2cl7AgAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api",
68
+ "link": "https://books.google.com/books/about/Annihilation.html?hl=&id=2cl7AgAAQBAJ"
90
69
  }
91
70
  ```
92
71
 
@@ -96,12 +75,12 @@ You can optionally specify the providers that you want to use, in the order you
96
75
  need them to be invoked.
97
76
 
98
77
  ```javascript
99
- import isbn from "@library-pals/isbn";
100
-
101
- // This request will search first in the Open Library API and then in the Google Books API
102
- isbn.provider(["openlibrary", "google"]);
78
+ import Isbn from "@library-pals/isbn";
103
79
 
104
80
  try {
81
+ const isbn = new Isbn();
82
+ // This request will search first in the Open Library API and then in the Google Books API
83
+ isbn.provider(["openlibrary", "google"]);
105
84
  const book = await isbn.resolve("9780374104092");
106
85
  console.log("Book isbn:" + input + " found %j", book);
107
86
  } catch (err) {
@@ -110,12 +89,12 @@ try {
110
89
  ```
111
90
 
112
91
  ```javascript
113
- import isbn from "@library-pals/isbn";
114
-
115
- // This request will search ONLY in the Google Books API
116
- isbn.provider( "google"]);
92
+ import Isbn from "@library-pals/isbn";
117
93
 
118
94
  try {
95
+ const isbn = new Isbn();
96
+ // This request will search ONLY in the Google Books API
97
+ isbn.provider( "google"]);
119
98
  const book = await isbn.resolve("9780374104092");
120
99
  console.log("Book isbn:" + input + " found %j", book);
121
100
  } catch (err) {
@@ -127,12 +106,13 @@ If you do not like using strings to specify the providers, you could grab the
127
106
  providers from `isbn.PROVIDER_NAMES` constant that the library provides!
128
107
 
129
108
  ```javascript
130
- import isbn from "@library-pals/isbn";
131
-
132
- // This request will search ONLY in the Google Books API
133
- isbn.provider([isbn.PROVIDER_NAMES.GOOGLE]);
109
+ import Isbn from "@library-pals/isbn";
134
110
 
135
111
  try {
112
+ const isbn = new Isbn();
113
+ // This request will search ONLY in the Google Books API
114
+ isbn.provider([isbn.PROVIDER_NAMES.GOOGLE]);
115
+
136
116
  const book = await isbn.resolve("9780374104092");
137
117
  console.log("Book isbn:" + input + " found %j", book);
138
118
  } catch (err) {
@@ -147,5 +127,4 @@ try {
147
127
  See also
148
128
  [Google Books API Terms of Service](https://developers.google.com/books/terms),
149
129
  [Open Library Licensing](https://openlibrary.org/developers/licensing),
150
- [WorldCat xISBN Terms of Service](http://www.oclc.org/worldcat/community/terms.en.html),
151
130
  [ISBNdb Terms and Conditions](https://isbndb.com/terms-and-conditions).
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@library-pals/isbn",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "Find books by ISBN",
5
- "main": "src/index.js",
5
+ "exports": "./src/index.js",
6
+ "types": "./src/index.d.ts",
6
7
  "type": "module",
7
8
  "engines": {
8
9
  "node": ">=20.0.0"
9
10
  },
10
- "bin": {
11
- "isbn": "src/cli.js"
12
- },
13
11
  "scripts": {
12
+ "build": "tsc --version && tsc --build --clean && tsc --build",
13
+ "prepack": "npm run build",
14
14
  "lint": "eslint .",
15
- "pretest": "npm run lint",
16
- "test": "mocha test/spec",
17
- "testDebug": "mocha --inspect-brk test/spec"
15
+ "pretest": "npm run build && npm run lint",
16
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
17
+ "format": "prettier . --log-level warn --write"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -26,31 +26,27 @@
26
26
  "google",
27
27
  "openlibrary",
28
28
  "api",
29
- "worldcat",
30
29
  "isbndb"
31
30
  ],
32
31
  "author": "Katy DeCorah <@katydecorah>",
33
32
  "license": "AGPL-3.0-or-later",
34
33
  "devDependencies": {
35
34
  "@eslint/js": "^9.2.0",
36
- "@types/nock": "^11.1.0",
37
35
  "eslint": "^9.2.0",
38
- "eslint-plugin-jsdoc": "^48.2.3",
39
- "eslint-plugin-unicorn": "^52.0.0",
40
- "globals": "^15.1.0",
41
- "meow": "^13.2.0",
42
- "mocha": "^10.4.0",
43
- "nock": "^13.5.4"
36
+ "eslint-plugin-jest": "^28.5.0",
37
+ "eslint-plugin-jsdoc": "^48.2.4",
38
+ "eslint-plugin-unicorn": "^53.0.0",
39
+ "globals": "^15.2.0",
40
+ "jest": "^29.7.0",
41
+ "prettier": "^3.2.5",
42
+ "prettier-2": "npm:prettier@^2",
43
+ "typescript": "^5.4.5"
44
44
  },
45
45
  "dependencies": {
46
46
  "axios": "^1.6.8"
47
47
  },
48
48
  "bugs": {
49
- "url": "https://github.com/palmerabollo/node-isbn/issues"
49
+ "url": "https://github.com/library-pals/isbn/issues"
50
50
  },
51
- "homepage": "https://github.com/palmerabollo/node-isbn#readme",
52
- "directories": {
53
- "example": "examples",
54
- "test": "test"
55
- }
51
+ "homepage": "https://github.com/library-pals/isbn#readme"
56
52
  }
package/src/index.d.ts ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @typedef {object} Book
3
+ * @property {string} isbn - The ISBN of the book.
4
+ * @property {string} title - The long title of the book.
5
+ * @property {string[]} authors - The authors of the book.
6
+ * @property {string} description - The overview of the book.
7
+ * @property {number} pageCount - The number of pages in the book.
8
+ * @property {string} printType - The print type of the book. Always "BOOK" for this context.
9
+ * @property {string[]} categories - The subjects or categories of the book.
10
+ * @property {string} thumbnail - The thumbnail image link of the book.
11
+ * @property {string} [link] - The link of the book.
12
+ */
13
+ /**
14
+ * @typedef {import('./provider-resolvers.js').Providers} Providers
15
+ * @typedef {import('axios').AxiosRequestConfig} AxiosRequestConfig
16
+ */
17
+ export default class Isbn {
18
+ /**
19
+ * @type {Providers}
20
+ */
21
+ _providers: import("./provider-resolvers.js").Providers;
22
+ PROVIDER_NAMES: {
23
+ GOOGLE: string;
24
+ OPENLIBRARY: string;
25
+ ISBNDB: string;
26
+ };
27
+ /**
28
+ * Sets the providers for the ISBN lookup.
29
+ * @param {string[]} providers - An array of provider names.
30
+ * @returns {object} - The current instance of the ISBN lookup.
31
+ * @throws {TypeError} - If `providers` is not an array.
32
+ * @throws {Error} - If any of the provided providers are not supported.
33
+ */
34
+ provider(providers: string[]): object;
35
+ /**
36
+ * Resolves the book information for the given ISBN.
37
+ * @param {string} isbn - The ISBN of the book.
38
+ * @param {AxiosRequestConfig} options - The options for the request.
39
+ * @returns {Promise<Book>} - A Promise that resolves to the book information.
40
+ * @throws {Error} - If an error occurs while resolving the book information.
41
+ */
42
+ resolve(isbn: string, options?: AxiosRequestConfig): Promise<Book>;
43
+ }
44
+ export type Book = {
45
+ /**
46
+ * - The ISBN of the book.
47
+ */
48
+ isbn: string;
49
+ /**
50
+ * - The long title of the book.
51
+ */
52
+ title: string;
53
+ /**
54
+ * - The authors of the book.
55
+ */
56
+ authors: string[];
57
+ /**
58
+ * - The overview of the book.
59
+ */
60
+ description: string;
61
+ /**
62
+ * - The number of pages in the book.
63
+ */
64
+ pageCount: number;
65
+ /**
66
+ * - The print type of the book. Always "BOOK" for this context.
67
+ */
68
+ printType: string;
69
+ /**
70
+ * - The subjects or categories of the book.
71
+ */
72
+ categories: string[];
73
+ /**
74
+ * - The thumbnail image link of the book.
75
+ */
76
+ thumbnail: string;
77
+ /**
78
+ * - The link of the book.
79
+ */
80
+ link?: string;
81
+ };
82
+ export type Providers = import('./provider-resolvers.js').Providers;
83
+ export type AxiosRequestConfig = import('axios').AxiosRequestConfig;
84
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AAEH;IACE;;OAEG;IACH,wDAA+B;IAG7B;;;;MAAoC;IAGtC;;;;;;OAMG;IACH,oBALW,MAAM,EAAE,GACN,MAAM,CAwBlB;IAED;;;;;;OAMG;IACH,cALW,MAAM,YACN,kBAAkB,GAChB,QAAQ,IAAI,CAAC,CAkBzB;CACF;;;;;UA9Ea,MAAM;;;;WACN,MAAM;;;;aACN,MAAM,EAAE;;;;iBACR,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;gBACN,MAAM,EAAE;;;;eACR,MAAM;;;;WACN,MAAM;;wBAIP,OAAO,yBAAyB,EAAE,SAAS;iCAC3C,OAAO,OAAO,EAAE,kBAAkB"}
package/src/index.js CHANGED
@@ -5,21 +5,31 @@ import {
5
5
  } from "./provider-resolvers.js";
6
6
 
7
7
  /**
8
- * Represents an ISBN (International Standard Book Number) utility class.
9
- * Provides methods for configuring providers, retrieving book information, and resolving ISBNs.
8
+ * @typedef {object} Book
9
+ * @property {string} isbn - The ISBN of the book.
10
+ * @property {string} title - The long title of the book.
11
+ * @property {string[]} authors - The authors of the book.
12
+ * @property {string} description - The overview of the book.
13
+ * @property {number} pageCount - The number of pages in the book.
14
+ * @property {string} printType - The print type of the book. Always "BOOK" for this context.
15
+ * @property {string[]} categories - The subjects or categories of the book.
16
+ * @property {string} thumbnail - The thumbnail image link of the book.
17
+ * @property {string} [link] - The link of the book.
10
18
  */
11
- class Isbn {
12
- constructor() {
13
- this.PROVIDER_NAMES = PROVIDER_NAMES;
14
19
 
15
- this._resetProviders();
16
- }
20
+ /**
21
+ * @typedef {import('./provider-resolvers.js').Providers} Providers
22
+ * @typedef {import('axios').AxiosRequestConfig} AxiosRequestConfig
23
+ */
17
24
 
25
+ export default class Isbn {
18
26
  /**
19
- * Resets the providers to the default set of providers.
27
+ * @type {Providers}
20
28
  */
21
- _resetProviders() {
22
- this._providers = DEFAULT_PROVIDERS;
29
+ _providers = DEFAULT_PROVIDERS;
30
+
31
+ constructor() {
32
+ this.PROVIDER_NAMES = PROVIDER_NAMES;
23
33
  }
24
34
 
25
35
  /**
@@ -39,11 +49,11 @@ class Isbn {
39
49
  }
40
50
 
41
51
  const unsupportedProviders = providers.filter(
42
- (p) => !DEFAULT_PROVIDERS.includes(p)
52
+ (p) => !DEFAULT_PROVIDERS.includes(p),
43
53
  );
44
54
  if (unsupportedProviders.length > 0) {
45
55
  throw new Error(
46
- `Unsupported providers: ${unsupportedProviders.join(", ")}`
56
+ `Unsupported providers: ${unsupportedProviders.join(", ")}`,
47
57
  );
48
58
  }
49
59
 
@@ -52,42 +62,26 @@ class Isbn {
52
62
  }
53
63
 
54
64
  /**
55
- * Retrieves book information from a list of providers using the given ISBN.
56
- * @param {Array<string>} providers - The list of providers to retrieve book information from.
65
+ * Resolves the book information for the given ISBN.
57
66
  * @param {string} isbn - The ISBN of the book.
58
- * @param {object} options - Additional options for retrieving book information.
59
- * @returns {Promise<object>} A promise that resolves to the book information.
60
- * @throws {Error} If none of the providers are able to retrieve the book information.
67
+ * @param {AxiosRequestConfig} options - The options for the request.
68
+ * @returns {Promise<Book>} - A Promise that resolves to the book information.
69
+ * @throws {Error} - If an error occurs while resolving the book information.
61
70
  */
62
- async _getBookInfo(providers, isbn, options) {
63
- for (const provider of providers) {
71
+ async resolve(isbn, options = {}) {
72
+ const messages = [];
73
+ for (const provider of this._providers) {
64
74
  try {
65
75
  return await PROVIDER_RESOLVERS[provider](isbn, options);
66
- } catch {
67
- // console.debug(`Unable to reach ${provider}. Trying the next one...`);
76
+ } catch (error) {
77
+ if (error.message) messages.push(`${provider}: ${error.message}`);
68
78
  }
69
79
  }
70
80
  // If none of the providers worked, we throw an error.
71
- throw new Error("All providers failed.");
72
- }
73
-
74
- /**
75
- * Resolves the book information for the given ISBN.
76
- * @param {string} isbn - The ISBN of the book.
77
- * @param {object} options - The options for the request.
78
- * @returns {Promise<object>} - A Promise that resolves to the book information.
79
- * @throws {Error} - If an error occurs while resolving the book information.
80
- */
81
- async resolve(isbn, options = {}) {
82
- try {
83
- const book = await this._getBookInfo(this._providers, isbn, options);
84
- this._resetProviders();
85
- return book;
86
- } catch (error) {
87
- this._resetProviders();
88
- throw error;
89
- }
81
+ throw new Error(
82
+ `All providers failed${
83
+ messages.length > 0 ? `\n${messages.join("\n")}` : ""
84
+ }`,
85
+ );
90
86
  }
91
87
  }
92
-
93
- export default new Isbn();
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @typedef {string[]} Providers
3
+ * @typedef {import('axios').AxiosRequestConfig} AxiosRequestConfig
4
+ */
5
+ /**
6
+ * Default options for the provider resolvers.
7
+ * @type {AxiosRequestConfig}
8
+ * @property {number} timeout - The timeout value in milliseconds.
9
+ */
10
+ export const defaultOptions: AxiosRequestConfig;
11
+ export const GOOGLE_BOOKS_API_BASE: "https://www.googleapis.com";
12
+ export const GOOGLE_BOOKS_API_BOOK: "/books/v1/volumes";
13
+ export const OPENLIBRARY_API_BASE: "https://openlibrary.org";
14
+ export const OPENLIBRARY_API_BOOK: "/isbn";
15
+ export const ISBNDB_API_BASE: "https://api2.isbndb.com";
16
+ export const ISBNDB_API_BOOK: "/book";
17
+ export namespace PROVIDER_NAMES {
18
+ let GOOGLE: string;
19
+ let OPENLIBRARY: string;
20
+ let ISBNDB: string;
21
+ }
22
+ /**
23
+ * Default providers for resolving ISBN information.
24
+ * @type {Providers}
25
+ */
26
+ export const DEFAULT_PROVIDERS: Providers;
27
+ export const PROVIDER_RESOLVERS: {
28
+ [x: string]: typeof resolveGoogle;
29
+ };
30
+ export type Providers = string[];
31
+ export type AxiosRequestConfig = import('axios').AxiosRequestConfig;
32
+ import { resolveGoogle } from "./providers/google.js";
33
+ //# sourceMappingURL=provider-resolvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-resolvers.d.ts","sourceRoot":"","sources":["provider-resolvers.js"],"names":[],"mappings":"AAIA;;;GAGG;AAEH;;;;GAIG;AACH,6BAHU,kBAAkB,CAK1B;AAEF,iEAAkE;AAClE,wDAAyD;AAEzD,6DAA8D;AAC9D,2CAA4C;AAE5C,wDAAyD;AACzD,sCAAuC;;;;;;AAOvC;;;GAGG;AACH,0CAIE;AACF;;EAIE;wBAxCW,MAAM,EAAE;iCACR,OAAO,OAAO,EAAE,kBAAkB;8BANjB,uBAAuB"}
@@ -1,12 +1,18 @@
1
1
  import { resolveGoogle } from "./providers/google.js";
2
2
  import { resolveOpenLibrary } from "./providers/open-library.js";
3
- import { resolveWorldcat } from "./providers/worldcat.js";
4
3
  import { resolveIsbnDb } from "./providers/isbndb.js";
5
4
 
5
+ /**
6
+ * @typedef {string[]} Providers
7
+ * @typedef {import('axios').AxiosRequestConfig} AxiosRequestConfig
8
+ */
9
+
10
+ /**
11
+ * Default options for the provider resolvers.
12
+ * @type {AxiosRequestConfig}
13
+ * @property {number} timeout - The timeout value in milliseconds.
14
+ */
6
15
  export const defaultOptions = {
7
- poll: {
8
- maxSockets: 500,
9
- },
10
16
  timeout: 5000,
11
17
  };
12
18
 
@@ -14,28 +20,27 @@ export const GOOGLE_BOOKS_API_BASE = "https://www.googleapis.com";
14
20
  export const GOOGLE_BOOKS_API_BOOK = "/books/v1/volumes";
15
21
 
16
22
  export const OPENLIBRARY_API_BASE = "https://openlibrary.org";
17
- export const OPENLIBRARY_API_BOOK = "/api/books";
18
-
19
- export const WORLDCAT_API_BASE = "http://xisbn.worldcat.org";
20
- export const WORLDCAT_API_BOOK = "/webservices/xid/isbn";
23
+ export const OPENLIBRARY_API_BOOK = "/isbn";
21
24
 
22
25
  export const ISBNDB_API_BASE = "https://api2.isbndb.com";
23
26
  export const ISBNDB_API_BOOK = "/book";
24
27
  export const PROVIDER_NAMES = {
25
28
  GOOGLE: "google",
26
29
  OPENLIBRARY: "openlibrary",
27
- WORLDCAT: "worldcat",
28
30
  ISBNDB: "isbndb",
29
31
  };
32
+
33
+ /**
34
+ * Default providers for resolving ISBN information.
35
+ * @type {Providers}
36
+ */
30
37
  export const DEFAULT_PROVIDERS = [
31
38
  PROVIDER_NAMES.GOOGLE,
32
39
  PROVIDER_NAMES.OPENLIBRARY,
33
- PROVIDER_NAMES.WORLDCAT,
34
40
  PROVIDER_NAMES.ISBNDB,
35
41
  ];
36
42
  export const PROVIDER_RESOLVERS = {
37
43
  [PROVIDER_NAMES.GOOGLE]: resolveGoogle,
38
44
  [PROVIDER_NAMES.OPENLIBRARY]: resolveOpenLibrary,
39
- [PROVIDER_NAMES.WORLDCAT]: resolveWorldcat,
40
45
  [PROVIDER_NAMES.ISBNDB]: resolveIsbnDb,
41
46
  };
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @typedef {import('../index.js').Book} Book
3
+ * @typedef {import('axios').AxiosRequestConfig} AxiosRequestConfig
4
+ */
5
+ /**
6
+ * Resolves book information from Google Books API using the provided ISBN.
7
+ * @param {string} isbn - The ISBN of the book.
8
+ * @param {AxiosRequestConfig} options - Additional options for the API request.
9
+ * @returns {Promise<Book>} The book information retrieved from the API.
10
+ * @throws {Error} If the API response code is not 200, or if no books are found with the provided ISBN, or if no volume information is found for the book.
11
+ */
12
+ export function resolveGoogle(isbn: string, options: AxiosRequestConfig): Promise<Book>;
13
+ /**
14
+ * @typedef {object} GoogleBook
15
+ * @property {string} title - The title of the book.
16
+ * @property {string} subtitle - The subtitle of the book.
17
+ * @property {string[]} authors - The authors of the book.
18
+ * @property {string} publisher - The publisher of the book.
19
+ * @property {string} publishedDate - The published date of the book.
20
+ * @property {string} description - The description of the book.
21
+ * @property {object[]} industryIdentifiers - The industry identifiers of the book.
22
+ * @property {object} readingModes - The reading modes of the book.
23
+ * @property {number} pageCount - The number of pages in the book.
24
+ * @property {string} printType - The print type of the book.
25
+ * @property {string[]} categories - The categories of the book.
26
+ * @property {number} averageRating - The average rating of the book.
27
+ * @property {number} ratingsCount - The ratings count of the book.
28
+ * @property {string} maturityRating - The maturity rating of the book.
29
+ * @property {boolean} allowAnonLogging - The allow anon logging of the book.
30
+ * @property {string} contentVersion - The content version of the book.
31
+ * @property {object} panelizationSummary - The panelization summary of the book.
32
+ * @property {object} imageLinks - The image links of the book.
33
+ * @property {string} language - The language of the book.
34
+ * @property {string} previewLink - The preview link of the book.
35
+ * @property {string} infoLink - The info link of the book.
36
+ * @property {string} canonicalVolumeLink - The canonical volume link of the book.
37
+ * @property {object} saleInfo - The sale info of the book.
38
+ * @property {object} accessInfo - The access info of the book.
39
+ * @property {object} searchInfo - The search info of the book.
40
+ */
41
+ /**
42
+ * Standardizes a book object by extracting relevant information from the provided book object.
43
+ * @param {GoogleBook} book - The book object to be standardized.
44
+ * @param {string} id - The book's id.
45
+ * @param {string} isbn - The book's ISBN.
46
+ * @returns {Book} - The standardized book object.
47
+ */
48
+ export function standardize(book: GoogleBook, id: string, isbn: string): Book;
49
+ export type Book = import('../index.js').Book;
50
+ export type AxiosRequestConfig = import('axios').AxiosRequestConfig;
51
+ export type GoogleBook = {
52
+ /**
53
+ * - The title of the book.
54
+ */
55
+ title: string;
56
+ /**
57
+ * - The subtitle of the book.
58
+ */
59
+ subtitle: string;
60
+ /**
61
+ * - The authors of the book.
62
+ */
63
+ authors: string[];
64
+ /**
65
+ * - The publisher of the book.
66
+ */
67
+ publisher: string;
68
+ /**
69
+ * - The published date of the book.
70
+ */
71
+ publishedDate: string;
72
+ /**
73
+ * - The description of the book.
74
+ */
75
+ description: string;
76
+ /**
77
+ * - The industry identifiers of the book.
78
+ */
79
+ industryIdentifiers: object[];
80
+ /**
81
+ * - The reading modes of the book.
82
+ */
83
+ readingModes: object;
84
+ /**
85
+ * - The number of pages in the book.
86
+ */
87
+ pageCount: number;
88
+ /**
89
+ * - The print type of the book.
90
+ */
91
+ printType: string;
92
+ /**
93
+ * - The categories of the book.
94
+ */
95
+ categories: string[];
96
+ /**
97
+ * - The average rating of the book.
98
+ */
99
+ averageRating: number;
100
+ /**
101
+ * - The ratings count of the book.
102
+ */
103
+ ratingsCount: number;
104
+ /**
105
+ * - The maturity rating of the book.
106
+ */
107
+ maturityRating: string;
108
+ /**
109
+ * - The allow anon logging of the book.
110
+ */
111
+ allowAnonLogging: boolean;
112
+ /**
113
+ * - The content version of the book.
114
+ */
115
+ contentVersion: string;
116
+ /**
117
+ * - The panelization summary of the book.
118
+ */
119
+ panelizationSummary: object;
120
+ /**
121
+ * - The image links of the book.
122
+ */
123
+ imageLinks: object;
124
+ /**
125
+ * - The language of the book.
126
+ */
127
+ language: string;
128
+ /**
129
+ * - The preview link of the book.
130
+ */
131
+ previewLink: string;
132
+ /**
133
+ * - The info link of the book.
134
+ */
135
+ infoLink: string;
136
+ /**
137
+ * - The canonical volume link of the book.
138
+ */
139
+ canonicalVolumeLink: string;
140
+ /**
141
+ * - The sale info of the book.
142
+ */
143
+ saleInfo: object;
144
+ /**
145
+ * - The access info of the book.
146
+ */
147
+ accessInfo: object;
148
+ /**
149
+ * - The search info of the book.
150
+ */
151
+ searchInfo: object;
152
+ };
153
+ //# sourceMappingURL=google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["google.js"],"names":[],"mappings":"AAOA;;;GAGG;AAEH;;;;;;GAMG;AACH,oCALW,MAAM,WACN,kBAAkB,GAChB,QAAQ,IAAI,CAAC,CA4BzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;GAMG;AACH,kCALW,UAAU,MACV,MAAM,QACN,MAAM,GACJ,IAAI,CAgBhB;mBAxFY,OAAO,aAAa,EAAE,IAAI;iCAC1B,OAAO,OAAO,EAAE,kBAAkB;;;;;WAuCjC,MAAM;;;;cACN,MAAM;;;;aACN,MAAM,EAAE;;;;eACR,MAAM;;;;mBACN,MAAM;;;;iBACN,MAAM;;;;yBACN,MAAM,EAAE;;;;kBACR,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;gBACN,MAAM,EAAE;;;;mBACR,MAAM;;;;kBACN,MAAM;;;;oBACN,MAAM;;;;sBACN,OAAO;;;;oBACP,MAAM;;;;yBACN,MAAM;;;;gBACN,MAAM;;;;cACN,MAAM;;;;iBACN,MAAM;;;;cACN,MAAM;;;;yBACN,MAAM;;;;cACN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM"}