@emmvish/stable-request 1.3.7 → 1.3.8

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 +18 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -181,30 +181,38 @@ npm install @emmvish/stable-request
181
181
  ### 1. Basic Request (No Retries)
182
182
 
183
183
  ```typescript
184
- import { stableRequest } from '@emmvish/stable-request';
184
+ import { stableRequest, REQUEST_METHODS } from '@emmvish/stable-request';
185
185
 
186
- interface RequestBodyParams {
187
- page: number,
188
- offset: number
186
+ interface PatchRequestBodyParams {
187
+ id: number;
188
+ updates: {
189
+ name?: string;
190
+ age?: number;
191
+ }
189
192
  }
190
193
 
191
194
  interface ResponseParams {
192
- id: number,
193
- name: string
195
+ id: number;
196
+ name: string;
197
+ age: number;
194
198
  }
195
199
 
196
200
  const getStableResponse = async () => {
197
- const data = await stableRequest<RequestBodyParams, ResponseParams>({
201
+
202
+ const token = 'my-auth-token';
203
+
204
+ const data = await stableRequest<PatchRequestBodyParams, ResponseParams>({
198
205
  reqData: {
206
+ method: REQUEST_METHODS.PATCH,
199
207
  hostname: 'api.example.com',
200
- path: '/users/123',
208
+ path: '/users',
201
209
  headers: { Authorization: `Bearer ${token}` },
202
- query: { page: 10, offset: 5 }
210
+ body: { id: 123, updates: { age: 27 } }
203
211
  },
204
212
  resReq: true // Return the response data
205
213
  });
206
214
 
207
- console.log(data); // { id: 123, name: 'John' }
215
+ console.log(data); // { id: 123, name: 'MV', age: 27 }
208
216
  }
209
217
 
210
218
  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.8",
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",