@bitfab/sdk 0.33.3 → 0.33.5

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
@@ -542,8 +542,11 @@ __export(replay_exports, {
542
542
  replay: () => replay,
543
543
  reportReplayProgress: () => reportReplayProgress
544
544
  });
545
+ function dbBranchEnabled(dbBranch) {
546
+ return dbBranch !== void 0 && dbBranch !== false;
547
+ }
545
548
  function resolveDbBranchSettings(dbBranch) {
546
- if (!dbBranch) {
549
+ if (!dbBranch || dbBranch === true) {
547
550
  return void 0;
548
551
  }
549
552
  const { minCu, maxCu, warmupSql } = dbBranch;
@@ -812,7 +815,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
812
815
  options?.name,
813
816
  codeChangeDescription,
814
817
  codeChangeFiles,
815
- options?.dbBranch !== void 0,
818
+ dbBranchEnabled(options?.dbBranch),
816
819
  // includeDbBranchLease
817
820
  options?.experimentGroupId,
818
821
  options?.datasetId,
@@ -835,7 +838,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
835
838
  mockStrategy,
836
839
  resolvedOverrides,
837
840
  replayedTraceIds[index],
838
- options?.dbBranch !== void 0,
841
+ dbBranchEnabled(options?.dbBranch),
839
842
  resolveDbBranchSettings(options?.dbBranch),
840
843
  options?.adaptInputs
841
844
  )
@@ -1005,7 +1008,7 @@ __export(index_exports, {
1005
1008
  module.exports = __toCommonJS(index_exports);
1006
1009
 
1007
1010
  // src/version.generated.ts
1008
- var __version__ = "0.33.3";
1011
+ var __version__ = "0.33.5";
1009
1012
 
1010
1013
  // src/constants.ts
1011
1014
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -4304,6 +4307,38 @@ var Bitfab = class {
4304
4307
  () => wrappedFn.apply(this, args)
4305
4308
  );
4306
4309
  }
4310
+ const captureWhen = options.captureWhen === void 0 ? "always" : options.captureWhen;
4311
+ const resolvedCaptureWhen = captureWhen === "always" || captureWhen === "nested" ? captureWhen : "always";
4312
+ if (resolvedCaptureWhen !== captureWhen) {
4313
+ let invalidValue;
4314
+ try {
4315
+ invalidValue = String(captureWhen);
4316
+ } catch {
4317
+ invalidValue = "<unprintable>";
4318
+ }
4319
+ warnOnce(
4320
+ `invalid-capture-when:${traceFunctionKey}`,
4321
+ `unknown captureWhen value "${invalidValue}"; defaulting to "always". Valid values: "always", "nested".`
4322
+ );
4323
+ }
4324
+ if (resolvedCaptureWhen === "nested") {
4325
+ let hasParent = false;
4326
+ try {
4327
+ hasParent = getSpanStack().length > 0;
4328
+ } catch (setupError) {
4329
+ if (getReplayContext()) {
4330
+ throw setupError;
4331
+ }
4332
+ warnOnce(
4333
+ `withSpan-setup:${traceFunctionKey}`,
4334
+ `tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
4335
+ );
4336
+ return fn.apply(this, args);
4337
+ }
4338
+ if (!hasParent) {
4339
+ return fn.apply(this, args);
4340
+ }
4341
+ }
4307
4342
  let newStack;
4308
4343
  let executeWithContext;
4309
4344
  let registeredTraceId;