@camunda8/orchestration-cluster-api 10.0.0-alpha.38 → 10.0.0-alpha.39
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 +7 -0
- package/README.md +125 -5
- package/dist/{CamundaClient-BMOpGKIo.d.ts → CamundaClient-Crt5W0EI.d.ts} +8 -9
- package/dist/{CamundaClient-CvdIL8uM.d.cts → CamundaClient-VlYVveFG.d.cts} +8 -9
- package/dist/{chunk-LPNUMNEM.js → chunk-LNMC2FKC.js} +73 -74
- package/dist/chunk-LNMC2FKC.js.map +1 -0
- package/dist/effect/index.cjs +109 -74
- package/dist/effect/index.cjs.map +1 -1
- package/dist/effect/index.d.cts +48 -4
- package/dist/effect/index.d.ts +48 -4
- package/dist/effect/index.js +45 -8
- package/dist/effect/index.js.map +1 -1
- package/dist/index.cjs +72 -73
- 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 +1 -1
- package/package.json +4 -3
- package/dist/chunk-LPNUMNEM.js.map +0 -1
package/dist/effect/index.cjs
CHANGED
|
@@ -14156,7 +14156,7 @@ function createLogger(opts = {}) {
|
|
|
14156
14156
|
}
|
|
14157
14157
|
|
|
14158
14158
|
// src/runtime/version.ts
|
|
14159
|
-
var packageVersion = "10.0.0-alpha.
|
|
14159
|
+
var packageVersion = "10.0.0-alpha.39";
|
|
14160
14160
|
|
|
14161
14161
|
// src/runtime/supportLogger.ts
|
|
14162
14162
|
var NoopSupportLogger = class {
|
|
@@ -15481,6 +15481,51 @@ function nextActivationRetryDelayMs(attempt, cfg, rng) {
|
|
|
15481
15481
|
return Number.isFinite(cfg.pollIntervalMs) ? Math.max(0, Math.round(cfg.pollIntervalMs)) : 0;
|
|
15482
15482
|
}
|
|
15483
15483
|
|
|
15484
|
+
// src/runtime/workerGracefulStop.ts
|
|
15485
|
+
async function stopWorkerGracefully(deps, opts) {
|
|
15486
|
+
const waitUpToMs = opts?.waitUpToMs ?? 5e3;
|
|
15487
|
+
const checkIntervalMs = opts?.checkIntervalMs ?? 10;
|
|
15488
|
+
deps.haltPolling();
|
|
15489
|
+
const start = liveClock.now();
|
|
15490
|
+
const inFlight = deps.inFlightActivation();
|
|
15491
|
+
if (inFlight) {
|
|
15492
|
+
const budget = liveClock.deadline(waitUpToMs);
|
|
15493
|
+
try {
|
|
15494
|
+
await Promise.race([
|
|
15495
|
+
inFlight,
|
|
15496
|
+
new Promise((_, rej) => {
|
|
15497
|
+
const reject = () => rej(new Error("activation.wait.timeout"));
|
|
15498
|
+
if (budget.signal.aborted) reject();
|
|
15499
|
+
else budget.signal.addEventListener("abort", reject, { once: true });
|
|
15500
|
+
})
|
|
15501
|
+
]);
|
|
15502
|
+
} catch (e) {
|
|
15503
|
+
if (e && e.message === "activation.wait.timeout") {
|
|
15504
|
+
deps.log.debug("worker.gracefulStop.activationTimeout");
|
|
15505
|
+
}
|
|
15506
|
+
} finally {
|
|
15507
|
+
budget.dispose();
|
|
15508
|
+
}
|
|
15509
|
+
}
|
|
15510
|
+
while (deps.activeJobs() > 0 && liveClock.now() - start < waitUpToMs) {
|
|
15511
|
+
await liveClock.sleep(checkIntervalMs);
|
|
15512
|
+
}
|
|
15513
|
+
const timedOut = deps.activeJobs() > 0;
|
|
15514
|
+
if (timedOut) {
|
|
15515
|
+
const pending = deps.inFlightActivation();
|
|
15516
|
+
if (pending?.cancel) {
|
|
15517
|
+
try {
|
|
15518
|
+
pending.cancel();
|
|
15519
|
+
} catch {
|
|
15520
|
+
}
|
|
15521
|
+
}
|
|
15522
|
+
deps.log.debug("worker.gracefulStop.timeout", { remaining: deps.activeJobs() });
|
|
15523
|
+
} else {
|
|
15524
|
+
deps.log.debug("worker.gracefulStop.done");
|
|
15525
|
+
}
|
|
15526
|
+
return { remainingJobs: deps.activeJobs(), timedOut };
|
|
15527
|
+
}
|
|
15528
|
+
|
|
15484
15529
|
// src/runtime/workerStartGate.ts
|
|
15485
15530
|
var WorkerStartGate = class {
|
|
15486
15531
|
/**
|
|
@@ -15627,42 +15672,19 @@ var JobWorker = class {
|
|
|
15627
15672
|
* If timeout is reached, falls back to hard stop logic (cancels activation if still pending).
|
|
15628
15673
|
*/
|
|
15629
15674
|
async stopGracefully(opts) {
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
]);
|
|
15644
|
-
} catch (e) {
|
|
15645
|
-
if (e && e.message === "activation.wait.timeout") {
|
|
15646
|
-
this._log.debug("worker.gracefulStop.activationTimeout");
|
|
15647
|
-
}
|
|
15648
|
-
}
|
|
15649
|
-
}
|
|
15650
|
-
while (this._activeJobs > 0 && Date.now() - start < waitUpToMs) {
|
|
15651
|
-
await new Promise((r) => setTimeout(r, checkIntervalMs));
|
|
15652
|
-
}
|
|
15653
|
-
const timedOut = this._activeJobs > 0;
|
|
15654
|
-
if (timedOut) {
|
|
15655
|
-
if (this._inFlightActivation?.cancel) {
|
|
15656
|
-
try {
|
|
15657
|
-
this._inFlightActivation.cancel();
|
|
15658
|
-
} catch {
|
|
15659
|
-
}
|
|
15660
|
-
}
|
|
15661
|
-
this._log.debug("worker.gracefulStop.timeout", { remaining: this._activeJobs });
|
|
15662
|
-
} else {
|
|
15663
|
-
this._log.debug("worker.gracefulStop.done");
|
|
15664
|
-
}
|
|
15665
|
-
return { remainingJobs: this._activeJobs, timedOut };
|
|
15675
|
+
return stopWorkerGracefully(
|
|
15676
|
+
{
|
|
15677
|
+
haltPolling: () => {
|
|
15678
|
+
this._stopped = true;
|
|
15679
|
+
if (this._pollTimer) clearTimeout(this._pollTimer);
|
|
15680
|
+
this._pollTimer = null;
|
|
15681
|
+
},
|
|
15682
|
+
activeJobs: () => this._activeJobs,
|
|
15683
|
+
inFlightActivation: () => this._inFlightActivation,
|
|
15684
|
+
log: this._log
|
|
15685
|
+
},
|
|
15686
|
+
opts
|
|
15687
|
+
);
|
|
15666
15688
|
}
|
|
15667
15689
|
_scheduleNext(delayMs) {
|
|
15668
15690
|
if (this._stopped) return;
|
|
@@ -15955,42 +15977,19 @@ var ThreadedJobWorker = class {
|
|
|
15955
15977
|
this._log.info("worker.stop");
|
|
15956
15978
|
}
|
|
15957
15979
|
async stopGracefully(opts) {
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
]);
|
|
15972
|
-
} catch (e) {
|
|
15973
|
-
if (e && e.message === "activation.wait.timeout") {
|
|
15974
|
-
this._log.debug("worker.gracefulStop.activationTimeout");
|
|
15975
|
-
}
|
|
15976
|
-
}
|
|
15977
|
-
}
|
|
15978
|
-
while (this._activeJobs > 0 && Date.now() - start < waitUpToMs) {
|
|
15979
|
-
await new Promise((r) => setTimeout(r, checkIntervalMs));
|
|
15980
|
-
}
|
|
15981
|
-
const timedOut = this._activeJobs > 0;
|
|
15982
|
-
if (timedOut) {
|
|
15983
|
-
if (this._inFlightActivation?.cancel) {
|
|
15984
|
-
try {
|
|
15985
|
-
this._inFlightActivation.cancel();
|
|
15986
|
-
} catch {
|
|
15987
|
-
}
|
|
15988
|
-
}
|
|
15989
|
-
this._log.debug("worker.gracefulStop.timeout", { remaining: this._activeJobs });
|
|
15990
|
-
} else {
|
|
15991
|
-
this._log.debug("worker.gracefulStop.done");
|
|
15992
|
-
}
|
|
15993
|
-
return { remainingJobs: this._activeJobs, timedOut };
|
|
15980
|
+
return stopWorkerGracefully(
|
|
15981
|
+
{
|
|
15982
|
+
haltPolling: () => {
|
|
15983
|
+
this._stopped = true;
|
|
15984
|
+
if (this._pollTimer) clearTimeout(this._pollTimer);
|
|
15985
|
+
this._pollTimer = null;
|
|
15986
|
+
},
|
|
15987
|
+
activeJobs: () => this._activeJobs,
|
|
15988
|
+
inFlightActivation: () => this._inFlightActivation,
|
|
15989
|
+
log: this._log
|
|
15990
|
+
},
|
|
15991
|
+
opts
|
|
15992
|
+
);
|
|
15994
15993
|
}
|
|
15995
15994
|
// ─── Job dispatch ───
|
|
15996
15995
|
_drainQueue() {
|
|
@@ -31067,6 +31066,36 @@ function toDomainError(err) {
|
|
|
31067
31066
|
}
|
|
31068
31067
|
return new CamundaGenericError({ message: String(err), cause: err });
|
|
31069
31068
|
}
|
|
31069
|
+
function effectifyPaginate(search) {
|
|
31070
|
+
return (body, opts = {}) => {
|
|
31071
|
+
const { consistency, maxPages = Number.POSITIVE_INFINITY, mode = "auto" } = opts;
|
|
31072
|
+
const pagesFrom = (pageBody, remaining, isFirstPage) => {
|
|
31073
|
+
if (remaining <= 0) return import_effect.Stream.empty;
|
|
31074
|
+
const consistencyArg = {
|
|
31075
|
+
consistency: isFirstPage ? consistency ?? { waitUpToMs: 0 } : { waitUpToMs: 0 }
|
|
31076
|
+
};
|
|
31077
|
+
return import_effect.Stream.unwrap(
|
|
31078
|
+
search(pageBody, consistencyArg).pipe(
|
|
31079
|
+
import_effect.Effect.map((response) => {
|
|
31080
|
+
const next = nextPageRequest(pageBody, response, mode);
|
|
31081
|
+
const head = import_effect.Stream.make(response);
|
|
31082
|
+
return next === null ? head : import_effect.Stream.concat(head, pagesFrom(next, remaining - 1, false));
|
|
31083
|
+
})
|
|
31084
|
+
)
|
|
31085
|
+
);
|
|
31086
|
+
};
|
|
31087
|
+
const pages = () => pagesFrom(body, maxPages, true);
|
|
31088
|
+
const items = () => pages().pipe(
|
|
31089
|
+
import_effect.Stream.map((response) => response.items),
|
|
31090
|
+
import_effect.Stream.flattenIterable
|
|
31091
|
+
);
|
|
31092
|
+
return {
|
|
31093
|
+
pages,
|
|
31094
|
+
items,
|
|
31095
|
+
toArray: () => import_effect.Stream.runCollect(items()).pipe(import_effect.Effect.map((chunk) => [...chunk]))
|
|
31096
|
+
};
|
|
31097
|
+
};
|
|
31098
|
+
}
|
|
31070
31099
|
function isPromiseLike(v) {
|
|
31071
31100
|
return !!v && typeof v.then === "function";
|
|
31072
31101
|
}
|
|
@@ -31074,7 +31103,7 @@ function createCamundaEffectClient(options) {
|
|
|
31074
31103
|
const base = createCamundaClient(options);
|
|
31075
31104
|
const cache = /* @__PURE__ */ new Map();
|
|
31076
31105
|
function wrap(fn) {
|
|
31077
|
-
|
|
31106
|
+
const wrapped = (...args) => import_effect.Effect.suspend(() => {
|
|
31078
31107
|
let r;
|
|
31079
31108
|
try {
|
|
31080
31109
|
r = fn.apply(base, args);
|
|
@@ -31092,6 +31121,12 @@ function createCamundaEffectClient(options) {
|
|
|
31092
31121
|
return typeof cancel === "function" ? import_effect.Effect.sync(() => cancel.call(r)) : void 0;
|
|
31093
31122
|
});
|
|
31094
31123
|
});
|
|
31124
|
+
if (typeof fn.paginate === "function") {
|
|
31125
|
+
wrapped.paginate = effectifyPaginate(
|
|
31126
|
+
wrapped
|
|
31127
|
+
);
|
|
31128
|
+
}
|
|
31129
|
+
return wrapped;
|
|
31095
31130
|
}
|
|
31096
31131
|
const handler = {
|
|
31097
31132
|
get(_t, prop) {
|