bitfab 0.12.1 → 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-NU52P7HA.js → chunk-3HBV4GQO.js} +17 -7
- package/dist/{chunk-NU52P7HA.js.map → chunk-3HBV4GQO.js.map} +1 -1
- package/dist/{chunk-OOKZ6S64.js → chunk-HUSTKOQI.js} +2 -2
- package/dist/{chunk-OOKZ6S64.js.map → chunk-HUSTKOQI.js.map} +1 -1
- package/dist/index.cjs +23 -9
- 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 +23 -9
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-UQP2XXBZ.js → replay-RJZGLEHI.js} +10 -6
- package/dist/replay-RJZGLEHI.js.map +1 -0
- package/package.json +1 -1
- package/dist/replay-UQP2XXBZ.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,7 +2117,7 @@ var Bitfab = class {
|
|
|
2107
2117
|
});
|
|
2108
2118
|
}
|
|
2109
2119
|
void sendSpan({ result: output });
|
|
2110
|
-
if (
|
|
2120
|
+
if (fnReturnsPromise) {
|
|
2111
2121
|
return Promise.resolve(output);
|
|
2112
2122
|
}
|
|
2113
2123
|
return output;
|
|
@@ -2255,7 +2265,7 @@ var Bitfab = class {
|
|
|
2255
2265
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
2256
2266
|
*/
|
|
2257
2267
|
async replay(traceFunctionKey, fn, options) {
|
|
2258
|
-
const { replay: doReplay } = await import("./replay-
|
|
2268
|
+
const { replay: doReplay } = await import("./replay-RJZGLEHI.js");
|
|
2259
2269
|
return doReplay(
|
|
2260
2270
|
this.httpClient,
|
|
2261
2271
|
this.serviceUrl,
|
|
@@ -2323,4 +2333,4 @@ export {
|
|
|
2323
2333
|
Bitfab,
|
|
2324
2334
|
BitfabFunction
|
|
2325
2335
|
};
|
|
2326
|
-
//# sourceMappingURL=chunk-
|
|
2336
|
+
//# sourceMappingURL=chunk-3HBV4GQO.js.map
|