@camunda8/orchestration-cluster-api 8.9.0-alpha.21 → 8.9.0-alpha.22
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 +15 -0
- package/README.md +62 -7
- package/dist/{chunk-Z5TE7HRA.js → chunk-7IUDW222.js} +100 -94
- package/dist/chunk-7IUDW222.js.map +1 -0
- package/dist/{chunk-2N2LUTZ2.js → chunk-KQ4UL2WX.js} +3 -3
- package/dist/chunk-KQ4UL2WX.js.map +1 -0
- package/dist/fp/index.cjs +95 -91
- package/dist/fp/index.cjs.map +1 -1
- package/dist/fp/index.d.cts +1 -1
- package/dist/fp/index.d.ts +1 -1
- package/dist/fp/index.js +2 -2
- package/dist/{index-ddM18uDQ.d.cts → index-BmzsA8v5.d.cts} +2 -2
- package/dist/{index-BmDqK0O0.d.ts → index-CoLIT6o0.d.ts} +2 -2
- package/dist/index.cjs +123 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -31
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +2 -2
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +1 -1
- package/dist/threadWorkerEntry.cjs +2 -2
- package/dist/threadWorkerEntry.cjs.map +1 -1
- package/dist/threadWorkerEntry.js +2 -2
- package/dist/threadWorkerEntry.js.map +1 -1
- package/package.json +14 -23
- package/dist/chunk-2N2LUTZ2.js.map +0 -1
- package/dist/chunk-Z5TE7HRA.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [8.9.0-alpha.22](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.21...v8.9.0-alpha.22) (2026-03-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* address PR review comments ([ae51b85](https://github.com/camunda/orchestration-cluster-api-js/commit/ae51b8534239de5bb0ca61c1897dfe89514a740d))
|
|
7
|
+
* address PR review comments on job corrections ([3a82c3a](https://github.com/camunda/orchestration-cluster-api-js/commit/3a82c3a06e25f589ccc9638aba191affa8f25948))
|
|
8
|
+
* address review comments on PR [#85](https://github.com/camunda/orchestration-cluster-api-js/issues/85) ([3d3a810](https://github.com/camunda/orchestration-cluster-api-js/commit/3d3a8109742e6b3fec2e17aecc729565da871ed9))
|
|
9
|
+
* restore 'Later, on shutdown:' comment and fix test formatting ([aed9ba5](https://github.com/camunda/orchestration-cluster-api-js/commit/aed9ba5eb0ed5351da0c1c2a84cf3b40c88f63b5))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* support job corrections in worker job.complete() ([790e15d](https://github.com/camunda/orchestration-cluster-api-js/commit/790e15d675ef3fea09c47cb820a1bc960a075ff6))
|
|
15
|
+
|
|
1
16
|
# [8.9.0-alpha.21](https://github.com/camunda/orchestration-cluster-api-js/compare/v8.9.0-alpha.20...v8.9.0-alpha.21) (2026-03-25)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -503,7 +503,7 @@ const worker = client.createJobWorker({
|
|
|
503
503
|
const vars = job.variables; // inferred from Input schema
|
|
504
504
|
console.log(`Processing order: ${vars.orderId}`);
|
|
505
505
|
// Do work...
|
|
506
|
-
return job.complete({
|
|
506
|
+
return job.complete({ processed: true });
|
|
507
507
|
},
|
|
508
508
|
});
|
|
509
509
|
|
|
@@ -542,7 +542,7 @@ client.createJobWorker({
|
|
|
542
542
|
|
|
543
543
|
Your `jobHandler` must ultimately invoke exactly one of:
|
|
544
544
|
|
|
545
|
-
- `job.complete(
|
|
545
|
+
- `job.complete(variables?, result?)` OR `job.complete()`
|
|
546
546
|
- `job.fail({ errorMessage, retries?, retryBackoff? })`
|
|
547
547
|
- `job.cancelWorkflow({})` (cancels the process instance)
|
|
548
548
|
- `job.error({ errorCode, errorMessage? })` (throws a business error)
|
|
@@ -569,9 +569,7 @@ Example patterns:
|
|
|
569
569
|
|
|
570
570
|
```ts
|
|
571
571
|
// GOOD: explicit completion
|
|
572
|
-
return job.complete({
|
|
573
|
-
|
|
574
|
-
// GOOD: No-arg completion example, sentinel stored for ultimate return
|
|
572
|
+
return job.complete({ processed: true }); // sentinel stored for ultimate return
|
|
575
573
|
const ack = await job.complete();
|
|
576
574
|
// ...
|
|
577
575
|
return ack;
|
|
@@ -584,6 +582,55 @@ const ack = await job.ignore();
|
|
|
584
582
|
// No-arg completion example
|
|
585
583
|
```
|
|
586
584
|
|
|
585
|
+
### Job Corrections (User Task Listeners)
|
|
586
|
+
|
|
587
|
+
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()`:
|
|
588
|
+
|
|
589
|
+
<!-- snippet:ReadmeJobCorrectionsImport+ReadmeJobCorrections -->
|
|
590
|
+
|
|
591
|
+
```ts
|
|
592
|
+
import type { JobResult } from '@camunda8/orchestration-cluster-api';
|
|
593
|
+
|
|
594
|
+
const worker = client.createJobWorker({
|
|
595
|
+
jobType: 'io.camunda:userTaskListener',
|
|
596
|
+
jobTimeoutMs: 30_000,
|
|
597
|
+
maxParallelJobs: 5,
|
|
598
|
+
jobHandler: async (job) => {
|
|
599
|
+
const result: JobResult = {
|
|
600
|
+
type: 'userTask',
|
|
601
|
+
corrections: {
|
|
602
|
+
assignee: 'corrected-user',
|
|
603
|
+
priority: 80,
|
|
604
|
+
},
|
|
605
|
+
};
|
|
606
|
+
return job.complete({}, result);
|
|
607
|
+
},
|
|
608
|
+
});
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
To deny a task completion (reject the work):
|
|
612
|
+
|
|
613
|
+
<!-- snippet:ReadmeJobCorrectionsDenial -->
|
|
614
|
+
|
|
615
|
+
```ts
|
|
616
|
+
return job.complete({}, {
|
|
617
|
+
type: 'userTask',
|
|
618
|
+
denied: true,
|
|
619
|
+
deniedReason: 'Insufficient documentation',
|
|
620
|
+
});
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
| Correctable attribute | Type | Clear value |
|
|
624
|
+
|---|---|---|
|
|
625
|
+
| `assignee` | `string` | Empty string `""` |
|
|
626
|
+
| `dueDate` | `string` (ISO 8601) | Empty string `""` |
|
|
627
|
+
| `followUpDate` | `string` (ISO 8601) | Empty string `""` |
|
|
628
|
+
| `candidateUsers` | `string[]` | Empty array `[]` |
|
|
629
|
+
| `candidateGroups` | `string[]` | Empty array `[]` |
|
|
630
|
+
| `priority` | `number` (0–100) | — |
|
|
631
|
+
|
|
632
|
+
Omitting an attribute or passing `null` preserves the persisted value.
|
|
633
|
+
|
|
587
634
|
### Concurrency & Backpressure
|
|
588
635
|
|
|
589
636
|
Set `maxParallelJobs` to the maximum number of jobs you want actively processing concurrently. The worker will long‑poll for up to the remaining capacity each cycle. Global backpressure (adaptive concurrency) still applies to the underlying REST calls; activation itself is a normal operation.
|
|
@@ -652,7 +699,7 @@ Action methods return a unique symbol (not a string) to avoid accidental misuse
|
|
|
652
699
|
```ts
|
|
653
700
|
import type { JobActionReceipt } from '@camunda8/orchestration-cluster-api';
|
|
654
701
|
|
|
655
|
-
const receipt: JobActionReceipt = await job.complete({
|
|
702
|
+
const receipt: JobActionReceipt = await job.complete({ processed: true });
|
|
656
703
|
```
|
|
657
704
|
|
|
658
705
|
If you ignore the return value you don’t need to import the symbol.
|
|
@@ -928,6 +975,14 @@ Notes:
|
|
|
928
975
|
|
|
929
976
|
@experimental - this feature is not guaranteed to be tested or stable.
|
|
930
977
|
|
|
978
|
+
> **Peer dependency:** `fp-ts` is an optional peer dependency. If you use real `fp-ts` functions
|
|
979
|
+
> (e.g. `pipe`, `TE.match`) alongside this subpath, install it separately:
|
|
980
|
+
> ```sh
|
|
981
|
+
> npm install fp-ts
|
|
982
|
+
> ```
|
|
983
|
+
> The `/fp` subpath works without `fp-ts` installed — it exposes structurally-compatible
|
|
984
|
+
> `Either`/`TaskEither` shapes that interoperate with `fp-ts` but do not require it at runtime.
|
|
985
|
+
|
|
931
986
|
The main entry stays minimal. To opt in to a TaskEither-style facade & helper combinators import from the dedicated subpath:
|
|
932
987
|
|
|
933
988
|
```ts
|
|
@@ -1392,7 +1447,7 @@ Inject a mock fetch:
|
|
|
1392
1447
|
|
|
1393
1448
|
```ts
|
|
1394
1449
|
const client = createCamundaClient({
|
|
1395
|
-
fetch: async (
|
|
1450
|
+
fetch: async (_input, _init) => new Response(JSON.stringify({ ok: true }), { status: 200 }),
|
|
1396
1451
|
});
|
|
1397
1452
|
```
|
|
1398
1453
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KQ4UL2WX.js";
|
|
4
4
|
import {
|
|
5
5
|
__require
|
|
6
6
|
} from "./chunk-DGUM43GV.js";
|
|
@@ -104,7 +104,7 @@ var EventualConsistencyTimeoutError = class extends Error {
|
|
|
104
104
|
if (params.lastResponse !== void 0) {
|
|
105
105
|
try {
|
|
106
106
|
const s = typeof params.lastResponse === "string" ? params.lastResponse : JSON.stringify(params.lastResponse);
|
|
107
|
-
this.lastResponseSnippet = s.length > 8192 ? s.slice(0, 8192)
|
|
107
|
+
this.lastResponseSnippet = s.length > 8192 ? `${s.slice(0, 8192)}\u2026[truncated]` : s;
|
|
108
108
|
} catch (_e) {
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -3077,7 +3077,7 @@ var OAuthManager = class {
|
|
|
3077
3077
|
this.tHooks = tHooks;
|
|
3078
3078
|
this.correlationProvider = correlationProvider;
|
|
3079
3079
|
const hashBase = `${cfg.oauth.oauthUrl}|${cfg.oauth.clientId || ""}|${cfg.tokenAudience}|${cfg.oauth.scope || ""}`;
|
|
3080
|
-
this.storageKey =
|
|
3080
|
+
this.storageKey = `camunda_oauth_token_cache_${this.simpleHash(hashBase)}`;
|
|
3081
3081
|
this.session = this.isBrowser && typeof window.sessionStorage !== "undefined" ? window.sessionStorage : null;
|
|
3082
3082
|
this.loadPersisted();
|
|
3083
3083
|
}
|
|
@@ -3113,7 +3113,7 @@ var OAuthManager = class {
|
|
|
3113
3113
|
try {
|
|
3114
3114
|
const fs = __require("fs");
|
|
3115
3115
|
const path2 = __require("path");
|
|
3116
|
-
const file = path2.join(this.cfg.oauth.cacheDir, this.storageKey
|
|
3116
|
+
const file = path2.join(this.cfg.oauth.cacheDir, `${this.storageKey}.json`);
|
|
3117
3117
|
if (fs.existsSync(file)) {
|
|
3118
3118
|
const raw = fs.readFileSync(file, "utf8");
|
|
3119
3119
|
this.token = JSON.parse(raw);
|
|
@@ -3135,8 +3135,8 @@ var OAuthManager = class {
|
|
|
3135
3135
|
const path2 = __require("path");
|
|
3136
3136
|
if (!fs.existsSync(this.cfg.oauth.cacheDir))
|
|
3137
3137
|
fs.mkdirSync(this.cfg.oauth.cacheDir, { recursive: true });
|
|
3138
|
-
const file = path2.join(this.cfg.oauth.cacheDir, this.storageKey
|
|
3139
|
-
const tmp = file
|
|
3138
|
+
const file = path2.join(this.cfg.oauth.cacheDir, `${this.storageKey}.json`);
|
|
3139
|
+
const tmp = `${file}.tmp`;
|
|
3140
3140
|
fs.writeFileSync(tmp, JSON.stringify(this.token), { mode: 384 });
|
|
3141
3141
|
fs.renameSync(tmp, file);
|
|
3142
3142
|
} catch {
|
|
@@ -3189,7 +3189,7 @@ var OAuthManager = class {
|
|
|
3189
3189
|
try {
|
|
3190
3190
|
const fs = __require("fs");
|
|
3191
3191
|
const path2 = __require("path");
|
|
3192
|
-
const file = path2.join(this.cfg.oauth.cacheDir, this.storageKey
|
|
3192
|
+
const file = path2.join(this.cfg.oauth.cacheDir, `${this.storageKey}.json`);
|
|
3193
3193
|
if (fs.existsSync(file)) fs.unlinkSync(file);
|
|
3194
3194
|
} catch {
|
|
3195
3195
|
}
|
|
@@ -3288,7 +3288,7 @@ var OAuthManager = class {
|
|
|
3288
3288
|
lastErr = e;
|
|
3289
3289
|
attempt++;
|
|
3290
3290
|
if (attempt >= max) break;
|
|
3291
|
-
const delay = base *
|
|
3291
|
+
const delay = base * 2 ** (attempt - 1);
|
|
3292
3292
|
const jitter = delay * 0.2 * (Math.random() - 0.5);
|
|
3293
3293
|
const sleep2 = delay + jitter;
|
|
3294
3294
|
try {
|
|
@@ -3328,8 +3328,8 @@ var OAuthManager = class {
|
|
|
3328
3328
|
}
|
|
3329
3329
|
};
|
|
3330
3330
|
var BasicAuthManager = class {
|
|
3331
|
+
token;
|
|
3331
3332
|
constructor(cfg) {
|
|
3332
|
-
this.cfg = cfg;
|
|
3333
3333
|
const u = cfg.auth.basic?.username?.trim();
|
|
3334
3334
|
const p = cfg.auth.basic?.password?.trim();
|
|
3335
3335
|
if (!u || !p)
|
|
@@ -3343,7 +3343,6 @@ var BasicAuthManager = class {
|
|
|
3343
3343
|
this.token = btoa(`${u}:${p}`);
|
|
3344
3344
|
}
|
|
3345
3345
|
}
|
|
3346
|
-
token;
|
|
3347
3346
|
getHeader() {
|
|
3348
3347
|
return `Basic ${this.token}`;
|
|
3349
3348
|
}
|
|
@@ -3415,8 +3414,8 @@ function createAuthFacade(config, opts) {
|
|
|
3415
3414
|
return {
|
|
3416
3415
|
async getAuthHeaders() {
|
|
3417
3416
|
const h = {};
|
|
3418
|
-
if (oauth) h
|
|
3419
|
-
else if (basic) h
|
|
3417
|
+
if (oauth) h.Authorization = `Bearer ${await oauth.getToken(withAgent)}`;
|
|
3418
|
+
else if (basic) h.Authorization = basic.getHeader();
|
|
3420
3419
|
let acc = h;
|
|
3421
3420
|
for (const hook of hooks) {
|
|
3422
3421
|
acc = await hook(acc);
|
|
@@ -3785,7 +3784,7 @@ function hydrateConfig(options = {}) {
|
|
|
3785
3784
|
provided[k] = baseEnv[k].trim();
|
|
3786
3785
|
}
|
|
3787
3786
|
}
|
|
3788
|
-
const userSetStrategy = provided
|
|
3787
|
+
const userSetStrategy = provided.CAMUNDA_AUTH_STRATEGY !== void 0 && provided.CAMUNDA_AUTH_STRATEGY.trim() !== "";
|
|
3789
3788
|
const parseErrors = [];
|
|
3790
3789
|
function boolParserFactory(key) {
|
|
3791
3790
|
return (v) => {
|
|
@@ -3847,14 +3846,14 @@ function hydrateConfig(options = {}) {
|
|
|
3847
3846
|
if (overrides[k] !== void 0) envInput[k] = String(overrides[k]);
|
|
3848
3847
|
else if (baseEnv[k] !== void 0) envInput[k] = baseEnv[k];
|
|
3849
3848
|
}
|
|
3850
|
-
if (envInput
|
|
3851
|
-
envInput
|
|
3849
|
+
if (envInput.CAMUNDA_SUPPORT_LOG_ENABLED === void 0 && envInput.CAMUNDA_SUPPORT_LOGGER !== void 0) {
|
|
3850
|
+
envInput.CAMUNDA_SUPPORT_LOG_ENABLED = envInput.CAMUNDA_SUPPORT_LOGGER;
|
|
3852
3851
|
}
|
|
3853
|
-
if (envInput
|
|
3854
|
-
envInput
|
|
3852
|
+
if (envInput.CAMUNDA_REST_ADDRESS === void 0 && baseEnv.ZEEBE_REST_ADDRESS !== void 0 && baseEnv.ZEEBE_REST_ADDRESS.trim() !== "") {
|
|
3853
|
+
envInput.CAMUNDA_REST_ADDRESS = baseEnv.ZEEBE_REST_ADDRESS.trim();
|
|
3855
3854
|
}
|
|
3856
|
-
if ((envInput
|
|
3857
|
-
envInput
|
|
3855
|
+
if ((envInput.CAMUNDA_AUTH_STRATEGY === void 0 || envInput.CAMUNDA_AUTH_STRATEGY.trim() === "") && envInput.CAMUNDA_OAUTH_URL !== void 0 && envInput.CAMUNDA_OAUTH_URL.trim() !== "" && envInput.CAMUNDA_CLIENT_ID !== void 0 && envInput.CAMUNDA_CLIENT_ID.trim() !== "" && envInput.CAMUNDA_CLIENT_SECRET !== void 0 && envInput.CAMUNDA_CLIENT_SECRET.trim() !== "") {
|
|
3856
|
+
envInput.CAMUNDA_AUTH_STRATEGY = "OAUTH";
|
|
3858
3857
|
}
|
|
3859
3858
|
let envTyped = {};
|
|
3860
3859
|
envTyped = createEnv(typedEnvSchema, { env: envInput });
|
|
@@ -3869,10 +3868,10 @@ function hydrateConfig(options = {}) {
|
|
|
3869
3868
|
rawMap[k] = String(entry.default);
|
|
3870
3869
|
}
|
|
3871
3870
|
}
|
|
3872
|
-
if (!userSetStrategy && rawMap
|
|
3873
|
-
rawMap
|
|
3871
|
+
if (!userSetStrategy && rawMap.CAMUNDA_AUTH_STRATEGY === "NONE" && rawMap.CAMUNDA_OAUTH_URL && rawMap.CAMUNDA_OAUTH_URL.trim() !== "" && rawMap.CAMUNDA_CLIENT_ID && rawMap.CAMUNDA_CLIENT_ID.trim() !== "" && rawMap.CAMUNDA_CLIENT_SECRET && rawMap.CAMUNDA_CLIENT_SECRET.trim() !== "") {
|
|
3872
|
+
rawMap.CAMUNDA_AUTH_STRATEGY = "OAUTH";
|
|
3874
3873
|
}
|
|
3875
|
-
const authStrategyRaw = (rawMap
|
|
3874
|
+
const authStrategyRaw = (rawMap.CAMUNDA_AUTH_STRATEGY || "NONE").toString();
|
|
3876
3875
|
const authStrategy = authStrategyRaw.trim().toUpperCase();
|
|
3877
3876
|
if (!["NONE", "OAUTH", "BASIC"].includes(authStrategy)) {
|
|
3878
3877
|
errors.push({
|
|
@@ -3907,16 +3906,16 @@ function hydrateConfig(options = {}) {
|
|
|
3907
3906
|
details: { strategy: cond, keys }
|
|
3908
3907
|
});
|
|
3909
3908
|
}
|
|
3910
|
-
const mtlsCertProvided = !!(rawMap
|
|
3911
|
-
const mtlsKeyProvided = !!(rawMap
|
|
3912
|
-
const mtlsAny = mtlsCertProvided || mtlsKeyProvided || rawMap
|
|
3909
|
+
const mtlsCertProvided = !!(rawMap.CAMUNDA_MTLS_CERT || rawMap.CAMUNDA_MTLS_CERT_PATH);
|
|
3910
|
+
const mtlsKeyProvided = !!(rawMap.CAMUNDA_MTLS_KEY || rawMap.CAMUNDA_MTLS_KEY_PATH);
|
|
3911
|
+
const mtlsAny = mtlsCertProvided || mtlsKeyProvided || rawMap.CAMUNDA_MTLS_CA || rawMap.CAMUNDA_MTLS_CA_PATH || rawMap.CAMUNDA_MTLS_KEY_PASSPHRASE;
|
|
3913
3912
|
if (mtlsAny && (!mtlsCertProvided || !mtlsKeyProvided)) {
|
|
3914
3913
|
errors.push({
|
|
3915
3914
|
code: "CONFIG_MISSING_REQUIRED" /* CONFIG_MISSING_REQUIRED */,
|
|
3916
3915
|
message: "Incomplete mTLS configuration; both certificate (CAMUNDA_MTLS_CERT|_PATH) and key (CAMUNDA_MTLS_KEY|_PATH) must be provided."
|
|
3917
3916
|
});
|
|
3918
3917
|
}
|
|
3919
|
-
const validationRaw = rawMap
|
|
3918
|
+
const validationRaw = rawMap.CAMUNDA_SDK_VALIDATION || "req:none,res:none";
|
|
3920
3919
|
const validation = parseValidation(validationRaw, errors);
|
|
3921
3920
|
if (errors.length) {
|
|
3922
3921
|
errors.sort((a, b) => (a.key || "").localeCompare(b.key || "") || a.code.localeCompare(b.code));
|
|
@@ -3931,15 +3930,15 @@ function hydrateConfig(options = {}) {
|
|
|
3931
3930
|
if (isSecret(k) && v) redacted[k] = redactSecret(v);
|
|
3932
3931
|
else redacted[k] = v;
|
|
3933
3932
|
}
|
|
3934
|
-
let _restAddress = rawMap
|
|
3933
|
+
let _restAddress = rawMap.CAMUNDA_REST_ADDRESS;
|
|
3935
3934
|
if (_restAddress) {
|
|
3936
3935
|
_restAddress = _restAddress.trim();
|
|
3937
3936
|
if (!/\/v2\/?$/i.test(_restAddress)) {
|
|
3938
|
-
_restAddress = _restAddress.replace(/\/+$/, "")
|
|
3937
|
+
_restAddress = `${_restAddress.replace(/\/+$/, "")}/v2`;
|
|
3939
3938
|
} else {
|
|
3940
3939
|
}
|
|
3941
3940
|
}
|
|
3942
|
-
const profile = (rawMap
|
|
3941
|
+
const profile = (rawMap.CAMUNDA_SDK_BACKPRESSURE_PROFILE || "BALANCED").toString().toUpperCase();
|
|
3943
3942
|
const PRESETS = {
|
|
3944
3943
|
BALANCED: {
|
|
3945
3944
|
initialMax: 16,
|
|
@@ -4012,91 +4011,91 @@ function hydrateConfig(options = {}) {
|
|
|
4012
4011
|
ensure("CAMUNDA_SDK_BACKPRESSURE_UNLIMITED_AFTER_HEALTHY_MS", preset.unlimitedAfterHealthyMs);
|
|
4013
4012
|
const config = {
|
|
4014
4013
|
restAddress: _restAddress,
|
|
4015
|
-
tokenAudience: rawMap
|
|
4016
|
-
defaultTenantId: rawMap
|
|
4014
|
+
tokenAudience: rawMap.CAMUNDA_TOKEN_AUDIENCE,
|
|
4015
|
+
defaultTenantId: rawMap.CAMUNDA_DEFAULT_TENANT_ID || "<default>",
|
|
4017
4016
|
httpRetry: {
|
|
4018
|
-
maxAttempts: parseInt(rawMap
|
|
4019
|
-
baseDelayMs: parseInt(rawMap
|
|
4020
|
-
maxDelayMs: parseInt(rawMap
|
|
4017
|
+
maxAttempts: parseInt(rawMap.CAMUNDA_SDK_HTTP_RETRY_MAX_ATTEMPTS || "3", 10),
|
|
4018
|
+
baseDelayMs: parseInt(rawMap.CAMUNDA_SDK_HTTP_RETRY_BASE_DELAY_MS || "100", 10),
|
|
4019
|
+
maxDelayMs: parseInt(rawMap.CAMUNDA_SDK_HTTP_RETRY_MAX_DELAY_MS || "2000", 10)
|
|
4021
4020
|
},
|
|
4022
4021
|
backpressure: {
|
|
4023
4022
|
enabled: profile !== "LEGACY",
|
|
4024
4023
|
profile,
|
|
4025
4024
|
observeOnly: profile === "LEGACY",
|
|
4026
|
-
initialMax: parseInt(rawMap
|
|
4025
|
+
initialMax: parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_INITIAL_MAX || "16", 10),
|
|
4027
4026
|
softFactor: Math.min(
|
|
4028
4027
|
1,
|
|
4029
4028
|
Math.max(
|
|
4030
4029
|
0.01,
|
|
4031
|
-
(parseInt(rawMap
|
|
4030
|
+
(parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_SOFT_FACTOR || "70", 10) || 70) / 100
|
|
4032
4031
|
)
|
|
4033
4032
|
),
|
|
4034
4033
|
severeFactor: Math.min(
|
|
4035
4034
|
1,
|
|
4036
4035
|
Math.max(
|
|
4037
4036
|
0.01,
|
|
4038
|
-
(parseInt(rawMap
|
|
4037
|
+
(parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_SEVERE_FACTOR || "50", 10) || 50) / 100
|
|
4039
4038
|
)
|
|
4040
4039
|
),
|
|
4041
4040
|
recoveryIntervalMs: parseInt(
|
|
4042
|
-
rawMap
|
|
4041
|
+
rawMap.CAMUNDA_SDK_BACKPRESSURE_RECOVERY_INTERVAL_MS || "1000",
|
|
4043
4042
|
10
|
|
4044
4043
|
),
|
|
4045
|
-
recoveryStep: parseInt(rawMap
|
|
4046
|
-
decayQuietMs: parseInt(rawMap
|
|
4047
|
-
floor: parseInt(rawMap
|
|
4048
|
-
severeThreshold: parseInt(rawMap
|
|
4049
|
-
maxWaiters: parseInt(rawMap
|
|
4044
|
+
recoveryStep: parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_RECOVERY_STEP || "1", 10),
|
|
4045
|
+
decayQuietMs: parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_DECAY_QUIET_MS || "2000", 10),
|
|
4046
|
+
floor: parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_FLOOR || "1", 10),
|
|
4047
|
+
severeThreshold: parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_SEVERE_THRESHOLD || "3", 10),
|
|
4048
|
+
maxWaiters: parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_MAX_WAITERS || "1000", 10),
|
|
4050
4049
|
healthyRecoveryMultiplier: Math.max(
|
|
4051
4050
|
1,
|
|
4052
|
-
(parseInt(rawMap
|
|
4051
|
+
(parseInt(rawMap.CAMUNDA_SDK_BACKPRESSURE_HEALTHY_RECOVERY_MULTIPLIER || "150", 10) || 150) / 100
|
|
4053
4052
|
),
|
|
4054
4053
|
unlimitedAfterHealthyMs: parseInt(
|
|
4055
|
-
rawMap
|
|
4054
|
+
rawMap.CAMUNDA_SDK_BACKPRESSURE_UNLIMITED_AFTER_HEALTHY_MS || "30000",
|
|
4056
4055
|
10
|
|
4057
4056
|
)
|
|
4058
4057
|
},
|
|
4059
4058
|
oauth: {
|
|
4060
|
-
clientId: rawMap
|
|
4061
|
-
clientSecret: rawMap
|
|
4062
|
-
oauthUrl: rawMap
|
|
4063
|
-
grantType: rawMap
|
|
4064
|
-
scope: rawMap
|
|
4065
|
-
timeoutMs: parseInt(rawMap
|
|
4059
|
+
clientId: rawMap.CAMUNDA_CLIENT_ID?.trim() || void 0,
|
|
4060
|
+
clientSecret: rawMap.CAMUNDA_CLIENT_SECRET?.trim() || void 0,
|
|
4061
|
+
oauthUrl: rawMap.CAMUNDA_OAUTH_URL,
|
|
4062
|
+
grantType: rawMap.CAMUNDA_OAUTH_GRANT_TYPE,
|
|
4063
|
+
scope: rawMap.CAMUNDA_OAUTH_SCOPE?.trim() || void 0,
|
|
4064
|
+
timeoutMs: parseInt(rawMap.CAMUNDA_OAUTH_TIMEOUT_MS, 10),
|
|
4066
4065
|
retry: {
|
|
4067
|
-
max: parseInt(rawMap
|
|
4068
|
-
baseDelayMs: parseInt(rawMap
|
|
4066
|
+
max: parseInt(rawMap.CAMUNDA_OAUTH_RETRY_MAX, 10),
|
|
4067
|
+
baseDelayMs: parseInt(rawMap.CAMUNDA_OAUTH_RETRY_BASE_DELAY_MS, 10)
|
|
4069
4068
|
},
|
|
4070
|
-
cacheDir: rawMap
|
|
4069
|
+
cacheDir: rawMap.CAMUNDA_OAUTH_CACHE_DIR?.trim() || void 0
|
|
4071
4070
|
},
|
|
4072
4071
|
auth: {
|
|
4073
4072
|
strategy: authStrategy,
|
|
4074
4073
|
basic: authStrategy === "BASIC" ? {
|
|
4075
|
-
username: rawMap
|
|
4076
|
-
password: rawMap
|
|
4074
|
+
username: rawMap.CAMUNDA_BASIC_AUTH_USERNAME?.trim(),
|
|
4075
|
+
password: rawMap.CAMUNDA_BASIC_AUTH_PASSWORD?.trim()
|
|
4077
4076
|
} : void 0
|
|
4078
4077
|
},
|
|
4079
4078
|
validation: { req: validation.req, res: validation.res, raw: validation.raw },
|
|
4080
|
-
logLevel: rawMap
|
|
4079
|
+
logLevel: rawMap.CAMUNDA_SDK_LOG_LEVEL || "error",
|
|
4081
4080
|
eventual: {
|
|
4082
|
-
pollDefaultMs: parseInt(rawMap
|
|
4081
|
+
pollDefaultMs: parseInt(rawMap.CAMUNDA_SDK_EVENTUAL_POLL_DEFAULT_MS || "500", 10)
|
|
4083
4082
|
},
|
|
4084
|
-
mtls: rawMap
|
|
4085
|
-
cert: rawMap
|
|
4086
|
-
key: rawMap
|
|
4087
|
-
ca: rawMap
|
|
4088
|
-
keyPassphrase: rawMap
|
|
4089
|
-
certPath: rawMap
|
|
4090
|
-
keyPath: rawMap
|
|
4091
|
-
caPath: rawMap
|
|
4083
|
+
mtls: rawMap.CAMUNDA_MTLS_CERT_PATH || rawMap.CAMUNDA_MTLS_KEY_PATH || rawMap.CAMUNDA_MTLS_CA_PATH || rawMap.CAMUNDA_MTLS_CERT || rawMap.CAMUNDA_MTLS_KEY || rawMap.CAMUNDA_MTLS_CA || rawMap.CAMUNDA_MTLS_KEY_PASSPHRASE ? {
|
|
4084
|
+
cert: rawMap.CAMUNDA_MTLS_CERT || void 0,
|
|
4085
|
+
key: rawMap.CAMUNDA_MTLS_KEY || void 0,
|
|
4086
|
+
ca: rawMap.CAMUNDA_MTLS_CA || void 0,
|
|
4087
|
+
keyPassphrase: rawMap.CAMUNDA_MTLS_KEY_PASSPHRASE || void 0,
|
|
4088
|
+
certPath: rawMap.CAMUNDA_MTLS_CERT_PATH || void 0,
|
|
4089
|
+
keyPath: rawMap.CAMUNDA_MTLS_KEY_PATH || void 0,
|
|
4090
|
+
caPath: rawMap.CAMUNDA_MTLS_CA_PATH || void 0
|
|
4092
4091
|
} : void 0,
|
|
4093
4092
|
telemetry: {
|
|
4094
|
-
log: (rawMap
|
|
4095
|
-
correlation: (rawMap
|
|
4093
|
+
log: (rawMap.CAMUNDA_SDK_TELEMETRY_LOG || "false").toString().toLowerCase() === "true",
|
|
4094
|
+
correlation: (rawMap.CAMUNDA_SDK_TELEMETRY_CORRELATION || "false").toString().toLowerCase() === "true"
|
|
4096
4095
|
},
|
|
4097
4096
|
supportLog: {
|
|
4098
|
-
enabled: (rawMap
|
|
4099
|
-
filePath: rawMap
|
|
4097
|
+
enabled: (rawMap.CAMUNDA_SUPPORT_LOG_ENABLED || "false").toString().toLowerCase() === "true",
|
|
4098
|
+
filePath: rawMap.CAMUNDA_SUPPORT_LOG_FILE_PATH || (typeof process !== "undefined" && typeof process.cwd === "function" ? path.join(process.cwd(), "camunda-support.log") : "camunda-support.log")
|
|
4100
4099
|
},
|
|
4101
4100
|
__raw: { ...rawMap }
|
|
4102
4101
|
};
|
|
@@ -4288,10 +4287,10 @@ function eventualPoll(operationId, isGet, invoke, options) {
|
|
|
4288
4287
|
}
|
|
4289
4288
|
if (status === 429 && remaining > 0) {
|
|
4290
4289
|
let delay = pollInterval * 2;
|
|
4291
|
-
const ra = err?.headers?.["retry-after"] || err?.headers?.["Retry-After"] || err?.body?.
|
|
4290
|
+
const ra = err?.headers?.["retry-after"] || err?.headers?.["Retry-After"] || err?.body?.retryAfter || err?.body?.["Retry-After"];
|
|
4292
4291
|
if (ra) {
|
|
4293
4292
|
const parsed = parseInt(ra, 10);
|
|
4294
|
-
if (!isNaN(parsed)) delay = parsed < 1e3 ? parsed * 1e3 : parsed;
|
|
4293
|
+
if (!Number.isNaN(parsed)) delay = parsed < 1e3 ? parsed * 1e3 : parsed;
|
|
4295
4294
|
}
|
|
4296
4295
|
delay = Math.min(delay, pollInterval * 5, 2e3, remaining);
|
|
4297
4296
|
const jitter = 0.9 + Math.random() * 0.2;
|
|
@@ -4331,7 +4330,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
4331
4330
|
try {
|
|
4332
4331
|
if (getStrategy() === "NONE") return request;
|
|
4333
4332
|
const hdrs = await getAuthHeaders();
|
|
4334
|
-
const auth = hdrs?.
|
|
4333
|
+
const auth = hdrs?.Authorization;
|
|
4335
4334
|
if (auth && !request.headers.get("Authorization")) {
|
|
4336
4335
|
const h = new Headers(request.headers);
|
|
4337
4336
|
h.set("Authorization", auth);
|
|
@@ -4344,16 +4343,15 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
4344
4343
|
}
|
|
4345
4344
|
|
|
4346
4345
|
// src/runtime/version.ts
|
|
4347
|
-
var packageVersion = "8.9.0-alpha.
|
|
4346
|
+
var packageVersion = "8.9.0-alpha.22";
|
|
4348
4347
|
|
|
4349
4348
|
// src/runtime/supportLogger.ts
|
|
4350
4349
|
var NoopSupportLogger = class {
|
|
4351
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4352
4350
|
log(_message, _addTimestamp = true) {
|
|
4353
4351
|
}
|
|
4354
4352
|
};
|
|
4355
4353
|
function safeStringifyReplacer(seen) {
|
|
4356
|
-
return
|
|
4354
|
+
return (_, value) => {
|
|
4357
4355
|
if (value && typeof value?.toJSON === "function") {
|
|
4358
4356
|
try {
|
|
4359
4357
|
value = value.toJSON();
|
|
@@ -4397,8 +4395,6 @@ function obscureSensitiveInfo(raw) {
|
|
|
4397
4395
|
var CamundaSupportLogger = class {
|
|
4398
4396
|
enabled;
|
|
4399
4397
|
filepath;
|
|
4400
|
-
/** marker used by writeSupportLogPreamble to avoid duplicate emission */
|
|
4401
|
-
__preambleEmitted = false;
|
|
4402
4398
|
constructor(config) {
|
|
4403
4399
|
const enabled = !!config.supportLog?.enabled;
|
|
4404
4400
|
this.enabled = enabled;
|
|
@@ -4478,12 +4474,16 @@ function writeSupportLogPreamble(logger, config) {
|
|
|
4478
4474
|
cpus: os.cpus().length,
|
|
4479
4475
|
uptime: os.uptime()
|
|
4480
4476
|
};
|
|
4481
|
-
logger.log(
|
|
4477
|
+
logger.log(`/** OS Information */
|
|
4478
|
+
${safeStringify(osInfo)}
|
|
4479
|
+
`, false);
|
|
4482
4480
|
} catch {
|
|
4483
4481
|
}
|
|
4484
4482
|
const raw = config.__raw || {};
|
|
4485
4483
|
const obscured = obscureSensitiveInfo(raw);
|
|
4486
|
-
logger.log(
|
|
4484
|
+
logger.log(`/** Configuration */
|
|
4485
|
+
${safeStringify(obscured)}
|
|
4486
|
+
`, false);
|
|
4487
4487
|
} catch {
|
|
4488
4488
|
}
|
|
4489
4489
|
}
|
|
@@ -4494,7 +4494,7 @@ function redactUrl(u) {
|
|
|
4494
4494
|
const url = new URL(u);
|
|
4495
4495
|
if (url.searchParams && Array.from(url.searchParams.keys()).length) {
|
|
4496
4496
|
const keys = Array.from(new Set(Array.from(url.searchParams.keys())));
|
|
4497
|
-
url.search = keys.length ?
|
|
4497
|
+
url.search = keys.length ? `?${keys.map((k) => k).join("&")}` : "";
|
|
4498
4498
|
}
|
|
4499
4499
|
return url.toString();
|
|
4500
4500
|
} catch {
|
|
@@ -4542,7 +4542,7 @@ function wrapFetch(orig, opts) {
|
|
|
4542
4542
|
else if (typeof Request !== "undefined" && input instanceof Request) origUrl = input.url;
|
|
4543
4543
|
else origUrl = input?.url || input?.toString?.() || String(input);
|
|
4544
4544
|
const redactedUrl = redactUrl(origUrl);
|
|
4545
|
-
const requestId =
|
|
4545
|
+
const requestId = `r${(++globalRequestCounter).toString(36)}`;
|
|
4546
4546
|
const correlationId = opts.correlation ? opts.correlation() : void 0;
|
|
4547
4547
|
const start = Date.now();
|
|
4548
4548
|
let bodyPreview;
|
|
@@ -4580,7 +4580,7 @@ function wrapFetch(orig, opts) {
|
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
4582
4582
|
if (bodyPreview && bodyPreview.length > 4e3)
|
|
4583
|
-
bodyPreview = bodyPreview.slice(0, 4e3)
|
|
4583
|
+
bodyPreview = `${bodyPreview.slice(0, 4e3)}\u2026`;
|
|
4584
4584
|
}
|
|
4585
4585
|
}
|
|
4586
4586
|
} catch {
|
|
@@ -4714,10 +4714,12 @@ async function withCorrelation(id, fn) {
|
|
|
4714
4714
|
}
|
|
4715
4715
|
|
|
4716
4716
|
// src/runtime/validationCore.ts
|
|
4717
|
-
import { ZodError
|
|
4717
|
+
import { ZodError } from "zod";
|
|
4718
4718
|
|
|
4719
4719
|
// src/runtime/formatValidation.ts
|
|
4720
|
-
import {
|
|
4720
|
+
import {
|
|
4721
|
+
ZodObject
|
|
4722
|
+
} from "zod";
|
|
4721
4723
|
function identity(v) {
|
|
4722
4724
|
return v;
|
|
4723
4725
|
}
|
|
@@ -4847,7 +4849,7 @@ function formatUnion(schema) {
|
|
|
4847
4849
|
}
|
|
4848
4850
|
function formatValidationError(params) {
|
|
4849
4851
|
const { side, operationId, schemaName, schema, value, error } = params;
|
|
4850
|
-
const prefix = `Invalid ${operationId ? operationId
|
|
4852
|
+
const prefix = `Invalid ${operationId ? `${operationId} ` : ""}${side}`.trim();
|
|
4851
4853
|
const providedKeys = value && typeof value === "object" && !Array.isArray(value) ? Object.keys(value) : [];
|
|
4852
4854
|
let union;
|
|
4853
4855
|
const firstIssue = error.issues[0];
|
|
@@ -4861,7 +4863,7 @@ function formatValidationError(params) {
|
|
|
4861
4863
|
providedKeys.length ? `provided keys: { ${providedKeys.join(", ")} }` : void 0
|
|
4862
4864
|
].filter(Boolean);
|
|
4863
4865
|
const summary = summaryParts.join(" ");
|
|
4864
|
-
const message = `${prefix}${schemaName ?
|
|
4866
|
+
const message = `${prefix}${schemaName ? ` (${schemaName})` : ""}: ${union ? "no union variant matched" : "validation failed"}`;
|
|
4865
4867
|
const issues = [...union?.lines || [], ...issueLines];
|
|
4866
4868
|
return { message, summary, issues };
|
|
4867
4869
|
}
|
|
@@ -4912,7 +4914,7 @@ async function applySchemaValidation(opts) {
|
|
|
4912
4914
|
const parsed = schema.parseAsync ? await schema.parseAsync(value) : schema.parse(value);
|
|
4913
4915
|
return mode === "warn" ? value : parsed;
|
|
4914
4916
|
} catch (err) {
|
|
4915
|
-
if (err instanceof
|
|
4917
|
+
if (err instanceof ZodError) {
|
|
4916
4918
|
const formatted = formatValidationError({ side, operationId, schema, value, error: err });
|
|
4917
4919
|
if (mode === "warn") {
|
|
4918
4920
|
if (logger) logFormattedValidation("warn", formatted, logger);
|
|
@@ -4981,7 +4983,7 @@ function detectExtrasAndMaybeThrow(opts) {
|
|
|
4981
4983
|
const pathMod = __require("path");
|
|
4982
4984
|
if (!fs.existsSync(settings.captureDir))
|
|
4983
4985
|
fs.mkdirSync(settings.captureDir, { recursive: true, mode: 448 });
|
|
4984
|
-
const sig = operationId
|
|
4986
|
+
const sig = `${operationId}|${flatIssues.sort().join("|")}`;
|
|
4985
4987
|
const h = hash(sig);
|
|
4986
4988
|
if (!seenCaptures.has(h)) {
|
|
4987
4989
|
seenCaptures.add(h);
|
|
@@ -5199,7 +5201,7 @@ var BackpressureManager = class {
|
|
|
5199
5201
|
};
|
|
5200
5202
|
}
|
|
5201
5203
|
log(evt, data, prevSeverity) {
|
|
5202
|
-
this.logger?.trace?.(() => [
|
|
5204
|
+
this.logger?.trace?.(() => [`backpressure.${evt}`, data]);
|
|
5203
5205
|
if (evt === "severity") {
|
|
5204
5206
|
const curr = data.severity;
|
|
5205
5207
|
const enteringUnhealthy = prevSeverity === "healthy" && curr !== "healthy";
|
|
@@ -5384,9 +5386,13 @@ function enrichActivatedJob(raw, client2, log) {
|
|
|
5384
5386
|
}
|
|
5385
5387
|
};
|
|
5386
5388
|
const job = { ...raw, log };
|
|
5387
|
-
job.complete = async (variables = {}) => {
|
|
5389
|
+
job.complete = async (variables = {}, result) => {
|
|
5388
5390
|
try {
|
|
5389
|
-
await client2.completeJob({
|
|
5391
|
+
await client2.completeJob({
|
|
5392
|
+
variables,
|
|
5393
|
+
jobKey: raw.jobKey,
|
|
5394
|
+
...result !== void 0 && { result }
|
|
5395
|
+
});
|
|
5390
5396
|
} finally {
|
|
5391
5397
|
ack();
|
|
5392
5398
|
}
|
|
@@ -16500,7 +16506,7 @@ function retryTE(task, opts) {
|
|
|
16500
16506
|
attempt++;
|
|
16501
16507
|
const retry = attempt < max && (shouldRetry ? await shouldRetry(res.left, attempt) : true);
|
|
16502
16508
|
if (!retry) return res;
|
|
16503
|
-
const delay = Math.min(2e3, baseDelayMs *
|
|
16509
|
+
const delay = Math.min(2e3, baseDelayMs * 2 ** (attempt - 1));
|
|
16504
16510
|
await new Promise((r) => setTimeout(r, delay));
|
|
16505
16511
|
}
|
|
16506
16512
|
return lastLeft;
|
|
@@ -16562,4 +16568,4 @@ export {
|
|
|
16562
16568
|
withTimeoutTE,
|
|
16563
16569
|
eventuallyTE
|
|
16564
16570
|
};
|
|
16565
|
-
//# sourceMappingURL=chunk-
|
|
16571
|
+
//# sourceMappingURL=chunk-7IUDW222.js.map
|