@bitfab/sdk 0.28.7 → 0.28.10
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-TIMBGA3A.js → chunk-SK4TNXRC.js} +15 -7
- package/dist/chunk-SK4TNXRC.js.map +1 -0
- package/dist/index.cjs +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1 -1
- package/dist/node.cjs +14 -6
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-TIMBGA3A.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -683,7 +683,7 @@ __export(index_exports, {
|
|
|
683
683
|
module.exports = __toCommonJS(index_exports);
|
|
684
684
|
|
|
685
685
|
// src/version.generated.ts
|
|
686
|
-
var __version__ = "0.28.
|
|
686
|
+
var __version__ = "0.28.10";
|
|
687
687
|
|
|
688
688
|
// src/constants.ts
|
|
689
689
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -3129,8 +3129,11 @@ init_warnOnce();
|
|
|
3129
3129
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
3130
3130
|
var pendingSpanPromises = /* @__PURE__ */ new Map();
|
|
3131
3131
|
var asyncLocalStorage = null;
|
|
3132
|
+
var initializeAsyncContext = () => {
|
|
3133
|
+
asyncLocalStorage ?? (asyncLocalStorage = createAsyncLocalStorage());
|
|
3134
|
+
};
|
|
3132
3135
|
var asyncLocalStorageReady = asyncStorageReady.then(() => {
|
|
3133
|
-
|
|
3136
|
+
initializeAsyncContext();
|
|
3134
3137
|
});
|
|
3135
3138
|
var browserSpanStack = [];
|
|
3136
3139
|
function getSpanStack() {
|
|
@@ -3899,6 +3902,7 @@ var Bitfab = class {
|
|
|
3899
3902
|
if (!self.isTracingEnabled()) {
|
|
3900
3903
|
return fn.apply(this, args);
|
|
3901
3904
|
}
|
|
3905
|
+
initializeAsyncContext();
|
|
3902
3906
|
if (!asyncLocalStorage && !isAsyncStorageInitDone()) {
|
|
3903
3907
|
return asyncLocalStorageReady.then(
|
|
3904
3908
|
() => wrappedFn.apply(this, args)
|
|
@@ -3962,13 +3966,16 @@ var Bitfab = class {
|
|
|
3962
3966
|
}
|
|
3963
3967
|
try {
|
|
3964
3968
|
const endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3965
|
-
const
|
|
3969
|
+
const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
|
|
3970
|
+
const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
|
|
3966
3971
|
...baseSpanParams,
|
|
3967
3972
|
...params,
|
|
3968
3973
|
contexts: newContext.contexts,
|
|
3969
3974
|
prompt: newContext.prompt,
|
|
3970
3975
|
endedAt,
|
|
3971
|
-
...replayCtx?.testRunId && {
|
|
3976
|
+
...replayCtx?.testRunId && {
|
|
3977
|
+
testRunId: replayCtx.testRunId
|
|
3978
|
+
},
|
|
3972
3979
|
...replayCtx?.inputSourceSpanId && {
|
|
3973
3980
|
inputSourceSpanId: replayCtx.inputSourceSpanId
|
|
3974
3981
|
}
|
|
@@ -4056,7 +4063,7 @@ var Bitfab = class {
|
|
|
4056
4063
|
meta: mockSpan.outputMeta
|
|
4057
4064
|
});
|
|
4058
4065
|
}
|
|
4059
|
-
void sendSpan({ result: output });
|
|
4066
|
+
void sendSpan({ result: output, mocked: true });
|
|
4060
4067
|
if (fnReturnsPromise) {
|
|
4061
4068
|
return Promise.resolve(output);
|
|
4062
4069
|
}
|
|
@@ -4308,7 +4315,8 @@ var Bitfab = class {
|
|
|
4308
4315
|
sourceTraceId: params.traceId,
|
|
4309
4316
|
traceFunctionKey: params.traceFunctionKey,
|
|
4310
4317
|
rawSpan: externalSpan,
|
|
4311
|
-
...params.testRunId && { testRunId: params.testRunId }
|
|
4318
|
+
...params.testRunId && { testRunId: params.testRunId },
|
|
4319
|
+
...params.mocked && { mocked: true }
|
|
4312
4320
|
});
|
|
4313
4321
|
}
|
|
4314
4322
|
/**
|