@camunda8/orchestration-cluster-api 10.0.0-alpha.39 → 10.0.0-alpha.40

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,10 @@
1
+ # [10.0.0-alpha.40](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.39...v10.0.0-alpha.40) (2026-08-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * **clock:** resolve runtime cadence through the injected clock ([#474](https://github.com/camunda/orchestration-cluster-api-js/issues/474)) ([303d10d](https://github.com/camunda/orchestration-cluster-api-js/commit/303d10de1e092c6bb7aa5b95ef036eaba9a47f06))
7
+
1
8
  # [10.0.0-alpha.39](https://github.com/camunda/orchestration-cluster-api-js/compare/v10.0.0-alpha.38...v10.0.0-alpha.39) (2026-08-27)
2
9
 
3
10
 
@@ -2,6 +2,68 @@ import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
  import { L as LogLevel, a as LogTransport, b as Logger } from './logger-D-p21VHo.js';
4
4
 
5
+ /**
6
+ * The clock all SDK runtime cadence resolves through — worker poll loops, eventual
7
+ * consistency polling, retry backoff, backpressure decay and auth refresh.
8
+ *
9
+ * Pinning this pins the client's own timing, which is what makes those loops testable
10
+ * without waiting for real time. See the cross-SDK contract in
11
+ * camunda/orchestration-cluster-api-js#450.
12
+ *
13
+ * Generalises the two seams that already existed: `CollectClock` in `typedVariables.ts`
14
+ * and the injected `now`/`sleep` on `BackpressureManager`.
15
+ */
16
+ interface Clock {
17
+ /** Current wall-clock time in epoch milliseconds. */
18
+ now(): number;
19
+ /**
20
+ * Resolve after `ms` have elapsed on this clock.
21
+ *
22
+ * Rejects with the signal's reason if `signal` aborts first, so a caller can cancel a
23
+ * wait without leaving the timer behind.
24
+ */
25
+ sleep(ms: number, signal?: AbortSignal): Promise<void>;
26
+ /**
27
+ * A signal that aborts once `ms` have elapsed on this clock.
28
+ *
29
+ * `dispose()` releases the underlying timer; call it when the guarded work finishes
30
+ * early, or a long deadline keeps a handle alive for its full duration.
31
+ */
32
+ deadline(ms: number): {
33
+ signal: AbortSignal;
34
+ dispose: () => void;
35
+ };
36
+ }
37
+ /**
38
+ * The live clock: the platform clock, made non-decreasing and self-correcting.
39
+ *
40
+ * This is the single place the SDK runtime is allowed to read ambient time or use a
41
+ * platform timer. Everything else takes a `Clock`.
42
+ *
43
+ * Ruling 2a requires three properties together, and the C# pilot shipped three
44
+ * implementations that each satisfied only two:
45
+ *
46
+ * - **Never decreases.** Wall clocks step backwards (NTP correction, VM resume, manual
47
+ * change), and a deadline measured across a backward step waits longer than asked.
48
+ * - **Keeps advancing immediately after a step.** Clamping to a high-water mark satisfies
49
+ * the first property but freezes logical time for the *whole* duration of the
50
+ * correction, so an hour-long step adds an hour to every deadline in flight — the very
51
+ * damage the rule exists to prevent.
52
+ * - **Converges back.** Absorbing the step into a permanent offset satisfies the first two
53
+ * but leaves reported time ahead of true time forever, so any comparison against a
54
+ * server-supplied absolute time is wrong for the life of the process.
55
+ *
56
+ * A backward step is therefore absorbed and then repaid gradually out of forward
57
+ * progress, the way NTP slews rather than steps.
58
+ *
59
+ * @param source injectable purely so the slew behaviour itself is testable; production
60
+ * callers use the default. Called through rather than captured, so a test that swaps the
61
+ * global `Date` (fake timers) still drives the shared `liveClock`.
62
+ */
63
+ declare function createLiveClock(source?: () => number): Clock;
64
+ /** The clock used when none is injected. */
65
+ declare const liveClock: Clock;
66
+
5
67
  /** Manages eventual consistency for a given operation */
6
68
  interface ConsistencyOptions<T> {
7
69
  waitUpToMs: number;
@@ -639,7 +701,10 @@ type AgentInstanceUpdateRequest = {
639
701
  * Used for ownership/equality validation against the stored agent instance
640
702
  * and, when the supplied key differs from the previous association (re-entry
641
703
  * of an ad-hoc sub-process or AI Agent task), appended to elementInstanceKeys
642
- * with the reverse link updated on the supplied element instance.
704
+ * with the reverse link updated on the supplied element instance. Only one
705
+ * element instance may hold this write claim at a time: any update from a
706
+ * different element instance is rejected while the current writer's job is
707
+ * still active.
643
708
  *
644
709
  */
645
710
  elementInstanceKey: ElementInstanceKey;
@@ -8131,7 +8196,7 @@ type MappingRuleFilter = {
8131
8196
  /**
8132
8197
  * The name of the mapping rule.
8133
8198
  */
8134
- name?: string;
8199
+ name?: StringFilterProperty;
8135
8200
  /**
8136
8201
  * The ID of the mapping rule.
8137
8202
  */
@@ -10040,7 +10105,7 @@ type RoleFilter = {
10040
10105
  /**
10041
10106
  * The role name search filters.
10042
10107
  */
10043
- name?: string;
10108
+ name?: StringFilterProperty;
10044
10109
  };
10045
10110
  /**
10046
10111
  * Role search response.
@@ -22048,67 +22113,6 @@ declare namespace VariableKey {
22048
22113
 
22049
22114
  type BackpressureSeverity = 'healthy' | 'soft' | 'severe';
22050
22115
 
22051
- /**
22052
- * The clock all SDK runtime cadence resolves through — worker poll loops, eventual
22053
- * consistency polling, retry backoff, backpressure decay and auth refresh.
22054
- *
22055
- * Pinning this pins the client's own timing, which is what makes those loops testable
22056
- * without waiting for real time. See the cross-SDK contract in
22057
- * camunda/orchestration-cluster-api-js#450.
22058
- *
22059
- * Generalises the two seams that already existed: `CollectClock` in `typedVariables.ts`
22060
- * and the injected `now`/`sleep` on `BackpressureManager`.
22061
- */
22062
- interface Clock {
22063
- /** Current wall-clock time in epoch milliseconds. */
22064
- now(): number;
22065
- /**
22066
- * Resolve after `ms` have elapsed on this clock.
22067
- *
22068
- * Rejects with the signal's reason if `signal` aborts first, so a caller can cancel a
22069
- * wait without leaving the timer behind.
22070
- */
22071
- sleep(ms: number, signal?: AbortSignal): Promise<void>;
22072
- /**
22073
- * A signal that aborts once `ms` have elapsed on this clock.
22074
- *
22075
- * `dispose()` releases the underlying timer; call it when the guarded work finishes
22076
- * early, or a long deadline keeps a handle alive for its full duration.
22077
- */
22078
- deadline(ms: number): {
22079
- signal: AbortSignal;
22080
- dispose: () => void;
22081
- };
22082
- }
22083
- /**
22084
- * The live clock: the platform clock, made non-decreasing and self-correcting.
22085
- *
22086
- * This is the single place the SDK runtime is allowed to read ambient time or use a
22087
- * platform timer. Everything else takes a `Clock`.
22088
- *
22089
- * Ruling 2a requires three properties together, and the C# pilot shipped three
22090
- * implementations that each satisfied only two:
22091
- *
22092
- * - **Never decreases.** Wall clocks step backwards (NTP correction, VM resume, manual
22093
- * change), and a deadline measured across a backward step waits longer than asked.
22094
- * - **Keeps advancing immediately after a step.** Clamping to a high-water mark satisfies
22095
- * the first property but freezes logical time for the *whole* duration of the
22096
- * correction, so an hour-long step adds an hour to every deadline in flight — the very
22097
- * damage the rule exists to prevent.
22098
- * - **Converges back.** Absorbing the step into a permanent offset satisfies the first two
22099
- * but leaves reported time ahead of true time forever, so any comparison against a
22100
- * server-supplied absolute time is wrong for the life of the process.
22101
- *
22102
- * A backward step is therefore absorbed and then repaid gradually out of forward
22103
- * progress, the way NTP slews rather than steps.
22104
- *
22105
- * @param source injectable purely so the slew behaviour itself is testable; production
22106
- * callers use the default.
22107
- */
22108
- declare function createLiveClock(source?: () => number): Clock;
22109
- /** The clock used when none is injected. */
22110
- declare const liveClock: Clock;
22111
-
22112
22116
  interface GracefulStopResult {
22113
22117
  remainingJobs: number;
22114
22118
  timedOut: boolean;
@@ -22186,7 +22190,7 @@ declare class JobWorker {
22186
22190
  private _name;
22187
22191
  private _activeJobs;
22188
22192
  private _stopped;
22189
- private _pollTimer;
22193
+ private _pollWait;
22190
22194
  private _inFlightActivation;
22191
22195
  /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
22192
22196
  private _consecutiveActivationErrors;
@@ -22877,7 +22881,7 @@ declare class ThreadedJobWorker {
22877
22881
  private _name;
22878
22882
  private _activeJobs;
22879
22883
  private _stopped;
22880
- private _pollTimer;
22884
+ private _pollWait;
22881
22885
  private _inFlightActivation;
22882
22886
  /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
22883
22887
  private _consecutiveActivationErrors;
@@ -2,6 +2,68 @@ import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
  import { L as LogLevel, a as LogTransport, b as Logger } from './logger-D-p21VHo.cjs';
4
4
 
5
+ /**
6
+ * The clock all SDK runtime cadence resolves through — worker poll loops, eventual
7
+ * consistency polling, retry backoff, backpressure decay and auth refresh.
8
+ *
9
+ * Pinning this pins the client's own timing, which is what makes those loops testable
10
+ * without waiting for real time. See the cross-SDK contract in
11
+ * camunda/orchestration-cluster-api-js#450.
12
+ *
13
+ * Generalises the two seams that already existed: `CollectClock` in `typedVariables.ts`
14
+ * and the injected `now`/`sleep` on `BackpressureManager`.
15
+ */
16
+ interface Clock {
17
+ /** Current wall-clock time in epoch milliseconds. */
18
+ now(): number;
19
+ /**
20
+ * Resolve after `ms` have elapsed on this clock.
21
+ *
22
+ * Rejects with the signal's reason if `signal` aborts first, so a caller can cancel a
23
+ * wait without leaving the timer behind.
24
+ */
25
+ sleep(ms: number, signal?: AbortSignal): Promise<void>;
26
+ /**
27
+ * A signal that aborts once `ms` have elapsed on this clock.
28
+ *
29
+ * `dispose()` releases the underlying timer; call it when the guarded work finishes
30
+ * early, or a long deadline keeps a handle alive for its full duration.
31
+ */
32
+ deadline(ms: number): {
33
+ signal: AbortSignal;
34
+ dispose: () => void;
35
+ };
36
+ }
37
+ /**
38
+ * The live clock: the platform clock, made non-decreasing and self-correcting.
39
+ *
40
+ * This is the single place the SDK runtime is allowed to read ambient time or use a
41
+ * platform timer. Everything else takes a `Clock`.
42
+ *
43
+ * Ruling 2a requires three properties together, and the C# pilot shipped three
44
+ * implementations that each satisfied only two:
45
+ *
46
+ * - **Never decreases.** Wall clocks step backwards (NTP correction, VM resume, manual
47
+ * change), and a deadline measured across a backward step waits longer than asked.
48
+ * - **Keeps advancing immediately after a step.** Clamping to a high-water mark satisfies
49
+ * the first property but freezes logical time for the *whole* duration of the
50
+ * correction, so an hour-long step adds an hour to every deadline in flight — the very
51
+ * damage the rule exists to prevent.
52
+ * - **Converges back.** Absorbing the step into a permanent offset satisfies the first two
53
+ * but leaves reported time ahead of true time forever, so any comparison against a
54
+ * server-supplied absolute time is wrong for the life of the process.
55
+ *
56
+ * A backward step is therefore absorbed and then repaid gradually out of forward
57
+ * progress, the way NTP slews rather than steps.
58
+ *
59
+ * @param source injectable purely so the slew behaviour itself is testable; production
60
+ * callers use the default. Called through rather than captured, so a test that swaps the
61
+ * global `Date` (fake timers) still drives the shared `liveClock`.
62
+ */
63
+ declare function createLiveClock(source?: () => number): Clock;
64
+ /** The clock used when none is injected. */
65
+ declare const liveClock: Clock;
66
+
5
67
  /** Manages eventual consistency for a given operation */
6
68
  interface ConsistencyOptions<T> {
7
69
  waitUpToMs: number;
@@ -639,7 +701,10 @@ type AgentInstanceUpdateRequest = {
639
701
  * Used for ownership/equality validation against the stored agent instance
640
702
  * and, when the supplied key differs from the previous association (re-entry
641
703
  * of an ad-hoc sub-process or AI Agent task), appended to elementInstanceKeys
642
- * with the reverse link updated on the supplied element instance.
704
+ * with the reverse link updated on the supplied element instance. Only one
705
+ * element instance may hold this write claim at a time: any update from a
706
+ * different element instance is rejected while the current writer's job is
707
+ * still active.
643
708
  *
644
709
  */
645
710
  elementInstanceKey: ElementInstanceKey;
@@ -8131,7 +8196,7 @@ type MappingRuleFilter = {
8131
8196
  /**
8132
8197
  * The name of the mapping rule.
8133
8198
  */
8134
- name?: string;
8199
+ name?: StringFilterProperty;
8135
8200
  /**
8136
8201
  * The ID of the mapping rule.
8137
8202
  */
@@ -10040,7 +10105,7 @@ type RoleFilter = {
10040
10105
  /**
10041
10106
  * The role name search filters.
10042
10107
  */
10043
- name?: string;
10108
+ name?: StringFilterProperty;
10044
10109
  };
10045
10110
  /**
10046
10111
  * Role search response.
@@ -22048,67 +22113,6 @@ declare namespace VariableKey {
22048
22113
 
22049
22114
  type BackpressureSeverity = 'healthy' | 'soft' | 'severe';
22050
22115
 
22051
- /**
22052
- * The clock all SDK runtime cadence resolves through — worker poll loops, eventual
22053
- * consistency polling, retry backoff, backpressure decay and auth refresh.
22054
- *
22055
- * Pinning this pins the client's own timing, which is what makes those loops testable
22056
- * without waiting for real time. See the cross-SDK contract in
22057
- * camunda/orchestration-cluster-api-js#450.
22058
- *
22059
- * Generalises the two seams that already existed: `CollectClock` in `typedVariables.ts`
22060
- * and the injected `now`/`sleep` on `BackpressureManager`.
22061
- */
22062
- interface Clock {
22063
- /** Current wall-clock time in epoch milliseconds. */
22064
- now(): number;
22065
- /**
22066
- * Resolve after `ms` have elapsed on this clock.
22067
- *
22068
- * Rejects with the signal's reason if `signal` aborts first, so a caller can cancel a
22069
- * wait without leaving the timer behind.
22070
- */
22071
- sleep(ms: number, signal?: AbortSignal): Promise<void>;
22072
- /**
22073
- * A signal that aborts once `ms` have elapsed on this clock.
22074
- *
22075
- * `dispose()` releases the underlying timer; call it when the guarded work finishes
22076
- * early, or a long deadline keeps a handle alive for its full duration.
22077
- */
22078
- deadline(ms: number): {
22079
- signal: AbortSignal;
22080
- dispose: () => void;
22081
- };
22082
- }
22083
- /**
22084
- * The live clock: the platform clock, made non-decreasing and self-correcting.
22085
- *
22086
- * This is the single place the SDK runtime is allowed to read ambient time or use a
22087
- * platform timer. Everything else takes a `Clock`.
22088
- *
22089
- * Ruling 2a requires three properties together, and the C# pilot shipped three
22090
- * implementations that each satisfied only two:
22091
- *
22092
- * - **Never decreases.** Wall clocks step backwards (NTP correction, VM resume, manual
22093
- * change), and a deadline measured across a backward step waits longer than asked.
22094
- * - **Keeps advancing immediately after a step.** Clamping to a high-water mark satisfies
22095
- * the first property but freezes logical time for the *whole* duration of the
22096
- * correction, so an hour-long step adds an hour to every deadline in flight — the very
22097
- * damage the rule exists to prevent.
22098
- * - **Converges back.** Absorbing the step into a permanent offset satisfies the first two
22099
- * but leaves reported time ahead of true time forever, so any comparison against a
22100
- * server-supplied absolute time is wrong for the life of the process.
22101
- *
22102
- * A backward step is therefore absorbed and then repaid gradually out of forward
22103
- * progress, the way NTP slews rather than steps.
22104
- *
22105
- * @param source injectable purely so the slew behaviour itself is testable; production
22106
- * callers use the default.
22107
- */
22108
- declare function createLiveClock(source?: () => number): Clock;
22109
- /** The clock used when none is injected. */
22110
- declare const liveClock: Clock;
22111
-
22112
22116
  interface GracefulStopResult {
22113
22117
  remainingJobs: number;
22114
22118
  timedOut: boolean;
@@ -22186,7 +22190,7 @@ declare class JobWorker {
22186
22190
  private _name;
22187
22191
  private _activeJobs;
22188
22192
  private _stopped;
22189
- private _pollTimer;
22193
+ private _pollWait;
22190
22194
  private _inFlightActivation;
22191
22195
  /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
22192
22196
  private _consecutiveActivationErrors;
@@ -22877,7 +22881,7 @@ declare class ThreadedJobWorker {
22877
22881
  private _name;
22878
22882
  private _activeJobs;
22879
22883
  private _stopped;
22880
- private _pollTimer;
22884
+ private _pollWait;
22881
22885
  private _inFlightActivation;
22882
22886
  /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
22883
22887
  private _consecutiveActivationErrors;