bitfab 0.53.3 → 0.53.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.
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-KUWCXZVT.js → chunk-7UOWGJFK.js} +3 -3
  5. package/dist/chunk-7UOWGJFK.js.map +1 -0
  6. package/dist/{chunk-I3W46Y7U.js → chunk-A67P4IPJ.js} +20 -2
  7. package/dist/chunk-A67P4IPJ.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-QVRPMSFH.js → chunk-HIWCN36R.js} +11 -2
  11. package/dist/chunk-HIWCN36R.js.map +1 -0
  12. package/dist/{chunk-LOQOG2MW.js → chunk-I6HABUAU.js} +10 -4
  13. package/dist/chunk-I6HABUAU.js.map +1 -0
  14. package/dist/{chunk-JFDOUOBS.js → chunk-JMZSZD22.js} +39 -21
  15. package/dist/chunk-JMZSZD22.js.map +1 -0
  16. package/dist/{chunk-H6LZRFMN.js → chunk-VCRFFCLY.js} +20 -2
  17. package/dist/chunk-VCRFFCLY.js.map +1 -0
  18. package/dist/{http-DPLYIYPM.js → http-7G364U2F.js} +2 -2
  19. package/dist/{http-UBKEZ5VN.js → http-VZG3GUGE.js} +3 -3
  20. package/dist/index.cjs +70 -14
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +3 -3
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +5 -5
  25. package/dist/node.cjs +70 -14
  26. package/dist/node.cjs.map +1 -1
  27. package/dist/node.js +5 -5
  28. package/dist/{replay-RPZ5RUPM.js → replay-2PZ7OOTJ.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-H6LZRFMN.js.map +0 -1
  34. package/dist/chunk-I3W46Y7U.js.map +0 -1
  35. package/dist/chunk-JFDOUOBS.js.map +0 -1
  36. package/dist/chunk-KUWCXZVT.js.map +0 -1
  37. package/dist/chunk-LOQOG2MW.js.map +0 -1
  38. package/dist/chunk-QVRPMSFH.js.map +0 -1
  39. /package/dist/{http-DPLYIYPM.js.map → http-7G364U2F.js.map} +0 -0
  40. /package/dist/{http-UBKEZ5VN.js.map → http-VZG3GUGE.js.map} +0 -0
  41. /package/dist/{replay-RPZ5RUPM.js.map → replay-2PZ7OOTJ.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1259,12 +1259,12 @@ declare class DatasetsClient {
1259
1259
  save(params: SaveDatasetParams): Promise<SaveDatasetResult>;
1260
1260
  /**
1261
1261
  * List datasets, scoped to one trace function when `traceFunctionKey` is
1262
- * given and organization-wide otherwise.
1262
+ * given and organization-wide otherwise. Fetches all pages automatically.
1263
1263
  */
1264
1264
  list(params?: ListDatasetsParams): Promise<Dataset[]>;
1265
1265
  /** Fetch one dataset by id. Rejects with a 404 `BitfabError` when it is not in this organization. */
1266
1266
  get(datasetId: string): Promise<Dataset>;
1267
- /** The ids of every trace in the dataset, the same membership a replay with `datasetId` selects. */
1267
+ /** Fetches all trace-ID pages, the same membership a replay with `datasetId` selects. */
1268
1268
  listTraces(datasetId: string): Promise<DatasetTraceIds>;
1269
1269
  /**
1270
1270
  * Add traces to the dataset (1 to 100 ids per call). Traces outside the
@@ -3344,7 +3344,7 @@ interface CommitRef {
3344
3344
  /**
3345
3345
  * SDK version from package.json (injected at build time)
3346
3346
  */
3347
- declare const __version__ = "0.53.3";
3347
+ declare const __version__ = "0.53.5";
3348
3348
 
3349
3349
  /**
3350
3350
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -1259,12 +1259,12 @@ declare class DatasetsClient {
1259
1259
  save(params: SaveDatasetParams): Promise<SaveDatasetResult>;
1260
1260
  /**
1261
1261
  * List datasets, scoped to one trace function when `traceFunctionKey` is
1262
- * given and organization-wide otherwise.
1262
+ * given and organization-wide otherwise. Fetches all pages automatically.
1263
1263
  */
1264
1264
  list(params?: ListDatasetsParams): Promise<Dataset[]>;
1265
1265
  /** Fetch one dataset by id. Rejects with a 404 `BitfabError` when it is not in this organization. */
1266
1266
  get(datasetId: string): Promise<Dataset>;
1267
- /** The ids of every trace in the dataset, the same membership a replay with `datasetId` selects. */
1267
+ /** Fetches all trace-ID pages, the same membership a replay with `datasetId` selects. */
1268
1268
  listTraces(datasetId: string): Promise<DatasetTraceIds>;
1269
1269
  /**
1270
1270
  * Add traces to the dataset (1 to 100 ids per call). Traces outside the
@@ -3344,7 +3344,7 @@ interface CommitRef {
3344
3344
  /**
3345
3345
  * SDK version from package.json (injected at build time)
3346
3346
  */
3347
- declare const __version__ = "0.53.3";
3347
+ declare const __version__ = "0.53.5";
3348
3348
 
3349
3349
  /**
3350
3350
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -28,8 +28,8 @@ import {
28
28
  getCurrentTrace,
29
29
  reseedFromRegistry,
30
30
  seedFromRegistry
31
- } from "./chunk-JFDOUOBS.js";
32
- import "./chunk-E5BLYL5X.js";
31
+ } from "./chunk-JMZSZD22.js";
32
+ import "./chunk-EGWJYCNT.js";
33
33
  import {
34
34
  BITFAB_PROGRESS_PREFIX,
35
35
  DbBranchReplayError,
@@ -37,7 +37,7 @@ import {
37
37
  ReplayError,
38
38
  reportReplayProgress,
39
39
  serializeReplayResult
40
- } from "./chunk-QVRPMSFH.js";
40
+ } from "./chunk-HIWCN36R.js";
41
41
  import {
42
42
  BitfabError,
43
43
  DEFAULT_SERVICE_URL,
@@ -45,8 +45,8 @@ import {
45
45
  MixedTracingError,
46
46
  __version__,
47
47
  flushTraces
48
- } from "./chunk-LOQOG2MW.js";
49
- import "./chunk-H6LZRFMN.js";
48
+ } from "./chunk-I6HABUAU.js";
49
+ import "./chunk-VCRFFCLY.js";
50
50
  export {
51
51
  BITFAB_PROGRESS_PREFIX,
52
52
  Bitfab,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.53.3";
100
+ __version__ = "0.53.5";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -274,6 +274,28 @@ var init_replayContext = __esm({
274
274
  }
275
275
  });
276
276
 
277
+ // src/captureSuppression.ts
278
+ function isCaptureSuppressed() {
279
+ return suppressionState.depth > 0;
280
+ }
281
+ function runWithCaptureSuppressed(fn) {
282
+ suppressionState.depth += 1;
283
+ try {
284
+ return fn();
285
+ } finally {
286
+ suppressionState.depth -= 1;
287
+ }
288
+ }
289
+ var suppressionGlobal, suppressionState;
290
+ var init_captureSuppression = __esm({
291
+ "src/captureSuppression.ts"() {
292
+ "use strict";
293
+ suppressionGlobal = globalThis;
294
+ suppressionState = suppressionGlobal.__bitfabCaptureSuppressionV1 ?? { depth: 0 };
295
+ suppressionGlobal.__bitfabCaptureSuppressionV1 = suppressionState;
296
+ }
297
+ });
298
+
277
299
  // src/payloadBudget.ts
278
300
  function byteLength(value) {
279
301
  return textEncoder ? textEncoder.encode(value).length : value.length;
@@ -424,6 +446,11 @@ var init_warnOnce = __esm({
424
446
 
425
447
  // src/serializePayload.ts
426
448
  function serializePayloadBody(payload, maxCarrierBytes = MAX_SPAN_CARRIER_BYTES) {
449
+ return runWithCaptureSuppressed(
450
+ () => encodeWithinBudget(payload, maxCarrierBytes)
451
+ );
452
+ }
453
+ function encodeWithinBudget(payload, maxCarrierBytes) {
427
454
  const encoded = encodePayloadBody(payload);
428
455
  if (fitsCarrierBudget(encoded.body, maxCarrierBytes)) {
429
456
  return { body: encoded.body, dropped: encoded.dropped };
@@ -548,6 +575,7 @@ function encodePayloadBody(payload) {
548
575
  var init_serializePayload = __esm({
549
576
  "src/serializePayload.ts"() {
550
577
  "use strict";
578
+ init_captureSuppression();
551
579
  init_payloadBudget();
552
580
  init_warnOnce();
553
581
  }
@@ -2730,6 +2758,9 @@ function unserializableStub(value, reason) {
2730
2758
  return { json: summary };
2731
2759
  }
2732
2760
  function serializeValue(value) {
2761
+ return runWithCaptureSuppressed(() => serializeWithSuperjson(value));
2762
+ }
2763
+ function serializeWithSuperjson(value) {
2733
2764
  try {
2734
2765
  const { json, meta } = import_superjson.default.serialize(value);
2735
2766
  let size;
@@ -2763,6 +2794,9 @@ function toJsonSafe(value) {
2763
2794
  return toJsonSafeReport(value).safe;
2764
2795
  }
2765
2796
  function toJsonSafeReport(value) {
2797
+ return runWithCaptureSuppressed(() => jsonSafeReport(value));
2798
+ }
2799
+ function jsonSafeReport(value) {
2766
2800
  const dropped = [];
2767
2801
  const safe = toJsonSafeInner(value, 0, /* @__PURE__ */ new WeakSet(), dropped);
2768
2802
  try {
@@ -2848,6 +2882,7 @@ var init_serialize = __esm({
2848
2882
  "src/serialize.ts"() {
2849
2883
  "use strict";
2850
2884
  import_superjson = __toESM(require("superjson"), 1);
2885
+ init_captureSuppression();
2851
2886
  init_payloadBudget();
2852
2887
  init_warnOnce();
2853
2888
  MAX_SERIALIZED_BYTES = MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES;
@@ -4754,6 +4789,7 @@ init_asyncStorage();
4754
4789
 
4755
4790
  // src/autoTrace.ts
4756
4791
  init_asyncStorage();
4792
+ init_captureSuppression();
4757
4793
  var autoTraceGlobal = globalThis;
4758
4794
  var autoTraceState = autoTraceGlobal.__bitfabAutoTraceStateV4 ?? {
4759
4795
  storage: null,
@@ -4886,7 +4922,7 @@ function wrapAutoTraceNodeAsyncGenerator(nodeConfiguration, source) {
4886
4922
  return wrapped;
4887
4923
  }
4888
4924
  function __bitfabAutoTraceActive() {
4889
- if (autoTraceState.activeRoots === 0) {
4925
+ if (autoTraceState.activeRoots === 0 || isCaptureSuppressed()) {
4890
4926
  return false;
4891
4927
  }
4892
4928
  return currentAutoTraceEntries().length > 0;
@@ -5216,6 +5252,9 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
5216
5252
  };
5217
5253
  }
5218
5254
 
5255
+ // src/client.ts
5256
+ init_captureSuppression();
5257
+
5219
5258
  // src/captureSurface.ts
5220
5259
  init_errors();
5221
5260
  var DEFAULT_SURFACE = "opt-in";
@@ -5509,14 +5548,24 @@ var DatasetsClient = class {
5509
5548
  }
5510
5549
  /**
5511
5550
  * List datasets, scoped to one trace function when `traceFunctionKey` is
5512
- * given and organization-wide otherwise.
5551
+ * given and organization-wide otherwise. Fetches all pages automatically.
5513
5552
  */
5514
5553
  async list(params = {}) {
5515
- const query = params.traceFunctionKey === void 0 ? "" : `?traceFunctionKey=${encodeURIComponent(params.traceFunctionKey)}`;
5516
- const response = await this.httpClient.get(
5517
- `/api/sdk/datasets${query}`
5518
- );
5519
- return response.datasets;
5554
+ const datasets = [];
5555
+ let cursor;
5556
+ do {
5557
+ const query = new URLSearchParams({ limit: "100" });
5558
+ if (params.traceFunctionKey !== void 0) {
5559
+ query.set("traceFunctionKey", params.traceFunctionKey);
5560
+ }
5561
+ if (cursor !== void 0) {
5562
+ query.set("cursor", cursor);
5563
+ }
5564
+ const response = await this.httpClient.get(`/api/sdk/datasets?${query}`);
5565
+ datasets.push(...response.datasets);
5566
+ cursor = response.nextCursor ?? void 0;
5567
+ } while (cursor !== void 0);
5568
+ return datasets;
5520
5569
  }
5521
5570
  /** Fetch one dataset by id. Rejects with a 404 `BitfabError` when it is not in this organization. */
5522
5571
  async get(datasetId) {
@@ -5525,11 +5574,18 @@ var DatasetsClient = class {
5525
5574
  );
5526
5575
  return response.dataset;
5527
5576
  }
5528
- /** The ids of every trace in the dataset, the same membership a replay with `datasetId` selects. */
5577
+ /** Fetches all trace-ID pages, the same membership a replay with `datasetId` selects. */
5529
5578
  async listTraces(datasetId) {
5530
- return this.httpClient.get(
5531
- datasetPath(datasetId, "/traces")
5532
- );
5579
+ const traceIds = [];
5580
+ const query = new URLSearchParams({ limit: "100" });
5581
+ for (; ; ) {
5582
+ const page = await this.httpClient.get(`${datasetPath(datasetId, "/traces")}?${query}`);
5583
+ traceIds.push(...page.traceIds);
5584
+ if (page.nextCursor === void 0 || page.nextCursor === null) {
5585
+ return { datasetId: page.datasetId, traceIds };
5586
+ }
5587
+ query.set("cursor", page.nextCursor);
5588
+ }
5533
5589
  }
5534
5590
  /**
5535
5591
  * Add traces to the dataset (1 to 100 ids per call). Traces outside the
@@ -7918,7 +7974,7 @@ var Bitfab = class {
7918
7974
  );
7919
7975
  const tracedRoot = buildTracedRoot(rootOptions);
7920
7976
  const autoTraceRoot = function(...args) {
7921
- if (!self.shouldRecord()) {
7977
+ if (!self.shouldRecord() || isCaptureSuppressed()) {
7922
7978
  return fn.apply(this, args);
7923
7979
  }
7924
7980
  const enclosing = currentAutoTraceEntries();
@@ -8495,7 +8551,7 @@ var Bitfab = class {
8495
8551
  }
8496
8552
  })();
8497
8553
  const wrappedFn = function(...args) {
8498
- if (!self.shouldRecord()) {
8554
+ if (!self.shouldRecord() || isCaptureSuppressed()) {
8499
8555
  return fn.apply(this, args);
8500
8556
  }
8501
8557
  initializeAsyncContext();