safe-timeouts 0.1.1 → 0.1.2

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 +13 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # safe-timeout
1
+ # safe-timeouts
2
2
 
3
3
  **Deadline-based timeouts for async Node.js code with AbortSignal support.**
4
4
 
@@ -10,7 +10,7 @@
10
10
  ![GitHub Repo stars](https://img.shields.io/github/stars/yetanotheraryan/safe-timeouts)
11
11
  ![GitHub License](https://img.shields.io/github/license/yetanotheraryan/safe-timeouts)
12
12
 
13
- Promise-based deadline enforcement for async code in Node.js. `safe-timeout` helps you apply a **single execution deadline** across async functions, services, and external calls using standard `AbortSignal` semantics.
13
+ Promise-based deadline enforcement for async code in Node.js. `safe-timeouts` helps you apply a **single execution deadline** across async functions, services, and external calls using standard `AbortSignal` semantics.
14
14
 
15
15
  ---
16
16
 
@@ -28,14 +28,14 @@ Most timeout utilities fail here because they:
28
28
  * don’t compose across nested calls
29
29
  * don’t integrate with `AbortSignal`
30
30
 
31
- `safe-timeout` solves this correctly.
31
+ `safe-timeouts` solves this correctly.
32
32
 
33
33
  ---
34
34
 
35
35
  ## Installation
36
36
 
37
37
  ```bash
38
- npm install safe-timeout
38
+ npm install safe-timeouts
39
39
  ```
40
40
 
41
41
  Node.js >= 16 is required.
@@ -45,7 +45,7 @@ Node.js >= 16 is required.
45
45
  ## Basic usage
46
46
 
47
47
  ```ts
48
- import { withTimeout, TimeoutError } from "safe-timeout";
48
+ import { withTimeout, TimeoutError } from "safe-timeouts";
49
49
  import axios from "axios";
50
50
 
51
51
  try {
@@ -161,7 +161,7 @@ These **cannot be forcibly stopped**:
161
161
  * CPU-bound loops
162
162
  * legacy libraries
163
163
 
164
- For these, `safe-timeout`:
164
+ For these, `safe-timeouts`:
165
165
 
166
166
  * stops waiting
167
167
  * rejects the outer promise
@@ -175,7 +175,7 @@ JavaScript cannot forcibly stop non-abort-aware operations (like `setTimeout`, S
175
175
 
176
176
  When such operations exceed the deadline:
177
177
 
178
- * `safe-timeout` rejects the outer promise
178
+ * `safe-timeouts` rejects the outer promise
179
179
  * abort-aware APIs are cancelled automatically
180
180
  * JavaScript execution resumes only when the pending operation completes
181
181
 
@@ -190,11 +190,11 @@ This design avoids hidden global checks while remaining honest about JavaScript
190
190
 
191
191
  ## Axios integration
192
192
 
193
- `safe-timeout` works with Axios by passing the provided `AbortSignal` to the request.
193
+ `safe-timeouts` works with Axios by passing the provided `AbortSignal` to the request.
194
194
 
195
195
  ```ts
196
196
  import axios from "axios";
197
- import { withTimeout } from "safe-timeout";
197
+ import { withTimeout } from "safe-timeouts";
198
198
 
199
199
  await withTimeout(2000, async (signal) => {
200
200
  const res = await axios.get("/users", { signal });
@@ -211,7 +211,7 @@ This explicit integration keeps cancellation predictable and avoids hidden behav
211
211
 
212
212
  ---
213
213
 
214
- ## What `safe-timeout` does NOT do
214
+ ## What `safe-timeouts` does NOT do
215
215
 
216
216
  It is important to be explicit about limitations:
217
217
 
@@ -226,7 +226,7 @@ This matches the realities of Node.js and modern async runtimes.
226
226
 
227
227
  ## How this differs from `setTimeout`
228
228
 
229
- | Feature | setTimeout | safe-timeout |
229
+ | Feature | setTimeout | safe-timeouts |
230
230
  | ------------------- | ---------- | ------------ |
231
231
  | End-to-end deadline | ❌ | ✅ |
232
232
  | Nested composition | ❌ | ✅ |
@@ -234,7 +234,7 @@ This matches the realities of Node.js and modern async runtimes.
234
234
  | Context propagation | ❌ | ✅ |
235
235
  | Concurrency-safe | ❌ | ✅ |
236
236
 
237
- `setTimeout` works locally. `safe-timeout` works across your entire async call graph.
237
+ `setTimeout` works locally. `safe-timeouts` works across your entire async call graph.
238
238
 
239
239
  ---
240
240
 
@@ -264,7 +264,7 @@ instanceof TimeoutError === true
264
264
 
265
265
  ## When to use this
266
266
 
267
- Use `safe-timeout` when:
267
+ Use `safe-timeouts` when:
268
268
 
269
269
  * you want request-level deadlines
270
270
  * you call multiple async services
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safe-timeouts",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Deadline-based timeouts for async code in Node.js. Enforce end-to-end execution deadlines with automatic propagation and AbortSignal support.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",