@camunda8/orchestration-cluster-api 10.0.0-alpha.41 → 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.
@@ -1,7 +1,7 @@
1
1
  import * as effect_Cause from 'effect/Cause';
2
2
  import * as effect_Types from 'effect/Types';
3
3
  import { Context, Effect, Stream, Duration, Layer, Schedule, Cause, Scope } from 'effect';
4
- import { S as SearchPaginateOptions, P as Paginator, a as PaginationMode, C as ConsistencyOptions, b as SearchResponse, c as CamundaClient, d as CamundaOptions, A as ActivatedJobResult } from '../CamundaClient-HroU9acH.cjs';
4
+ import { S as SearchPaginateOptions, P as Paginator, a as PaginationMode, C as ConsistencyOptions, b as SearchResponse, c as CamundaClient, d as CamundaOptions, A as ActivatedJobResult } from '../CamundaClient-BdWYcKHb.cjs';
5
5
  import 'zod';
6
6
  import '../logger-D-p21VHo.cjs';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as effect_Cause from 'effect/Cause';
2
2
  import * as effect_Types from 'effect/Types';
3
3
  import { Context, Effect, Stream, Duration, Layer, Schedule, Cause, Scope } from 'effect';
4
- import { S as SearchPaginateOptions, P as Paginator, a as PaginationMode, C as ConsistencyOptions, b as SearchResponse, c as CamundaClient, d as CamundaOptions, A as ActivatedJobResult } from '../CamundaClient-BlKXG8gE.js';
4
+ import { S as SearchPaginateOptions, P as Paginator, a as PaginationMode, C as ConsistencyOptions, b as SearchResponse, c as CamundaClient, d as CamundaOptions, A as ActivatedJobResult } from '../CamundaClient-2kGcsFZx.js';
5
5
  import 'zod';
6
6
  import '../logger-D-p21VHo.js';
7
7
 
@@ -3,8 +3,8 @@ import {
3
3
  EventualConsistencyTimeoutError,
4
4
  createCamundaClient,
5
5
  nextPageRequest
6
- } from "../chunk-267HUCFY.js";
7
- import "../chunk-KQ4UL2WX.js";
6
+ } from "../chunk-4F4DVIJW.js";
7
+ import "../chunk-LXWPMQOS.js";
8
8
  import "../chunk-DGUM43GV.js";
9
9
 
10
10
  // src/effect.ts
package/dist/index.cjs CHANGED
@@ -9609,6 +9609,7 @@ __export(index_exports, {
9609
9609
  createCamundaClientLoose: () => createCamundaClientLoose,
9610
9610
  createCamundaResultClient: () => createCamundaResultClient,
9611
9611
  createLiveClock: () => createLiveClock,
9612
+ createTestClock: () => createTestClock,
9612
9613
  default: () => index_default,
9613
9614
  isErr: () => isErr,
9614
9615
  isOk: () => isOk,
@@ -12767,6 +12768,82 @@ function createLiveClock(source = () => Date.now()) {
12767
12768
  return { now, sleep, deadline };
12768
12769
  }
12769
12770
  var liveClock = createLiveClock();
12771
+ function createTestClock(options = {}) {
12772
+ const { start = 0, autoAdvance = true } = options;
12773
+ let current = start;
12774
+ let nowCalls = 0;
12775
+ const sleeps = [];
12776
+ let waiters = [];
12777
+ const settleDue = () => {
12778
+ const due = waiters.filter((w) => w.at <= current);
12779
+ waiters = waiters.filter((w) => w.at > current);
12780
+ for (const w of due) {
12781
+ w.detach();
12782
+ w.resolve();
12783
+ }
12784
+ };
12785
+ const nextTick = (fn) => {
12786
+ setTimeout(fn, 0);
12787
+ };
12788
+ const now = () => {
12789
+ nowCalls += 1;
12790
+ return current;
12791
+ };
12792
+ const requireDuration = (ms, label) => {
12793
+ if (!Number.isFinite(ms) || ms < 0) {
12794
+ throw new RangeError(`${label} needs a finite, non-negative duration in ms, got ${ms}`);
12795
+ }
12796
+ };
12797
+ const sleep = (ms, signal) => new Promise((resolve, reject) => {
12798
+ requireDuration(ms, "clock.sleep");
12799
+ if (signal?.aborted) {
12800
+ reject(signal.reason);
12801
+ return;
12802
+ }
12803
+ sleeps.push(ms);
12804
+ const waiter = { at: current + ms, resolve, detach: () => {
12805
+ } };
12806
+ if (signal) {
12807
+ const onAbort = () => {
12808
+ waiters = waiters.filter((w) => w !== waiter);
12809
+ reject(signal.reason);
12810
+ };
12811
+ signal.addEventListener("abort", onAbort, { once: true });
12812
+ waiter.detach = () => signal.removeEventListener("abort", onAbort);
12813
+ }
12814
+ waiters.push(waiter);
12815
+ if (autoAdvance) {
12816
+ nextTick(() => {
12817
+ if (!waiters.includes(waiter)) return;
12818
+ current = Math.max(current, waiter.at);
12819
+ settleDue();
12820
+ });
12821
+ }
12822
+ });
12823
+ const advance = async (ms) => {
12824
+ requireDuration(ms, "clock.advance");
12825
+ current += ms;
12826
+ settleDue();
12827
+ await new Promise((resolve) => nextTick(resolve));
12828
+ };
12829
+ return {
12830
+ now,
12831
+ sleep,
12832
+ advance,
12833
+ // A deadline bounds liveness rather than pacing cadence: it stays on real time even
12834
+ // here, because code guarded by one should time out rather than hang on a pinned clock.
12835
+ deadline: (ms) => liveClock.deadline(ms),
12836
+ get sleeps() {
12837
+ return sleeps;
12838
+ },
12839
+ get nowCalls() {
12840
+ return nowCalls;
12841
+ },
12842
+ get pending() {
12843
+ return waiters.length;
12844
+ }
12845
+ };
12846
+ }
12770
12847
 
12771
12848
  // src/runtime/auth.ts
12772
12849
  var CamundaAuthError = class extends Error {
@@ -12936,6 +13013,7 @@ var OAuthManager = class {
12936
13013
  if (attempt === 0) {
12937
13014
  const evt = {
12938
13015
  type: "auth.start",
13016
+ // biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
12939
13017
  ts: Date.now(),
12940
13018
  audience: this.cfg.tokenAudience,
12941
13019
  endpoint: this.cfg.oauth.oauthUrl,
@@ -12987,6 +13065,7 @@ var OAuthManager = class {
12987
13065
  try {
12988
13066
  const evt = {
12989
13067
  type: "auth.success",
13068
+ // biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
12990
13069
  ts: Date.now(),
12991
13070
  audience: this.cfg.tokenAudience,
12992
13071
  endpoint: this.cfg.oauth.oauthUrl,
@@ -13011,6 +13090,7 @@ var OAuthManager = class {
13011
13090
  try {
13012
13091
  this.tHooks?.retry?.({
13013
13092
  type: "retry",
13093
+ // biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
13014
13094
  ts: Date.now(),
13015
13095
  attempt,
13016
13096
  nextDelayMs: Math.round(sleep),
@@ -13026,6 +13106,7 @@ var OAuthManager = class {
13026
13106
  try {
13027
13107
  const evt = {
13028
13108
  type: "auth.error",
13109
+ // biome-ignore lint/plugin: telemetry event timestamp: must be real wall-clock so emitted events correlate with external logs, and never drives cadence
13029
13110
  ts: Date.now(),
13030
13111
  audience: this.cfg.tokenAudience,
13031
13112
  endpoint: this.cfg.oauth.oauthUrl,
@@ -14319,7 +14400,7 @@ function createLogger(opts = {}) {
14319
14400
  }
14320
14401
 
14321
14402
  // src/runtime/version.ts
14322
- var packageVersion = "10.0.0-alpha.41";
14403
+ var packageVersion = "10.0.0-alpha.42";
14323
14404
 
14324
14405
  // src/runtime/supportLogger.ts
14325
14406
  var NoopSupportLogger = class {
@@ -14965,6 +15046,7 @@ function detectExtrasAndMaybeThrow(opts) {
14965
15046
  const payload = {
14966
15047
  operationId,
14967
15048
  extras,
15049
+ // biome-ignore lint/plugin: capture-artifact timestamp: records when the capture was written, not cadence
14968
15050
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
14969
15051
  sample: value
14970
15052
  };
@@ -15136,8 +15218,8 @@ var BackpressureManager = class {
15136
15218
  // current backoff delay in ms (0 = no backoff)
15137
15219
  constructor(opts = {}) {
15138
15220
  this.logger = opts.logger;
15139
- this.now = opts.now || (() => Date.now());
15140
- this.sleep = opts.sleep || ((ms) => new Promise((r) => setTimeout(r, ms)));
15221
+ this.now = opts.now || (() => liveClock.now());
15222
+ this.sleep = opts.sleep || ((ms) => liveClock.sleep(ms));
15141
15223
  this.cfg = {
15142
15224
  enabled: true,
15143
15225
  initialMaxConcurrency: null,
@@ -32517,6 +32599,7 @@ var index_default = createCamundaClient;
32517
32599
  createCamundaClientLoose,
32518
32600
  createCamundaResultClient,
32519
32601
  createLiveClock,
32602
+ createTestClock,
32520
32603
  isErr,
32521
32604
  isOk,
32522
32605
  isSdkError,