vigor-fetch 3.0.1 → 3.1.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.
Files changed (2) hide show
  1. package/README.md +5 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # vigor-fetch
2
2
 
3
- ## Vigor is a composable, lightweighted (minified + gzipped ~5.5kb) network workflow toolkit built on top of native Fetch.
3
+ ## Vigor is a composable, lightweighted (minified + gzipped ~5.8kb) network workflow toolkit built on top of native Fetch.
4
4
 
5
5
  > Vigor provides a fluent, chainable API for building robust network logic with built-in retry, backoff, interceptors, parsing, and concurrency control.
6
6
 
@@ -57,6 +57,7 @@ const data = await vigor
57
57
  .request();
58
58
  // -> https://api.example.com/api/v1/main
59
59
  ```
60
+
60
61
  #### Advanced
61
62
  ```ts
62
63
  const data = await vigor
@@ -70,7 +71,7 @@ const data = await vigor
70
71
  )
71
72
  .interceptors(i => i
72
73
  .onError((ctx, api) => {
73
- api.retry();
74
+ api.restart();
74
75
  })
75
76
  )
76
77
  .request();
@@ -702,6 +703,7 @@ const data = await vigor
702
703
 
703
704
  | Method | Description |
704
705
  |---|---|
706
+ | method(http method) | Forces the http method |
705
707
  | origin(...paths) | Sets base URL and origin paths |
706
708
  | path(...paths) | Appends request paths |
707
709
  | query(params) | Sets query parameters |
@@ -934,7 +936,7 @@ Runs when fetch fails.
934
936
  |---|---|
935
937
  | setResult(value) | Returns fallback value |
936
938
  | throwError(error) | Throws error |
937
- | retry() | Re-executes fetch pipeline |
939
+ | restart() | Re-executes fetch pipeline |
938
940
 
939
941
  ---
940
942
 
@@ -1064,25 +1066,6 @@ Runs before task execution starts.
1064
1066
 
1065
1067
  ---
1066
1068
 
1067
- ### afterEach
1068
-
1069
- Runs after each task resolves.
1070
-
1071
- ```ts
1072
- .afterEach(async (ctx, api) => {
1073
- console.log(ctx.result);
1074
- })
1075
- ```
1076
-
1077
- #### Available APIs
1078
-
1079
- | API | Description |
1080
- |---|---|
1081
- | setResult(value) | Replaces task result |
1082
- | throwError(error) | Throws error |
1083
-
1084
- ---
1085
-
1086
1069
  ### after
1087
1070
 
1088
1071
  Runs after all tasks complete.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigor-fetch",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Smart, zero-dependency HTTP client with self-healing retries for rate-limited servers.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",