@camunda8/orchestration-cluster-api 8.9.0-alpha.1 → 8.9.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,3 +1,55 @@
1
+ # [8.9.0-alpha.11](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.10...v8.9.0-alpha.11) (2026-03-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * add per-operation retry config. New tuning for backpressure ([9dd921a](https://github.com/camunda/orchestration-cluster-api-js/commit/9dd921a0eae67d56d0e8a7d6423ac7d8a3edd3b4))
7
+
8
+ # [8.9.0-alpha.10](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.9...v8.9.0-alpha.10) (2026-03-05)
9
+
10
+ ### Features
11
+
12
+ - tune backpressure ([b64c6f1](https://github.com/camunda/orchestration-cluster-api-js/commit/b64c6f14a5b4755881cb1c79c804a5cd8403145f))
13
+
14
+ # [8.9.0-alpha.9](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.8...v8.9.0-alpha.9) (2026-03-05)
15
+
16
+ ### Features
17
+
18
+ - add startup jitter for workers ([95b431d](https://github.com/camunda/orchestration-cluster-api-js/commit/95b431d97fc42aaddfde0b744a8ad94bf82ce401))
19
+ - regenerate from stable/8.9 ([390a04e](https://github.com/camunda/orchestration-cluster-api-js/commit/390a04e6ea06b462ffd6d77d4ed10a3bf31dffda))
20
+
21
+ # [8.9.0-alpha.8](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.7...v8.9.0-alpha.8) (2026-03-02)
22
+
23
+ ### Features
24
+
25
+ - support deprecated enums ([a1a2290](https://github.com/camunda/orchestration-cluster-api-js/commit/a1a22908fef6ca75ce353b851d4b6aabd7aa4522))
26
+
27
+ # [8.9.0-alpha.7](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.6...v8.9.0-alpha.7) (2026-03-02)
28
+
29
+ ### Bug Fixes
30
+
31
+ - rebuild from upstream spec ([efd13cb](https://github.com/camunda/orchestration-cluster-api-js/commit/efd13cbaec2e3fa2c0a8c0578f5d5b0fa0101715))
32
+
33
+ # [8.9.0-alpha.6](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.5...v8.9.0-alpha.6) (2026-02-17)
34
+
35
+ ### Features
36
+
37
+ - regenerate from latest schema ([c2d9dff](https://github.com/camunda/orchestration-cluster-api-js/commit/c2d9dffe96f645d2043f62335ef97bdc381b37b1))
38
+
39
+ ## [1.2.4-alpha.1](https://github.com/camunda/orchestration-cluster-api-js/compare/v1.2.3...v1.2.4-alpha.1) (2026-01-22)
40
+
41
+ ### Bug Fixes
42
+
43
+ - correctly type optional parameters ([8fef8c8](https://github.com/camunda/orchestration-cluster-api-js/commit/8fef8c8a4bc69a3dd86b76ac1e01431d97607050))
44
+ - enhance response validation error message ([d138134](https://github.com/camunda/orchestration-cluster-api-js/commit/d1381348f46c187e8321fdec088b7654b70c4fa8))
45
+ - handle multi-part spec ([86ac930](https://github.com/camunda/orchestration-cluster-api-js/commit/86ac930e3b599126cf5446bcaa323089049bb4ef))
46
+ - **spec:** prevent path-local $like refs breaking dts build ([3b75200](https://github.com/camunda/orchestration-cluster-api-js/commit/3b75200caeffb198f072668567cff7e34f5700f0))
47
+
48
+ ### Features
49
+
50
+ - build 8.9 from monorepo spec ([a80303d](https://github.com/camunda/orchestration-cluster-api-js/commit/a80303d3a54f2d6db77c428f46848f131bd8bf42))
51
+ - build from 8.9 spec ([e4ab53c](https://github.com/camunda/orchestration-cluster-api-js/commit/e4ab53cd253ca5d1fcf2d0bf0626c8d26c7da49c))
52
+
1
53
  ## [1.2.3](https://github.com/camunda/orchestration-cluster-api-js/compare/v1.2.2...v1.2.3) (2025-12-05)
2
54
 
3
55
  ### Bug Fixes
package/README.md CHANGED
@@ -14,6 +14,7 @@ Type‑safe, promise‑based client for the Camunda 8 Orchestration Cluster REST
14
14
  - Immutable, deep‑frozen configuration accessible through a factory‑created client instance
15
15
  - Automatic body-level tenantId defaulting: if a request body supports an optional tenantId and you omit it, the SDK fills it from CAMUNDA_DEFAULT_TENANT_ID (path params are never auto-filled)
16
16
  - Automatic transient HTTP retry (429, 503, network) with exponential backoff + full jitter (configurable via CAMUNDA_SDK_HTTP_RETRY\*). Non-retryable 500s fail fast. Pluggable strategy surface (default uses p-retry when available, internal fallback otherwise).
17
+ - Per-method retry override: disable or customize retry policy on any individual API call without changing global settings
17
18
 
18
19
  ## Install
19
20
 
@@ -28,6 +29,23 @@ Runtime support:
28
29
 
29
30
  For older Node versions supply a fetch ponyfill AND a `File` shim (or upgrade). For legacy browsers, add a fetch polyfill (e.g. `whatwg-fetch`).
30
31
 
32
+ ## Versioning
33
+
34
+ This SDK does **not** follow traditional semver. The **major.minor** version tracks the Camunda server version, so you can easily match the SDK to your deployment target (e.g. SDK `8.9.x` targets Camunda `8.9`).
35
+
36
+ **Patch releases** contain fixes, features, and occasionally **breaking type changes**. A breaking type change typically means an upstream API definition fix that corrects the shape of a request or response model — your code may stop type-checking even though it worked before.
37
+
38
+ When this happens, we signal it in the [CHANGELOG](https://github.com/camunda/orchestration-cluster-api-js/releases).
39
+
40
+ **Recommended approach:**
41
+
42
+ - **Ride the latest** — accept that types may shift and update your code when it happens. This keeps you on the most accurate API surface.
43
+ - **Pin and review** — pin to a specific patch version in `package.json` and review the [CHANGELOG](https://github.com/camunda/orchestration-cluster-api-js/releases) before upgrading:
44
+
45
+ ```json
46
+ "@camunda8/orchestration-cluster-api": "8.9.3"
47
+ ```
48
+
31
49
  ## Quick Start (Zero‑Config – Recommended)
32
50
 
33
51
  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.
@@ -132,15 +150,61 @@ Behavior:
132
150
  - `strict` - fail on type mismatch or missing required fields
133
151
  - `fanatical` - fail on type mismatch, missing required fields, or unknown additional fields
134
152
 
153
+ ## Per-Method Retry Override
154
+
155
+ Every API method accepts an optional trailing `options` parameter that lets you override or disable the global retry policy for that single call.
156
+
157
+ ### Disable Retry for a Single Call
158
+
159
+ ```ts
160
+ // This call will not retry on transient errors
161
+ await camunda.completeJob({ jobKey }, { retry: false });
162
+ ```
163
+
164
+ ### Override Specific Retry Settings
165
+
166
+ Pass a partial `HttpRetryPolicy` to override individual fields. Unspecified fields inherit from the global configuration.
167
+
168
+ ```ts
169
+ import type { OperationOptions } from '@camunda8/orchestration-cluster-api';
170
+
171
+ // More aggressive retry for this operation only
172
+ await camunda.createProcessInstance(
173
+ { processDefinitionId: 'payment-process' },
174
+ { retry: { maxAttempts: 8, maxDelayMs: 5000 } }
175
+ );
176
+
177
+ // Minimal retry: single retry with short backoff
178
+ await camunda.getTopology({ retry: { maxAttempts: 2, baseDelayMs: 50 } });
179
+ ```
180
+
181
+ ### How It Works
182
+
183
+ | `options.retry` value | Behavior |
184
+ | --------------------- | -------------------------------------------------------------------- |
185
+ | omitted / `undefined` | Uses global policy (`CAMUNDA_SDK_HTTP_RETRY_*` env vars) |
186
+ | `false` | Disables retry entirely (single attempt, no backoff) |
187
+ | `{ maxAttempts: 5 }` | Merges with global policy — only the specified fields are overridden |
188
+
189
+ The `HttpRetryPolicy` fields available for override:
190
+
191
+ | Field | Type | Description |
192
+ | ------------- | -------- | --------------------------------------- |
193
+ | `maxAttempts` | `number` | Total attempts (initial + retries) |
194
+ | `baseDelayMs` | `number` | Base delay for exponential backoff (ms) |
195
+ | `maxDelayMs` | `number` | Maximum delay cap (ms) |
196
+
135
197
  ## Advanced HTTP Retry: Cockatiel Adapter (Optional)
136
198
 
137
- The SDK includes built‑in transient HTTP retry (429, 503, network errors) using a p‑retry based engine plus a fallback implementation. For advanced resilience patterns (circuit breakers, timeouts, custom classification, combining policies) you can integrate [cockatiel](https://github.com/connor4312/cockatiel).
199
+ For advanced resilience patterns beyond per-method overrides circuit breakers, timeouts, custom classification, combining policies you can integrate [cockatiel](https://github.com/connor4312/cockatiel).
200
+
201
+ > **Tip:** For most use cases, per-method retry override (above) is sufficient. Reach for Cockatiel when you need circuit breaking, hedging, or bulkhead controls.
138
202
 
139
203
  ### When To Use Cockatiel
140
204
 
141
- - You need different retry policies per operation (e.g. idempotent GET vs mutating POST)
142
205
  - You want circuit breaking, hedging, timeout, or bulkhead controls
143
206
  - You want to add custom classification (e.g. retry certain 5xx only on safe verbs)
207
+ - You need to compose multiple resilience policies together
144
208
 
145
209
  ### Disable Built‑In HTTP Retries
146
210
 
@@ -275,7 +339,7 @@ const policy = retry(classify, {
275
339
  - Keep SDK retries disabled to prevent duplicate layers.
276
340
  - SDK synthesizes `Error` objects with a `status` for retry-significant HTTP responses (429, 503, 500), enabling classification.
277
341
  - You can tag errors (e.g. assign `err.__opVerb`) in a wrapper if verb-level logic is needed.
278
- - Future improvement: an official `retryStrategy` injection hook—current approach is non-invasive.
342
+ - For per-operation retry customization without external dependencies, use the built-in [per-method retry override](#per-method-retry-override) instead.
279
343
 
280
344
  > Combine cockatiel retry with a circuit breaker, timeout, or bulkhead policy for more robust behavior in partial outages.
281
345
 
@@ -377,6 +441,21 @@ Factors use integer percentages to avoid floating point drift in env parsing; th
377
441
 
378
442
  If you have concrete tuning needs, open an issue describing workload patterns (operation mix, baseline concurrency, observed broker limits) to help prioritize which knobs to surface.
379
443
 
444
+ ### What Should I Set?
445
+
446
+ If you're unsure about your workload shape, **don't set anything**. The default BALANCED profile activates automatically and outperforms no-gating (LEGACY) in most scenarios — on raw throughput alone, not just error reduction.
447
+
448
+ Benchmark results against a single-node local cluster with multiple independent clients (no shared state between them):
449
+
450
+ | Scenario | BALANCED | LEGACY (no gating) |
451
+ | ----------------------------- | --------------- | ------------------ |
452
+ | Single-client (1K processes) | **80.1 ops/s** | 67.8 ops/s |
453
+ | Single-client sustained (10K) | **119.6 ops/s** | 87.8 ops/s |
454
+ | Multi-client 3+2 spike | **86.3 ops/s** | 48.0 ops/s |
455
+ | Stress 8 clients ×1000 | 76.3 ops/s | **106.4 ops/s** |
456
+
457
+ BALANCED wins 3 of 4 on pure throughput. The only scenario where LEGACY is faster is extreme overload (800 concurrent requests against a single broker) — and in that case LEGACY accumulates 44,505 errors vs BALANCED's 15,527. The default just works.
458
+
380
459
  ## Job Workers (Polling API)
381
460
 
382
461
  The SDK provides a lightweight polling job worker for service task job types using `createJobWorker`. It activates jobs in batches (respecting a concurrency limit), validates variables (optional), and offers action helpers on each job.
@@ -404,6 +483,7 @@ const worker = client.createJobWorker({
404
483
  outputSchema: Output, // validates variables passed to complete(...)
405
484
  validateSchemas: true, // set false for max throughput (skip Zod)
406
485
  autoStart: true, // default true; start polling immediately
486
+ startupJitterMaxSeconds: 5, // random delay up to 5s before first poll (default 0)
407
487
  jobHandler: (job) => {
408
488
  // Access typed variables
409
489
  const vars = job.variables; // inferred from Input schema
@@ -526,6 +606,22 @@ Activation cancellations during stop are logged at debug (`activation.cancelled`
526
606
 
527
607
  You can register multiple workers on a single client instance—one per job type is typical. The client exposes `client.getWorkers()` for inspection and `client.stopAllWorkers()` for coordinated shutdown.
528
608
 
609
+ ### Startup Jitter
610
+
611
+ When deploying multiple application instances simultaneously (e.g. a rolling restart or scale-up), all workers start polling at the same time and can saturate the server with activation requests. Set `startupJitterMaxSeconds` to spread out the initial poll across a random window:
612
+
613
+ ```ts
614
+ client.createJobWorker({
615
+ jobType: 'process-order',
616
+ maxParallelJobs: 10,
617
+ jobTimeoutMs: 30_000,
618
+ startupJitterMaxSeconds: 5, // each instance delays 0–5s before first poll
619
+ jobHandler: async (job) => job.complete(),
620
+ });
621
+ ```
622
+
623
+ A value of `0` (the default) means no delay.
624
+
529
625
  ### Receipt Type (Unique Symbol)
530
626
 
531
627
  Action methods return a unique symbol (not a string) to avoid accidental misuse and allow internal metrics. If you store the receipt, annotate its type as `JobActionReceipt` to preserve uniqueness: