@camunda8/orchestration-cluster-api 10.0.0-alpha.40 → 10.0.0-alpha.42
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-BsoVLG5C.d.ts → CamundaClient-2kGcsFZx.d.ts} +61 -2
- package/dist/{CamundaClient-DsXh8p3U.d.cts → CamundaClient-BdWYcKHb.d.cts} +61 -2
- package/dist/{chunk-3HNGJ4FZ.js → chunk-4F4DVIJW.js} +94 -8
- package/dist/chunk-4F4DVIJW.js.map +1 -0
- package/dist/{chunk-KQ4UL2WX.js → chunk-LXWPMQOS.js} +1 -1
- package/dist/chunk-LXWPMQOS.js.map +1 -0
- package/dist/effect/index.cjs +15 -6
- package/dist/effect/index.cjs.map +1 -1
- package/dist/effect/index.d.cts +1 -1
- package/dist/effect/index.d.ts +1 -1
- package/dist/effect/index.js +2 -2
- package/dist/index.cjs +93 -6
- 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 +4 -2
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +1 -1
- package/dist/threadWorkerEntry.cjs.map +1 -1
- package/dist/threadWorkerEntry.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HNGJ4FZ.js.map +0 -1
- package/dist/chunk-KQ4UL2WX.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LXWPMQOS.js";
|
|
4
4
|
import {
|
|
5
5
|
__require
|
|
6
6
|
} from "./chunk-DGUM43GV.js";
|
|
@@ -64,6 +64,82 @@ function createLiveClock(source = () => Date.now()) {
|
|
|
64
64
|
return { now, sleep, deadline };
|
|
65
65
|
}
|
|
66
66
|
var liveClock = createLiveClock();
|
|
67
|
+
function createTestClock(options = {}) {
|
|
68
|
+
const { start = 0, autoAdvance = true } = options;
|
|
69
|
+
let current = start;
|
|
70
|
+
let nowCalls = 0;
|
|
71
|
+
const sleeps = [];
|
|
72
|
+
let waiters = [];
|
|
73
|
+
const settleDue = () => {
|
|
74
|
+
const due = waiters.filter((w) => w.at <= current);
|
|
75
|
+
waiters = waiters.filter((w) => w.at > current);
|
|
76
|
+
for (const w of due) {
|
|
77
|
+
w.detach();
|
|
78
|
+
w.resolve();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const nextTick = (fn) => {
|
|
82
|
+
setTimeout(fn, 0);
|
|
83
|
+
};
|
|
84
|
+
const now = () => {
|
|
85
|
+
nowCalls += 1;
|
|
86
|
+
return current;
|
|
87
|
+
};
|
|
88
|
+
const requireDuration = (ms, label) => {
|
|
89
|
+
if (!Number.isFinite(ms) || ms < 0) {
|
|
90
|
+
throw new RangeError(`${label} needs a finite, non-negative duration in ms, got ${ms}`);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const sleep = (ms, signal) => new Promise((resolve, reject) => {
|
|
94
|
+
requireDuration(ms, "clock.sleep");
|
|
95
|
+
if (signal?.aborted) {
|
|
96
|
+
reject(signal.reason);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
sleeps.push(ms);
|
|
100
|
+
const waiter = { at: current + ms, resolve, detach: () => {
|
|
101
|
+
} };
|
|
102
|
+
if (signal) {
|
|
103
|
+
const onAbort = () => {
|
|
104
|
+
waiters = waiters.filter((w) => w !== waiter);
|
|
105
|
+
reject(signal.reason);
|
|
106
|
+
};
|
|
107
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
108
|
+
waiter.detach = () => signal.removeEventListener("abort", onAbort);
|
|
109
|
+
}
|
|
110
|
+
waiters.push(waiter);
|
|
111
|
+
if (autoAdvance) {
|
|
112
|
+
nextTick(() => {
|
|
113
|
+
if (!waiters.includes(waiter)) return;
|
|
114
|
+
current = Math.max(current, waiter.at);
|
|
115
|
+
settleDue();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const advance = async (ms) => {
|
|
120
|
+
requireDuration(ms, "clock.advance");
|
|
121
|
+
current += ms;
|
|
122
|
+
settleDue();
|
|
123
|
+
await new Promise((resolve) => nextTick(resolve));
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
now,
|
|
127
|
+
sleep,
|
|
128
|
+
advance,
|
|
129
|
+
// A deadline bounds liveness rather than pacing cadence: it stays on real time even
|
|
130
|
+
// here, because code guarded by one should time out rather than hang on a pinned clock.
|
|
131
|
+
deadline: (ms) => liveClock.deadline(ms),
|
|
132
|
+
get sleeps() {
|
|
133
|
+
return sleeps;
|
|
134
|
+
},
|
|
135
|
+
get nowCalls() {
|
|
136
|
+
return nowCalls;
|
|
137
|
+
},
|
|
138
|
+
get pending() {
|
|
139
|
+
return waiters.length;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
67
143
|
|
|
68
144
|
// src/runtime/errors.ts
|
|
69
145
|
function isSdkError(e) {
|
|
@@ -4081,6 +4157,7 @@ var OAuthManager = class {
|
|
|
4081
4157
|
if (attempt === 0) {
|
|
4082
4158
|
const evt = {
|
|
4083
4159
|
type: "auth.start",
|
|
4160
|
+
// biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
|
|
4084
4161
|
ts: Date.now(),
|
|
4085
4162
|
audience: this.cfg.tokenAudience,
|
|
4086
4163
|
endpoint: this.cfg.oauth.oauthUrl,
|
|
@@ -4132,6 +4209,7 @@ var OAuthManager = class {
|
|
|
4132
4209
|
try {
|
|
4133
4210
|
const evt = {
|
|
4134
4211
|
type: "auth.success",
|
|
4212
|
+
// biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
|
|
4135
4213
|
ts: Date.now(),
|
|
4136
4214
|
audience: this.cfg.tokenAudience,
|
|
4137
4215
|
endpoint: this.cfg.oauth.oauthUrl,
|
|
@@ -4156,6 +4234,7 @@ var OAuthManager = class {
|
|
|
4156
4234
|
try {
|
|
4157
4235
|
this.tHooks?.retry?.({
|
|
4158
4236
|
type: "retry",
|
|
4237
|
+
// biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
|
|
4159
4238
|
ts: Date.now(),
|
|
4160
4239
|
attempt,
|
|
4161
4240
|
nextDelayMs: Math.round(sleep),
|
|
@@ -4171,6 +4250,7 @@ var OAuthManager = class {
|
|
|
4171
4250
|
try {
|
|
4172
4251
|
const evt = {
|
|
4173
4252
|
type: "auth.error",
|
|
4253
|
+
// biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
|
|
4174
4254
|
ts: Date.now(),
|
|
4175
4255
|
audience: this.cfg.tokenAudience,
|
|
4176
4256
|
endpoint: this.cfg.oauth.oauthUrl,
|
|
@@ -5285,7 +5365,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
5285
5365
|
}
|
|
5286
5366
|
|
|
5287
5367
|
// src/runtime/version.ts
|
|
5288
|
-
var packageVersion = "10.0.0-alpha.
|
|
5368
|
+
var packageVersion = "10.0.0-alpha.42";
|
|
5289
5369
|
|
|
5290
5370
|
// src/runtime/supportLogger.ts
|
|
5291
5371
|
var NoopSupportLogger = class {
|
|
@@ -5933,6 +6013,7 @@ function detectExtrasAndMaybeThrow(opts) {
|
|
|
5933
6013
|
const payload = {
|
|
5934
6014
|
operationId,
|
|
5935
6015
|
extras,
|
|
6016
|
+
// biome-ignore lint/plugin: capture-artifact timestamp: records when the capture was written, not cadence
|
|
5936
6017
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5937
6018
|
sample: value
|
|
5938
6019
|
};
|
|
@@ -6104,8 +6185,8 @@ var BackpressureManager = class {
|
|
|
6104
6185
|
// current backoff delay in ms (0 = no backoff)
|
|
6105
6186
|
constructor(opts = {}) {
|
|
6106
6187
|
this.logger = opts.logger;
|
|
6107
|
-
this.now = opts.now || (() =>
|
|
6108
|
-
this.sleep = opts.sleep || ((ms) =>
|
|
6188
|
+
this.now = opts.now || (() => liveClock.now());
|
|
6189
|
+
this.sleep = opts.sleep || ((ms) => liveClock.sleep(ms));
|
|
6109
6190
|
this.cfg = {
|
|
6110
6191
|
enabled: true,
|
|
6111
6192
|
initialMaxConcurrency: null,
|
|
@@ -6318,7 +6399,7 @@ var BackpressureManager = class {
|
|
|
6318
6399
|
};
|
|
6319
6400
|
|
|
6320
6401
|
// src/runtime/jobActions.ts
|
|
6321
|
-
function enrichActivatedJob(raw, client2, log) {
|
|
6402
|
+
function enrichActivatedJob(raw, client2, log, clock = client2.clock) {
|
|
6322
6403
|
let acknowledged = false;
|
|
6323
6404
|
const ack = () => {
|
|
6324
6405
|
if (!acknowledged) {
|
|
@@ -6326,7 +6407,11 @@ function enrichActivatedJob(raw, client2, log) {
|
|
|
6326
6407
|
job.acknowledged = true;
|
|
6327
6408
|
}
|
|
6328
6409
|
};
|
|
6329
|
-
const job = {
|
|
6410
|
+
const job = {
|
|
6411
|
+
...raw,
|
|
6412
|
+
log,
|
|
6413
|
+
clock: { now: () => clock.now(), sleep: (ms, signal) => clock.sleep(ms, signal) }
|
|
6414
|
+
};
|
|
6330
6415
|
job.complete = async (variables = {}, result) => {
|
|
6331
6416
|
try {
|
|
6332
6417
|
await client2.completeJob({
|
|
@@ -6572,7 +6657,7 @@ var ThreadedJobWorker = class {
|
|
|
6572
6657
|
const data = {};
|
|
6573
6658
|
for (const [key, value] of Object.entries(raw)) {
|
|
6574
6659
|
if (typeof value === "function") continue;
|
|
6575
|
-
if (key === "log") continue;
|
|
6660
|
+
if (key === "log" || key === "clock") continue;
|
|
6576
6661
|
data[key] = value;
|
|
6577
6662
|
}
|
|
6578
6663
|
return JSON.parse(JSON.stringify(data));
|
|
@@ -21467,6 +21552,7 @@ var CamundaClient = CamundaClientBase;
|
|
|
21467
21552
|
export {
|
|
21468
21553
|
createLiveClock,
|
|
21469
21554
|
liveClock,
|
|
21555
|
+
createTestClock,
|
|
21470
21556
|
isSdkError,
|
|
21471
21557
|
CamundaValidationError,
|
|
21472
21558
|
EventualConsistencyTimeoutError,
|
|
@@ -21484,4 +21570,4 @@ export {
|
|
|
21484
21570
|
createCamundaClient,
|
|
21485
21571
|
CamundaClient
|
|
21486
21572
|
};
|
|
21487
|
-
//# sourceMappingURL=chunk-
|
|
21573
|
+
//# sourceMappingURL=chunk-4F4DVIJW.js.map
|