@bitfab/sdk 0.62.0 → 0.62.2

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.
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-B6GT4MMS.js";
10
+ } from "./chunk-3ROZF4U7.js";
11
11
  export {
12
12
  BitfabError,
13
13
  HttpClient,
@@ -18,4 +18,4 @@ export {
18
18
  parseRetryAfterMs,
19
19
  serializePayloadBody
20
20
  };
21
- //# sourceMappingURL=http-AWAVEHV5.js.map
21
+ //# sourceMappingURL=http-6UZAVHB3.js.map
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-TI7NSDRZ.js";
10
+ } from "./chunk-QKGU6NIO.js";
11
11
  import "./chunk-BAOIRE5T.js";
12
12
  export {
13
13
  BitfabError,
@@ -19,4 +19,4 @@ export {
19
19
  parseRetryAfterMs,
20
20
  serializePayloadBody
21
21
  };
22
- //# sourceMappingURL=http-7A3HIWJE.js.map
22
+ //# sourceMappingURL=http-77O2BMHW.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.62.0";
45
+ __version__ = "0.62.2";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -3697,12 +3697,13 @@ function installReplayInterruptHandlers(target) {
3697
3697
  const removeHandlers = () => {
3698
3698
  for (const [signal, handler] of handlers) {
3699
3699
  host.removeListener(signal, handler);
3700
+ replayListeners.delete(handler);
3700
3701
  }
3701
3702
  handlers.clear();
3702
3703
  };
3703
3704
  let interrupting = false;
3704
3705
  const handleSignal = async (signal) => {
3705
- const hostHandlesSignal = host.listenerCount(signal) > 1;
3706
+ const hostHandlesSignal = host.listeners(signal).some((listener) => !replayListeners.has(listener));
3706
3707
  const markedInterrupted = await target.interrupt();
3707
3708
  removeHandlers();
3708
3709
  if (target.onInterrupt !== void 0) {
@@ -3731,11 +3732,12 @@ function installReplayInterruptHandlers(target) {
3731
3732
  void handleSignal(signal);
3732
3733
  };
3733
3734
  handlers.set(signal, handler);
3735
+ replayListeners.add(handler);
3734
3736
  host.on(signal, handler);
3735
3737
  }
3736
3738
  return { remove: removeHandlers, interrupted: () => interrupting };
3737
3739
  }
3738
- var REPLAY_INTERRUPT_SIGNALS;
3740
+ var REPLAY_INTERRUPT_SIGNALS, replayListeners;
3739
3741
  var init_replayInterrupt = __esm({
3740
3742
  "src/replayInterrupt.ts"() {
3741
3743
  "use strict";
@@ -3743,6 +3745,7 @@ var init_replayInterrupt = __esm({
3743
3745
  "SIGINT",
3744
3746
  "SIGTERM"
3745
3747
  ];
3748
+ replayListeners = /* @__PURE__ */ new Set();
3746
3749
  }
3747
3750
  });
3748
3751
 
@@ -4574,11 +4577,11 @@ function sleepForReplayPersistence(ms) {
4574
4577
  setTimeout(resolve, ms);
4575
4578
  });
4576
4579
  }
4577
- async function mapWithConcurrency2(tasks, maxConcurrency, onSettled, onStarted) {
4580
+ async function mapWithConcurrency2(tasks, maxConcurrency, onSettled, onStarted, shouldStop) {
4578
4581
  const results = new Array(tasks.length);
4579
4582
  let nextIndex = 0;
4580
4583
  async function worker() {
4581
- while (nextIndex < tasks.length) {
4584
+ while (nextIndex < tasks.length && shouldStop?.() !== true) {
4582
4585
  const index = nextIndex++;
4583
4586
  onStarted?.(index);
4584
4587
  const result = await tasks[index]();
@@ -4591,7 +4594,7 @@ async function mapWithConcurrency2(tasks, maxConcurrency, onSettled, onStarted)
4591
4594
  () => worker()
4592
4595
  );
4593
4596
  await Promise.all(workers);
4594
- return results;
4597
+ return results.slice(0, nextIndex);
4595
4598
  }
4596
4599
  async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, registeredOverrides = []) {
4597
4600
  if (options?.resume !== void 0) {
@@ -4906,9 +4909,11 @@ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxC
4906
4909
  });
4907
4910
  } catch {
4908
4911
  }
4909
- } : void 0
4912
+ } : void 0,
4913
+ interrupted
4910
4914
  );
4911
4915
  const resultItems = [...carriedOverItems, ...ranItems];
4916
+ throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
4912
4917
  if (options?.dryRun === true) {
4913
4918
  throwIfInterrupted(
4914
4919
  interrupted,