@bitfab/sdk 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
@@ -218,7 +218,7 @@ function buildMockTree(rootNode) {
218
218
  }
219
219
  return { spans };
220
220
  }
221
- async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, environment) {
221
+ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy, environment, adaptInputs) {
222
222
  const lease = environment ? serverItem.dbBranchLease : void 0;
223
223
  let inputs = [];
224
224
  let originalOutput;
@@ -231,6 +231,12 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
231
231
  const spanData = span.rawData?.span_data ?? {};
232
232
  inputs = deserializeInputs(spanData);
233
233
  originalOutput = deserializeOutput(spanData);
234
+ if (adaptInputs) {
235
+ inputs = adaptInputs(inputs, {
236
+ traceId: serverItem.traceId,
237
+ sourceSpanId: serverItem.externalSpanId
238
+ });
239
+ }
234
240
  let mockTree;
235
241
  if (mockStrategy === "all" || mockStrategy === "marked") {
236
242
  const treeResponse = await httpClient.getSpanTree(
@@ -311,9 +317,12 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
311
317
  }
312
318
  }
313
319
  if (options?.limit !== void 0 && options?.traceIds !== void 0) {
314
- throw new BitfabError(
315
- "Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
316
- );
320
+ try {
321
+ console.warn(
322
+ "Bitfab: limit is ignored when traceIds is passed: the explicit trace ID list already determines how many traces replay."
323
+ );
324
+ } catch {
325
+ }
317
326
  }
318
327
  await replayContextReady;
319
328
  const {
@@ -341,7 +350,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
341
350
  fn,
342
351
  testRunId,
343
352
  mockStrategy,
344
- options?.environment
353
+ options?.environment,
354
+ options?.adaptInputs
345
355
  )
346
356
  );
347
357
  const resultItems = await mapWithConcurrency(tasks, maxConcurrency);
@@ -422,7 +432,7 @@ __export(index_exports, {
422
432
  module.exports = __toCommonJS(index_exports);
423
433
 
424
434
  // src/version.generated.ts
425
- var __version__ = "0.15.0";
435
+ var __version__ = "0.16.1";
426
436
 
427
437
  // src/constants.ts
428
438
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -3212,9 +3222,9 @@ var Bitfab = class {
3212
3222
  *
3213
3223
  * @param traceFunctionKey - The trace function key to replay
3214
3224
  * @param fn - The function to replay (must be the return value of `withSpan`)
3215
- * @param options - Optional replay options. `limit` and `traceIds` are
3216
- * mutually exclusive an explicit ID list already determines how many
3217
- * traces replay, so passing both throws a BitfabError.
3225
+ * @param options - Optional replay options. When `traceIds` is passed,
3226
+ * `limit` is ignored (with a warning): an explicit ID list already
3227
+ * determines how many traces replay.
3218
3228
  * @returns ReplayResult with items, testRunId, and testRunUrl
3219
3229
  */
3220
3230
  async replay(traceFunctionKey, fn, options) {