@camunda8/orchestration-cluster-api 10.0.0-alpha.42 → 10.0.0-alpha.44

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.
@@ -63,6 +63,14 @@ function createLiveClock(source = () => Date.now()) {
63
63
  };
64
64
  return { now, sleep, deadline };
65
65
  }
66
+ function nextTick(fn) {
67
+ setTimeout(fn, 0);
68
+ }
69
+ function requireDuration(ms, label) {
70
+ if (!Number.isFinite(ms) || ms < 0) {
71
+ throw new RangeError(`${label} needs a finite, non-negative duration in ms, got ${ms}`);
72
+ }
73
+ }
66
74
  var liveClock = createLiveClock();
67
75
  function createTestClock(options = {}) {
68
76
  const { start = 0, autoAdvance = true } = options;
@@ -78,18 +86,10 @@ function createTestClock(options = {}) {
78
86
  w.resolve();
79
87
  }
80
88
  };
81
- const nextTick = (fn) => {
82
- setTimeout(fn, 0);
83
- };
84
89
  const now = () => {
85
90
  nowCalls += 1;
86
91
  return current;
87
92
  };
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
93
  const sleep = (ms, signal) => new Promise((resolve, reject) => {
94
94
  requireDuration(ms, "clock.sleep");
95
95
  if (signal?.aborted) {
@@ -140,6 +140,50 @@ function createTestClock(options = {}) {
140
140
  }
141
141
  };
142
142
  }
143
+ function createEngineClock(target, options = {}) {
144
+ const { start = Date.now() } = options;
145
+ let current = start;
146
+ const sleeps = [];
147
+ let queue = Promise.resolve();
148
+ const enqueue = (fn) => {
149
+ const run = queue.then(fn, fn);
150
+ queue = run.catch(() => {
151
+ });
152
+ return run;
153
+ };
154
+ const pinTo = (epochMs) => enqueue(async () => {
155
+ if (epochMs <= current) return;
156
+ await target.pinClock({ timestamp: epochMs });
157
+ current = epochMs;
158
+ });
159
+ const sleep = async (ms, signal) => {
160
+ requireDuration(ms, "clock.sleep");
161
+ if (signal?.aborted) throw signal.reason;
162
+ sleeps.push(ms);
163
+ await pinTo(current + ms);
164
+ await new Promise((resolve) => nextTick(resolve));
165
+ if (signal?.aborted) throw signal.reason;
166
+ };
167
+ return {
168
+ now: () => current,
169
+ sleep,
170
+ async pin(epochMs) {
171
+ if (!Number.isFinite(epochMs)) {
172
+ throw new RangeError(`clock.pin needs a finite epoch-ms instant, got ${epochMs}`);
173
+ }
174
+ await pinTo(epochMs);
175
+ },
176
+ async reset() {
177
+ await target.resetClock();
178
+ },
179
+ // A deadline bounds liveness, so it stays on real time: a request timeout must fire even
180
+ // though engine time only moves when something asks it to.
181
+ deadline: (ms) => liveClock.deadline(ms),
182
+ get sleeps() {
183
+ return sleeps;
184
+ }
185
+ };
186
+ }
143
187
 
144
188
  // src/runtime/errors.ts
145
189
  function isSdkError(e) {
@@ -5365,7 +5409,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
5365
5409
  }
5366
5410
 
5367
5411
  // src/runtime/version.ts
5368
- var packageVersion = "10.0.0-alpha.42";
5412
+ var packageVersion = "10.0.0-alpha.44";
5369
5413
 
5370
5414
  // src/runtime/supportLogger.ts
5371
5415
  var NoopSupportLogger = class {
@@ -7443,7 +7487,7 @@ var CamundaClientBase = class {
7443
7487
  _schemasPromise = null;
7444
7488
  _loadSchemas() {
7445
7489
  if (!this._schemasPromise) {
7446
- this._schemasPromise = import("./zod.gen-2PU225MP.js");
7490
+ this._schemasPromise = import("./zod.gen-SZTQQ6VL.js");
7447
7491
  }
7448
7492
  return this._schemasPromise;
7449
7493
  }
@@ -21553,6 +21597,7 @@ export {
21553
21597
  createLiveClock,
21554
21598
  liveClock,
21555
21599
  createTestClock,
21600
+ createEngineClock,
21556
21601
  isSdkError,
21557
21602
  CamundaValidationError,
21558
21603
  EventualConsistencyTimeoutError,
@@ -21570,4 +21615,4 @@ export {
21570
21615
  createCamundaClient,
21571
21616
  CamundaClient
21572
21617
  };
21573
- //# sourceMappingURL=chunk-4F4DVIJW.js.map
21618
+ //# sourceMappingURL=chunk-AJLLDG7R.js.map