@bitfab/sdk 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/{chunk-VFGUZWAV.js → chunk-OW2EJK7T.js} +6 -3
- package/dist/chunk-OW2EJK7T.js.map +1 -0
- package/dist/{chunk-4ANYHNQJ.js → chunk-RMQX546G.js} +6 -4
- package/dist/chunk-RMQX546G.js.map +1 -0
- package/dist/index.cjs +27 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +2 -2
- package/dist/node.cjs +27 -4
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-F7K2JQCZ.js → replay-LNP2K3DN.js} +21 -3
- package/dist/replay-LNP2K3DN.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-4ANYHNQJ.js.map +0 -1
- package/dist/chunk-VFGUZWAV.js.map +0 -1
- package/dist/replay-F7K2JQCZ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var __version__;
|
|
|
35
35
|
var init_version_generated = __esm({
|
|
36
36
|
"src/version.generated.ts"() {
|
|
37
37
|
"use strict";
|
|
38
|
-
__version__ = "0.
|
|
38
|
+
__version__ = "0.14.0";
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -269,7 +269,10 @@ var init_http = __esm({
|
|
|
269
269
|
* Blocking call — creates a test run and returns lightweight item references.
|
|
270
270
|
*/
|
|
271
271
|
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
|
|
272
|
-
const payload = { traceFunctionKey
|
|
272
|
+
const payload = { traceFunctionKey };
|
|
273
|
+
if (limit !== void 0) {
|
|
274
|
+
payload.limit = limit;
|
|
275
|
+
}
|
|
273
276
|
if (traceIds) {
|
|
274
277
|
payload.traceIds = traceIds;
|
|
275
278
|
}
|
|
@@ -650,6 +653,21 @@ async function mapWithConcurrency(tasks, maxConcurrency) {
|
|
|
650
653
|
return results;
|
|
651
654
|
}
|
|
652
655
|
async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
656
|
+
if (options?.traceIds !== void 0) {
|
|
657
|
+
if (options.traceIds.length === 0) {
|
|
658
|
+
throw new BitfabError("traceIds must contain at least one trace ID.");
|
|
659
|
+
}
|
|
660
|
+
if (options.traceIds.length > 100) {
|
|
661
|
+
throw new BitfabError(
|
|
662
|
+
`traceIds supports at most 100 trace IDs per replay (got ${options.traceIds.length}).`
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
if (options?.limit !== void 0 && options?.traceIds !== void 0) {
|
|
667
|
+
throw new BitfabError(
|
|
668
|
+
"Pass either limit or traceIds, not both: an explicit trace ID list already determines how many traces replay."
|
|
669
|
+
);
|
|
670
|
+
}
|
|
653
671
|
await replayContextReady;
|
|
654
672
|
const {
|
|
655
673
|
testRunId,
|
|
@@ -657,7 +675,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
657
675
|
items: serverItems
|
|
658
676
|
} = await httpClient.startReplay(
|
|
659
677
|
traceFunctionKey,
|
|
660
|
-
|
|
678
|
+
// limit is meaningless with explicit traceIds (the ID list determines
|
|
679
|
+
// the count), so it's omitted from the request entirely.
|
|
680
|
+
options?.traceIds ? void 0 : options?.limit ?? 5,
|
|
661
681
|
options?.traceIds,
|
|
662
682
|
options?.codeChangeDescription,
|
|
663
683
|
options?.codeChangeFiles,
|
|
@@ -703,6 +723,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
703
723
|
var init_replay = __esm({
|
|
704
724
|
"src/replay.ts"() {
|
|
705
725
|
"use strict";
|
|
726
|
+
init_errors();
|
|
706
727
|
init_http();
|
|
707
728
|
init_replayContext();
|
|
708
729
|
init_serialize();
|
|
@@ -3174,7 +3195,9 @@ var Bitfab = class {
|
|
|
3174
3195
|
*
|
|
3175
3196
|
* @param traceFunctionKey - The trace function key to replay
|
|
3176
3197
|
* @param fn - The function to replay (must be the return value of `withSpan`)
|
|
3177
|
-
* @param options - Optional replay options
|
|
3198
|
+
* @param options - Optional replay options. `limit` and `traceIds` are
|
|
3199
|
+
* mutually exclusive — an explicit ID list already determines how many
|
|
3200
|
+
* traces replay, so passing both throws a BitfabError.
|
|
3178
3201
|
* @returns ReplayResult with items, testRunId, and testRunUrl
|
|
3179
3202
|
*/
|
|
3180
3203
|
async replay(traceFunctionKey, fn, options) {
|