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.cjs CHANGED
@@ -44,7 +44,7 @@ var __version__;
44
44
  var init_version_generated = __esm({
45
45
  "src/version.generated.ts"() {
46
46
  "use strict";
47
- __version__ = "0.13.8";
47
+ __version__ = "0.14.0";
48
48
  }
49
49
  });
50
50
 
@@ -278,7 +278,10 @@ var init_http = __esm({
278
278
  * Blocking call — creates a test run and returns lightweight item references.
279
279
  */
280
280
  async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
281
- const payload = { traceFunctionKey, limit };
281
+ const payload = { traceFunctionKey };
282
+ if (limit !== void 0) {
283
+ payload.limit = limit;
284
+ }
282
285
  if (traceIds) {
283
286
  payload.traceIds = traceIds;
284
287
  }
@@ -659,6 +662,21 @@ async function mapWithConcurrency(tasks, maxConcurrency) {
659
662
  return results;
660
663
  }
661
664
  async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
665
+ if (options?.traceIds !== void 0) {
666
+ if (options.traceIds.length === 0) {
667
+ throw new BitfabError("traceIds must contain at least one trace ID.");
668
+ }
669
+ if (options.traceIds.length > 100) {
670
+ throw new BitfabError(
671
+ `traceIds supports at most 100 trace IDs per replay (got ${options.traceIds.length}).`
672
+ );
673
+ }
674
+ }
675
+ if (options?.limit !== void 0 && options?.traceIds !== void 0) {
676
+ throw new BitfabError(
677
+ "Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
678
+ );
679
+ }
662
680
  await replayContextReady;
663
681
  const {
664
682
  testRunId,
@@ -666,7 +684,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
666
684
  items: serverItems
667
685
  } = await httpClient.startReplay(
668
686
  traceFunctionKey,
669
- options?.limit ?? 5,
687
+ // limit is meaningless with explicit traceIds (the ID list determines
688
+ // the count), so it's omitted from the request entirely.
689
+ options?.traceIds ? void 0 : options?.limit ?? 5,
670
690
  options?.traceIds,
671
691
  options?.codeChangeDescription,
672
692
  options?.codeChangeFiles,
@@ -712,6 +732,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
712
732
  var init_replay = __esm({
713
733
  "src/replay.ts"() {
714
734
  "use strict";
735
+ init_errors();
715
736
  init_http();
716
737
  init_replayContext();
717
738
  init_serialize();
@@ -3183,7 +3204,9 @@ var Bitfab = class {
3183
3204
  *
3184
3205
  * @param traceFunctionKey - The trace function key to replay
3185
3206
  * @param fn - The function to replay (must be the return value of `withSpan`)
3186
- * @param options - Optional replay options (limit, traceIds)
3207
+ * @param options - Optional replay options. `limit` and `traceIds` are
3208
+ * mutually exclusive — an explicit ID list already determines how many
3209
+ * traces replay, so passing both throws a BitfabError.
3187
3210
  * @returns ReplayResult with items, testRunId, and testRunUrl
3188
3211
  */
3189
3212
  async replay(traceFunctionKey, fn, options) {