@bitfab/sdk 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
@@ -8,13 +8,13 @@ import {
8
8
  SUPPORTED_PROVIDERS,
9
9
  getCurrentSpan,
10
10
  getCurrentTrace
11
- } from "./chunk-4ANYHNQJ.js";
11
+ } from "./chunk-RMQX546G.js";
12
12
  import {
13
13
  BitfabError,
14
14
  DEFAULT_SERVICE_URL,
15
15
  __version__,
16
16
  flushTraces
17
- } from "./chunk-VFGUZWAV.js";
17
+ } from "./chunk-OW2EJK7T.js";
18
18
  export {
19
19
  Bitfab,
20
20
  BitfabClaudeAgentHandler,
package/dist/node.cjs CHANGED
@@ -81,7 +81,7 @@ var __version__;
81
81
  var init_version_generated = __esm({
82
82
  "src/version.generated.ts"() {
83
83
  "use strict";
84
- __version__ = "0.13.8";
84
+ __version__ = "0.14.0";
85
85
  }
86
86
  });
87
87
 
@@ -315,7 +315,10 @@ var init_http = __esm({
315
315
  * Blocking call — creates a test run and returns lightweight item references.
316
316
  */
317
317
  async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
318
- const payload = { traceFunctionKey, limit };
318
+ const payload = { traceFunctionKey };
319
+ if (limit !== void 0) {
320
+ payload.limit = limit;
321
+ }
319
322
  if (traceIds) {
320
323
  payload.traceIds = traceIds;
321
324
  }
@@ -657,6 +660,21 @@ async function mapWithConcurrency(tasks, maxConcurrency) {
657
660
  return results;
658
661
  }
659
662
  async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
663
+ if (options?.traceIds !== void 0) {
664
+ if (options.traceIds.length === 0) {
665
+ throw new BitfabError("traceIds must contain at least one trace ID.");
666
+ }
667
+ if (options.traceIds.length > 100) {
668
+ throw new BitfabError(
669
+ `traceIds supports at most 100 trace IDs per replay (got ${options.traceIds.length}).`
670
+ );
671
+ }
672
+ }
673
+ if (options?.limit !== void 0 && options?.traceIds !== void 0) {
674
+ throw new BitfabError(
675
+ "Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
676
+ );
677
+ }
660
678
  await replayContextReady;
661
679
  const {
662
680
  testRunId,
@@ -664,7 +682,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
664
682
  items: serverItems
665
683
  } = await httpClient.startReplay(
666
684
  traceFunctionKey,
667
- options?.limit ?? 5,
685
+ // limit is meaningless with explicit traceIds (the ID list determines
686
+ // the count), so it's omitted from the request entirely.
687
+ options?.traceIds ? void 0 : options?.limit ?? 5,
668
688
  options?.traceIds,
669
689
  options?.codeChangeDescription,
670
690
  options?.codeChangeFiles,
@@ -710,6 +730,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
710
730
  var init_replay = __esm({
711
731
  "src/replay.ts"() {
712
732
  "use strict";
733
+ init_errors();
713
734
  init_http();
714
735
  init_replayContext();
715
736
  init_serialize();
@@ -3188,7 +3209,9 @@ var Bitfab = class {
3188
3209
  *
3189
3210
  * @param traceFunctionKey - The trace function key to replay
3190
3211
  * @param fn - The function to replay (must be the return value of `withSpan`)
3191
- * @param options - Optional replay options (limit, traceIds)
3212
+ * @param options - Optional replay options. `limit` and `traceIds` are
3213
+ * mutually exclusive — an explicit ID list already determines how many
3214
+ * traces replay, so passing both throws a BitfabError.
3192
3215
  * @returns ReplayResult with items, testRunId, and testRunUrl
3193
3216
  */
3194
3217
  async replay(traceFunctionKey, fn, options) {