@bluelibs/runner 5.2.0 → 5.2.1
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 +19 -9
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +1 -0
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.mjs +1 -1
- package/dist/node/node.mjs.map +1 -1
- package/dist/types/defs.d.ts +1 -0
- package/dist/types/node/node.d.ts +2 -1
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
### Explicit TypeScript Dependency Injection Toolkit
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Build apps from tasks and resources with explicit dependencies, predictable lifecycle, and first-class testing**
|
|
6
6
|
|
|
7
|
-
Runner is a TypeScript-first
|
|
8
|
-
|
|
7
|
+
Runner is a TypeScript-first toolkit for building an `app` out of small, typed building blocks. You can find more details and a visual overview at [runner.bluelibs.com](https://runner.bluelibs.com/).
|
|
8
|
+
|
|
9
|
+
- **Tasks**: async functions with explicit `dependencies`, middleware, and input/output validation
|
|
10
|
+
- **Resources**: singletons with `init`/`dispose` lifecycle (databases, clients, servers, caches)
|
|
11
|
+
- **Reliability Middleware**: built-in `retry`, `timeout`, `circuitBreaker`, `cache`, and `rateLimit`
|
|
12
|
+
- **HTTP Tunnels**: cross-process execution (the "Distributed Monolith") with zero call-site changes
|
|
13
|
+
- **Durable Workflows**: persistent, crash-recoverable async logic for Node.js
|
|
14
|
+
- **Events & hooks**: typed signals and subscribers for decoupling
|
|
15
|
+
- **Runtime control**: run, observe, test, and dispose your `app` predictably
|
|
16
|
+
|
|
17
|
+
The goal is simple: keep dependencies explicit, keep lifecycle predictable, and make your runtime easy to control in production and in tests.
|
|
9
18
|
|
|
10
19
|
<p align="center">
|
|
11
20
|
<a href="https://github.com/bluelibs/runner/actions/workflows/ci.yml"><img src="https://github.com/bluelibs/runner/actions/workflows/ci.yml/badge.svg?branch=main" alt="Build Status" /></a>
|
|
@@ -16,7 +25,7 @@ Runner is a TypeScript-first framework for building applications from tasks (fun
|
|
|
16
25
|
</p>
|
|
17
26
|
|
|
18
27
|
```typescript
|
|
19
|
-
import { r, run } from "@bluelibs/runner";
|
|
28
|
+
import { r, run, globals } from "@bluelibs/runner";
|
|
20
29
|
import { z } from "zod";
|
|
21
30
|
|
|
22
31
|
const db = r
|
|
@@ -40,10 +49,11 @@ const mailer = r
|
|
|
40
49
|
}))
|
|
41
50
|
.build();
|
|
42
51
|
|
|
43
|
-
// Define a task with dependencies,
|
|
52
|
+
// Define a task with dependencies, middleware, and zod validation
|
|
44
53
|
const createUser = r
|
|
45
54
|
.task("users.create")
|
|
46
55
|
.dependencies({ db, mailer })
|
|
56
|
+
.middleware([globals.middleware.task.retry.with({ attempts: 3 })])
|
|
47
57
|
.inputSchema(z.object({ name: z.string(), email: z.string().email() }))
|
|
48
58
|
.run(async (input, { db, mailer }) => {
|
|
49
59
|
const user = await db.users.insert(input);
|
|
@@ -63,7 +73,7 @@ await runtime.runTask(createUser, { name: "Ada", email: "ada@example.com" });
|
|
|
63
73
|
|
|
64
74
|
| Resource | Type | Description |
|
|
65
75
|
| ------------------------------------------------------------------------------------------------------------------- | ------- | ----------------------------------- |
|
|
66
|
-
| [
|
|
76
|
+
| [Official Website & Documentation](https://runner.bluelibs.com/) | Website | Overview and features |
|
|
67
77
|
| [GitHub Repository](https://github.com/bluelibs/runner) | GitHub | Source code, issues, and releases |
|
|
68
78
|
| [Runner Dev Tools](https://github.com/bluelibs/runner-dev) | GitHub | Development CLI and tooling |
|
|
69
79
|
| [API Documentation](https://bluelibs.github.io/runner/) | Docs | TypeDoc-generated reference |
|
|
@@ -91,9 +101,9 @@ await runtime.runTask(createUser, { name: "Ada", email: "ada@example.com" });
|
|
|
91
101
|
|
|
92
102
|
## Platform Support (Quick Summary)
|
|
93
103
|
|
|
94
|
-
| Capability
|
|
95
|
-
|
|
|
96
|
-
| Core runtime (tasks/resources/events/hooks) | Full | Full | Full | Platform adapters hide runtime differences |
|
|
104
|
+
| Capability | Node.js | Browser | Edge | Notes |
|
|
105
|
+
| ------------------------------------------------------- | ------- | ------- | ---- | ------------------------------------------ |
|
|
106
|
+
| Core runtime (tasks/resources/middleware/events/hooks) | Full | Full | Full | Platform adapters hide runtime differences |
|
|
97
107
|
| Async Context (`r.asyncContext`) | Full | None | None | Requires Node.js `AsyncLocalStorage` |
|
|
98
108
|
| Durable workflows (`@bluelibs/runner/node`) | Full | None | None | Node-only module |
|
|
99
109
|
| Tunnels client (`createExposureFetch`) | Full | Full | Full | Requires `fetch` |
|