bitfab 0.12.0 → 0.12.2
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-QUCK3IU2.js → chunk-3HBV4GQO.js} +19 -6
- package/dist/{chunk-QUCK3IU2.js.map → chunk-3HBV4GQO.js.map} +1 -1
- package/dist/{chunk-VMJPNYAG.js → chunk-HUSTKOQI.js} +2 -2
- package/dist/{chunk-VMJPNYAG.js.map → chunk-HUSTKOQI.js.map} +1 -1
- package/dist/index.cjs +22 -7
- 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 -7
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-6FKD2UEU.js → replay-RJZGLEHI.js} +7 -5
- package/dist/replay-RJZGLEHI.js.map +1 -0
- package/package.json +1 -1
- package/dist/replay-6FKD2UEU.js.map +0 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getReplayContext,
|
|
9
9
|
isAsyncStorageInitDone,
|
|
10
10
|
serializeValue
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HUSTKOQI.js";
|
|
12
12
|
|
|
13
13
|
// src/claudeAgentSdk.ts
|
|
14
14
|
function nowIso() {
|
|
@@ -1999,6 +1999,15 @@ var Bitfab = class {
|
|
|
1999
1999
|
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
|
|
2000
2000
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
2001
2001
|
const self = this;
|
|
2002
|
+
const fnIsAsyncFunction = fn.constructor.name === "AsyncFunction";
|
|
2003
|
+
const fnReturnsPromise = fnIsAsyncFunction || (() => {
|
|
2004
|
+
try {
|
|
2005
|
+
const src = fn.toString();
|
|
2006
|
+
return /\b(?:Promise|await)\b/.test(src);
|
|
2007
|
+
} catch {
|
|
2008
|
+
return false;
|
|
2009
|
+
}
|
|
2010
|
+
})();
|
|
2002
2011
|
const wrappedFn = function(...args) {
|
|
2003
2012
|
if (!asyncLocalStorage && !isAsyncStorageInitDone()) {
|
|
2004
2013
|
return asyncLocalStorageReady.then(
|
|
@@ -2092,11 +2101,12 @@ var Bitfab = class {
|
|
|
2092
2101
|
const replayCtxForMock = getReplayContext();
|
|
2093
2102
|
if (replayCtxForMock?.mockTree && !isRootSpan) {
|
|
2094
2103
|
const counters = replayCtxForMock.callCounters;
|
|
2095
|
-
const
|
|
2096
|
-
counters.
|
|
2104
|
+
const counterKey = `${traceFunctionKey}:${baseSpanParams.spanName}`;
|
|
2105
|
+
const callIndex = counters.get(counterKey) ?? 0;
|
|
2106
|
+
counters.set(counterKey, callIndex + 1);
|
|
2097
2107
|
const shouldMock = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
|
|
2098
2108
|
if (shouldMock) {
|
|
2099
|
-
const mockKey = `${
|
|
2109
|
+
const mockKey = `${counterKey}:${callIndex}`;
|
|
2100
2110
|
const mockSpan = replayCtxForMock.mockTree.spans.get(mockKey);
|
|
2101
2111
|
if (mockSpan) {
|
|
2102
2112
|
let output = mockSpan.output;
|
|
@@ -2107,6 +2117,9 @@ var Bitfab = class {
|
|
|
2107
2117
|
});
|
|
2108
2118
|
}
|
|
2109
2119
|
void sendSpan({ result: output });
|
|
2120
|
+
if (fnReturnsPromise) {
|
|
2121
|
+
return Promise.resolve(output);
|
|
2122
|
+
}
|
|
2110
2123
|
return output;
|
|
2111
2124
|
}
|
|
2112
2125
|
}
|
|
@@ -2252,7 +2265,7 @@ var Bitfab = class {
|
|
|
2252
2265
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
2253
2266
|
*/
|
|
2254
2267
|
async replay(traceFunctionKey, fn, options) {
|
|
2255
|
-
const { replay: doReplay } = await import("./replay-
|
|
2268
|
+
const { replay: doReplay } = await import("./replay-RJZGLEHI.js");
|
|
2256
2269
|
return doReplay(
|
|
2257
2270
|
this.httpClient,
|
|
2258
2271
|
this.serviceUrl,
|
|
@@ -2320,4 +2333,4 @@ export {
|
|
|
2320
2333
|
Bitfab,
|
|
2321
2334
|
BitfabFunction
|
|
2322
2335
|
};
|
|
2323
|
-
//# sourceMappingURL=chunk-
|
|
2336
|
+
//# sourceMappingURL=chunk-3HBV4GQO.js.map
|