@bitfab/sdk 0.28.5 → 0.28.6

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/dist/index.cjs CHANGED
@@ -615,11 +615,35 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
615
615
  }
616
616
  }
617
617
  }
618
- return {
618
+ const replayResult = {
619
619
  items: resultItems,
620
620
  testRunId,
621
621
  testRunUrl: `${serviceUrl}${testRunUrl}`
622
622
  };
623
+ await writeReplayResultFile(replayResult);
624
+ return replayResult;
625
+ }
626
+ async function writeReplayResultFile(result) {
627
+ const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
628
+ if (!resultPath) {
629
+ return;
630
+ }
631
+ try {
632
+ const [{ dirname }, { mkdir, writeFile }] = await Promise.all([
633
+ import("path"),
634
+ import("fs/promises")
635
+ ]);
636
+ await mkdir(dirname(resultPath), { recursive: true });
637
+ await writeFile(resultPath, `${JSON.stringify(result, null, 2)}
638
+ `);
639
+ } catch (err) {
640
+ try {
641
+ console.warn(
642
+ `Bitfab: failed to write replay result to BITFAB_REPLAY_RESULT_PATH (${resultPath}): ${err instanceof Error ? err.message : String(err)}`
643
+ );
644
+ } catch {
645
+ }
646
+ }
623
647
  }
624
648
  var BITFAB_PROGRESS_PREFIX;
625
649
  var init_replay = __esm({
@@ -659,7 +683,7 @@ __export(index_exports, {
659
683
  module.exports = __toCommonJS(index_exports);
660
684
 
661
685
  // src/version.generated.ts
662
- var __version__ = "0.28.5";
686
+ var __version__ = "0.28.6";
663
687
 
664
688
  // src/constants.ts
665
689
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";