@bitfab/sdk 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
|
@@ -405,18 +405,23 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
405
405
|
originalOutput,
|
|
406
406
|
error,
|
|
407
407
|
durationMs: serverItem.durationMs ?? null,
|
|
408
|
-
|
|
408
|
+
// Filled in by replay() from the complete-replay response once the
|
|
409
|
+
// replay traces are persisted and their spans aggregated server-side.
|
|
410
|
+
// Null here (and on older servers) means "replay tokens not known".
|
|
411
|
+
tokens: null,
|
|
409
412
|
model: serverItem.model ?? null,
|
|
410
413
|
dbSnapshotRef: serverItem.dbSnapshotRef ?? null
|
|
411
414
|
};
|
|
412
415
|
}
|
|
413
|
-
async function mapWithConcurrency(tasks, maxConcurrency) {
|
|
416
|
+
async function mapWithConcurrency(tasks, maxConcurrency, onSettled) {
|
|
414
417
|
const results = new Array(tasks.length);
|
|
415
418
|
let nextIndex = 0;
|
|
416
419
|
async function worker() {
|
|
417
420
|
while (nextIndex < tasks.length) {
|
|
418
421
|
const index = nextIndex++;
|
|
419
|
-
|
|
422
|
+
const result = await tasks[index]();
|
|
423
|
+
results[index] = result;
|
|
424
|
+
onSettled?.(result, index);
|
|
420
425
|
}
|
|
421
426
|
}
|
|
422
427
|
const workers = Array.from(
|
|
@@ -476,9 +481,29 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
476
481
|
options?.adaptInputs
|
|
477
482
|
)
|
|
478
483
|
);
|
|
479
|
-
const
|
|
484
|
+
const total = tasks.length;
|
|
485
|
+
let completed = 0;
|
|
486
|
+
let succeeded = 0;
|
|
487
|
+
let errored = 0;
|
|
488
|
+
const resultItems = await mapWithConcurrency(
|
|
489
|
+
tasks,
|
|
490
|
+
maxConcurrency,
|
|
491
|
+
options?.onProgress ? (item) => {
|
|
492
|
+
completed += 1;
|
|
493
|
+
if (item.error === null) {
|
|
494
|
+
succeeded += 1;
|
|
495
|
+
} else {
|
|
496
|
+
errored += 1;
|
|
497
|
+
}
|
|
498
|
+
try {
|
|
499
|
+
options?.onProgress?.({ completed, total, succeeded, errored });
|
|
500
|
+
} catch {
|
|
501
|
+
}
|
|
502
|
+
} : void 0
|
|
503
|
+
);
|
|
480
504
|
const completeResult = await httpClient.completeReplay(testRunId);
|
|
481
505
|
const serverTraceIds = completeResult.traceIds;
|
|
506
|
+
const replayTokens = completeResult.tokens;
|
|
482
507
|
if (serverTraceIds === void 0) {
|
|
483
508
|
try {
|
|
484
509
|
console.warn(
|
|
@@ -501,6 +526,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
501
526
|
missing.push(item.traceId);
|
|
502
527
|
}
|
|
503
528
|
}
|
|
529
|
+
if (mapped !== void 0) {
|
|
530
|
+
item.tokens = replayTokens?.[mapped] ?? null;
|
|
531
|
+
}
|
|
504
532
|
item.traceId = mapped ?? null;
|
|
505
533
|
}
|
|
506
534
|
}
|
|
@@ -559,7 +587,7 @@ __export(index_exports, {
|
|
|
559
587
|
module.exports = __toCommonJS(index_exports);
|
|
560
588
|
|
|
561
589
|
// src/version.generated.ts
|
|
562
|
-
var __version__ = "0.
|
|
590
|
+
var __version__ = "0.25.0";
|
|
563
591
|
|
|
564
592
|
// src/constants.ts
|
|
565
593
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|