@camunda8/orchestration-cluster-api 10.0.0-alpha.44 → 10.0.0-alpha.46
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/dist/{CamundaClient-Cm0dssvE.d.cts → CamundaClient-Bmpnfx22.d.cts} +123 -34
- package/dist/{CamundaClient-pcUQlGFl.d.ts → CamundaClient-CfF1-z1H.d.ts} +123 -34
- package/dist/{chunk-AJLLDG7R.js → chunk-ZMKXUGHZ.js} +79 -17
- package/dist/chunk-ZMKXUGHZ.js.map +1 -0
- package/dist/effect/index.cjs +134 -68
- package/dist/effect/index.cjs.map +1 -1
- package/dist/effect/index.d.cts +14 -1
- package/dist/effect/index.d.ts +14 -1
- package/dist/effect/index.js +24 -8
- package/dist/effect/index.js.map +1 -1
- package/dist/index.cjs +115 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -5
- package/dist/index.d.ts +27 -5
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/threadWorkerEntry.cjs +77 -48
- package/dist/threadWorkerEntry.cjs.map +1 -1
- package/dist/threadWorkerEntry.js +77 -48
- package/dist/threadWorkerEntry.js.map +1 -1
- package/dist/{zod.gen-SZTQQ6VL.js → zod.gen-SY24X4YQ.js} +36 -46
- package/dist/zod.gen-SY24X4YQ.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-AJLLDG7R.js.map +0 -1
- package/dist/zod.gen-SZTQQ6VL.js.map +0 -1
|
@@ -192,9 +192,13 @@ function isSdkError(e) {
|
|
|
192
192
|
"ValidationSdkError",
|
|
193
193
|
"AuthSdkError",
|
|
194
194
|
"NetworkSdkError",
|
|
195
|
-
"CancelSdkError"
|
|
195
|
+
"CancelSdkError",
|
|
196
|
+
"PresentWhenUnsupportedError"
|
|
196
197
|
].includes(e.name);
|
|
197
198
|
}
|
|
199
|
+
function isPresentWhenUnsupportedError(e) {
|
|
200
|
+
return !!e && typeof e === "object" && e.name === "PresentWhenUnsupportedError";
|
|
201
|
+
}
|
|
198
202
|
function normalizeError(err, ctx) {
|
|
199
203
|
if (isSdkError(err)) return err;
|
|
200
204
|
const e = err || {};
|
|
@@ -642,7 +646,8 @@ var JobWorker = class {
|
|
|
642
646
|
autoStart: cfg.autoStart ?? true,
|
|
643
647
|
validateSchemas: cfg.validateSchemas ?? false,
|
|
644
648
|
maxParallelJobs: cfg.maxParallelJobs ?? 10,
|
|
645
|
-
jobTimeoutMs: cfg.jobTimeoutMs ?? 6e4
|
|
649
|
+
jobTimeoutMs: cfg.jobTimeoutMs ?? 6e4,
|
|
650
|
+
withLease: cfg.withLease ?? false
|
|
646
651
|
};
|
|
647
652
|
this._maxParallelJobs = this._cfg.maxParallelJobs;
|
|
648
653
|
this._jobTimeoutMs = this._cfg.jobTimeoutMs;
|
|
@@ -760,7 +765,10 @@ var JobWorker = class {
|
|
|
760
765
|
requestTimeout: this._cfg.pollTimeoutMs ?? DEFAULT_LONGPOLL_TIMEOUT,
|
|
761
766
|
timeout: this._jobTimeoutMs,
|
|
762
767
|
// API expects `fetchVariable`; map from config `fetchVariables`
|
|
763
|
-
...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {}
|
|
768
|
+
...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {},
|
|
769
|
+
// Request a lease only when explicitly enabled; omitting the field keeps
|
|
770
|
+
// the activation identical to a non-leasing worker.
|
|
771
|
+
...this._cfg.withLease ? { withLease: true } : {}
|
|
764
772
|
};
|
|
765
773
|
this._log.debug(() => ["activation.request", { batchSize }]);
|
|
766
774
|
let result = [];
|
|
@@ -779,6 +787,11 @@ var JobWorker = class {
|
|
|
779
787
|
this._scheduleNext(this._cfg.pollIntervalMs);
|
|
780
788
|
return;
|
|
781
789
|
}
|
|
790
|
+
if (isPresentWhenUnsupportedError(e)) {
|
|
791
|
+
this._log.error("activation.fatal", e);
|
|
792
|
+
this.stop();
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
782
795
|
this._consecutiveActivationErrors += 1;
|
|
783
796
|
const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, this._cfg);
|
|
784
797
|
this._log.error("activation.error", e);
|
|
@@ -842,7 +855,9 @@ var JobWorker = class {
|
|
|
842
855
|
await this._client.failJob({
|
|
843
856
|
jobKey: raw.jobKey,
|
|
844
857
|
errorMessage: e?.message || "Handler error",
|
|
845
|
-
retries: typeof retries === "number" ? Math.max(0, retries - 1) : 0
|
|
858
|
+
retries: typeof retries === "number" ? Math.max(0, retries - 1) : 0,
|
|
859
|
+
// Fence the failure against a superseded activation when leased.
|
|
860
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
846
861
|
});
|
|
847
862
|
} catch (failErr) {
|
|
848
863
|
this._log.error("job.fail.error", failErr);
|
|
@@ -854,7 +869,12 @@ var JobWorker = class {
|
|
|
854
869
|
}
|
|
855
870
|
async _failValidation(raw, msg) {
|
|
856
871
|
try {
|
|
857
|
-
await this._client.failJob({
|
|
872
|
+
await this._client.failJob({
|
|
873
|
+
jobKey: raw.jobKey,
|
|
874
|
+
errorMessage: msg,
|
|
875
|
+
// Fence the failure against a superseded activation when leased.
|
|
876
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
877
|
+
});
|
|
858
878
|
} catch (e) {
|
|
859
879
|
this._log.error("job.fail.validation.error", e);
|
|
860
880
|
} finally {
|
|
@@ -5409,7 +5429,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
5409
5429
|
}
|
|
5410
5430
|
|
|
5411
5431
|
// src/runtime/version.ts
|
|
5412
|
-
var packageVersion = "10.0.0-alpha.
|
|
5432
|
+
var packageVersion = "10.0.0-alpha.46";
|
|
5413
5433
|
|
|
5414
5434
|
// src/runtime/supportLogger.ts
|
|
5415
5435
|
var NoopSupportLogger = class {
|
|
@@ -6461,7 +6481,8 @@ function enrichActivatedJob(raw, client2, log, clock = client2.clock) {
|
|
|
6461
6481
|
await client2.completeJob({
|
|
6462
6482
|
variables,
|
|
6463
6483
|
jobKey: raw.jobKey,
|
|
6464
|
-
...result !== void 0 && { result }
|
|
6484
|
+
...result !== void 0 && { result },
|
|
6485
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6465
6486
|
});
|
|
6466
6487
|
} finally {
|
|
6467
6488
|
ack();
|
|
@@ -6470,7 +6491,11 @@ function enrichActivatedJob(raw, client2, log, clock = client2.clock) {
|
|
|
6470
6491
|
};
|
|
6471
6492
|
job.fail = async (reason) => {
|
|
6472
6493
|
try {
|
|
6473
|
-
await client2.failJob({
|
|
6494
|
+
await client2.failJob({
|
|
6495
|
+
...reason,
|
|
6496
|
+
jobKey: raw.jobKey,
|
|
6497
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6498
|
+
});
|
|
6474
6499
|
} finally {
|
|
6475
6500
|
ack();
|
|
6476
6501
|
}
|
|
@@ -6478,7 +6503,11 @@ function enrichActivatedJob(raw, client2, log, clock = client2.clock) {
|
|
|
6478
6503
|
};
|
|
6479
6504
|
job.error = async (error) => {
|
|
6480
6505
|
try {
|
|
6481
|
-
await client2.throwJobError({
|
|
6506
|
+
await client2.throwJobError({
|
|
6507
|
+
...error,
|
|
6508
|
+
jobKey: raw.jobKey,
|
|
6509
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6510
|
+
});
|
|
6482
6511
|
} finally {
|
|
6483
6512
|
ack();
|
|
6484
6513
|
}
|
|
@@ -6498,8 +6527,16 @@ function enrichActivatedJob(raw, client2, log, clock = client2.clock) {
|
|
|
6498
6527
|
ack();
|
|
6499
6528
|
return JobActionReceipt;
|
|
6500
6529
|
};
|
|
6501
|
-
job.modifyJobTimeout = ({ newTimeoutMs }) => client2.updateJob({
|
|
6502
|
-
|
|
6530
|
+
job.modifyJobTimeout = ({ newTimeoutMs }) => client2.updateJob({
|
|
6531
|
+
changeset: { timeout: newTimeoutMs },
|
|
6532
|
+
jobKey: raw.jobKey,
|
|
6533
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6534
|
+
});
|
|
6535
|
+
job.modifyRetries = ({ retries }) => client2.updateJob({
|
|
6536
|
+
changeset: { retries },
|
|
6537
|
+
jobKey: raw.jobKey,
|
|
6538
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6539
|
+
});
|
|
6503
6540
|
return job;
|
|
6504
6541
|
}
|
|
6505
6542
|
|
|
@@ -6533,7 +6570,8 @@ var ThreadedJobWorker = class {
|
|
|
6533
6570
|
autoStart: cfg.autoStart ?? true,
|
|
6534
6571
|
validateSchemas: cfg.validateSchemas ?? false,
|
|
6535
6572
|
maxParallelJobs: cfg.maxParallelJobs ?? 10,
|
|
6536
|
-
jobTimeoutMs: cfg.jobTimeoutMs ?? 6e4
|
|
6573
|
+
jobTimeoutMs: cfg.jobTimeoutMs ?? 6e4,
|
|
6574
|
+
withLease: cfg.withLease ?? false
|
|
6537
6575
|
};
|
|
6538
6576
|
this._maxParallelJobs = this._cfg.maxParallelJobs;
|
|
6539
6577
|
this._jobTimeoutMs = this._cfg.jobTimeoutMs;
|
|
@@ -6687,7 +6725,9 @@ var ThreadedJobWorker = class {
|
|
|
6687
6725
|
this._client.failJob({
|
|
6688
6726
|
jobKey: raw.jobKey,
|
|
6689
6727
|
errorMessage: err?.message || "Thread handler error",
|
|
6690
|
-
retries: typeof raw.retries === "number" ? Math.max(0, raw.retries - 1) : 0
|
|
6728
|
+
retries: typeof raw.retries === "number" ? Math.max(0, raw.retries - 1) : 0,
|
|
6729
|
+
// Fence the failure against a superseded activation when leased.
|
|
6730
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6691
6731
|
}).catch((failErr) => {
|
|
6692
6732
|
this._log.error("job.fail.error", failErr);
|
|
6693
6733
|
}).finally(() => {
|
|
@@ -6738,7 +6778,8 @@ var ThreadedJobWorker = class {
|
|
|
6738
6778
|
maxJobsToActivate: batchSize,
|
|
6739
6779
|
requestTimeout: this._cfg.pollTimeoutMs ?? DEFAULT_LONGPOLL_TIMEOUT2,
|
|
6740
6780
|
timeout: this._jobTimeoutMs,
|
|
6741
|
-
...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {}
|
|
6781
|
+
...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {},
|
|
6782
|
+
...this._cfg.withLease ? { withLease: true } : {}
|
|
6742
6783
|
};
|
|
6743
6784
|
this._log.debug(() => ["activation.request", { batchSize }]);
|
|
6744
6785
|
let result = [];
|
|
@@ -6757,6 +6798,11 @@ var ThreadedJobWorker = class {
|
|
|
6757
6798
|
this._scheduleNext(this._cfg.pollIntervalMs);
|
|
6758
6799
|
return;
|
|
6759
6800
|
}
|
|
6801
|
+
if (isPresentWhenUnsupportedError(e)) {
|
|
6802
|
+
this._log.error("activation.fatal", e);
|
|
6803
|
+
this.stop();
|
|
6804
|
+
return;
|
|
6805
|
+
}
|
|
6760
6806
|
this._consecutiveActivationErrors += 1;
|
|
6761
6807
|
const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, this._cfg);
|
|
6762
6808
|
this._log.error("activation.error", e);
|
|
@@ -6824,7 +6870,12 @@ var ThreadedJobWorker = class {
|
|
|
6824
6870
|
}
|
|
6825
6871
|
async _failValidation(raw, msg) {
|
|
6826
6872
|
try {
|
|
6827
|
-
await this._client.failJob({
|
|
6873
|
+
await this._client.failJob({
|
|
6874
|
+
jobKey: raw.jobKey,
|
|
6875
|
+
errorMessage: msg,
|
|
6876
|
+
// Fence the failure against a superseded activation when leased.
|
|
6877
|
+
...raw.jobLeaseToken != null ? { jobLeaseToken: raw.jobLeaseToken } : {}
|
|
6878
|
+
});
|
|
6828
6879
|
} catch (e) {
|
|
6829
6880
|
this._log.error("job.fail.validation.error", e);
|
|
6830
6881
|
} finally {
|
|
@@ -7487,7 +7538,7 @@ var CamundaClientBase = class {
|
|
|
7487
7538
|
_schemasPromise = null;
|
|
7488
7539
|
_loadSchemas() {
|
|
7489
7540
|
if (!this._schemasPromise) {
|
|
7490
|
-
this._schemasPromise = import("./zod.gen-
|
|
7541
|
+
this._schemasPromise = import("./zod.gen-SY24X4YQ.js");
|
|
7491
7542
|
}
|
|
7492
7543
|
return this._schemasPromise;
|
|
7493
7544
|
}
|
|
@@ -7681,6 +7732,16 @@ var CamundaClientBase = class {
|
|
|
7681
7732
|
if (this._validation.settings.res === "strict") data = maybeR;
|
|
7682
7733
|
}
|
|
7683
7734
|
}
|
|
7735
|
+
if (data && data.jobs && _body && _body.withLease === true) {
|
|
7736
|
+
for (const _el of data.jobs) {
|
|
7737
|
+
if (_el.jobLeaseToken == null) {
|
|
7738
|
+
const _e = new Error("activateJobs: withLease=true was requested but the server returned an item without 'jobLeaseToken' \u2014 the server may predate this feature. Refusing to silently mis-type the dependent field.");
|
|
7739
|
+
_e.name = "PresentWhenUnsupportedError";
|
|
7740
|
+
_e.nonRetryable = true;
|
|
7741
|
+
throw _e;
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7684
7745
|
if (data && data.jobs) {
|
|
7685
7746
|
data.jobs = data.jobs.map((j) => enrichActivatedJob(j, this, this.logger().scope(`job:${j.jobKey}`)));
|
|
7686
7747
|
}
|
|
@@ -21599,6 +21660,7 @@ export {
|
|
|
21599
21660
|
createTestClock,
|
|
21600
21661
|
createEngineClock,
|
|
21601
21662
|
isSdkError,
|
|
21663
|
+
isPresentWhenUnsupportedError,
|
|
21602
21664
|
CamundaValidationError,
|
|
21603
21665
|
EventualConsistencyTimeoutError,
|
|
21604
21666
|
TypedVariablesError,
|
|
@@ -21615,4 +21677,4 @@ export {
|
|
|
21615
21677
|
createCamundaClient,
|
|
21616
21678
|
CamundaClient
|
|
21617
21679
|
};
|
|
21618
|
-
//# sourceMappingURL=chunk-
|
|
21680
|
+
//# sourceMappingURL=chunk-ZMKXUGHZ.js.map
|