@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/{chunk-VDFPZYLH.js → chunk-OCJSHTJR.js} +24 -12
- package/dist/chunk-OCJSHTJR.js.map +1 -0
- package/dist/{chunk-EKOAKLZC.js → chunk-VUYTATF5.js} +2 -2
- package/dist/{chunk-EKOAKLZC.js.map → chunk-VUYTATF5.js.map} +1 -1
- package/dist/index.cjs +22 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +22 -10
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-TW3ONJ3W.js → replay-P35CUNGH.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-VDFPZYLH.js.map +0 -1
- /package/dist/{replay-TW3ONJ3W.js.map → replay-P35CUNGH.js.map} +0 -0
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.
|
|
45
|
+
__version__ = "0.36.12";
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -6101,14 +6101,19 @@ var Bitfab = class {
|
|
|
6101
6101
|
counters.set(counterKey, callIndex + 1);
|
|
6102
6102
|
const mockKey = `${counterKey}:${callIndex}`;
|
|
6103
6103
|
const mockSpan = replayCtxForMock.mockTree.spans.get(mockKey);
|
|
6104
|
-
const emitMock = (output) => {
|
|
6105
|
-
void sendSpan({
|
|
6104
|
+
const emitMock = (output, mockSource) => {
|
|
6105
|
+
void sendSpan({
|
|
6106
|
+
result: output,
|
|
6107
|
+
mocked: true,
|
|
6108
|
+
mockTarget: "output",
|
|
6109
|
+
mockSource
|
|
6110
|
+
});
|
|
6106
6111
|
if (fnReturnsPromise) {
|
|
6107
6112
|
return Promise.resolve(output);
|
|
6108
6113
|
}
|
|
6109
6114
|
return output;
|
|
6110
6115
|
};
|
|
6111
|
-
const emitMockAsync = (pending) => {
|
|
6116
|
+
const emitMockAsync = (pending, mockSource) => {
|
|
6112
6117
|
if (!fnReturnsPromise) {
|
|
6113
6118
|
throw new BitfabError(
|
|
6114
6119
|
`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.`
|
|
@@ -6116,7 +6121,12 @@ var Bitfab = class {
|
|
|
6116
6121
|
}
|
|
6117
6122
|
return (async () => {
|
|
6118
6123
|
const output = await pending;
|
|
6119
|
-
void sendSpan({
|
|
6124
|
+
void sendSpan({
|
|
6125
|
+
result: output,
|
|
6126
|
+
mocked: true,
|
|
6127
|
+
mockTarget: "output",
|
|
6128
|
+
mockSource
|
|
6129
|
+
});
|
|
6120
6130
|
return output;
|
|
6121
6131
|
})();
|
|
6122
6132
|
};
|
|
@@ -6158,18 +6168,18 @@ var Bitfab = class {
|
|
|
6158
6168
|
getOriginalOutput: () => Promise.resolve(resolveRecordedOutput())
|
|
6159
6169
|
});
|
|
6160
6170
|
if (injected instanceof Promise) {
|
|
6161
|
-
return emitMockAsync(injected);
|
|
6171
|
+
return emitMockAsync(injected, "override");
|
|
6162
6172
|
}
|
|
6163
|
-
return emitMock(injected);
|
|
6173
|
+
return emitMock(injected, "override");
|
|
6164
6174
|
}
|
|
6165
6175
|
}
|
|
6166
6176
|
const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
|
|
6167
6177
|
if (shouldMock && mockSpan) {
|
|
6168
6178
|
const recorded = resolveRecordedOutput();
|
|
6169
6179
|
if (recorded instanceof Promise) {
|
|
6170
|
-
return emitMockAsync(recorded);
|
|
6180
|
+
return emitMockAsync(recorded, "recorded");
|
|
6171
6181
|
}
|
|
6172
|
-
return emitMock(recorded);
|
|
6182
|
+
return emitMock(recorded, "recorded");
|
|
6173
6183
|
}
|
|
6174
6184
|
}
|
|
6175
6185
|
const recordSpan = (result) => {
|
|
@@ -6469,7 +6479,9 @@ var Bitfab = class {
|
|
|
6469
6479
|
traceFunctionKey: params.traceFunctionKey,
|
|
6470
6480
|
rawSpan: externalSpan,
|
|
6471
6481
|
...params.testRunId && { testRunId: params.testRunId },
|
|
6472
|
-
...params.mocked && { mocked: true }
|
|
6482
|
+
...params.mocked && { mocked: true },
|
|
6483
|
+
...params.mockTarget && { mockTarget: params.mockTarget },
|
|
6484
|
+
...params.mockSource && { mockSource: params.mockSource }
|
|
6473
6485
|
});
|
|
6474
6486
|
}
|
|
6475
6487
|
registerMockOverride(overrideOrMatch, value) {
|