@emmvish/stable-request 1.3.4 → 1.3.6
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 +83 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,71 @@
|
|
|
4
4
|
|
|
5
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.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
All in all, it provides you with the **entire ecosystem** to build **API-integrations based workflows**.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 📚 Table of Contents
|
|
12
|
+
<!-- TOC START -->
|
|
13
|
+
- [Why stable-request exists](#why-stable-request-exists)
|
|
14
|
+
- [What stable-request gives you](#what-stable-request-gives-you)
|
|
15
|
+
- [Core capabilities](#core-capabilities)
|
|
16
|
+
- [Scaling beyond single requests](#scaling-beyond-single-requests)
|
|
17
|
+
- [Full workflow orchestration](#full-workflow-orchestration)
|
|
18
|
+
- [How stable-request is different](#how-stable-request-is-different)
|
|
19
|
+
- [Choose your entry point](#choose-your-entry-point)
|
|
20
|
+
- [Installation](#installation)
|
|
21
|
+
- [Quick Start](#quick-start)
|
|
22
|
+
- [Basic Request (No Retries)](#1-basic-request-no-retries)
|
|
23
|
+
- [Add Simple Retries](#2-add-simple-retries)
|
|
24
|
+
- [Validate Response Content](#3-validate-response-content-content-aware-retries)
|
|
25
|
+
- [Monitor Errors](#4-monitor-errors-observability)
|
|
26
|
+
- [Monitor Successful Attempts](#5-monitor-successful-attempts)
|
|
27
|
+
- [Handle Final Errors Gracefully](#6-handle-final-errors-gracefully)
|
|
28
|
+
- [Pass Custom Parameters to Hooks](#7-pass-custom-parameters-to-hooks)
|
|
29
|
+
- [Pre-Execution Hook](#8-pre-execution-hook-dynamic-configuration)
|
|
30
|
+
- [Intermediate Concepts](#intermediate-concepts)
|
|
31
|
+
- [Making POST/PUT/PATCH/DELETE Requests](#making-postputpatchdelete-requests)
|
|
32
|
+
- [Query Parameters](#query-parameters)
|
|
33
|
+
- [Custom Timeout and Port](#custom-timeout-and-port)
|
|
34
|
+
- [Request Cancellation](#request-cancellation)
|
|
35
|
+
- [Trial Mode](#trial-mode-testing-your-retry-logic)
|
|
36
|
+
- [Batch Processing - Multiple Requests](#batch-processing---multiple-requests)
|
|
37
|
+
- [Basic Batch Request](#basic-batch-request)
|
|
38
|
+
- [Sequential Execution (With Dependencies)](#sequential-execution-with-dependencies)
|
|
39
|
+
- [Shared Configuration (Common Options)](#shared-configuration-common-options)
|
|
40
|
+
- [Advanced: Request Grouping](#advanced-request-grouping)
|
|
41
|
+
- [Service Tiers](#example-service-tiers)
|
|
42
|
+
- [Multi-Region Configuration](#example-multi-region-configuration)
|
|
43
|
+
- [Shared Buffer Across Requests](#example-shared-buffer-is-common-across-the-entire-batch-of-requests)
|
|
44
|
+
- [Multi-Phase Workflows](#multi-phase-workflows)
|
|
45
|
+
- [Basic Workflow](#basic-workflow)
|
|
46
|
+
- [Phase Configuration](#phase-configuration)
|
|
47
|
+
- [Workflow with Request Groups](#workflow-with-request-groups)
|
|
48
|
+
- [Phase Observability Hooks](#phase-observability-hooks)
|
|
49
|
+
- [Real-World Examples](#real-world-examples)
|
|
50
|
+
- [Polling for Job Completion](#1-polling-for-job-completion)
|
|
51
|
+
- [Database Replication Lag](#2-database-replication-lag)
|
|
52
|
+
- [Idempotent Payment Processing](#3-idempotent-payment-processing)
|
|
53
|
+
- [Batch User Creation](#4-batch-user-creation-with-error-handling)
|
|
54
|
+
- [Health Check Monitoring System](#5-health-check-monitoring-system)
|
|
55
|
+
- [Data Pipeline (ETL Workflow)](#6-data-pipeline-etl-workflow)
|
|
56
|
+
- [Complete API Reference](#complete-api-reference)
|
|
57
|
+
- [`stableRequest`](#stablerequestoptions)
|
|
58
|
+
- [`stableApiGateway`](#stableapigatewayrequests-options)
|
|
59
|
+
- [`stableWorkflow`](#stableworkflowphases-options)
|
|
60
|
+
- [Hooks Reference](#hooks-reference)
|
|
61
|
+
- [`preExecutionHook`](#preexecutionhook)
|
|
62
|
+
- [`responseAnalyzer`](#responseanalyzer)
|
|
63
|
+
- [`handleErrors`](#handleerrors)
|
|
64
|
+
- [`handleSuccessfulAttemptData`](#handlesuccessfulattemptdata)
|
|
65
|
+
- [`finalErrorAnalyzer`](#finalerroranalyzer)
|
|
66
|
+
- [`handlePhaseCompletion`](#handlephasecompletion)
|
|
67
|
+
- [`handlePhaseError`](#handlephaseerror)
|
|
68
|
+
- [Configuration Hierarchy](#configuration-hierarchy)
|
|
69
|
+
- [TypeScript Support](#typescript-support)
|
|
70
|
+
- [License](#license)
|
|
71
|
+
<!-- TOC END -->
|
|
8
72
|
|
|
9
73
|
---
|
|
10
74
|
|
|
@@ -66,14 +130,31 @@ Most HTTP clients answer only one question:
|
|
|
66
130
|
### Full workflow orchestration
|
|
67
131
|
|
|
68
132
|
🧩 **Multi-phase workflows with shared state (`stableWorkflow`)**
|
|
133
|
+
Model real-world business flows as deterministic, observable execution graphs.
|
|
69
134
|
|
|
70
135
|
🔀 **Mix concurrent and sequential execution**
|
|
136
|
+
Parallelize where safe, serialize where correctness matters.
|
|
71
137
|
|
|
72
138
|
🛑 **Stop early or degrade gracefully**
|
|
139
|
+
Stop execution early or continue based on business criticality.
|
|
73
140
|
|
|
74
141
|
📈 **Phase-level metrics and hooks**
|
|
142
|
+
Track execution time, success rates, and failure boundaries per phase.
|
|
75
143
|
|
|
76
144
|
🧭 **Deterministic, observable execution paths**
|
|
145
|
+
Every decision is explicit, traceable, and reproducible.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## How stable-request is different
|
|
150
|
+
|
|
151
|
+
| Traditional HTTP Clients | stable-request |
|
|
152
|
+
|--------------------------|---------------|
|
|
153
|
+
| Status-code based retries | Content-aware retries |
|
|
154
|
+
| Per-request thinking | System-level thinking |
|
|
155
|
+
| Fire-and-forget | Deterministic workflows |
|
|
156
|
+
| Best-effort retries | Business-aware execution |
|
|
157
|
+
| Little observability | Deep, structured hooks |
|
|
77
158
|
|
|
78
159
|
---
|
|
79
160
|
|
|
@@ -446,7 +527,7 @@ interface PreExecutionOptions {
|
|
|
446
527
|
|
|
447
528
|
## Intermediate Concepts
|
|
448
529
|
|
|
449
|
-
### Making POST/PUT/PATCH Requests
|
|
530
|
+
### Making POST/PUT/PATCH/DELETE Requests
|
|
450
531
|
|
|
451
532
|
```typescript
|
|
452
533
|
import { stableRequest, REQUEST_METHODS } from '@emmvish/stable-request';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emmvish/stable-request",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
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",
|