bitfab 0.24.0 → 0.25.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/{chunk-S3PN26RH.js → chunk-GQLNEYSU.js} +3 -3
- package/dist/chunk-GQLNEYSU.js.map +1 -0
- package/dist/index.cjs +33 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +1 -1
- package/dist/node.cjs +33 -5
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/{replay-CQIU2ITL.js → replay-KYGI6LJY.js} +33 -5
- package/dist/replay-KYGI6LJY.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-S3PN26RH.js.map +0 -1
- package/dist/replay-CQIU2ITL.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -414,18 +414,23 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
414
414
|
originalOutput,
|
|
415
415
|
error,
|
|
416
416
|
durationMs: serverItem.durationMs ?? null,
|
|
417
|
-
|
|
417
|
+
// Filled in by replay() from the complete-replay response once the
|
|
418
|
+
// replay traces are persisted and their spans aggregated server-side.
|
|
419
|
+
// Null here (and on older servers) means "replay tokens not known".
|
|
420
|
+
tokens: null,
|
|
418
421
|
model: serverItem.model ?? null,
|
|
419
422
|
dbSnapshotRef: serverItem.dbSnapshotRef ?? null
|
|
420
423
|
};
|
|
421
424
|
}
|
|
422
|
-
async function mapWithConcurrency(tasks, maxConcurrency) {
|
|
425
|
+
async function mapWithConcurrency(tasks, maxConcurrency, onSettled) {
|
|
423
426
|
const results = new Array(tasks.length);
|
|
424
427
|
let nextIndex = 0;
|
|
425
428
|
async function worker() {
|
|
426
429
|
while (nextIndex < tasks.length) {
|
|
427
430
|
const index = nextIndex++;
|
|
428
|
-
|
|
431
|
+
const result = await tasks[index]();
|
|
432
|
+
results[index] = result;
|
|
433
|
+
onSettled?.(result, index);
|
|
429
434
|
}
|
|
430
435
|
}
|
|
431
436
|
const workers = Array.from(
|
|
@@ -485,9 +490,29 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
485
490
|
options?.adaptInputs
|
|
486
491
|
)
|
|
487
492
|
);
|
|
488
|
-
const
|
|
493
|
+
const total = tasks.length;
|
|
494
|
+
let completed = 0;
|
|
495
|
+
let succeeded = 0;
|
|
496
|
+
let errored = 0;
|
|
497
|
+
const resultItems = await mapWithConcurrency(
|
|
498
|
+
tasks,
|
|
499
|
+
maxConcurrency,
|
|
500
|
+
options?.onProgress ? (item) => {
|
|
501
|
+
completed += 1;
|
|
502
|
+
if (item.error === null) {
|
|
503
|
+
succeeded += 1;
|
|
504
|
+
} else {
|
|
505
|
+
errored += 1;
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
options?.onProgress?.({ completed, total, succeeded, errored });
|
|
509
|
+
} catch {
|
|
510
|
+
}
|
|
511
|
+
} : void 0
|
|
512
|
+
);
|
|
489
513
|
const completeResult = await httpClient.completeReplay(testRunId);
|
|
490
514
|
const serverTraceIds = completeResult.traceIds;
|
|
515
|
+
const replayTokens = completeResult.tokens;
|
|
491
516
|
if (serverTraceIds === void 0) {
|
|
492
517
|
try {
|
|
493
518
|
console.warn(
|
|
@@ -510,6 +535,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
510
535
|
missing.push(item.traceId);
|
|
511
536
|
}
|
|
512
537
|
}
|
|
538
|
+
if (mapped !== void 0) {
|
|
539
|
+
item.tokens = replayTokens?.[mapped] ?? null;
|
|
540
|
+
}
|
|
513
541
|
item.traceId = mapped ?? null;
|
|
514
542
|
}
|
|
515
543
|
}
|
|
@@ -568,7 +596,7 @@ __export(index_exports, {
|
|
|
568
596
|
module.exports = __toCommonJS(index_exports);
|
|
569
597
|
|
|
570
598
|
// src/version.generated.ts
|
|
571
|
-
var __version__ = "0.
|
|
599
|
+
var __version__ = "0.25.0";
|
|
572
600
|
|
|
573
601
|
// src/constants.ts
|
|
574
602
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|