@bitfab/sdk 0.28.5 → 0.28.7
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-SAGZ674W.js → chunk-5E4BUIYA.js} +26 -2
- package/dist/chunk-5E4BUIYA.js.map +1 -0
- package/dist/{chunk-7UU5L64L.js → chunk-TIMBGA3A.js} +14 -4
- package/dist/chunk-TIMBGA3A.js.map +1 -0
- package/dist/index.cjs +36 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +2 -2
- package/dist/node.cjs +36 -2
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-3E43G7OC.js → replay-IEE4RY57.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-7UU5L64L.js.map +0 -1
- package/dist/chunk-SAGZ674W.js.map +0 -1
- /package/dist/{replay-3E43G7OC.js.map → replay-IEE4RY57.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -735,7 +735,7 @@ declare const BITFAB_PROGRESS_PREFIX = "@@bitfab:progress ";
|
|
|
735
735
|
* It writes one `@@bitfab:progress` line per trace to stderr, which the Bitfab
|
|
736
736
|
* plugin polls to report live progress while the replay runs in the background,
|
|
737
737
|
* so scripts never hand-format the wire protocol.
|
|
738
|
-
* stdout is left untouched for
|
|
738
|
+
* stdout is left untouched for direct-run ReplayResult JSON. Outside Node (no
|
|
739
739
|
* `process.stderr`, e.g. a browser) it is a no-op, and a write failure is
|
|
740
740
|
* swallowed so progress can never crash a run.
|
|
741
741
|
*/
|
|
@@ -1014,6 +1014,15 @@ interface CurrentTrace {
|
|
|
1014
1014
|
* Context entries are stored in rawData.contexts as [{key, value}, ...].
|
|
1015
1015
|
*/
|
|
1016
1016
|
addContext(context: Record<string, unknown>): void;
|
|
1017
|
+
/**
|
|
1018
|
+
* Flag this trace to be dropped. When the trace completes, the server scrubs
|
|
1019
|
+
* its payloads (trace, external trace, and all spans) and marks it `dropped`
|
|
1020
|
+
* instead of `completed`, retaining only a skeleton audit record. Use this to
|
|
1021
|
+
* discard runs you never want stored (e.g. health checks, or a run you know
|
|
1022
|
+
* contains sensitive data). Takes effect at trace completion; a trace that is
|
|
1023
|
+
* flagged but never completes is not scrubbed.
|
|
1024
|
+
*/
|
|
1025
|
+
drop(): void;
|
|
1017
1026
|
}
|
|
1018
1027
|
/**
|
|
1019
1028
|
* Get a handle to the current active span.
|
|
@@ -1603,7 +1612,7 @@ declare class BitfabFunction {
|
|
|
1603
1612
|
/**
|
|
1604
1613
|
* SDK version from package.json (injected at build time)
|
|
1605
1614
|
*/
|
|
1606
|
-
declare const __version__ = "0.28.
|
|
1615
|
+
declare const __version__ = "0.28.7";
|
|
1607
1616
|
|
|
1608
1617
|
/**
|
|
1609
1618
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -735,7 +735,7 @@ declare const BITFAB_PROGRESS_PREFIX = "@@bitfab:progress ";
|
|
|
735
735
|
* It writes one `@@bitfab:progress` line per trace to stderr, which the Bitfab
|
|
736
736
|
* plugin polls to report live progress while the replay runs in the background,
|
|
737
737
|
* so scripts never hand-format the wire protocol.
|
|
738
|
-
* stdout is left untouched for
|
|
738
|
+
* stdout is left untouched for direct-run ReplayResult JSON. Outside Node (no
|
|
739
739
|
* `process.stderr`, e.g. a browser) it is a no-op, and a write failure is
|
|
740
740
|
* swallowed so progress can never crash a run.
|
|
741
741
|
*/
|
|
@@ -1014,6 +1014,15 @@ interface CurrentTrace {
|
|
|
1014
1014
|
* Context entries are stored in rawData.contexts as [{key, value}, ...].
|
|
1015
1015
|
*/
|
|
1016
1016
|
addContext(context: Record<string, unknown>): void;
|
|
1017
|
+
/**
|
|
1018
|
+
* Flag this trace to be dropped. When the trace completes, the server scrubs
|
|
1019
|
+
* its payloads (trace, external trace, and all spans) and marks it `dropped`
|
|
1020
|
+
* instead of `completed`, retaining only a skeleton audit record. Use this to
|
|
1021
|
+
* discard runs you never want stored (e.g. health checks, or a run you know
|
|
1022
|
+
* contains sensitive data). Takes effect at trace completion; a trace that is
|
|
1023
|
+
* flagged but never completes is not scrubbed.
|
|
1024
|
+
*/
|
|
1025
|
+
drop(): void;
|
|
1017
1026
|
}
|
|
1018
1027
|
/**
|
|
1019
1028
|
* Get a handle to the current active span.
|
|
@@ -1603,7 +1612,7 @@ declare class BitfabFunction {
|
|
|
1603
1612
|
/**
|
|
1604
1613
|
* SDK version from package.json (injected at build time)
|
|
1605
1614
|
*/
|
|
1606
|
-
declare const __version__ = "0.28.
|
|
1615
|
+
declare const __version__ = "0.28.7";
|
|
1607
1616
|
|
|
1608
1617
|
/**
|
|
1609
1618
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
flushTraces,
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TIMBGA3A.js";
|
|
18
18
|
import {
|
|
19
19
|
BITFAB_PROGRESS_PREFIX,
|
|
20
20
|
BitfabError,
|
|
21
21
|
reportReplayProgress
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5E4BUIYA.js";
|
|
23
23
|
export {
|
|
24
24
|
BITFAB_PROGRESS_PREFIX,
|
|
25
25
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -622,11 +622,35 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
|
|
625
|
+
const replayResult = {
|
|
626
626
|
items: resultItems,
|
|
627
627
|
testRunId,
|
|
628
628
|
testRunUrl: `${serviceUrl}${testRunUrl}`
|
|
629
629
|
};
|
|
630
|
+
await writeReplayResultFile(replayResult);
|
|
631
|
+
return replayResult;
|
|
632
|
+
}
|
|
633
|
+
async function writeReplayResultFile(result) {
|
|
634
|
+
const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
|
|
635
|
+
if (!resultPath) {
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
try {
|
|
639
|
+
const [{ dirname }, { mkdir, writeFile }] = await Promise.all([
|
|
640
|
+
import("path"),
|
|
641
|
+
import("fs/promises")
|
|
642
|
+
]);
|
|
643
|
+
await mkdir(dirname(resultPath), { recursive: true });
|
|
644
|
+
await writeFile(resultPath, `${JSON.stringify(result, null, 2)}
|
|
645
|
+
`);
|
|
646
|
+
} catch (err) {
|
|
647
|
+
try {
|
|
648
|
+
console.warn(
|
|
649
|
+
`Bitfab: failed to write replay result to BITFAB_REPLAY_RESULT_PATH (${resultPath}): ${err instanceof Error ? err.message : String(err)}`
|
|
650
|
+
);
|
|
651
|
+
} catch {
|
|
652
|
+
}
|
|
653
|
+
}
|
|
630
654
|
}
|
|
631
655
|
var BITFAB_PROGRESS_PREFIX;
|
|
632
656
|
var init_replay = __esm({
|
|
@@ -673,7 +697,7 @@ registerAsyncLocalStorageClass(
|
|
|
673
697
|
);
|
|
674
698
|
|
|
675
699
|
// src/version.generated.ts
|
|
676
|
-
var __version__ = "0.28.
|
|
700
|
+
var __version__ = "0.28.7";
|
|
677
701
|
|
|
678
702
|
// src/constants.ts
|
|
679
703
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -3324,6 +3348,8 @@ var noOpTrace = {
|
|
|
3324
3348
|
setMetadata() {
|
|
3325
3349
|
},
|
|
3326
3350
|
addContext() {
|
|
3351
|
+
},
|
|
3352
|
+
drop() {
|
|
3327
3353
|
}
|
|
3328
3354
|
};
|
|
3329
3355
|
function getCurrentSpan() {
|
|
@@ -3400,6 +3426,12 @@ function getCurrentTrace() {
|
|
|
3400
3426
|
traceState.contexts.push(context);
|
|
3401
3427
|
} catch {
|
|
3402
3428
|
}
|
|
3429
|
+
},
|
|
3430
|
+
drop() {
|
|
3431
|
+
try {
|
|
3432
|
+
getOrCreateTraceState().dropped = true;
|
|
3433
|
+
} catch {
|
|
3434
|
+
}
|
|
3403
3435
|
}
|
|
3404
3436
|
};
|
|
3405
3437
|
}
|
|
@@ -3989,6 +4021,7 @@ var Bitfab = class {
|
|
|
3989
4021
|
testRunId: traceState?.testRunId,
|
|
3990
4022
|
inputSourceTraceId: traceState?.inputSourceTraceId,
|
|
3991
4023
|
dbSnapshotRef: traceState?.dbSnapshotRef,
|
|
4024
|
+
dropped: traceState?.dropped,
|
|
3992
4025
|
// Built AFTER the wrapped fn finished, so `accessed` reflects
|
|
3993
4026
|
// whether customer code obtained the branch URL during this
|
|
3994
4027
|
// item. Omitted entirely when no lease was attached, so the
|
|
@@ -4234,6 +4267,7 @@ var Bitfab = class {
|
|
|
4234
4267
|
traceFunctionKey: params.traceFunctionKey,
|
|
4235
4268
|
externalTrace: rawTrace,
|
|
4236
4269
|
completed: true,
|
|
4270
|
+
...params.dropped && { dropped: true },
|
|
4237
4271
|
...params.sessionId && { sessionId: params.sessionId },
|
|
4238
4272
|
...params.testRunId && { testRunId: params.testRunId }
|
|
4239
4273
|
});
|