bitfab 0.36.11 → 0.36.12

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
@@ -51,7 +51,7 @@ var __version__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.36.11";
54
+ __version__ = "0.36.12";
55
55
  }
56
56
  });
57
57
 
@@ -6110,14 +6110,19 @@ var Bitfab = class {
6110
6110
  counters.set(counterKey, callIndex + 1);
6111
6111
  const mockKey = `${counterKey}:${callIndex}`;
6112
6112
  const mockSpan = replayCtxForMock.mockTree.spans.get(mockKey);
6113
- const emitMock = (output) => {
6114
- void sendSpan({ result: output, mocked: true });
6113
+ const emitMock = (output, mockSource) => {
6114
+ void sendSpan({
6115
+ result: output,
6116
+ mocked: true,
6117
+ mockTarget: "output",
6118
+ mockSource
6119
+ });
6115
6120
  if (fnReturnsPromise) {
6116
6121
  return Promise.resolve(output);
6117
6122
  }
6118
6123
  return output;
6119
6124
  };
6120
- const emitMockAsync = (pending) => {
6125
+ const emitMockAsync = (pending, mockSource) => {
6121
6126
  if (!fnReturnsPromise) {
6122
6127
  throw new BitfabError(
6123
6128
  `Cannot mock synchronous span "${traceFunctionKey}" with an asynchronously-resolved value (lazy recorded-output fetch or an async value function). Make the wrapped function async, or use mock: "all" so recorded outputs are fetched eagerly.`
@@ -6125,7 +6130,12 @@ var Bitfab = class {
6125
6130
  }
6126
6131
  return (async () => {
6127
6132
  const output = await pending;
6128
- void sendSpan({ result: output, mocked: true });
6133
+ void sendSpan({
6134
+ result: output,
6135
+ mocked: true,
6136
+ mockTarget: "output",
6137
+ mockSource
6138
+ });
6129
6139
  return output;
6130
6140
  })();
6131
6141
  };
@@ -6167,18 +6177,18 @@ var Bitfab = class {
6167
6177
  getOriginalOutput: () => Promise.resolve(resolveRecordedOutput())
6168
6178
  });
6169
6179
  if (injected instanceof Promise) {
6170
- return emitMockAsync(injected);
6180
+ return emitMockAsync(injected, "override");
6171
6181
  }
6172
- return emitMock(injected);
6182
+ return emitMock(injected, "override");
6173
6183
  }
6174
6184
  }
6175
6185
  const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
6176
6186
  if (shouldMock && mockSpan) {
6177
6187
  const recorded = resolveRecordedOutput();
6178
6188
  if (recorded instanceof Promise) {
6179
- return emitMockAsync(recorded);
6189
+ return emitMockAsync(recorded, "recorded");
6180
6190
  }
6181
- return emitMock(recorded);
6191
+ return emitMock(recorded, "recorded");
6182
6192
  }
6183
6193
  }
6184
6194
  const recordSpan = (result) => {
@@ -6478,7 +6488,9 @@ var Bitfab = class {
6478
6488
  traceFunctionKey: params.traceFunctionKey,
6479
6489
  rawSpan: externalSpan,
6480
6490
  ...params.testRunId && { testRunId: params.testRunId },
6481
- ...params.mocked && { mocked: true }
6491
+ ...params.mocked && { mocked: true },
6492
+ ...params.mockTarget && { mockTarget: params.mockTarget },
6493
+ ...params.mockSource && { mockSource: params.mockSource }
6482
6494
  });
6483
6495
  }
6484
6496
  registerMockOverride(overrideOrMatch, value) {