@camunda8/orchestration-cluster-api 10.0.0-alpha.24 → 10.0.0-alpha.26

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,17 @@
1
+ # [10.0.0-alpha.26](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.25...v10.0.0-alpha.26) (2026-08-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * **examples:** add searchOwnAuthorizations example coverage ([a3749c3](https://github.com/camunda/orchestration-cluster-api-js/commit/a3749c392e725957ad22d7627b2161a6a4866165))
7
+
8
+ # [10.0.0-alpha.25](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.24...v10.0.0-alpha.25) (2026-08-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **runtime:** back off job-worker activation retries on transport errors ([#411](https://github.com/camunda/orchestration-cluster-api-js/issues/411)) ([bccaabe](https://github.com/camunda/orchestration-cluster-api-js/commit/bccaabeffc995b30fcb83488538928e57c8de953))
14
+
1
15
  # [10.0.0-alpha.24](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.23...v10.0.0-alpha.24) (2026-08-04)
2
16
 
3
17
 
@@ -317,6 +317,33 @@ function createVariableSearchFetchPage(params) {
317
317
  };
318
318
  }
319
319
 
320
+ // src/runtime/pollBackoff.ts
321
+ var DEFAULT_POLL_BACKOFF_MIN_MS = 1e3;
322
+ var DEFAULT_POLL_BACKOFF_MAX_MS = 3e4;
323
+ var MAX_SAFE_TIMEOUT_MS = 2147483647;
324
+ function computePollBackoffMs(attempt, opts) {
325
+ const rng = opts.rng ?? Math.random;
326
+ const min = Number.isFinite(opts.minMs) ? Math.min(MAX_SAFE_TIMEOUT_MS, Math.max(0, Math.floor(opts.minMs))) : 0;
327
+ const max = Number.isFinite(opts.maxMs) ? Math.min(MAX_SAFE_TIMEOUT_MS, Math.max(min, Math.floor(opts.maxMs))) : min;
328
+ const safeAttempt = Number.isFinite(attempt) ? Math.max(1, Math.floor(attempt)) : 1;
329
+ const exponent = Math.min(safeAttempt - 1, 53);
330
+ const cap = Math.min(max, min * 2 ** exponent);
331
+ const half = cap / 2;
332
+ const r = rng();
333
+ const jitter = Number.isFinite(r) ? Math.min(1, Math.max(0, r)) : 0;
334
+ return Math.round(half + jitter * half);
335
+ }
336
+ function nextActivationRetryDelayMs(attempt, cfg, rng) {
337
+ if (cfg.pollBackoffMinMs > 0) {
338
+ return computePollBackoffMs(attempt, {
339
+ minMs: cfg.pollBackoffMinMs,
340
+ maxMs: cfg.pollBackoffMaxMs,
341
+ rng
342
+ });
343
+ }
344
+ return Number.isFinite(cfg.pollIntervalMs) ? Math.max(0, Math.round(cfg.pollIntervalMs)) : 0;
345
+ }
346
+
320
347
  // src/runtime/workerStartGate.ts
321
348
  var WorkerStartGate = class {
322
349
  /**
@@ -376,6 +403,8 @@ var JobWorker = class {
376
403
  _pollTimer = null;
377
404
  _inFlightActivation = null;
378
405
  // CancelablePromise-like
406
+ /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
407
+ _consecutiveActivationErrors = 0;
379
408
  _log;
380
409
  _startGate;
381
410
  constructor(client2, cfg) {
@@ -383,6 +412,8 @@ var JobWorker = class {
383
412
  this._cfg = {
384
413
  ...cfg,
385
414
  pollIntervalMs: cfg.pollIntervalMs ?? 1,
415
+ pollBackoffMinMs: cfg.pollBackoffMinMs ?? DEFAULT_POLL_BACKOFF_MIN_MS,
416
+ pollBackoffMaxMs: cfg.pollBackoffMaxMs ?? DEFAULT_POLL_BACKOFF_MAX_MS,
386
417
  autoStart: cfg.autoStart ?? true,
387
418
  validateSchemas: cfg.validateSchemas ?? false,
388
419
  maxParallelJobs: cfg.maxParallelJobs ?? 10,
@@ -527,6 +558,7 @@ var JobWorker = class {
527
558
  this._inFlightActivation = this._client.activateJobs(body);
528
559
  const activation = await this._inFlightActivation;
529
560
  this._inFlightActivation = null;
561
+ this._consecutiveActivationErrors = 0;
530
562
  result = activation?.jobs || [];
531
563
  this._log.debug(() => ["activation.response", { jobs: result.length }]);
532
564
  } catch (e) {
@@ -534,10 +566,17 @@ var JobWorker = class {
534
566
  if (this._stopped) return;
535
567
  if (e?.name === "CancelSdkError") {
536
568
  this._log.debug("activation.cancelled");
537
- } else {
538
- this._log.error("activation.error", e);
569
+ this._scheduleNext(this._cfg.pollIntervalMs);
570
+ return;
539
571
  }
540
- this._scheduleNext(this._cfg.pollIntervalMs);
572
+ this._consecutiveActivationErrors += 1;
573
+ const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, this._cfg);
574
+ this._log.error("activation.error", e);
575
+ this._log.debug(() => [
576
+ "activation.retry",
577
+ { attempt: this._consecutiveActivationErrors, retryInMs: delayMs }
578
+ ]);
579
+ this._scheduleNext(delayMs);
541
580
  return;
542
581
  }
543
582
  if (!result || result.length === 0) {
@@ -1563,6 +1602,17 @@ var getAuthentication = (options) => (options?.client ?? client).get({
1563
1602
  url: "/authentication/me",
1564
1603
  ...options
1565
1604
  });
1605
+ var searchOwnAuthorizations = (options) => (options?.client ?? client).post({
1606
+ requestValidator: void 0,
1607
+ responseValidator: void 0,
1608
+ security: [{ scheme: "bearer", type: "http" }],
1609
+ url: "/authentication/me/authorizations/search",
1610
+ ...options,
1611
+ headers: {
1612
+ "Content-Type": "application/json",
1613
+ ...options?.headers
1614
+ }
1615
+ });
1566
1616
  var createAuthorization = (options) => (options.client ?? client).post({
1567
1617
  requestValidator: void 0,
1568
1618
  responseValidator: void 0,
@@ -4849,7 +4899,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
4849
4899
  }
4850
4900
 
4851
4901
  // src/runtime/version.ts
4852
- var packageVersion = "10.0.0-alpha.24";
4902
+ var packageVersion = "10.0.0-alpha.26";
4853
4903
 
4854
4904
  // src/runtime/supportLogger.ts
4855
4905
  var NoopSupportLogger = class {
@@ -5954,6 +6004,8 @@ var ThreadedJobWorker = class {
5954
6004
  _stopped = false;
5955
6005
  _pollTimer = null;
5956
6006
  _inFlightActivation = null;
6007
+ /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
6008
+ _consecutiveActivationErrors = 0;
5957
6009
  _log;
5958
6010
  _jobQueue = [];
5959
6011
  _startGate;
@@ -5963,6 +6015,8 @@ var ThreadedJobWorker = class {
5963
6015
  this._cfg = {
5964
6016
  ...cfg,
5965
6017
  pollIntervalMs: cfg.pollIntervalMs ?? 1,
6018
+ pollBackoffMinMs: cfg.pollBackoffMinMs ?? DEFAULT_POLL_BACKOFF_MIN_MS,
6019
+ pollBackoffMaxMs: cfg.pollBackoffMaxMs ?? DEFAULT_POLL_BACKOFF_MAX_MS,
5966
6020
  autoStart: cfg.autoStart ?? true,
5967
6021
  validateSchemas: cfg.validateSchemas ?? false,
5968
6022
  maxParallelJobs: cfg.maxParallelJobs ?? 10,
@@ -6194,6 +6248,7 @@ var ThreadedJobWorker = class {
6194
6248
  this._inFlightActivation = this._client.activateJobs(body);
6195
6249
  const activation = await this._inFlightActivation;
6196
6250
  this._inFlightActivation = null;
6251
+ this._consecutiveActivationErrors = 0;
6197
6252
  result = activation?.jobs || [];
6198
6253
  this._log.debug(() => ["activation.response", { jobs: result.length }]);
6199
6254
  } catch (e) {
@@ -6201,10 +6256,17 @@ var ThreadedJobWorker = class {
6201
6256
  if (this._stopped) return;
6202
6257
  if (e?.name === "CancelSdkError") {
6203
6258
  this._log.debug("activation.cancelled");
6204
- } else {
6205
- this._log.error("activation.error", e);
6259
+ this._scheduleNext(this._cfg.pollIntervalMs);
6260
+ return;
6206
6261
  }
6207
- this._scheduleNext(this._cfg.pollIntervalMs);
6262
+ this._consecutiveActivationErrors += 1;
6263
+ const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, this._cfg);
6264
+ this._log.error("activation.error", e);
6265
+ this._log.debug(() => [
6266
+ "activation.retry",
6267
+ { attempt: this._consecutiveActivationErrors, retryInMs: delayMs }
6268
+ ]);
6269
+ this._scheduleNext(delayMs);
6208
6270
  return;
6209
6271
  }
6210
6272
  if (!result || result.length === 0) {
@@ -6856,7 +6918,7 @@ var CamundaClient = class {
6856
6918
  _schemasPromise = null;
6857
6919
  _loadSchemas() {
6858
6920
  if (!this._schemasPromise) {
6859
- this._schemasPromise = import("./zod.gen-OIU26R2L.js");
6921
+ this._schemasPromise = import("./zod.gen-4DQL5SMC.js");
6860
6922
  }
6861
6923
  return this._schemasPromise;
6862
6924
  }
@@ -16391,6 +16453,64 @@ var CamundaClient = class {
16391
16453
  return invoke();
16392
16454
  });
16393
16455
  }
16456
+ searchOwnAuthorizations(arg, consistencyManagement, options) {
16457
+ if (!consistencyManagement) throw new Error("Missing consistencyManagement parameter for eventually consistent endpoint");
16458
+ const useConsistency = consistencyManagement.consistency;
16459
+ return toCancelable2(async (signal) => {
16460
+ const _body = arg;
16461
+ let envelope = {};
16462
+ envelope.body = _body;
16463
+ if (this._validation.settings.req !== "none") {
16464
+ const _schemas = await this._loadSchemas();
16465
+ if (envelope.body !== void 0) {
16466
+ const maybeBody = await this._validation.gateRequest("searchOwnAuthorizations", _schemas.zSearchOwnAuthorizationsBody, envelope.body);
16467
+ if (this._validation.settings.req === "strict") envelope.body = maybeBody;
16468
+ }
16469
+ }
16470
+ const opts = { client: this._client, signal, throwOnError: false };
16471
+ if (envelope.body !== void 0) opts.body = envelope.body;
16472
+ const call = async () => {
16473
+ try {
16474
+ const _raw = await searchOwnAuthorizations(opts);
16475
+ let data = this._evaluateResponse(_raw, "searchOwnAuthorizations", (resp) => {
16476
+ const st = resp.status ?? resp.response?.status;
16477
+ if (!st) return void 0;
16478
+ const candidate = st === 429 || st === 503 || st === 500;
16479
+ if (!candidate) return void 0;
16480
+ let prob = void 0;
16481
+ if (resp.error && typeof resp.error === "object") prob = resp.error;
16482
+ const err = new Error(prob && (prob.title || prob.detail) ? prob.title || prob.detail : "HTTP " + st);
16483
+ err.status = st;
16484
+ err.name = "HttpSdkError";
16485
+ if (prob) {
16486
+ for (const k of ["type", "title", "detail", "instance"]) if (prob[k] !== void 0) err[k] = prob[k];
16487
+ }
16488
+ const isBp = st === 429 || st === 503 && err.title === "RESOURCE_EXHAUSTED" || st === 500 && (typeof err.detail === "string" && /RESOURCE_EXHAUSTED/.test(err.detail));
16489
+ if (!isBp) err.nonRetryable = true;
16490
+ return err;
16491
+ });
16492
+ const _respSchemaName = "zSearchOwnAuthorizationsResponse";
16493
+ if (this._isVoidResponse(_respSchemaName)) {
16494
+ data = void 0;
16495
+ }
16496
+ if (this._validation.settings.res !== "none") {
16497
+ const _schemas = await this._loadSchemas();
16498
+ const _schema = _schemas.zSearchOwnAuthorizationsResponse;
16499
+ if (_schema) {
16500
+ const maybeR = await this._validation.gateResponse("searchOwnAuthorizations", _schema, data);
16501
+ if (this._validation.settings.res === "strict") data = maybeR;
16502
+ }
16503
+ }
16504
+ return data;
16505
+ } catch (e) {
16506
+ throw e;
16507
+ }
16508
+ };
16509
+ const invoke = () => toCancelable2(() => call());
16510
+ if (useConsistency) return eventualPoll("searchOwnAuthorizations", false, invoke, { ...useConsistency, logger: this._log });
16511
+ return invoke();
16512
+ });
16513
+ }
16394
16514
  searchProcessDefinitions(arg, consistencyManagement, options) {
16395
16515
  if (!consistencyManagement) throw new Error("Missing consistencyManagement parameter for eventually consistent endpoint");
16396
16516
  const useConsistency = consistencyManagement.consistency;
@@ -19692,4 +19812,4 @@ export {
19692
19812
  withTimeoutTE,
19693
19813
  eventuallyTE
19694
19814
  };
19695
- //# sourceMappingURL=chunk-GUNQU6UN.js.map
19815
+ //# sourceMappingURL=chunk-UXIQXURB.js.map