@bitfab/sdk 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.d.cts CHANGED
@@ -2575,7 +2575,7 @@ declare class BitfabFunction {
2575
2575
  /**
2576
2576
  * SDK version from package.json (injected at build time)
2577
2577
  */
2578
- declare const __version__ = "0.36.11";
2578
+ declare const __version__ = "0.36.12";
2579
2579
 
2580
2580
  /**
2581
2581
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -2575,7 +2575,7 @@ declare class BitfabFunction {
2575
2575
  /**
2576
2576
  * SDK version from package.json (injected at build time)
2577
2577
  */
2578
- declare const __version__ = "0.36.11";
2578
+ declare const __version__ = "0.36.12";
2579
2579
 
2580
2580
  /**
2581
2581
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  getCurrentReplayBranch,
12
12
  getCurrentSpan,
13
13
  getCurrentTrace
14
- } from "./chunk-VDFPZYLH.js";
14
+ } from "./chunk-OCJSHTJR.js";
15
15
  import {
16
16
  BITFAB_PROGRESS_PREFIX,
17
17
  BitfabError,
@@ -23,7 +23,7 @@ import {
23
23
  flushTraces,
24
24
  reportReplayProgress,
25
25
  serializeReplayResult
26
- } from "./chunk-EKOAKLZC.js";
26
+ } from "./chunk-VUYTATF5.js";
27
27
  export {
28
28
  BITFAB_PROGRESS_PREFIX,
29
29
  Bitfab,
package/dist/node.cjs CHANGED
@@ -88,7 +88,7 @@ var __version__;
88
88
  var init_version_generated = __esm({
89
89
  "src/version.generated.ts"() {
90
90
  "use strict";
91
- __version__ = "0.36.11";
91
+ __version__ = "0.36.12";
92
92
  }
93
93
  });
94
94
 
@@ -6115,14 +6115,19 @@ var Bitfab = class {
6115
6115
  counters.set(counterKey, callIndex + 1);
6116
6116
  const mockKey = `${counterKey}:${callIndex}`;
6117
6117
  const mockSpan = replayCtxForMock.mockTree.spans.get(mockKey);
6118
- const emitMock = (output) => {
6119
- void sendSpan({ result: output, mocked: true });
6118
+ const emitMock = (output, mockSource) => {
6119
+ void sendSpan({
6120
+ result: output,
6121
+ mocked: true,
6122
+ mockTarget: "output",
6123
+ mockSource
6124
+ });
6120
6125
  if (fnReturnsPromise) {
6121
6126
  return Promise.resolve(output);
6122
6127
  }
6123
6128
  return output;
6124
6129
  };
6125
- const emitMockAsync = (pending) => {
6130
+ const emitMockAsync = (pending, mockSource) => {
6126
6131
  if (!fnReturnsPromise) {
6127
6132
  throw new BitfabError(
6128
6133
  `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.`
@@ -6130,7 +6135,12 @@ var Bitfab = class {
6130
6135
  }
6131
6136
  return (async () => {
6132
6137
  const output = await pending;
6133
- void sendSpan({ result: output, mocked: true });
6138
+ void sendSpan({
6139
+ result: output,
6140
+ mocked: true,
6141
+ mockTarget: "output",
6142
+ mockSource
6143
+ });
6134
6144
  return output;
6135
6145
  })();
6136
6146
  };
@@ -6172,18 +6182,18 @@ var Bitfab = class {
6172
6182
  getOriginalOutput: () => Promise.resolve(resolveRecordedOutput())
6173
6183
  });
6174
6184
  if (injected instanceof Promise) {
6175
- return emitMockAsync(injected);
6185
+ return emitMockAsync(injected, "override");
6176
6186
  }
6177
- return emitMock(injected);
6187
+ return emitMock(injected, "override");
6178
6188
  }
6179
6189
  }
6180
6190
  const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
6181
6191
  if (shouldMock && mockSpan) {
6182
6192
  const recorded = resolveRecordedOutput();
6183
6193
  if (recorded instanceof Promise) {
6184
- return emitMockAsync(recorded);
6194
+ return emitMockAsync(recorded, "recorded");
6185
6195
  }
6186
- return emitMock(recorded);
6196
+ return emitMock(recorded, "recorded");
6187
6197
  }
6188
6198
  }
6189
6199
  const recordSpan = (result) => {
@@ -6483,7 +6493,9 @@ var Bitfab = class {
6483
6493
  traceFunctionKey: params.traceFunctionKey,
6484
6494
  rawSpan: externalSpan,
6485
6495
  ...params.testRunId && { testRunId: params.testRunId },
6486
- ...params.mocked && { mocked: true }
6496
+ ...params.mocked && { mocked: true },
6497
+ ...params.mockTarget && { mockTarget: params.mockTarget },
6498
+ ...params.mockSource && { mockSource: params.mockSource }
6487
6499
  });
6488
6500
  }
6489
6501
  registerMockOverride(overrideOrMatch, value) {