@emmvish/stable-request 1.0.6 → 1.0.7

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 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -112,9 +112,6 @@ const requests = [
112
112
  id: 'create-user-1',
113
113
  requestOptions: {
114
114
  reqData: {
115
- hostname: 'api.example.com',
116
- path: '/users',
117
- method: REQUEST_METHODS.POST,
118
115
  body: { name: 'John Doe', email: 'john@example.com' }
119
116
  }
120
117
  }
@@ -123,9 +120,6 @@ const requests = [
123
120
  id: 'create-user-2',
124
121
  requestOptions: {
125
122
  reqData: {
126
- hostname: 'api.example.com',
127
- path: '/users',
128
- method: REQUEST_METHODS.POST,
129
123
  body: { name: 'Jane Smith', email: 'jane@example.com' }
130
124
  }
131
125
  }
@@ -134,6 +128,11 @@ const requests = [
134
128
 
135
129
  const results = await stableApiGateway(requests, {
136
130
  concurrentExecution: true,
131
+ commonRequestData: {
132
+ hostname: 'api.example.com',
133
+ path: '/users',
134
+ method: REQUEST_METHODS.POST
135
+ },
137
136
  commonResReq: true,
138
137
  commonAttempts: 3,
139
138
  commonWait: 1000,
@@ -582,7 +581,6 @@ const healthChecks = services.map(service => ({
582
581
  requestOptions: {
583
582
  reqData: {
584
583
  hostname: `${service}.internal.example.com`,
585
- path: '/health'
586
584
  },
587
585
  resReq: true,
588
586
  attempts: 3,
@@ -592,6 +590,9 @@ const healthChecks = services.map(service => ({
592
590
 
593
591
  const results = await stableApiGateway(healthChecks, {
594
592
  concurrentExecution: true,
593
+ commonRequestData: {
594
+ path: '/health'
595
+ },
595
596
  commonRetryStrategy: RETRY_STRATEGIES.LINEAR
596
597
  });
597
598
 
@@ -638,9 +639,6 @@ const migrationRequests = records.map((record, index) => ({
638
639
  id: `migrate-${record.id}`,
639
640
  requestOptions: {
640
641
  reqData: {
641
- hostname: 'new-system.example.com',
642
- path: '/import',
643
- method: REQUEST_METHODS.POST,
644
642
  body: record
645
643
  },
646
644
  resReq: true,
@@ -655,6 +653,11 @@ const migrationRequests = records.map((record, index) => ({
655
653
 
656
654
  const results = await stableApiGateway(migrationRequests, {
657
655
  concurrentExecution: true,
656
+ commonRequestData: {
657
+ hostname: 'new-system.example.com',
658
+ path: '/import',
659
+ method: REQUEST_METHODS.POST,
660
+ }
658
661
  commonAttempts: 3,
659
662
  commonWait: 1000,
660
663
  commonRetryStrategy: RETRY_STRATEGIES.LINEAR,
@@ -707,10 +710,7 @@ const workflowSteps = [
707
710
  id: 'step-1-init',
708
711
  requestOptions: {
709
712
  reqData: {
710
- hostname: 'workflow.example.com',
711
713
  path: '/init',
712
- method: REQUEST_METHODS.POST,
713
- body: { workflowId: 'wf-123' }
714
714
  },
715
715
  resReq: true
716
716
  }
@@ -719,10 +719,7 @@ const workflowSteps = [
719
719
  id: 'step-2-process',
720
720
  requestOptions: {
721
721
  reqData: {
722
- hostname: 'workflow.example.com',
723
722
  path: '/process',
724
- method: REQUEST_METHODS.POST,
725
- body: { workflowId: 'wf-123' }
726
723
  },
727
724
  resReq: true,
728
725
  responseAnalyzer: async (reqConfig, data) => {
@@ -734,10 +731,7 @@ const workflowSteps = [
734
731
  id: 'step-3-finalize',
735
732
  requestOptions: {
736
733
  reqData: {
737
- hostname: 'workflow.example.com',
738
734
  path: '/finalize',
739
- method: REQUEST_METHODS.POST,
740
- body: { workflowId: 'wf-123' }
741
735
  },
742
736
  resReq: true
743
737
  }
@@ -747,6 +741,11 @@ const workflowSteps = [
747
741
  const results = await stableApiGateway(workflowSteps, {
748
742
  concurrentExecution: false, // Execute sequentially
749
743
  stopOnFirstError: true, // Stop if any step fails
744
+ commonRequestData: {
745
+ hostname: 'workflow.example.com',
746
+ method: REQUEST_METHODS.POST,
747
+ body: { workflowId: 'wf-123' }
748
+ }
750
749
  commonAttempts: 5,
751
750
  commonWait: 2000,
752
751
  commonRetryStrategy: RETRY_STRATEGIES.EXPONENTIAL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emmvish/stable-request",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "stable-request is a TypeScript-first HTTP reliability framework that goes beyond status-code retries by validating response content, handling eventual consistency, coordinating batch workflows, and providing deep observability into every request attempt. It is designed for real-world distributed systems where HTTP success does not guarantee business success.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",