@camunda8/orchestration-cluster-api 10.0.0-alpha.42 → 10.0.0-alpha.44
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/CHANGELOG.md +14 -0
- package/README.md +114 -20
- package/dist/{CamundaClient-BdWYcKHb.d.cts → CamundaClient-Cm0dssvE.d.cts} +309 -41
- package/dist/{CamundaClient-2kGcsFZx.d.ts → CamundaClient-pcUQlGFl.d.ts} +309 -41
- package/dist/{chunk-4F4DVIJW.js → chunk-AJLLDG7R.js} +56 -11
- package/dist/{chunk-4F4DVIJW.js.map → chunk-AJLLDG7R.js.map} +1 -1
- package/dist/effect/index.cjs +86 -42
- package/dist/effect/index.cjs.map +1 -1
- package/dist/effect/index.d.cts +1 -1
- package/dist/effect/index.d.ts +1 -1
- package/dist/effect/index.js +1 -1
- package/dist/index.cjs +187 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +48 -2
- package/dist/index.js.map +1 -1
- package/dist/{zod.gen-2PU225MP.js → zod.gen-SZTQQ6VL.js} +85 -41
- package/dist/zod.gen-SZTQQ6VL.js.map +1 -0
- package/package.json +2 -2
- package/dist/zod.gen-2PU225MP.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [10.0.0-alpha.44](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.43...v10.0.0-alpha.44) (2026-09-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* regenerate and update agentInstance examples ([#501](https://github.com/camunda/orchestration-cluster-api-js/issues/501)) ([093ffca](https://github.com/camunda/orchestration-cluster-api-js/commit/093ffca9593205585e197daa07fdd8909009fde7))
|
|
7
|
+
|
|
8
|
+
# [10.0.0-alpha.43](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.42...v10.0.0-alpha.43) (2026-08-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* bind SDK cadence to the engine clock with createEngineClock ([#482](https://github.com/camunda/orchestration-cluster-api-js/issues/482)) ([8770212](https://github.com/camunda/orchestration-cluster-api-js/commit/8770212210097606b3400b8b98b6d2b452b1ff83)), closes [#450](https://github.com/camunda/orchestration-cluster-api-js/issues/450) [#450](https://github.com/camunda/orchestration-cluster-api-js/issues/450) [#467](https://github.com/camunda/orchestration-cluster-api-js/issues/467) [#474](https://github.com/camunda/orchestration-cluster-api-js/issues/474) [#476](https://github.com/camunda/orchestration-cluster-api-js/issues/476) [#477](https://github.com/camunda/orchestration-cluster-api-js/issues/477) [#479](https://github.com/camunda/orchestration-cluster-api-js/issues/479)
|
|
14
|
+
|
|
1
15
|
# [10.0.0-alpha.42](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.41...v10.0.0-alpha.42) (2026-08-27)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -155,20 +155,11 @@ await camunda.createDeployment({
|
|
|
155
155
|
|
|
156
156
|
## Migrating from 8.9
|
|
157
157
|
|
|
158
|
-
SDK 10.x (for Camunda 8.10) promotes several identifier
|
|
158
|
+
SDK 10.x (for Camunda 8.10) promotes several identifier fields from plain `string` to **branded types**, changes the `getResourceContent` response from a string to an object, and makes `BatchOperationItemResponse.processInstanceKey` nullable. Nothing was removed or renamed, and the wire format is unchanged.
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
**→ See [MIGRATION.md](./MIGRATION.md) for the full guide**, including the complete list of affected fields.
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|-------|----------|
|
|
164
|
-
| `RoleId` | Role identifiers |
|
|
165
|
-
| `GroupId` | Group identifiers |
|
|
166
|
-
| `ClientId` | OAuth client identifiers |
|
|
167
|
-
| `MappingRuleId` | Mapping-rule identifiers |
|
|
168
|
-
| `ClusterVariableName` | Cluster variable names |
|
|
169
|
-
| `AgentInstanceKey` | Agent-instance system keys |
|
|
170
|
-
|
|
171
|
-
### Migration
|
|
162
|
+
The common case is branding an identifier at the boundary:
|
|
172
163
|
|
|
173
164
|
<!-- snippet-source: examples/readme.ts | regions: V9ToV10Migration -->
|
|
174
165
|
|
|
@@ -188,12 +179,6 @@ await camunda.assignRoleToGroup({
|
|
|
188
179
|
|
|
189
180
|
Each branded type has an `.assumeExists()` method that validates the string and returns the branded value. Validation runs at call time and can throw if the input is malformed, so call it once at the boundary (startup, config parsing, API response) and pass the branded value through your application. See [Branded Keys](#branded-keys) for more on this pattern.
|
|
190
181
|
|
|
191
|
-
### What does NOT change
|
|
192
|
-
|
|
193
|
-
- The wire format is unchanged — all values are still strings on the wire.
|
|
194
|
-
- No method signatures changed name or arity.
|
|
195
|
-
- Branded values are assignable anywhere a `string` is expected (template literals, logging, JSON serialization), so existing string-handling code continues to work.
|
|
196
|
-
|
|
197
182
|
## Quick Start (Zero‑Config – Recommended)
|
|
198
183
|
|
|
199
184
|
Keep configuration out of application code. Let the factory read `CAMUNDA_*` variables from the environment (12‑factor style). This makes rotation, secret management, and environment promotion safer & simpler.
|
|
@@ -766,6 +751,111 @@ return ack;
|
|
|
766
751
|
const ack2 = await job.ignore();
|
|
767
752
|
```
|
|
768
753
|
|
|
754
|
+
### Deterministic Time (`job.clock`)
|
|
755
|
+
|
|
756
|
+
The SDK resolves its own cadence — worker poll intervals, retry backoff, eventual-consistency
|
|
757
|
+
polling, backpressure decay — through an injectable clock. Pinning that clock runs all of it
|
|
758
|
+
on virtual time, so tests that would otherwise wait out a 30-second poll finish immediately.
|
|
759
|
+
|
|
760
|
+
The clock is configured on the client and available as `client.clock`. Handlers reach it as
|
|
761
|
+
`job.clock`, a narrowed view exposing only `now()` and `sleep(ms, signal?)` — `deadline` is
|
|
762
|
+
withheld because a handler that built one against a pinned clock would hang rather than time
|
|
763
|
+
out:
|
|
764
|
+
|
|
765
|
+
<!-- snippet-source: examples/readme.ts | regions: ReadmeHandlerClock -->
|
|
766
|
+
|
|
767
|
+
```ts
|
|
768
|
+
const startedAt = job.clock.now();
|
|
769
|
+
|
|
770
|
+
// A short back-off around a flaky dependency. Waiting here rather than on
|
|
771
|
+
// setTimeout means a test that pins the client's clock also drives the handler.
|
|
772
|
+
await job.clock.sleep(250);
|
|
773
|
+
|
|
774
|
+
return job.complete({ variables: { waitedMs: job.clock.now() - startedAt } });
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Read and wait through `job.clock` rather than `Date.now()` / `setTimeout`, and a test that
|
|
778
|
+
pins the client's clock drives your handler too.
|
|
779
|
+
|
|
780
|
+
`job.clock.sleep` is for **short in-handler coordination** — spacing retries within one job,
|
|
781
|
+
backing off around a flaky dependency. Long or business-meaningful waits belong in the
|
|
782
|
+
process as BPMN timers, where they survive a crash and are visible to operations.
|
|
783
|
+
|
|
784
|
+
Pass `createTestClock()` to pin the clock in your own tests:
|
|
785
|
+
|
|
786
|
+
<!-- snippet-source: examples/readme.ts | regions: ReadmeTestClock -->
|
|
787
|
+
|
|
788
|
+
```ts
|
|
789
|
+
// Pin the client's clock and the SDK's own cadence runs on virtual time: poll intervals,
|
|
790
|
+
// retry backoff and backpressure decay all settle without waiting in real time.
|
|
791
|
+
const clock = createTestClock({ start: 0, autoAdvance: false });
|
|
792
|
+
const client = createCamundaClient({ clock });
|
|
793
|
+
|
|
794
|
+
// Nothing settles until the test moves time, so start the wait and advance into it.
|
|
795
|
+
const waiting = client.clock.sleep(30_000);
|
|
796
|
+
await clock.advance(30_000);
|
|
797
|
+
await waiting;
|
|
798
|
+
|
|
799
|
+
console.log(client.clock.now()); // 30000
|
|
800
|
+
console.log(clock.sleeps); // [30000] — every duration the SDK asked to wait
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
`autoAdvance` defaults to `true`, where each sleep settles itself on the next macrotask
|
|
804
|
+
having moved time to its wake point — the SDK's loops make progress without the test driving
|
|
805
|
+
them. Set it to `false`, as above, when you need to assert on state *between* two waits.
|
|
806
|
+
|
|
807
|
+
#### Binding the SDK to the engine clock
|
|
808
|
+
|
|
809
|
+
`createTestClock` pins the SDK in isolation: the engine carries on at real time. When you are
|
|
810
|
+
testing against a live engine, `createEngineClock` binds the two together so they advance as
|
|
811
|
+
one — `sleep` moves engine time forward via `PUT /clock` instead of waiting:
|
|
812
|
+
|
|
813
|
+
<!-- snippet-source: examples/readme.ts | regions: ReadmeEngineClock -->
|
|
814
|
+
|
|
815
|
+
```ts
|
|
816
|
+
// Bind the SDK's cadence to the engine's own clock. `sleep` no longer waits — it moves
|
|
817
|
+
// engine time forward — so a worker polling for something that never arrives advances the
|
|
818
|
+
// engine instead of burning real seconds.
|
|
819
|
+
//
|
|
820
|
+
// Two clients, deliberately. `client` issues the pins and must stay on the live clock:
|
|
821
|
+
// HTTP retry sleeps on whatever clock its client was given, so pointing the engine clock
|
|
822
|
+
// at its own driver would have a failed pin back off through `sleep`, which issues another
|
|
823
|
+
// pin, and so on.
|
|
824
|
+
const client = createCamundaClient();
|
|
825
|
+
const clock = createEngineClock(client, { start: Date.now() });
|
|
826
|
+
const pinned = createCamundaClient({ clock });
|
|
827
|
+
|
|
828
|
+
await clock.pin(Date.now());
|
|
829
|
+
try {
|
|
830
|
+
// A minute of engine time. BPMN timers due inside it fire; the test does not wait.
|
|
831
|
+
await pinned.clock.sleep(60_000);
|
|
832
|
+
} finally {
|
|
833
|
+
await clock.reset(); // hand the engine back to real time
|
|
834
|
+
}
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
This is what makes a worker loop deterministic end to end: the poll interval *drives* engine
|
|
838
|
+
time rather than racing it, so a test that would spend a real minute waiting on something
|
|
839
|
+
that never becomes ready finishes as fast as the requests complete.
|
|
840
|
+
|
|
841
|
+
> [!WARNING]
|
|
842
|
+
> Pinning is global to the cluster. Only point an engine clock at an engine you own —
|
|
843
|
+
> never a shared environment. Always `reset()` in a `finally`.
|
|
844
|
+
|
|
845
|
+
> [!IMPORTANT]
|
|
846
|
+
> The client you hand to `createEngineClock` must not itself be configured with that clock.
|
|
847
|
+
> HTTP retry backs off on whatever clock its client was given, so a self-referential setup
|
|
848
|
+
> would have a failed `pinClock` retry through `sleep`, which issues another `pinClock`.
|
|
849
|
+
> Keep the driving client on the live clock, as in the example above.
|
|
850
|
+
|
|
851
|
+
Prefer `createTestClock` over hand-writing a `Clock`. The contract has clauses that are easy
|
|
852
|
+
to get subtly wrong — most notably that `sleep` must not settle in a microtask, because the
|
|
853
|
+
worker schedules its next poll on resolution and would otherwise spin.
|
|
854
|
+
|
|
855
|
+
Two things deliberately stay on real time even when the clock is pinned, so that pinning it
|
|
856
|
+
cannot hang a process: **liveness bounds** (shutdown drain, request and config-fetch
|
|
857
|
+
timeouts) and **observational timestamps** (log, telemetry and support-bundle records).
|
|
858
|
+
|
|
769
859
|
### Job Corrections (User Task Listeners)
|
|
770
860
|
|
|
771
861
|
When a job worker handles a [user task listener](https://docs.camunda.io/docs/components/concepts/user-task-listeners/), it can correct task properties (assignee, due date, candidate groups, etc.) by passing a `result` to `job.complete()`:
|
|
@@ -1330,7 +1420,9 @@ Exports available from `.../effect`:
|
|
|
1330
1420
|
(`pages()` / `items()` → `Stream`, `toArray()` → `Effect`). See below.
|
|
1331
1421
|
|
|
1332
1422
|
**Clock-class win:** `eventually` / `withTimeout` run on the Effect `Clock`, so `TestClock.adjust`
|
|
1333
|
-
advances eventual/timeout deterministically in tests — no real-clock burn.
|
|
1423
|
+
advances eventual/timeout deterministically in tests — no real-clock burn. The Promise surface
|
|
1424
|
+
has the same property via [`createTestClock`](#deterministic-time-jobclock); the difference is
|
|
1425
|
+
that Effect gives you `TestClock` and the rest of the ecosystem for free.
|
|
1334
1426
|
|
|
1335
1427
|
### Paginated Search as a `Stream`
|
|
1336
1428
|
|
|
@@ -1441,7 +1533,9 @@ Worker exports from `.../effect`:
|
|
|
1441
1533
|
|
|
1442
1534
|
**Clock-class win:** the activation poll interval and the handler-retry `Schedule` run on the Effect
|
|
1443
1535
|
`Clock`, so `TestClock.adjust` bounds activation/retry timing in virtual time — the whole loop is
|
|
1444
|
-
deterministic in tests, with no real-clock burn.
|
|
1536
|
+
deterministic in tests, with no real-clock burn. The Promise worker is equally drivable by pinning
|
|
1537
|
+
the client clock (see [Deterministic Time](#deterministic-time-jobclock)); what Effect adds here is
|
|
1538
|
+
`Schedule` composition over the retry policy.
|
|
1445
1539
|
|
|
1446
1540
|
### Injecting Services into a Handler
|
|
1447
1541
|
|