bitfab 0.13.8 → 0.14.0

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.d.cts CHANGED
@@ -342,9 +342,13 @@ declare class ReplayEnvironment {
342
342
 
343
343
  type MockStrategy = "none" | "all" | "marked";
344
344
  interface ReplayOptions {
345
- /** Maximum number of traces to replay (1–100, default 5). */
345
+ /**
346
+ * Maximum number of traces to replay (1–100, default 5). Mutually
347
+ * exclusive with `traceIds` — an explicit ID list already determines how
348
+ * many traces replay, so passing both throws.
349
+ */
346
350
  limit?: number;
347
- /** Optional list of specific trace IDs to replay. */
351
+ /** Optional list of specific trace IDs to replay (max 100). */
348
352
  traceIds?: string[];
349
353
  /** Maximum number of items to process in parallel. Set to 1 for sequential. Default 10. */
350
354
  maxConcurrency?: number;
@@ -916,18 +920,12 @@ declare class Bitfab {
916
920
  *
917
921
  * @param traceFunctionKey - The trace function key to replay
918
922
  * @param fn - The function to replay (must be the return value of `withSpan`)
919
- * @param options - Optional replay options (limit, traceIds)
923
+ * @param options - Optional replay options. `limit` and `traceIds` are
924
+ * mutually exclusive — an explicit ID list already determines how many
925
+ * traces replay, so passing both throws a BitfabError.
920
926
  * @returns ReplayResult with items, testRunId, and testRunUrl
921
927
  */
922
- replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: {
923
- limit?: number;
924
- traceIds?: string[];
925
- maxConcurrency?: number;
926
- codeChangeDescription?: string;
927
- codeChangeFiles?: CodeChangeFile[];
928
- mock?: "none" | "all" | "marked";
929
- environment?: ReplayEnvironment;
930
- }): Promise<ReplayResult<TReturn>>;
928
+ replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
931
929
  }
932
930
  /**
933
931
  * Represents a Bitfab function that can wrap user functions for tracing.
@@ -990,7 +988,7 @@ declare class BitfabFunction {
990
988
  /**
991
989
  * SDK version from package.json (injected at build time)
992
990
  */
993
- declare const __version__ = "0.13.8";
991
+ declare const __version__ = "0.14.0";
994
992
 
995
993
  /**
996
994
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -342,9 +342,13 @@ declare class ReplayEnvironment {
342
342
 
343
343
  type MockStrategy = "none" | "all" | "marked";
344
344
  interface ReplayOptions {
345
- /** Maximum number of traces to replay (1–100, default 5). */
345
+ /**
346
+ * Maximum number of traces to replay (1–100, default 5). Mutually
347
+ * exclusive with `traceIds` — an explicit ID list already determines how
348
+ * many traces replay, so passing both throws.
349
+ */
346
350
  limit?: number;
347
- /** Optional list of specific trace IDs to replay. */
351
+ /** Optional list of specific trace IDs to replay (max 100). */
348
352
  traceIds?: string[];
349
353
  /** Maximum number of items to process in parallel. Set to 1 for sequential. Default 10. */
350
354
  maxConcurrency?: number;
@@ -916,18 +920,12 @@ declare class Bitfab {
916
920
  *
917
921
  * @param traceFunctionKey - The trace function key to replay
918
922
  * @param fn - The function to replay (must be the return value of `withSpan`)
919
- * @param options - Optional replay options (limit, traceIds)
923
+ * @param options - Optional replay options. `limit` and `traceIds` are
924
+ * mutually exclusive — an explicit ID list already determines how many
925
+ * traces replay, so passing both throws a BitfabError.
920
926
  * @returns ReplayResult with items, testRunId, and testRunUrl
921
927
  */
922
- replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: {
923
- limit?: number;
924
- traceIds?: string[];
925
- maxConcurrency?: number;
926
- codeChangeDescription?: string;
927
- codeChangeFiles?: CodeChangeFile[];
928
- mock?: "none" | "all" | "marked";
929
- environment?: ReplayEnvironment;
930
- }): Promise<ReplayResult<TReturn>>;
928
+ replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
931
929
  }
932
930
  /**
933
931
  * Represents a Bitfab function that can wrap user functions for tracing.
@@ -990,7 +988,7 @@ declare class BitfabFunction {
990
988
  /**
991
989
  * SDK version from package.json (injected at build time)
992
990
  */
993
- declare const __version__ = "0.13.8";
991
+ declare const __version__ = "0.14.0";
994
992
 
995
993
  /**
996
994
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -17,13 +17,13 @@ import {
17
17
  SUPPORTED_PROVIDERS,
18
18
  getCurrentSpan,
19
19
  getCurrentTrace
20
- } from "./chunk-4ANYHNQJ.js";
20
+ } from "./chunk-RMQX546G.js";
21
21
  import {
22
22
  BitfabError,
23
23
  DEFAULT_SERVICE_URL,
24
24
  __version__,
25
25
  flushTraces
26
- } from "./chunk-VFGUZWAV.js";
26
+ } from "./chunk-OW2EJK7T.js";
27
27
  export {
28
28
  Bitfab,
29
29
  BitfabClaudeAgentHandler,
package/dist/node.cjs CHANGED
@@ -90,7 +90,7 @@ var __version__;
90
90
  var init_version_generated = __esm({
91
91
  "src/version.generated.ts"() {
92
92
  "use strict";
93
- __version__ = "0.13.8";
93
+ __version__ = "0.14.0";
94
94
  }
95
95
  });
96
96
 
@@ -324,7 +324,10 @@ var init_http = __esm({
324
324
  * Blocking call — creates a test run and returns lightweight item references.
325
325
  */
326
326
  async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
327
- const payload = { traceFunctionKey, limit };
327
+ const payload = { traceFunctionKey };
328
+ if (limit !== void 0) {
329
+ payload.limit = limit;
330
+ }
328
331
  if (traceIds) {
329
332
  payload.traceIds = traceIds;
330
333
  }
@@ -666,6 +669,21 @@ async function mapWithConcurrency(tasks, maxConcurrency) {
666
669
  return results;
667
670
  }
668
671
  async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
672
+ if (options?.traceIds !== void 0) {
673
+ if (options.traceIds.length === 0) {
674
+ throw new BitfabError("traceIds must contain at least one trace ID.");
675
+ }
676
+ if (options.traceIds.length > 100) {
677
+ throw new BitfabError(
678
+ `traceIds supports at most 100 trace IDs per replay (got ${options.traceIds.length}).`
679
+ );
680
+ }
681
+ }
682
+ if (options?.limit !== void 0 && options?.traceIds !== void 0) {
683
+ throw new BitfabError(
684
+ "Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
685
+ );
686
+ }
669
687
  await replayContextReady;
670
688
  const {
671
689
  testRunId,
@@ -673,7 +691,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
673
691
  items: serverItems
674
692
  } = await httpClient.startReplay(
675
693
  traceFunctionKey,
676
- options?.limit ?? 5,
694
+ // limit is meaningless with explicit traceIds (the ID list determines
695
+ // the count), so it's omitted from the request entirely.
696
+ options?.traceIds ? void 0 : options?.limit ?? 5,
677
697
  options?.traceIds,
678
698
  options?.codeChangeDescription,
679
699
  options?.codeChangeFiles,
@@ -719,6 +739,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
719
739
  var init_replay = __esm({
720
740
  "src/replay.ts"() {
721
741
  "use strict";
742
+ init_errors();
722
743
  init_http();
723
744
  init_replayContext();
724
745
  init_serialize();
@@ -3197,7 +3218,9 @@ var Bitfab = class {
3197
3218
  *
3198
3219
  * @param traceFunctionKey - The trace function key to replay
3199
3220
  * @param fn - The function to replay (must be the return value of `withSpan`)
3200
- * @param options - Optional replay options (limit, traceIds)
3221
+ * @param options - Optional replay options. `limit` and `traceIds` are
3222
+ * mutually exclusive — an explicit ID list already determines how many
3223
+ * traces replay, so passing both throws a BitfabError.
3201
3224
  * @returns ReplayResult with items, testRunId, and testRunUrl
3202
3225
  */
3203
3226
  async replay(traceFunctionKey, fn, options) {