@bitfab/sdk 0.33.2 → 0.33.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.
package/dist/index.cjs CHANGED
@@ -790,11 +790,13 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
790
790
  await replayContextReady;
791
791
  let codeChangeDescription = options?.codeChangeDescription;
792
792
  let codeChangeFiles = options?.codeChangeFiles;
793
- if (codeChangeDescription === void 0 && codeChangeFiles === void 0) {
793
+ if (codeChangeFiles === void 0) {
794
794
  const captured = await resolveAutoCodeChange(options?.name);
795
795
  if (captured) {
796
- codeChangeDescription = captured.description;
797
796
  codeChangeFiles = captured.files;
797
+ if (codeChangeDescription === void 0) {
798
+ codeChangeDescription = captured.description;
799
+ }
798
800
  }
799
801
  }
800
802
  const {
@@ -1003,7 +1005,7 @@ __export(index_exports, {
1003
1005
  module.exports = __toCommonJS(index_exports);
1004
1006
 
1005
1007
  // src/version.generated.ts
1006
- var __version__ = "0.33.2";
1008
+ var __version__ = "0.33.4";
1007
1009
 
1008
1010
  // src/constants.ts
1009
1011
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -4302,6 +4304,38 @@ var Bitfab = class {
4302
4304
  () => wrappedFn.apply(this, args)
4303
4305
  );
4304
4306
  }
4307
+ const captureWhen = options.captureWhen === void 0 ? "always" : options.captureWhen;
4308
+ const resolvedCaptureWhen = captureWhen === "always" || captureWhen === "nested" ? captureWhen : "always";
4309
+ if (resolvedCaptureWhen !== captureWhen) {
4310
+ let invalidValue;
4311
+ try {
4312
+ invalidValue = String(captureWhen);
4313
+ } catch {
4314
+ invalidValue = "<unprintable>";
4315
+ }
4316
+ warnOnce(
4317
+ `invalid-capture-when:${traceFunctionKey}`,
4318
+ `unknown captureWhen value "${invalidValue}"; defaulting to "always". Valid values: "always", "nested".`
4319
+ );
4320
+ }
4321
+ if (resolvedCaptureWhen === "nested") {
4322
+ let hasParent = false;
4323
+ try {
4324
+ hasParent = getSpanStack().length > 0;
4325
+ } catch (setupError) {
4326
+ if (getReplayContext()) {
4327
+ throw setupError;
4328
+ }
4329
+ warnOnce(
4330
+ `withSpan-setup:${traceFunctionKey}`,
4331
+ `tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
4332
+ );
4333
+ return fn.apply(this, args);
4334
+ }
4335
+ if (!hasParent) {
4336
+ return fn.apply(this, args);
4337
+ }
4338
+ }
4305
4339
  let newStack;
4306
4340
  let executeWithContext;
4307
4341
  let registeredTraceId;