@emmvish/stable-request 1.1.6 → 1.1.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.
package/README.md CHANGED
@@ -29,11 +29,23 @@ npm install @emmvish/stable-request
29
29
  ```typescript
30
30
  import { stableRequest } from '@emmvish/stable-request';
31
31
 
32
+ interface RequestBodyParams {
33
+ page: number,
34
+ offset: number
35
+ }
36
+
37
+ interface ResponseParams {
38
+ id: number,
39
+ name: string
40
+ }
41
+
32
42
  const getStableResponse = async () => {
33
- const data = await stableRequest({
43
+ const data = await stableRequest<RequestBodyParams, ResponseParams>({
34
44
  reqData: {
35
45
  hostname: 'api.example.com',
36
- path: '/users/123'
46
+ path: '/users/123',
47
+ headers: { Authorization: `Bearer ${token}` }
48
+ body: { page: 10, offset: 5 }
37
49
  },
38
50
  resReq: true // Return the response data
39
51
  });
@@ -58,6 +70,7 @@ const getStableResponse = async () => {
58
70
  resReq: true,
59
71
  attempts: 3, // Retry up to 3 times
60
72
  wait: 1000, // Wait 1 second between retries
73
+ maxAllowedWait: 8000, // Maximum permissible wait time between retries
61
74
  retryStrategy: RETRY_STRATEGIES.EXPONENTIAL // 1s, 2s, 4s, 8s...
62
75
  });
63
76
 
@@ -15,7 +15,7 @@ export async function executeSequentially(requests = [], requestExecutionOptions
15
15
  ...(req.groupId && { groupId: req.groupId }),
16
16
  success: res ? true : false,
17
17
  ...(res && { data: res }),
18
- ...(!res && { error: 'Request was unsuccessful, but analyzed successfully!' })
18
+ ...(!res && { error: 'Request was unsuccessful, but the error was analyzed successfully!' })
19
19
  });
20
20
  }
21
21
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"execute-sequentially.js","sourceRoot":"","sources":["../../src/utilities/execute-sequentially.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE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AAE,GAAG,CAAC,OAAO,EAAE,CAAC;gBAC5C,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,CAAC,EAAE,OAAO,IAAI,sDAAsD;aAC9E,CAAC,CAAC;YACH,IAAG,uBAAuB,CAAC,gBAAgB,EAAE,CAAC;gBAC1C,MAAM;YACV,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emmvish/stable-request",
3
- "version": "1.1.6",
3
+ "version": "1.1.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",