@bitfab/sdk 0.52.1 → 0.52.2

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/node.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  getCurrentSpan,
19
19
  getCurrentTrace,
20
20
  seedFromRegistry
21
- } from "./chunk-XAT6WLCS.js";
21
+ } from "./chunk-XLSKI7UA.js";
22
22
  import "./chunk-ZUD7OFYB.js";
23
23
  import {
24
24
  BITFAB_PROGRESS_PREFIX,
@@ -27,7 +27,7 @@ import {
27
27
  ReplayError,
28
28
  reportReplayProgress,
29
29
  serializeReplayResult
30
- } from "./chunk-A5UGSRMK.js";
30
+ } from "./chunk-XXKM4EL2.js";
31
31
  import {
32
32
  BitfabError,
33
33
  DEFAULT_SERVICE_URL,
@@ -35,7 +35,7 @@ import {
35
35
  MixedTracingError,
36
36
  __version__,
37
37
  flushTraces
38
- } from "./chunk-6DIR65JW.js";
38
+ } from "./chunk-QWAWERYM.js";
39
39
  import {
40
40
  assertAsyncStorageRegistered,
41
41
  registerAsyncLocalStorageClass
@@ -7,8 +7,8 @@ import {
7
7
  serializeReplayResult,
8
8
  sleepForReplayPersistence,
9
9
  waitForReplayPersistence
10
- } from "./chunk-A5UGSRMK.js";
11
- import "./chunk-6DIR65JW.js";
10
+ } from "./chunk-XXKM4EL2.js";
11
+ import "./chunk-QWAWERYM.js";
12
12
  import "./chunk-H6LZRFMN.js";
13
13
  export {
14
14
  BITFAB_PROGRESS_PREFIX,
@@ -20,4 +20,4 @@ export {
20
20
  sleepForReplayPersistence,
21
21
  waitForReplayPersistence
22
22
  };
23
- //# sourceMappingURL=replay-24F3F5RD.js.map
23
+ //# sourceMappingURL=replay-5UAWEGXP.js.map
package/dist/replayCli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  BitfabError
4
- } from "./chunk-UQLT25PG.js";
4
+ } from "./chunk-36ARJJ6S.js";
5
5
 
6
6
  // src/replayCli.ts
7
7
  import { tsImport } from "tsx/esm/api";
@@ -94,11 +94,31 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
94
94
  ]);
95
95
  var HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
96
96
  var MAX_ATTEMPTS = 100;
97
+ var MAX_PINNED_TRACE_IDS = 100;
98
+ async function pinnedDatasetMembers(client, datasetIds, limit) {
99
+ const members = /* @__PURE__ */ new Set();
100
+ for (const datasetId of datasetIds) {
101
+ const { traceIds } = await client.datasets.listTraces(datasetId);
102
+ for (const traceId of traceIds) {
103
+ members.add(traceId);
104
+ }
105
+ }
106
+ const ordered = [...members].sort();
107
+ if (limit >= ordered.length) {
108
+ return void 0;
109
+ }
110
+ if (limit > MAX_PINNED_TRACE_IDS) {
111
+ throw new BitfabError(
112
+ `Bounding a dataset replay to ${limit} names one trace ID per replayed item, and a replay accepts at most ${MAX_PINNED_TRACE_IDS}. Drop the limit to replay every selected dataset in full.`
113
+ );
114
+ }
115
+ return ordered.slice(0, limit);
116
+ }
97
117
  function usage(registry) {
98
118
  return `Usage: bitfab-replay --registry <path> <${Object.keys(registry).join("|")}> [options]
99
119
 
100
120
  Options:
101
- --limit N
121
+ --limit N (bounds a trace ID or dataset selection instead of replacing it)
102
122
  --attempts N (replay each trace N times in this run, max ${MAX_ATTEMPTS})
103
123
  --trace-ids id1,id2
104
124
  --name NAME
@@ -173,7 +193,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
173
193
  sessionId: seedCase.sessionId
174
194
  })
175
195
  );
176
- const { flushTraces: flushTraces2 } = await import("./http-RI4YCAS2.js");
196
+ const { flushTraces: flushTraces2 } = await import("./http-CVTQ3N5S.js");
177
197
  await flushTraces2(3e4);
178
198
  return { pipeline, traceFunctionKey, traceIds };
179
199
  }
@@ -543,18 +563,28 @@ async function runReplayCli(registry, argv = typeof process === "undefined" ? []
543
563
  if (args.traceIds !== void 0) {
544
564
  options.traceIds = args.traceIds;
545
565
  options.datasetIds = void 0;
546
- options.limit = void 0;
547
566
  } else if (args.datasetIds !== void 0) {
548
567
  options.traceIds = void 0;
549
- options.limit = void 0;
550
- } else if (args.limit !== void 0) {
551
- options.traceIds = void 0;
552
- options.datasetIds = void 0;
553
- options.limit = args.limit;
554
- } else if (registrationOptions.traceIds !== void 0 || registrationDatasetIds !== void 0) {
555
- options.limit = void 0;
568
+ }
569
+ const bound = args.limit ?? registrationOptions.limit;
570
+ options.limit = void 0;
571
+ if (options.traceIds !== void 0) {
572
+ if (bound !== void 0) {
573
+ options.traceIds = options.traceIds.slice(0, bound);
574
+ }
575
+ } else if (options.datasetIds !== void 0) {
576
+ if (bound !== void 0) {
577
+ const pinned = await pinnedDatasetMembers(
578
+ registration.client,
579
+ options.datasetIds,
580
+ bound
581
+ );
582
+ if (pinned !== void 0) {
583
+ options.traceIds = pinned;
584
+ }
585
+ }
556
586
  } else {
557
- options.limit = registrationOptions.limit ?? 10;
587
+ options.limit = bound ?? 10;
558
588
  }
559
589
  const attemptsSuffix = options.attempts !== void 0 && options.attempts > 1 ? ` (${options.attempts} attempts each)` : "";
560
590
  stderr(