@emmvish/stable-request 1.3.7 → 1.3.9

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 +36 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,10 +1,25 @@
1
1
  # stable-request
2
2
 
3
- **stable-request** is a TypeScript-first **HTTP workflow execution engine** for real-world distributed systems — where HTTP `200 OK` does **not** guarantee business success.
3
+ **stable-request** is a TypeScript-first **HTTP workflow execution engine** for real-world distributed systems — where HTTP `200 OK` does **not** guarantee business success, and HTTP failures still deserve **structured, actionable responses**.
4
4
 
5
- It enables **content-aware retries**, **hierarchical configuration**, **batch orchestration**, and **multi-phase workflows** with deep observability — all built on top of standard HTTP calls.
5
+ It ensures that **every request attempt**, whether it succeeds or fails, can be:
6
6
 
7
- All in all, it provides you with the **entire ecosystem** to build **API-integrations based workflows**.
7
+ - Observed
8
+ - Analyzed
9
+ - Retried intelligently
10
+ - Suppressed when non-critical
11
+ - Escalated when business-critical
12
+
13
+ All without crashing your application or hiding context behind opaque errors.
14
+
15
+ **stable-request treats failures as data.**
16
+
17
+ > If you’ve ever logged `error.message` and thought
18
+ > **“This tells me absolutely nothing”** — this library is for you.
19
+
20
+ In addition, it enables **content-aware retries**, **hierarchical configuration**, **batch orchestration**, and **multi-phase workflows** with deep observability — all built on top of standard HTTP calls.
21
+
22
+ All in all, it provides you with the **entire ecosystem** to build **API-integrations based workflows** with **complete flexibility**.
8
23
 
9
24
  ---
10
25
 
@@ -181,30 +196,38 @@ npm install @emmvish/stable-request
181
196
  ### 1. Basic Request (No Retries)
182
197
 
183
198
  ```typescript
184
- import { stableRequest } from '@emmvish/stable-request';
199
+ import { stableRequest, REQUEST_METHODS } from '@emmvish/stable-request';
185
200
 
186
- interface RequestBodyParams {
187
- page: number,
188
- offset: number
201
+ interface PatchRequestBodyParams {
202
+ id: number;
203
+ updates: {
204
+ name?: string;
205
+ age?: number;
206
+ }
189
207
  }
190
208
 
191
209
  interface ResponseParams {
192
- id: number,
193
- name: string
210
+ id: number;
211
+ name: string;
212
+ age: number;
194
213
  }
195
214
 
196
215
  const getStableResponse = async () => {
197
- const data = await stableRequest<RequestBodyParams, ResponseParams>({
216
+
217
+ const token = 'my-auth-token';
218
+
219
+ const data = await stableRequest<PatchRequestBodyParams, ResponseParams>({
198
220
  reqData: {
221
+ method: REQUEST_METHODS.PATCH,
199
222
  hostname: 'api.example.com',
200
- path: '/users/123',
223
+ path: '/users',
201
224
  headers: { Authorization: `Bearer ${token}` },
202
- query: { page: 10, offset: 5 }
225
+ body: { id: 123, updates: { age: 27 } }
203
226
  },
204
227
  resReq: true // Return the response data
205
228
  });
206
229
 
207
- console.log(data); // { id: 123, name: 'John' }
230
+ console.log(data); // { id: 123, name: 'MV', age: 27 }
208
231
  }
209
232
 
210
233
  getStableResponse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emmvish/stable-request",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "stable-request is a TypeScript-first HTTP reliability toolkit for workflow-driven API integrations, that goes beyond status-code retries by validating response content, handling eventual consistency, coordinating batch workflows with intelligent grouping, and providing deep observability into every request attempt. It is designed for real-world distributed systems where HTTP success does not guarantee business success. It also provides extensive support for managing multiple requests so as to achieve workflow automation.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",