bitfab 0.15.0 → 0.16.1

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
@@ -227,7 +227,7 @@ function buildMockTree(rootNode) {
227
227
  }
228
228
  return { spans };
229
229
  }
230
- async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, environment) {
230
+ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, environment, adaptInputs) {
231
231
  const lease = environment ? serverItem.dbBranchLease : void 0;
232
232
  let inputs = [];
233
233
  let originalOutput;
@@ -240,6 +240,12 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
240
240
  const spanData = span.rawData?.span_data ?? {};
241
241
  inputs = deserializeInputs(spanData);
242
242
  originalOutput = deserializeOutput(spanData);
243
+ if (adaptInputs) {
244
+ inputs = adaptInputs(inputs, {
245
+ traceId: serverItem.traceId,
246
+ sourceSpanId: serverItem.externalSpanId
247
+ });
248
+ }
243
249
  let mockTree;
244
250
  if (mockStrategy === "all" || mockStrategy === "marked") {
245
251
  const treeResponse = await httpClient.getSpanTree(
@@ -320,9 +326,12 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
320
326
  }
321
327
  }
322
328
  if (options?.limit !== void 0 && options?.traceIds !== void 0) {
323
- throw new BitfabError(
324
- "Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
325
- );
329
+ try {
330
+ console.warn(
331
+ "Bitfab: limit is ignored when traceIds is passed: the explicit trace ID list already determines how many traces replay."
332
+ );
333
+ } catch {
334
+ }
326
335
  }
327
336
  await replayContextReady;
328
337
  const {
@@ -350,7 +359,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
350
359
  fn,
351
360
  testRunId,
352
361
  mockStrategy,
353
- options?.environment
362
+ options?.environment,
363
+ options?.adaptInputs
354
364
  )
355
365
  );
356
366
  const resultItems = await mapWithConcurrency(tasks, maxConcurrency);
@@ -431,7 +441,7 @@ __export(index_exports, {
431
441
  module.exports = __toCommonJS(index_exports);
432
442
 
433
443
  // src/version.generated.ts
434
- var __version__ = "0.15.0";
444
+ var __version__ = "0.16.1";
435
445
 
436
446
  // src/constants.ts
437
447
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -3221,9 +3231,9 @@ var Bitfab = class {
3221
3231
  *
3222
3232
  * @param traceFunctionKey - The trace function key to replay
3223
3233
  * @param fn - The function to replay (must be the return value of `withSpan`)
3224
- * @param options - Optional replay options. `limit` and `traceIds` are
3225
- * mutually exclusive an explicit ID list already determines how many
3226
- * traces replay, so passing both throws a BitfabError.
3234
+ * @param options - Optional replay options. When `traceIds` is passed,
3235
+ * `limit` is ignored (with a warning): an explicit ID list already
3236
+ * determines how many traces replay.
3227
3237
  * @returns ReplayResult with items, testRunId, and testRunUrl
3228
3238
  */
3229
3239
  async replay(traceFunctionKey, fn, options) {