@chidchanun/bcp 0.2.10 → 0.2.11
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 +118 -45
- package/docs/README.md +47 -45
- package/docs/api-manifest.json +13 -1
- package/docs/api-reference.md +59 -15
- package/docs/docs-web-manifest.json +5 -3
- package/docs/platform-manifest.json +15 -4
- package/docs/releases/0.2.11.md +180 -0
- package/docs/workflow-orchestration.md +374 -0
- package/package.json +6 -1
- package/packages/bundler/src/client-boundary.ts +1 -0
- package/packages/client/src/workflow.mjs +601 -0
- package/packages/client/src/workflow.ts +23 -0
- package/packages/server/src/workflow.ts +887 -0
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# BCP Framework
|
|
2
2
|
|
|
3
|
-
BCP Framework is a React full-stack framework for file-based routing, SSR, SPA navigation, server data loading, guarded application flows, API routes, authentication, authorization, database access, background jobs, recurring scheduling, observability, validation, uploads, storage and standalone Node.js production deployment.
|
|
3
|
+
BCP Framework is a React full-stack framework for file-based routing, SSR, SPA navigation, server data loading, guarded application flows, API routes, authentication, authorization, database access, background jobs, recurring scheduling, workflow orchestration, observability, validation, uploads, storage and standalone Node.js production deployment.
|
|
4
4
|
|
|
5
|
-
> **Development target:** `0.2.
|
|
5
|
+
> **Development target:** `0.2.11 — Workflow Orchestration`
|
|
6
6
|
>
|
|
7
|
-
> `0.2.
|
|
7
|
+
> `0.2.11` is an unreleased development target until local validation, RC checks, tagging and npm publication complete.
|
|
8
8
|
|
|
9
9
|
## 0.2 platform
|
|
10
10
|
|
|
11
|
-
`0.2.0` established the Framework Platform baseline, `0.2.1` added the Documentation Platform, `0.2.2` added Configuration & Environment v2, `0.2.3` added Database Platform v2, `0.2.4` added Application Packaging, `0.2.5` added Authentication Platform v2, `0.2.6` added Authorization & Security v2, `0.2.7` added Observability Platform v2, `0.2.8` added Background Jobs Platform, `0.2.9` added recurring scheduling,
|
|
11
|
+
`0.2.0` established the Framework Platform baseline, `0.2.1` added the Documentation Platform, `0.2.2` added Configuration & Environment v2, `0.2.3` added Database Platform v2, `0.2.4` added Application Packaging, `0.2.5` added Authentication Platform v2, `0.2.6` added Authorization & Security v2, `0.2.7` added Observability Platform v2, `0.2.8` added Background Jobs Platform, `0.2.9` added recurring scheduling, `0.2.10` added durable worker leases/DLQ/Redis adapters, and `0.2.11` adds persistent multi-step workflow orchestration.
|
|
12
12
|
|
|
13
13
|
Machine-readable platform contracts:
|
|
14
14
|
|
|
@@ -38,6 +38,7 @@ docs/api-manifest.json
|
|
|
38
38
|
| Background jobs | Delayed jobs, retries/backoff, cancellation, concurrent workers, visibility leases, heartbeat, stale recovery and DLQ |
|
|
39
39
|
| Scheduling | Recurring interval jobs, UTC cron, schedule-store leases and deterministic scheduled run IDs |
|
|
40
40
|
| Durable jobs | Redis-compatible queue/schedule adapters, retention cleanup, requeue and queue statistics |
|
|
41
|
+
| Workflows | Sequential/parallel steps, retries, persisted delays, compensation, run leases and optional queue-backed execution |
|
|
41
42
|
| Observability | Structured logs, counters/gauges/histograms, Prometheus output, request metrics and health/readiness checks |
|
|
42
43
|
| Validation | Typed validators and structured validation errors |
|
|
43
44
|
| Error handling | HTTP error helpers and consistent error responses |
|
|
@@ -319,7 +320,7 @@ Read more: [Job Scheduling Platform](docs/job-scheduling.md)
|
|
|
319
320
|
|
|
320
321
|
## Durable Jobs Platform — 0.2.10
|
|
321
322
|
|
|
322
|
-
Workers
|
|
323
|
+
Workers support visibility leases, heartbeat renewal and stale-running recovery when the configured adapter implements those capabilities:
|
|
323
324
|
|
|
324
325
|
```ts
|
|
325
326
|
const worker =
|
|
@@ -347,36 +348,7 @@ await jobs.requeueDeadLetter(
|
|
|
347
348
|
);
|
|
348
349
|
```
|
|
349
350
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
```ts
|
|
353
|
-
await jobs.recoverStale({
|
|
354
|
-
limit: 100,
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
const stats =
|
|
358
|
-
await jobs.stats();
|
|
359
|
-
|
|
360
|
-
await jobs.cleanup({
|
|
361
|
-
before:
|
|
362
|
-
Date.now() -
|
|
363
|
-
7 * 24 * 60 * 60 * 1000,
|
|
364
|
-
});
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Redis-compatible durable queue
|
|
368
|
-
|
|
369
|
-
BCP does not install a Redis client library. Supply an application-owned client that implements:
|
|
370
|
-
|
|
371
|
-
```ts
|
|
372
|
-
interface RedisCommandClient {
|
|
373
|
-
sendCommand(
|
|
374
|
-
command: string[]
|
|
375
|
-
): Promise<unknown>;
|
|
376
|
-
}
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
Then create the adapters:
|
|
351
|
+
Redis-compatible durable adapters:
|
|
380
352
|
|
|
381
353
|
```ts
|
|
382
354
|
import {
|
|
@@ -411,17 +383,112 @@ export const scheduler =
|
|
|
411
383
|
});
|
|
412
384
|
```
|
|
413
385
|
|
|
414
|
-
|
|
386
|
+
BCP does not read `REDIS_URL` or own the Redis client connection lifecycle automatically.
|
|
387
|
+
|
|
388
|
+
Read more: [Durable Jobs Platform](docs/durable-jobs.md)
|
|
389
|
+
|
|
390
|
+
## Workflow Orchestration — 0.2.11
|
|
391
|
+
|
|
392
|
+
Create a server-only workflow with typed input:
|
|
393
|
+
|
|
394
|
+
```ts
|
|
395
|
+
import {
|
|
396
|
+
createWorkflow,
|
|
397
|
+
} from "bcp/workflow";
|
|
398
|
+
|
|
399
|
+
export const onboarding =
|
|
400
|
+
createWorkflow<{
|
|
401
|
+
userId: number;
|
|
402
|
+
}>(
|
|
403
|
+
"user.onboarding",
|
|
404
|
+
workflow => {
|
|
405
|
+
workflow.step(
|
|
406
|
+
"profile",
|
|
407
|
+
async ({ input }) => {
|
|
408
|
+
await createProfile(
|
|
409
|
+
input.userId
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
workflow.parallel(
|
|
415
|
+
"initialize",
|
|
416
|
+
parallel => {
|
|
417
|
+
parallel.step(
|
|
418
|
+
"preferences",
|
|
419
|
+
createPreferences
|
|
420
|
+
);
|
|
421
|
+
parallel.step(
|
|
422
|
+
"workspace",
|
|
423
|
+
createWorkspace
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
workflow.delay(
|
|
429
|
+
"cooldown",
|
|
430
|
+
1_000
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Per-step retries:
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
workflow.step(
|
|
440
|
+
"charge-card",
|
|
441
|
+
chargeCard,
|
|
442
|
+
{
|
|
443
|
+
maxAttempts: 3,
|
|
444
|
+
retryDelayMs:
|
|
445
|
+
attempt =>
|
|
446
|
+
attempt * 1_000,
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Saga-style compensation:
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
workflow.step(
|
|
455
|
+
"reserve-stock",
|
|
456
|
+
reserveStock,
|
|
457
|
+
{
|
|
458
|
+
compensate:
|
|
459
|
+
releaseStock,
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
```
|
|
415
463
|
|
|
416
|
-
A
|
|
464
|
+
A failed run can be compensated in reverse completion order:
|
|
417
465
|
|
|
418
|
-
```
|
|
419
|
-
|
|
466
|
+
```ts
|
|
467
|
+
await onboarding.compensate(
|
|
468
|
+
runId
|
|
469
|
+
);
|
|
420
470
|
```
|
|
421
471
|
|
|
422
|
-
|
|
472
|
+
For durable execution, supply an existing BCP job queue and a shared workflow store:
|
|
423
473
|
|
|
424
|
-
|
|
474
|
+
```ts
|
|
475
|
+
export const fulfillment =
|
|
476
|
+
createWorkflow(
|
|
477
|
+
"order.fulfillment",
|
|
478
|
+
defineWorkflow,
|
|
479
|
+
{
|
|
480
|
+
queue: jobs,
|
|
481
|
+
store:
|
|
482
|
+
workflowStore,
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
With a queue configured, `start()`, `retry()`, `resume()` and delay continuations execute through `bcp/jobs`. `WorkflowStore.claim()` is the atomic run-level concurrency boundary for multi-instance deployments.
|
|
488
|
+
|
|
489
|
+
The built-in `createMemoryWorkflowStore()` is intended for local development and tests. External side effects should remain idempotent because durable job delivery is at-least-once.
|
|
490
|
+
|
|
491
|
+
Read more: [Workflow Orchestration](docs/workflow-orchestration.md)
|
|
425
492
|
|
|
426
493
|
## Public entrypoints
|
|
427
494
|
|
|
@@ -437,6 +504,7 @@ bcp/error
|
|
|
437
504
|
bcp/database
|
|
438
505
|
bcp/auth
|
|
439
506
|
bcp/jobs
|
|
507
|
+
bcp/workflow
|
|
440
508
|
bcp/observability
|
|
441
509
|
bcp/server
|
|
442
510
|
bcp/server-only
|
|
@@ -498,7 +566,11 @@ loaders / actions / API routes
|
|
|
498
566
|
SSR / application responses
|
|
499
567
|
|
|
500
568
|
Operational side channels:
|
|
501
|
-
|
|
569
|
+
workflow orchestration
|
|
570
|
+
↓
|
|
571
|
+
shared jobs + scheduler
|
|
572
|
+
↓
|
|
573
|
+
workers + structured logs + metrics + health/readiness
|
|
502
574
|
```
|
|
503
575
|
|
|
504
576
|
Raw standalone build:
|
|
@@ -540,7 +612,7 @@ npm run test:e2e
|
|
|
540
612
|
npm run rc:check
|
|
541
613
|
```
|
|
542
614
|
|
|
543
|
-
`0.2.
|
|
615
|
+
`0.2.11` adds Workflow Orchestration unit and prepared-package smoke checks covering sequential/parallel execution, retries, persisted delay/resume behavior, compensation, queue-backed continuation, run leases, browser boundary enforcement and the compiled `bcp/workflow` runtime.
|
|
544
616
|
|
|
545
617
|
Do not tag or publish until the final release commit passes the complete RC sequence.
|
|
546
618
|
|
|
@@ -565,12 +637,13 @@ Do not tag or publish until the final release commit passes the complete RC sequ
|
|
|
565
637
|
| `0.2.8` | Background Jobs Platform |
|
|
566
638
|
| `0.2.9` | Job Scheduling Platform |
|
|
567
639
|
| `0.2.10` | Durable Jobs Platform |
|
|
640
|
+
| `0.2.11` | Workflow Orchestration |
|
|
568
641
|
|
|
569
642
|
## Roadmap
|
|
570
643
|
|
|
571
|
-
`0.2.
|
|
644
|
+
`0.2.11 — Workflow Orchestration` establishes persistent multi-step backend workflows on top of the provider-neutral jobs foundation.
|
|
572
645
|
|
|
573
|
-
|
|
646
|
+
The next logical `0.2.x` milestone is transactional outbox/event delivery so a database change and later asynchronous workflow/job publication can be coordinated without pretending a Redis publish is part of the database transaction. Realtime, testing, plugin/module and broader deployment work remain later roadmap items. Native `.exe`, desktop and mobile compilation remain later roadmap work.
|
|
574
647
|
|
|
575
648
|
## License
|
|
576
649
|
|
package/docs/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `docs/` directory is the documentation source of truth for BCP Framework and is organized for **`bcp-docs-web`**.
|
|
4
4
|
|
|
5
|
-
> **Documentation target:** BCP Framework `0.2.
|
|
5
|
+
> **Documentation target:** BCP Framework `0.2.11 — Workflow Orchestration`
|
|
6
6
|
>
|
|
7
7
|
> **Release state:** unreleased development target until RC validation, tagging and npm publication complete.
|
|
8
8
|
|
|
@@ -38,56 +38,54 @@ Framework source and tests remain authoritative for runtime behavior.
|
|
|
38
38
|
| `0.2.8` | Background Jobs Platform |
|
|
39
39
|
| `0.2.9` | Job Scheduling Platform |
|
|
40
40
|
| `0.2.10` | Durable Jobs Platform |
|
|
41
|
+
| `0.2.11` | Workflow Orchestration |
|
|
41
42
|
|
|
42
|
-
## 0.2.
|
|
43
|
+
## 0.2.11 — Workflow Orchestration
|
|
43
44
|
|
|
44
|
-
`0.2.
|
|
45
|
+
`0.2.11` adds a new server-only `bcp/workflow` public entrypoint for persistent multi-step backend orchestration.
|
|
45
46
|
|
|
46
47
|
New/updated documentation sources:
|
|
47
48
|
|
|
48
49
|
| Source | Purpose |
|
|
49
50
|
| --- | --- |
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `releases/0.2.10.md` | Durable Jobs Platform release notes |
|
|
51
|
+
| `workflow-orchestration.md` | Workflow definition, persistence, delays, retries, queue execution and compensation |
|
|
52
|
+
| `durable-jobs.md` | Durable execution layer used by queue-backed workflows |
|
|
53
|
+
| `api-reference.md` | Public `bcp/workflow` APIs |
|
|
54
|
+
| `platform-manifest.json` | Workflow capability flags and public entrypoint |
|
|
55
|
+
| `api-manifest.json` | `bcp/workflow` source/guide ownership |
|
|
56
|
+
| `docs-web-manifest.json` | Workflow docs navigation and `0.2.11` release route |
|
|
57
|
+
| `releases/0.2.11.md` | Workflow Orchestration release notes |
|
|
58
58
|
|
|
59
|
-
Primary
|
|
59
|
+
Primary APIs:
|
|
60
60
|
|
|
61
61
|
```ts
|
|
62
62
|
import {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} from "bcp/jobs";
|
|
63
|
+
createMemoryWorkflowStore,
|
|
64
|
+
createWorkflow,
|
|
65
|
+
} from "bcp/workflow";
|
|
67
66
|
```
|
|
68
67
|
|
|
69
68
|
Runtime model:
|
|
70
69
|
|
|
71
70
|
```text
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
shared JobScheduleStore lease
|
|
71
|
+
application / API
|
|
72
|
+
|
|
|
73
|
+
v
|
|
74
|
+
WorkflowStore
|
|
75
|
+
|
|
|
76
|
+
v
|
|
77
|
+
BCP Workflow
|
|
78
|
+
|
|
|
79
|
+
+--> sequential steps
|
|
80
|
+
+--> parallel groups
|
|
81
|
+
+--> retry / delay
|
|
82
|
+
+--> compensation
|
|
83
|
+
|
|
|
84
|
+
v
|
|
85
|
+
optional durable bcp/jobs queue
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
The memory workflow store is local-only. Multi-instance deployments should implement a shared durable `WorkflowStore` whose `claim()` method atomically leases one run to one executor.
|
|
91
89
|
|
|
92
90
|
## Update rule
|
|
93
91
|
|
|
@@ -114,10 +112,11 @@ Important current routes:
|
|
|
114
112
|
| `/docs/background-jobs` | `background-jobs.md` |
|
|
115
113
|
| `/docs/job-scheduling` | `job-scheduling.md` |
|
|
116
114
|
| `/docs/durable-jobs` | `durable-jobs.md` |
|
|
115
|
+
| `/docs/workflow-orchestration` | `workflow-orchestration.md` |
|
|
117
116
|
| `/docs/application-packaging` | `application-packaging.md` |
|
|
118
117
|
| `/docs/database` | `database.md` |
|
|
119
118
|
| `/docs/api-reference` | `api-reference.md` |
|
|
120
|
-
| `/releases/0.2.
|
|
119
|
+
| `/releases/0.2.11` | `releases/0.2.11.md` |
|
|
121
120
|
|
|
122
121
|
Every route/source pair is validated by unit tests.
|
|
123
122
|
|
|
@@ -135,6 +134,7 @@ bcp/error
|
|
|
135
134
|
bcp/database
|
|
136
135
|
bcp/auth
|
|
137
136
|
bcp/jobs
|
|
137
|
+
bcp/workflow
|
|
138
138
|
bcp/observability
|
|
139
139
|
bcp/server
|
|
140
140
|
bcp/server-only
|
|
@@ -145,7 +145,7 @@ The API-manifest entrypoint set must match the platform public-entrypoint set ex
|
|
|
145
145
|
|
|
146
146
|
## Release validation
|
|
147
147
|
|
|
148
|
-
Before publishing `0.2.
|
|
148
|
+
Before publishing `0.2.11`:
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
151
|
npm run typecheck
|
|
@@ -156,16 +156,18 @@ npm run test:e2e
|
|
|
156
156
|
npm run rc:check
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
159
|
+
Workflow Orchestration validation covers:
|
|
160
|
+
|
|
161
|
+
- sequential step execution,
|
|
162
|
+
- step retries,
|
|
163
|
+
- parallel child execution/state,
|
|
164
|
+
- persisted delay/resume behavior,
|
|
165
|
+
- manual retry,
|
|
166
|
+
- reverse-order compensation,
|
|
167
|
+
- queue-backed execution and delayed continuation,
|
|
168
|
+
- workflow store run leases,
|
|
169
|
+
- server-only client boundary enforcement,
|
|
170
|
+
- compiled `workflow.mjs` package execution,
|
|
169
171
|
- docs/platform/API version parity.
|
|
170
172
|
|
|
171
173
|
The final release tag must point to the exact commit that passed the complete RC sequence.
|
package/docs/api-manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.11",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
6
|
"coverage": "public-entrypoints",
|
|
7
7
|
"entrypoints": [
|
|
@@ -107,6 +107,18 @@
|
|
|
107
107
|
"/docs/observability"
|
|
108
108
|
]
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
"package": "bcp/workflow",
|
|
112
|
+
"source": "packages/client/src/workflow.ts",
|
|
113
|
+
"environment": "server",
|
|
114
|
+
"route": "/docs/api-reference#bcp-workflow",
|
|
115
|
+
"summary": "Persistent workflow orchestration with sequential and parallel steps, retries, delays, compensation, run leases and optional durable queue execution.",
|
|
116
|
+
"guides": [
|
|
117
|
+
"/docs/workflow-orchestration",
|
|
118
|
+
"/docs/durable-jobs",
|
|
119
|
+
"/docs/observability"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
110
122
|
{
|
|
111
123
|
"package": "bcp/observability",
|
|
112
124
|
"source": "packages/client/src/observability.ts",
|
package/docs/api-reference.md
CHANGED
|
@@ -133,21 +133,7 @@ import {
|
|
|
133
133
|
|
|
134
134
|
### Queue lifecycle
|
|
135
135
|
|
|
136
|
-
`createJobQueue()` supports
|
|
137
|
-
|
|
138
|
-
```text
|
|
139
|
-
immediate/delayed enqueue
|
|
140
|
-
retry/backoff
|
|
141
|
-
cancellation
|
|
142
|
-
manual processNext()
|
|
143
|
-
worker concurrency
|
|
144
|
-
visibility timeout
|
|
145
|
-
heartbeat lease renewal
|
|
146
|
-
stale-running recovery
|
|
147
|
-
DLQ inspection/requeue
|
|
148
|
-
terminal retention cleanup
|
|
149
|
-
queue statistics
|
|
150
|
-
```
|
|
136
|
+
`createJobQueue()` supports immediate/delayed enqueue, retry/backoff, cancellation, manual `processNext()`, worker concurrency, visibility timeout, heartbeat lease renewal, stale-running recovery, DLQ inspection/requeue, terminal retention cleanup and queue statistics.
|
|
151
137
|
|
|
152
138
|
Durable adapter methods such as `heartbeat()`, `recoverStale()`, `listDeadLetters()`, `requeueDeadLetter()`, `cleanup()` and `stats()` are optional so earlier `JobQueueAdapter` implementations remain compatible.
|
|
153
139
|
|
|
@@ -181,6 +167,64 @@ The processing model is at-least-once. Handlers that perform non-idempotent exte
|
|
|
181
167
|
|
|
182
168
|
Related guides: [Background Jobs Platform](background-jobs.md), [Job Scheduling Platform](job-scheduling.md), [Durable Jobs Platform](durable-jobs.md), [Observability Platform v2](observability.md).
|
|
183
169
|
|
|
170
|
+
## `bcp/workflow`
|
|
171
|
+
|
|
172
|
+
Server-only Workflow Orchestration APIs added in `0.2.11`.
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import {
|
|
176
|
+
createMemoryWorkflowStore,
|
|
177
|
+
createWorkflow,
|
|
178
|
+
type CancelWorkflowOptions,
|
|
179
|
+
type MemoryWorkflowStore,
|
|
180
|
+
type ResumeWorkflowOptions,
|
|
181
|
+
type StartWorkflowOptions,
|
|
182
|
+
type Workflow,
|
|
183
|
+
type WorkflowBuilder,
|
|
184
|
+
type WorkflowCompensationHandler,
|
|
185
|
+
type WorkflowOptions,
|
|
186
|
+
type WorkflowParallelBuilder,
|
|
187
|
+
type WorkflowRetryDelay,
|
|
188
|
+
type WorkflowRunRecord,
|
|
189
|
+
type WorkflowRunState,
|
|
190
|
+
type WorkflowStepContext,
|
|
191
|
+
type WorkflowStepHandler,
|
|
192
|
+
type WorkflowStepKind,
|
|
193
|
+
type WorkflowStepOptions,
|
|
194
|
+
type WorkflowStepRecord,
|
|
195
|
+
type WorkflowStepState,
|
|
196
|
+
type WorkflowStore,
|
|
197
|
+
} from "bcp/workflow";
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`createWorkflow()` defines a persistent server-side workflow with sequential steps, parallel groups, per-step retry policies, persisted delays and compensation handlers.
|
|
201
|
+
|
|
202
|
+
Workflow controls include:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
start()
|
|
206
|
+
run()
|
|
207
|
+
get()
|
|
208
|
+
list()
|
|
209
|
+
resume()
|
|
210
|
+
retry()
|
|
211
|
+
cancel()
|
|
212
|
+
compensate()
|
|
213
|
+
close()
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Without a queue, workflow execution runs in the current process until it succeeds, fails, is cancelled or reaches a persisted delay.
|
|
217
|
+
|
|
218
|
+
When an existing `BackgroundJobQueue` is passed through `WorkflowOptions.queue`, workflow execution is submitted through `bcp/jobs`. Delay steps enqueue delayed continuation jobs instead of holding a long-running timer.
|
|
219
|
+
|
|
220
|
+
`WorkflowStore` is the workflow persistence boundary. Its `claim()` / `release()` methods form the run-level lease contract for shared multi-instance stores.
|
|
221
|
+
|
|
222
|
+
`createMemoryWorkflowStore()` is intended for development and deterministic tests. Production multi-instance applications should implement a shared durable store with atomic `claim()` behavior.
|
|
223
|
+
|
|
224
|
+
Compensation is saga-style and executes successful compensatable steps in reverse completion order. It does not turn external services into one distributed database transaction.
|
|
225
|
+
|
|
226
|
+
Related guides: [Workflow Orchestration](workflow-orchestration.md), [Durable Jobs Platform](durable-jobs.md), [Observability Platform v2](observability.md).
|
|
227
|
+
|
|
184
228
|
## `bcp/observability`
|
|
185
229
|
|
|
186
230
|
Server-only Observability Platform v2 APIs for process-local counters, gauges, histograms, Prometheus exposition, request metrics middleware and health/readiness checks.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"versionTarget": "0.2.
|
|
4
|
+
"versionTarget": "0.2.11",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
6
|
"sections": [
|
|
7
7
|
{
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
{
|
|
58
58
|
"id": "runtime",
|
|
59
59
|
"title": "Runtime & Infrastructure",
|
|
60
|
-
"description": "Middleware, durable background jobs, scheduling, observability, logging, caching, security and production hardening.",
|
|
60
|
+
"description": "Middleware, durable background jobs, scheduling, workflow orchestration, observability, logging, caching, security and production hardening.",
|
|
61
61
|
"pages": [
|
|
62
62
|
{ "route": "/docs/middleware", "source": "middleware.md", "title": "Middleware" },
|
|
63
63
|
{ "route": "/docs/hydration", "source": "hydration.md", "title": "Hydration" },
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
{ "route": "/docs/background-jobs", "source": "background-jobs.md", "title": "Background Jobs Platform" },
|
|
67
67
|
{ "route": "/docs/job-scheduling", "source": "job-scheduling.md", "title": "Job Scheduling Platform" },
|
|
68
68
|
{ "route": "/docs/durable-jobs", "source": "durable-jobs.md", "title": "Durable Jobs Platform" },
|
|
69
|
+
{ "route": "/docs/workflow-orchestration", "source": "workflow-orchestration.md", "title": "Workflow Orchestration" },
|
|
69
70
|
{ "route": "/docs/caching", "source": "caching.md", "title": "Caching" },
|
|
70
71
|
{ "route": "/docs/security", "source": "security.md", "title": "Security" },
|
|
71
72
|
{ "route": "/docs/production-hardening", "source": "production-hardening.md", "title": "Production Hardening" }
|
|
@@ -111,7 +112,8 @@
|
|
|
111
112
|
}
|
|
112
113
|
],
|
|
113
114
|
"releases": [
|
|
114
|
-
{ "route": "/releases/0.2.
|
|
115
|
+
{ "route": "/releases/0.2.11", "source": "releases/0.2.11.md", "version": "0.2.11", "state": "unreleased" },
|
|
116
|
+
{ "route": "/releases/0.2.10", "source": "releases/0.2.10.md", "version": "0.2.10" },
|
|
115
117
|
{ "route": "/releases/0.2.9", "source": "releases/0.2.9.md", "version": "0.2.9" },
|
|
116
118
|
{ "route": "/releases/0.2.8", "source": "releases/0.2.8.md", "version": "0.2.8" },
|
|
117
119
|
{ "route": "/releases/0.2.7", "source": "releases/0.2.7.md", "version": "0.2.7" },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.11",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
|
-
"baseline": "
|
|
6
|
+
"baseline": "workflow-orchestration",
|
|
7
7
|
"runtime": {
|
|
8
8
|
"node": ">=24.11.0",
|
|
9
9
|
"react": "19",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"bcp/database",
|
|
21
21
|
"bcp/auth",
|
|
22
22
|
"bcp/jobs",
|
|
23
|
+
"bcp/workflow",
|
|
23
24
|
"bcp/observability",
|
|
24
25
|
"bcp/server",
|
|
25
26
|
"bcp/server-only",
|
|
@@ -90,6 +91,15 @@
|
|
|
90
91
|
"deadLetterRequeue": true,
|
|
91
92
|
"jobRetentionCleanup": true,
|
|
92
93
|
"jobQueueStatistics": true,
|
|
94
|
+
"workflowOrchestration": true,
|
|
95
|
+
"workflowStoreContract": true,
|
|
96
|
+
"workflowRunLeases": true,
|
|
97
|
+
"workflowSequentialSteps": true,
|
|
98
|
+
"workflowParallelSteps": true,
|
|
99
|
+
"workflowStepRetries": true,
|
|
100
|
+
"workflowDelays": true,
|
|
101
|
+
"workflowCompensation": true,
|
|
102
|
+
"workflowQueueExecution": true,
|
|
93
103
|
"databaseMigrations": true,
|
|
94
104
|
"databaseAdapterContract": true,
|
|
95
105
|
"databasePostgresql": true,
|
|
@@ -129,7 +139,7 @@
|
|
|
129
139
|
"s3-compatible"
|
|
130
140
|
],
|
|
131
141
|
"compatibility": {
|
|
132
|
-
"previousBaseline": "0.2.
|
|
142
|
+
"previousBaseline": "0.2.10",
|
|
133
143
|
"intentionalBreakingChangesFromPreviousBaseline": false,
|
|
134
144
|
"migrationGuide": "migration-0.2.md"
|
|
135
145
|
},
|
|
@@ -149,7 +159,8 @@
|
|
|
149
159
|
"backgroundJobs": "background-jobs.md",
|
|
150
160
|
"jobScheduling": "job-scheduling.md",
|
|
151
161
|
"durableJobs": "durable-jobs.md",
|
|
162
|
+
"workflowOrchestration": "workflow-orchestration.md",
|
|
152
163
|
"migrationGuide": "migration-0.2.md",
|
|
153
|
-
"releaseNotes": "releases/0.2.
|
|
164
|
+
"releaseNotes": "releases/0.2.11.md"
|
|
154
165
|
}
|
|
155
166
|
}
|