@bitfab/sdk 0.53.3 → 0.53.4

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.
Files changed (41) hide show
  1. package/dist/autoTrace.cjs +10 -2
  2. package/dist/autoTrace.cjs.map +1 -1
  3. package/dist/autoTrace.js +2 -2
  4. package/dist/{chunk-PVB4BGAS.js → chunk-4GMZN76Y.js} +3 -3
  5. package/dist/chunk-4GMZN76Y.js.map +1 -0
  6. package/dist/{chunk-EKIJ6QBA.js → chunk-BZML7OQD.js} +11 -2
  7. package/dist/chunk-BZML7OQD.js.map +1 -0
  8. package/dist/{chunk-E5BLYL5X.js → chunk-EGWJYCNT.js} +6 -5
  9. package/dist/chunk-EGWJYCNT.js.map +1 -0
  10. package/dist/{chunk-YE53VBBW.js → chunk-KTBWJLIN.js} +10 -4
  11. package/dist/chunk-KTBWJLIN.js.map +1 -0
  12. package/dist/{chunk-W5GNZSKR.js → chunk-OWZF23WR.js} +20 -2
  13. package/dist/chunk-OWZF23WR.js.map +1 -0
  14. package/dist/{chunk-H6LZRFMN.js → chunk-VCRFFCLY.js} +20 -2
  15. package/dist/chunk-VCRFFCLY.js.map +1 -0
  16. package/dist/{chunk-HKRITKFY.js → chunk-WQOA3SFF.js} +12 -11
  17. package/dist/chunk-WQOA3SFF.js.map +1 -0
  18. package/dist/{http-DCZ44JXM.js → http-6NM3JD5W.js} +3 -3
  19. package/dist/{http-NB6D7OIN.js → http-HSCOLYYK.js} +2 -2
  20. package/dist/index.cjs +43 -4
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +5 -5
  25. package/dist/node.cjs +43 -4
  26. package/dist/node.cjs.map +1 -1
  27. package/dist/node.js +5 -5
  28. package/dist/{replay-FE2R4GRT.js → replay-V3AN37XH.js} +4 -4
  29. package/dist/replayCli.js +2 -2
  30. package/dist/seedCli.js +2 -2
  31. package/package.json +1 -1
  32. package/dist/chunk-E5BLYL5X.js.map +0 -1
  33. package/dist/chunk-EKIJ6QBA.js.map +0 -1
  34. package/dist/chunk-H6LZRFMN.js.map +0 -1
  35. package/dist/chunk-HKRITKFY.js.map +0 -1
  36. package/dist/chunk-PVB4BGAS.js.map +0 -1
  37. package/dist/chunk-W5GNZSKR.js.map +0 -1
  38. package/dist/chunk-YE53VBBW.js.map +0 -1
  39. /package/dist/{http-DCZ44JXM.js.map → http-6NM3JD5W.js.map} +0 -0
  40. /package/dist/{http-NB6D7OIN.js.map → http-HSCOLYYK.js.map} +0 -0
  41. /package/dist/{replay-FE2R4GRT.js.map → replay-V3AN37XH.js.map} +0 -0
@@ -6,8 +6,8 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-YE53VBBW.js";
10
- import "./chunk-H6LZRFMN.js";
9
+ } from "./chunk-KTBWJLIN.js";
10
+ import "./chunk-VCRFFCLY.js";
11
11
  export {
12
12
  BitfabError,
13
13
  HttpClient,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-DCZ44JXM.js.map
20
+ //# sourceMappingURL=http-6NM3JD5W.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-W5GNZSKR.js";
9
+ } from "./chunk-OWZF23WR.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-NB6D7OIN.js.map
19
+ //# sourceMappingURL=http-HSCOLYYK.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.53.3";
45
+ __version__ = "0.53.4";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -258,6 +258,28 @@ var init_replayContext = __esm({
258
258
  }
259
259
  });
260
260
 
261
+ // src/captureSuppression.ts
262
+ function isCaptureSuppressed() {
263
+ return suppressionState.depth > 0;
264
+ }
265
+ function runWithCaptureSuppressed(fn) {
266
+ suppressionState.depth += 1;
267
+ try {
268
+ return fn();
269
+ } finally {
270
+ suppressionState.depth -= 1;
271
+ }
272
+ }
273
+ var suppressionGlobal, suppressionState;
274
+ var init_captureSuppression = __esm({
275
+ "src/captureSuppression.ts"() {
276
+ "use strict";
277
+ suppressionGlobal = globalThis;
278
+ suppressionState = suppressionGlobal.__bitfabCaptureSuppressionV1 ?? { depth: 0 };
279
+ suppressionGlobal.__bitfabCaptureSuppressionV1 = suppressionState;
280
+ }
281
+ });
282
+
261
283
  // src/payloadBudget.ts
262
284
  function byteLength(value) {
263
285
  return textEncoder ? textEncoder.encode(value).length : value.length;
@@ -408,6 +430,11 @@ var init_warnOnce = __esm({
408
430
 
409
431
  // src/serializePayload.ts
410
432
  function serializePayloadBody(payload, maxCarrierBytes = MAX_SPAN_CARRIER_BYTES) {
433
+ return runWithCaptureSuppressed(
434
+ () => encodeWithinBudget(payload, maxCarrierBytes)
435
+ );
436
+ }
437
+ function encodeWithinBudget(payload, maxCarrierBytes) {
411
438
  const encoded = encodePayloadBody(payload);
412
439
  if (fitsCarrierBudget(encoded.body, maxCarrierBytes)) {
413
440
  return { body: encoded.body, dropped: encoded.dropped };
@@ -532,6 +559,7 @@ function encodePayloadBody(payload) {
532
559
  var init_serializePayload = __esm({
533
560
  "src/serializePayload.ts"() {
534
561
  "use strict";
562
+ init_captureSuppression();
535
563
  init_payloadBudget();
536
564
  init_warnOnce();
537
565
  }
@@ -2714,6 +2742,9 @@ function unserializableStub(value, reason) {
2714
2742
  return { json: summary };
2715
2743
  }
2716
2744
  function serializeValue(value) {
2745
+ return runWithCaptureSuppressed(() => serializeWithSuperjson(value));
2746
+ }
2747
+ function serializeWithSuperjson(value) {
2717
2748
  try {
2718
2749
  const { json, meta } = import_superjson.default.serialize(value);
2719
2750
  let size;
@@ -2747,6 +2778,9 @@ function toJsonSafe(value) {
2747
2778
  return toJsonSafeReport(value).safe;
2748
2779
  }
2749
2780
  function toJsonSafeReport(value) {
2781
+ return runWithCaptureSuppressed(() => jsonSafeReport(value));
2782
+ }
2783
+ function jsonSafeReport(value) {
2750
2784
  const dropped = [];
2751
2785
  const safe = toJsonSafeInner(value, 0, /* @__PURE__ */ new WeakSet(), dropped);
2752
2786
  try {
@@ -2832,6 +2866,7 @@ var init_serialize = __esm({
2832
2866
  "src/serialize.ts"() {
2833
2867
  "use strict";
2834
2868
  import_superjson = __toESM(require("superjson"), 1);
2869
+ init_captureSuppression();
2835
2870
  init_payloadBudget();
2836
2871
  init_warnOnce();
2837
2872
  MAX_SERIALIZED_BYTES = MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES;
@@ -4731,6 +4766,7 @@ init_asyncStorage();
4731
4766
 
4732
4767
  // src/autoTrace.ts
4733
4768
  init_asyncStorage();
4769
+ init_captureSuppression();
4734
4770
  var autoTraceGlobal = globalThis;
4735
4771
  var autoTraceState = autoTraceGlobal.__bitfabAutoTraceStateV4 ?? {
4736
4772
  storage: null,
@@ -4863,7 +4899,7 @@ function wrapAutoTraceNodeAsyncGenerator(nodeConfiguration, source) {
4863
4899
  return wrapped;
4864
4900
  }
4865
4901
  function __bitfabAutoTraceActive() {
4866
- if (autoTraceState.activeRoots === 0) {
4902
+ if (autoTraceState.activeRoots === 0 || isCaptureSuppressed()) {
4867
4903
  return false;
4868
4904
  }
4869
4905
  return currentAutoTraceEntries().length > 0;
@@ -5193,6 +5229,9 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
5193
5229
  };
5194
5230
  }
5195
5231
 
5232
+ // src/client.ts
5233
+ init_captureSuppression();
5234
+
5196
5235
  // src/captureSurface.ts
5197
5236
  init_errors();
5198
5237
  var DEFAULT_SURFACE = "opt-in";
@@ -7895,7 +7934,7 @@ var Bitfab = class {
7895
7934
  );
7896
7935
  const tracedRoot = buildTracedRoot(rootOptions);
7897
7936
  const autoTraceRoot = function(...args) {
7898
- if (!self.shouldRecord()) {
7937
+ if (!self.shouldRecord() || isCaptureSuppressed()) {
7899
7938
  return fn.apply(this, args);
7900
7939
  }
7901
7940
  const enclosing = currentAutoTraceEntries();
@@ -8472,7 +8511,7 @@ var Bitfab = class {
8472
8511
  }
8473
8512
  })();
8474
8513
  const wrappedFn = function(...args) {
8475
- if (!self.shouldRecord()) {
8514
+ if (!self.shouldRecord() || isCaptureSuppressed()) {
8476
8515
  return fn.apply(this, args);
8477
8516
  }
8478
8517
  initializeAsyncContext();