@library-pals/isbn 1.5.0 → 1.6.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
@@ -34,7 +34,7 @@ try {
34
34
  }
35
35
  ```
36
36
 
37
- ### Setting a timeout
37
+ ### Setting request options
38
38
 
39
39
  ```javascript
40
40
  import Isbn from "@library-pals/isbn";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@library-pals/isbn",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Find books by ISBN",
5
5
  "exports": {
6
6
  ".": {
@@ -36,19 +36,19 @@
36
36
  "author": "Katy DeCorah <@katydecorah>",
37
37
  "license": "AGPL-3.0-or-later",
38
38
  "devDependencies": {
39
- "@eslint/js": "^9.26.0",
40
- "eslint": "^9.26.0",
41
- "eslint-plugin-jest": "^28.11.0",
42
- "eslint-plugin-jsdoc": "^50.6.11",
43
- "eslint-plugin-unicorn": "^59.0.0",
44
- "globals": "^16.0.0",
45
- "jest": "^29.7.0",
46
- "prettier": "^3.5.3",
39
+ "@eslint/js": "^9.36.0",
40
+ "eslint": "^9.36.0",
41
+ "eslint-plugin-jest": "^29.0.1",
42
+ "eslint-plugin-jsdoc": "^60.4.1",
43
+ "eslint-plugin-unicorn": "^61.0.2",
44
+ "globals": "^16.4.0",
45
+ "jest": "^30.1.3",
46
+ "prettier": "^3.6.2",
47
47
  "prettier-2": "npm:prettier@^2",
48
- "typescript": "^5.8.3"
48
+ "typescript": "^5.9.2"
49
49
  },
50
50
  "dependencies": {
51
- "axios": "^1.9.0"
51
+ "axios": "^1.12.2"
52
52
  },
53
53
  "bugs": {
54
54
  "url": "https://github.com/library-pals/isbn/issues"
@@ -1,4 +1,8 @@
1
- import { LIBROFM_API_BASE, LIBROFM_API_BOOK } from "../provider-resolvers.js";
1
+ import {
2
+ LIBROFM_API_BASE,
3
+ LIBROFM_API_BOOK,
4
+ defaultOptions,
5
+ } from "../provider-resolvers.js";
2
6
  import axios from "axios";
3
7
 
4
8
  /**
@@ -9,13 +13,19 @@ import axios from "axios";
9
13
  /**
10
14
  * Resolves book information from Libro.fm using the provided ISBN.
11
15
  * @param {string} isbn - The ISBN of the book.
16
+ * @param {AxiosRequestConfig} options - Additional options for the API request.
12
17
  * @returns {Promise<Book>} The book information retrieved from the API.
13
18
  * @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.
14
19
  */
15
- export async function resolveLibroFm(isbn) {
20
+ export async function resolveLibroFm(isbn, options) {
21
+ const requestOptions = {
22
+ ...defaultOptions,
23
+ ...options,
24
+ };
25
+
16
26
  const url = `${LIBROFM_API_BASE}${LIBROFM_API_BOOK}/${isbn}`;
17
27
 
18
- const response = await axios.get(url);
28
+ const response = await axios.get(url, requestOptions);
19
29
  try {
20
30
  if (response.status !== 200) {
21
31
  throw new Error(`Unable to get ${url}: ${response.status}`);
@@ -5,10 +5,11 @@
5
5
  /**
6
6
  * Resolves book information from Libro.fm using the provided ISBN.
7
7
  * @param {string} isbn - The ISBN of the book.
8
+ * @param {AxiosRequestConfig} options - Additional options for the API request.
8
9
  * @returns {Promise<Book>} The book information retrieved from the API.
9
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.
10
11
  */
11
- export function resolveLibroFm(isbn: string): Promise<Book>;
12
+ export function resolveLibroFm(isbn: string, options: AxiosRequestConfig): Promise<Book>;
12
13
  /**
13
14
  * Standardizes a book object by extracting relevant information from the provided book object.
14
15
  * @param {string} data - The data to be standardized.