@bitfab/sdk 0.33.1 → 0.33.2

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.
@@ -14,10 +14,10 @@ import {
14
14
  toJsonSafe,
15
15
  toJsonSafeReport,
16
16
  warnOnce
17
- } from "./chunk-ADUWXWWI.js";
17
+ } from "./chunk-GT2GSQM2.js";
18
18
 
19
19
  // src/version.generated.ts
20
- var __version__ = "0.33.1";
20
+ var __version__ = "0.33.2";
21
21
 
22
22
  // src/constants.ts
23
23
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -31,6 +31,7 @@ function unrefTimer(timer) {
31
31
  }
32
32
 
33
33
  // src/http.ts
34
+ var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS = 3e5;
34
35
  function serializePayloadBody(payload) {
35
36
  try {
36
37
  return { body: JSON.stringify(payload), dropped: [] };
@@ -391,6 +392,7 @@ var HttpClient = class {
391
392
  }
392
393
  if (includeDbBranchLease) {
393
394
  payload.includeDbBranchLease = true;
395
+ payload.lazyDbBranchLease = true;
394
396
  }
395
397
  if (experimentGroupId !== void 0) {
396
398
  payload.experimentGroupId = experimentGroupId;
@@ -404,7 +406,7 @@ var HttpClient = class {
404
406
  if (dbBranchSettings !== void 0) {
405
407
  payload.dbBranchSettings = dbBranchSettings;
406
408
  }
407
- const timeout = includeDbBranchLease ? 3e5 : 3e4;
409
+ const timeout = includeDbBranchLease ? REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS : 3e4;
408
410
  return this.request("/api/sdk/replay/start", payload, {
409
411
  timeout
410
412
  });
@@ -503,11 +505,11 @@ var HttpClient = class {
503
505
  * snapshot + preview branch and polls operations to readiness, which
504
506
  * can take seconds.
505
507
  */
506
- async resolveDbBranchLease(testRunId, traceId, dbSnapshotRef) {
508
+ async resolveDbBranchLease(testRunId, traceId, dbBranchSettings) {
507
509
  return this.request(
508
510
  "/api/sdk/replay/resolveDbBranchLease",
509
- { testRunId, traceId, dbSnapshotRef },
510
- { timeout: 9e4 }
511
+ { testRunId, traceId, dbBranchSettings },
512
+ { timeout: REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS }
511
513
  );
512
514
  }
513
515
  /** Release a previously-resolved DB branch by deleting its Neon branch. Idempotent server-side. */
@@ -2482,8 +2484,22 @@ var BitfabVercelAiHandler = class {
2482
2484
  var activeTraceStates = /* @__PURE__ */ new Map();
2483
2485
  var pendingSpanPromises = /* @__PURE__ */ new Map();
2484
2486
  var asyncLocalStorage = null;
2487
+ var SPAN_CONTEXT_STORAGE_SYMBOL = /* @__PURE__ */ Symbol.for("bitfab.spanContextStorage");
2485
2488
  var initializeAsyncContext = () => {
2486
- asyncLocalStorage ?? (asyncLocalStorage = createAsyncLocalStorage());
2489
+ if (asyncLocalStorage) {
2490
+ return;
2491
+ }
2492
+ const shared = globalThis;
2493
+ const existing = shared[SPAN_CONTEXT_STORAGE_SYMBOL];
2494
+ if (existing) {
2495
+ asyncLocalStorage = existing;
2496
+ return;
2497
+ }
2498
+ const created = createAsyncLocalStorage();
2499
+ if (created) {
2500
+ shared[SPAN_CONTEXT_STORAGE_SYMBOL] = created;
2501
+ asyncLocalStorage = created;
2502
+ }
2487
2503
  };
2488
2504
  var asyncLocalStorageReady = asyncStorageReady.then(() => {
2489
2505
  initializeAsyncContext();
@@ -3792,7 +3808,7 @@ var Bitfab = class {
3792
3808
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
3793
3809
  );
3794
3810
  }
3795
- const { replay: doReplay } = await import("./replay-EQPISJKC.js");
3811
+ const { replay: doReplay } = await import("./replay-V4GLDFSU.js");
3796
3812
  return doReplay(
3797
3813
  this.httpClient,
3798
3814
  this.serviceUrl,
@@ -4012,4 +4028,4 @@ export {
4012
4028
  BitfabFunction,
4013
4029
  finalizers
4014
4030
  };
4015
- //# sourceMappingURL=chunk-7UHJ67MH.js.map
4031
+ //# sourceMappingURL=chunk-A3WLV5VS.js.map