@workos-inc/node 10.7.0 → 10.9.0

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
@@ -37,6 +37,29 @@ import { WorkOS } from '@workos-inc/node';
37
37
  const workos = new WorkOS('sk_1234');
38
38
  ```
39
39
 
40
+ ### Automatic retries
41
+
42
+ The SDK automatically retries requests that fail with a transient error — a
43
+ network error, a request timeout (408), a rate limit (429), or a server error
44
+ (500, 502, 503, 504) — using exponential backoff with jitter. When the API
45
+ responds with a `Retry-After` header, the SDK waits for that duration instead
46
+ (capped at 60 seconds). Retried `POST` requests are automatically assigned an
47
+ `Idempotency-Key` header (unless one is already set) so a retried write is not
48
+ applied twice.
49
+
50
+ The default is 3 retries. Configure it client-wide, or per request on the
51
+ low-level HTTP methods:
52
+
53
+ ```ts
54
+ // Client-wide: up to 5 retries per request
55
+ const workos = new WorkOS('sk_1234', { maxRetries: 5 });
56
+
57
+ // Per-request override: disable retries for this call only
58
+ await workos.get('/organizations', { maxRetries: 0 });
59
+ ```
60
+
61
+ Set `maxRetries: 0` to disable automatic retries entirely.
62
+
40
63
  ## Public Client Mode (Browser/Mobile/CLI)
41
64
 
42
65
  For apps that can't securely store secrets, initialize with just a client ID: