@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.d.cts
CHANGED
|
@@ -1015,12 +1015,14 @@ interface CurrentTrace {
|
|
|
1015
1015
|
*/
|
|
1016
1016
|
addContext(context: Record<string, unknown>): void;
|
|
1017
1017
|
/**
|
|
1018
|
-
* Flag this trace to be dropped.
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1018
|
+
* Flag this trace to be dropped. Once flagged, spans that complete afterward
|
|
1019
|
+
* are not uploaded at all, and when the trace completes the server scrubs any
|
|
1020
|
+
* payloads that already raced out (trace, external trace, and sibling spans),
|
|
1021
|
+
* marking it `dropped` instead of `completed` and retaining only a skeleton
|
|
1022
|
+
* audit record. Use this to discard runs you never want stored (e.g. health
|
|
1023
|
+
* checks, or a run you know contains sensitive data). Takes effect
|
|
1024
|
+
* immediately for later spans; the server-side scrub takes effect at trace
|
|
1025
|
+
* completion, so a trace that is flagged but never completes is not scrubbed.
|
|
1024
1026
|
*/
|
|
1025
1027
|
drop(): void;
|
|
1026
1028
|
}
|
|
@@ -1612,7 +1614,7 @@ declare class BitfabFunction {
|
|
|
1612
1614
|
/**
|
|
1613
1615
|
* SDK version from package.json (injected at build time)
|
|
1614
1616
|
*/
|
|
1615
|
-
declare const __version__ = "0.28.
|
|
1617
|
+
declare const __version__ = "0.28.10";
|
|
1616
1618
|
|
|
1617
1619
|
/**
|
|
1618
1620
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -1015,12 +1015,14 @@ interface CurrentTrace {
|
|
|
1015
1015
|
*/
|
|
1016
1016
|
addContext(context: Record<string, unknown>): void;
|
|
1017
1017
|
/**
|
|
1018
|
-
* Flag this trace to be dropped.
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1018
|
+
* Flag this trace to be dropped. Once flagged, spans that complete afterward
|
|
1019
|
+
* are not uploaded at all, and when the trace completes the server scrubs any
|
|
1020
|
+
* payloads that already raced out (trace, external trace, and sibling spans),
|
|
1021
|
+
* marking it `dropped` instead of `completed` and retaining only a skeleton
|
|
1022
|
+
* audit record. Use this to discard runs you never want stored (e.g. health
|
|
1023
|
+
* checks, or a run you know contains sensitive data). Takes effect
|
|
1024
|
+
* immediately for later spans; the server-side scrub takes effect at trace
|
|
1025
|
+
* completion, so a trace that is flagged but never completes is not scrubbed.
|
|
1024
1026
|
*/
|
|
1025
1027
|
drop(): void;
|
|
1026
1028
|
}
|
|
@@ -1612,7 +1614,7 @@ declare class BitfabFunction {
|
|
|
1612
1614
|
/**
|
|
1613
1615
|
* SDK version from package.json (injected at build time)
|
|
1614
1616
|
*/
|
|
1615
|
-
declare const __version__ = "0.28.
|
|
1617
|
+
declare const __version__ = "0.28.10";
|
|
1616
1618
|
|
|
1617
1619
|
/**
|
|
1618
1620
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
package/dist/node.cjs
CHANGED
|
@@ -697,7 +697,7 @@ registerAsyncLocalStorageClass(
|
|
|
697
697
|
);
|
|
698
698
|
|
|
699
699
|
// src/version.generated.ts
|
|
700
|
-
var __version__ = "0.28.
|
|
700
|
+
var __version__ = "0.28.10";
|
|
701
701
|
|
|
702
702
|
// src/constants.ts
|
|
703
703
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -3143,8 +3143,11 @@ init_warnOnce();
|
|
|
3143
3143
|
var activeTraceStates = /* @__PURE__ */ new Map();
|
|
3144
3144
|
var pendingSpanPromises = /* @__PURE__ */ new Map();
|
|
3145
3145
|
var asyncLocalStorage = null;
|
|
3146
|
+
var initializeAsyncContext = () => {
|
|
3147
|
+
asyncLocalStorage ?? (asyncLocalStorage = createAsyncLocalStorage());
|
|
3148
|
+
};
|
|
3146
3149
|
var asyncLocalStorageReady = asyncStorageReady.then(() => {
|
|
3147
|
-
|
|
3150
|
+
initializeAsyncContext();
|
|
3148
3151
|
});
|
|
3149
3152
|
var browserSpanStack = [];
|
|
3150
3153
|
function getSpanStack() {
|
|
@@ -3913,6 +3916,7 @@ var Bitfab = class {
|
|
|
3913
3916
|
if (!self.isTracingEnabled()) {
|
|
3914
3917
|
return fn.apply(this, args);
|
|
3915
3918
|
}
|
|
3919
|
+
initializeAsyncContext();
|
|
3916
3920
|
if (!asyncLocalStorage && !isAsyncStorageInitDone()) {
|
|
3917
3921
|
return asyncLocalStorageReady.then(
|
|
3918
3922
|
() => wrappedFn.apply(this, args)
|
|
@@ -3976,13 +3980,16 @@ var Bitfab = class {
|
|
|
3976
3980
|
}
|
|
3977
3981
|
try {
|
|
3978
3982
|
const endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3979
|
-
const
|
|
3983
|
+
const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
|
|
3984
|
+
const spanPromise = traceDropped ? Promise.resolve() : self.sendWrapperSpan({
|
|
3980
3985
|
...baseSpanParams,
|
|
3981
3986
|
...params,
|
|
3982
3987
|
contexts: newContext.contexts,
|
|
3983
3988
|
prompt: newContext.prompt,
|
|
3984
3989
|
endedAt,
|
|
3985
|
-
...replayCtx?.testRunId && {
|
|
3990
|
+
...replayCtx?.testRunId && {
|
|
3991
|
+
testRunId: replayCtx.testRunId
|
|
3992
|
+
},
|
|
3986
3993
|
...replayCtx?.inputSourceSpanId && {
|
|
3987
3994
|
inputSourceSpanId: replayCtx.inputSourceSpanId
|
|
3988
3995
|
}
|
|
@@ -4070,7 +4077,7 @@ var Bitfab = class {
|
|
|
4070
4077
|
meta: mockSpan.outputMeta
|
|
4071
4078
|
});
|
|
4072
4079
|
}
|
|
4073
|
-
void sendSpan({ result: output });
|
|
4080
|
+
void sendSpan({ result: output, mocked: true });
|
|
4074
4081
|
if (fnReturnsPromise) {
|
|
4075
4082
|
return Promise.resolve(output);
|
|
4076
4083
|
}
|
|
@@ -4322,7 +4329,8 @@ var Bitfab = class {
|
|
|
4322
4329
|
sourceTraceId: params.traceId,
|
|
4323
4330
|
traceFunctionKey: params.traceFunctionKey,
|
|
4324
4331
|
rawSpan: externalSpan,
|
|
4325
|
-
...params.testRunId && { testRunId: params.testRunId }
|
|
4332
|
+
...params.testRunId && { testRunId: params.testRunId },
|
|
4333
|
+
...params.mocked && { mocked: true }
|
|
4326
4334
|
});
|
|
4327
4335
|
}
|
|
4328
4336
|
/**
|