@zayne-labs/callapi 1.11.12 → 1.11.14

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.
Files changed (2) hide show
  1. package/README.md +5 -5
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  Fetch is too basic for real apps. You end up writing the same boilerplate: error handling, retries, deduplication, response parsing etc. CallApi handles all of that and practically more.
32
32
 
33
- **Drop-in replacement for fetch. Under 6KB. Zero dependencies.**
33
+ **Drop-in replacement for fetch. Under 6KB. All kinds of convenience features. Zero dependencies.**
34
34
 
35
35
  ```js
36
36
  import { callApi } from "@zayne-labs/callapi";
@@ -44,7 +44,7 @@ const { data, error } = await callApi("/api/users");
44
44
 
45
45
  ```js
46
46
  const req1 = callApi("/api/user");
47
- const req2 = callApi("/api/user"); // Shares req1's response
47
+ const req2 = callApi("/api/user"); // Cancels req1 (can be configured to share it's response instead)
48
48
  ```
49
49
 
50
50
  **Smart Response Parsing** - Looks at Content-Type, does the right thing.
@@ -53,7 +53,7 @@ const req2 = callApi("/api/user"); // Shares req1's response
53
53
  const { data } = await callApi("/api/data"); // JSON? Parsed.
54
54
  ```
55
55
 
56
- **Error Handling** - Structured errors you can actually use.
56
+ **Error Handling** - Structured errors, making proper error handling trivial.
57
57
 
58
58
  ```js
59
59
  const { data, error } = await callApi("/api/users");
@@ -64,7 +64,7 @@ if (error) {
64
64
  }
65
65
  ```
66
66
 
67
- **Retries** - Exponential backoff, custom conditions.
67
+ **Retries** - Exponential backoff, custom conditions etc.
68
68
 
69
69
  ```js
70
70
  await callApi("/api/data", {
@@ -98,7 +98,7 @@ const user = await callMainApi("/users/:id", {
98
98
  });
99
99
  ```
100
100
 
101
- **Hooks** - Intercept at any point.
101
+ **Hooks** - Hook in callApi's lifecycle at any point.
102
102
 
103
103
  ```js
104
104
  const api = createFetchClient({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/callapi",
3
3
  "type": "module",
4
- "version": "1.11.12",
4
+ "version": "1.11.14",
5
5
  "description": "A lightweight wrapper over fetch with quality of life improvements like built-in request cancellation, retries, interceptors and more",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -25,7 +25,8 @@
25
25
  "sideEffects": false,
26
26
  "exports": {
27
27
  ".": "./dist/esm/index.js",
28
- "./utils": "./dist/esm/utils/external/index.js"
28
+ "./utils": "./dist/esm/utils/external/index.js",
29
+ "./constants": "./dist/esm/constants/index.js"
29
30
  },
30
31
  "files": [
31
32
  "dist"