bitfab 0.33.3 → 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
@@ -1014,7 +1014,7 @@ __export(index_exports, {
1014
1014
  module.exports = __toCommonJS(index_exports);
1015
1015
 
1016
1016
  // src/version.generated.ts
1017
- var __version__ = "0.33.3";
1017
+ var __version__ = "0.33.4";
1018
1018
 
1019
1019
  // src/constants.ts
1020
1020
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -4313,6 +4313,38 @@ var Bitfab = class {
4313
4313
  () => wrappedFn.apply(this, args)
4314
4314
  );
4315
4315
  }
4316
+ const captureWhen = options.captureWhen === void 0 ? "always" : options.captureWhen;
4317
+ const resolvedCaptureWhen = captureWhen === "always" || captureWhen === "nested" ? captureWhen : "always";
4318
+ if (resolvedCaptureWhen !== captureWhen) {
4319
+ let invalidValue;
4320
+ try {
4321
+ invalidValue = String(captureWhen);
4322
+ } catch {
4323
+ invalidValue = "<unprintable>";
4324
+ }
4325
+ warnOnce(
4326
+ `invalid-capture-when:${traceFunctionKey}`,
4327
+ `unknown captureWhen value "${invalidValue}"; defaulting to "always". Valid values: "always", "nested".`
4328
+ );
4329
+ }
4330
+ if (resolvedCaptureWhen === "nested") {
4331
+ let hasParent = false;
4332
+ try {
4333
+ hasParent = getSpanStack().length > 0;
4334
+ } catch (setupError) {
4335
+ if (getReplayContext()) {
4336
+ throw setupError;
4337
+ }
4338
+ warnOnce(
4339
+ `withSpan-setup:${traceFunctionKey}`,
4340
+ `tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
4341
+ );
4342
+ return fn.apply(this, args);
4343
+ }
4344
+ if (!hasParent) {
4345
+ return fn.apply(this, args);
4346
+ }
4347
+ }
4316
4348
  let newStack;
4317
4349
  let executeWithContext;
4318
4350
  let registeredTraceId;