@bitfab/sdk 0.36.12 → 0.36.13

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
@@ -42,7 +42,7 @@ var __version__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.36.12";
45
+ __version__ = "0.36.13";
46
46
  }
47
47
  });
48
48
 
@@ -2586,20 +2586,17 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2586
2586
  includeOutputs,
2587
2587
  includeRootOutput: false
2588
2588
  });
2589
- if (treeResponse.root) {
2590
- mockTree = buildMockTree(treeResponse.root);
2591
- } else if (mockStrategy === "all" || hasOverrides) {
2589
+ if (!treeResponse.root) {
2592
2590
  throw new BitfabError(
2593
2591
  `Replay mock strategy "${mockStrategy}"${hasOverrides ? " with overrides" : ""} requires a span tree root for original span ${originalSpanId}.`
2594
2592
  );
2595
- } else {
2596
- mockTree = void 0;
2597
2593
  }
2598
- } catch (e) {
2599
- if (mockStrategy === "all" || hasOverrides) {
2600
- throw e;
2594
+ mockTree = buildMockTree(treeResponse.root);
2595
+ } catch (error2) {
2596
+ if (mockStrategy !== "marked" || hasOverrides) {
2597
+ throw error2;
2601
2598
  }
2602
- mockTree = void 0;
2599
+ mockTree = { spans: /* @__PURE__ */ new Map() };
2603
2600
  }
2604
2601
  }
2605
2602
  const outputCache = /* @__PURE__ */ new Map();
@@ -6174,7 +6171,12 @@ var Bitfab = class {
6174
6171
  }
6175
6172
  }
6176
6173
  const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
6177
- if (shouldMock && mockSpan) {
6174
+ if (shouldMock && !mockSpan) {
6175
+ throw new BitfabError(
6176
+ `Replay selected span "${traceFunctionKey}:${baseSpanParams.spanName}" for mocking, but recorded occurrence ${callIndex + 1} is unavailable. The real span was not executed.`
6177
+ );
6178
+ }
6179
+ if (shouldMock) {
6178
6180
  const recorded = resolveRecordedOutput();
6179
6181
  if (recorded instanceof Promise) {
6180
6182
  return emitMockAsync(recorded, "recorded");