@bluelibs/runner 5.3.0 → 5.4.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/dist/browser/index.cjs +829 -742
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs +828 -743
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs +829 -742
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs +828 -743
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +1462 -1706
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.mjs +1459 -1659
- package/dist/node/node.mjs.map +1 -1
- package/dist/types/definers/builders/event/utils.d.ts +1 -4
- package/dist/types/definers/builders/hook/utils.d.ts +1 -4
- package/dist/types/definers/builders/middleware/utils.d.ts +1 -4
- package/dist/types/definers/builders/resource/utils.d.ts +1 -4
- package/dist/types/definers/builders/shared/mergeUtils.d.ts +5 -0
- package/dist/types/definers/builders/task/utils.d.ts +1 -4
- package/dist/types/definers/builders/utils.d.ts +1 -1
- package/dist/types/errors.d.ts +20 -21
- package/dist/types/models/DependencyProcessor.d.ts +1 -1
- package/dist/types/models/MiddlewareManager.d.ts +2 -2
- package/dist/types/models/RunResult.d.ts +1 -1
- package/dist/types/models/Store.d.ts +10 -10
- package/dist/types/models/StoreRegistry.d.ts +14 -13
- package/dist/types/models/middleware/ResourceMiddlewareComposer.d.ts +2 -2
- package/dist/types/models/utils/buildDependencyGraph.d.ts +12 -0
- package/dist/types/models/utils/dependencyStrategies.d.ts +15 -0
- package/dist/types/models/utils/disposeOrder.d.ts +7 -0
- package/dist/types/node/durable/core/DurableResource.d.ts +1 -0
- package/dist/types/node/durable/core/resource.d.ts +5 -5
- package/dist/types/node/durable/resources/memoryDurableResource.d.ts +5 -5
- package/dist/types/node/durable/resources/redisDurableResource.d.ts +5 -5
- package/dist/types/node/durable/tags/durableWorkflow.tag.d.ts +6 -1
- package/dist/types/node/exposure/requestContext.d.ts +1 -1
- package/dist/types/node/exposure/resource.d.ts +7 -7
- package/dist/types/node/http/http-mixed-client.factory.resource.d.ts +1 -1
- package/dist/types/node/http/http-smart-client.factory.resource.d.ts +1 -1
- package/dist/types/node/node.d.ts +1 -184
- package/dist/types/platform/adapters/edge.d.ts +17 -0
- package/dist/types/platform/adapters/universal-generic.d.ts +3 -0
- package/dist/types/platform/index.d.ts +1 -0
- package/dist/types/platform/types.d.ts +7 -1
- package/dist/types/public.d.ts +2 -0
- package/dist/types/tools/LockableMap.d.ts +20 -0
- package/dist/types/types/symbols.d.ts +1 -1
- package/dist/types/types/task.d.ts +1 -1
- package/dist/ui/assets/index-Bo7Gi6Vq.js +141 -0
- package/dist/ui/assets/index-Y_9aLumt.css +1 -0
- package/dist/ui/index.html +2 -3
- package/dist/universal/index.cjs +829 -742
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.mjs +828 -743
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +1 -2
- package/readmes/AI.md +34 -3
- package/dist/ui/assets/index-2cb8f39f.js +0 -141
- package/dist/ui/assets/index-b1f988bf.css +0 -1
- /package/dist/types/{tunnels → tools}/buildUniversalManifest.d.ts +0 -0
- /package/dist/types/{processHooks.d.ts → tools/processShutdownHooks.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluelibs/runner",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "BlueLibs Runner",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/universal/index.cjs",
|
|
@@ -110,7 +110,6 @@
|
|
|
110
110
|
"@types/benchmark": "^2.1.5",
|
|
111
111
|
"@types/busboy": "^1.5.4",
|
|
112
112
|
"@types/express": "^5.0.3",
|
|
113
|
-
"@types/graphql": "^0.11.3",
|
|
114
113
|
"@types/jest": "^27.0.0",
|
|
115
114
|
"@types/node": "^20.0.0",
|
|
116
115
|
"@typescript-eslint/eslint-plugin": "8.39.0",
|
package/readmes/AI.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
For the landing overview, see [README.md](../README.md). For the complete guide, see [FULL_GUIDE.md](./FULL_GUIDE.md).
|
|
6
6
|
|
|
7
|
-
**Durable Workflows (Node-only):** For persistence and crash recovery, see `DURABLE_WORKFLOWS.md`. Includes `ctx.switch()` (replay-safe branching)
|
|
7
|
+
**Durable Workflows (Node-only):** For persistence and crash recovery, see `DURABLE_WORKFLOWS.md`. Includes `ctx.switch()` (replay-safe branching), `durable.describe()` (DI-accurate flow shape export), and `durableWorkflowTag.defaults` (default input for `describe(task)` when omitted) — see `DURABLE_WORKFLOWS_AI.md` for quick reference.
|
|
8
8
|
|
|
9
9
|
## Serializer Safety
|
|
10
10
|
|
|
@@ -298,9 +298,9 @@ const getUser = r
|
|
|
298
298
|
|
|
299
299
|
## Async Context
|
|
300
300
|
|
|
301
|
-
Async Context provides per-request/thread-local state via the platform's `AsyncLocalStorage` (Node). Use the fluent builder under `r.asyncContext` or the classic `asyncContext({ ... })` export.
|
|
301
|
+
Async Context provides per-request/thread-local state via the platform's `AsyncLocalStorage` (Node, and Deno when `AsyncLocalStorage` is available). Use the fluent builder under `r.asyncContext` or the classic `asyncContext({ ... })` export.
|
|
302
302
|
|
|
303
|
-
> **Platform Note**: `AsyncLocalStorage
|
|
303
|
+
> **Platform Note**: Async Context requires `AsyncLocalStorage`. It is available in Node.js and Deno (when exposed), and unavailable in browser runtimes.
|
|
304
304
|
|
|
305
305
|
```ts
|
|
306
306
|
import { r } from "@bluelibs/runner";
|
|
@@ -339,6 +339,37 @@ const whoAmI = r
|
|
|
339
339
|
const app = r.resource("app").register([requestContext, whoAmI]).build();
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
+
## Queue
|
|
343
|
+
|
|
344
|
+
`Queue` is a cooperative FIFO task queue. Tasks run one-after-another, with dead-lock detection and graceful disposal.
|
|
345
|
+
|
|
346
|
+
The global resource `globals.resources.queue` provides a named queue factory — each `id` gets its own isolated `Queue` instance.
|
|
347
|
+
|
|
348
|
+
**Key methods:**
|
|
349
|
+
|
|
350
|
+
- `queue.run(id, task)` — schedule `task` (receives an `AbortSignal`) on the queue identified by `id`; creates the queue lazily.
|
|
351
|
+
|
|
352
|
+
**Event lifecycle:** `enqueue` → `start` → `finish` | `error`. On disposal: `disposed`. On cancel: `cancel`.
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
import { r, run, globals } from "@bluelibs/runner";
|
|
356
|
+
|
|
357
|
+
const processOrder = r
|
|
358
|
+
.task("app.tasks.processOrder")
|
|
359
|
+
.dependencies({ queue: globals.resources.queue })
|
|
360
|
+
.run(async (input: { orderId: string }, { queue }) => {
|
|
361
|
+
// Tasks with the same orderId run sequentially
|
|
362
|
+
return queue.run(input.orderId, async (signal) => {
|
|
363
|
+
if (signal.aborted) return;
|
|
364
|
+
// ... process order
|
|
365
|
+
return { processed: true };
|
|
366
|
+
});
|
|
367
|
+
})
|
|
368
|
+
.build();
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
For advanced usage, import `Queue` directly and use `on(type, handler)` / `once(type, handler)` to observe lifecycle events. Call `dispose({ cancel: true })` to abort in-flight work via the `AbortSignal`.
|
|
372
|
+
|
|
342
373
|
## Errors
|
|
343
374
|
|
|
344
375
|
Define typed, namespaced errors with a fluent builder. Built helpers expose `throw` and `is`:
|