@bitfab/sdk 0.53.4 → 0.53.5

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.
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-KTBWJLIN.js";
9
+ } from "./chunk-BOXLWX73.js";
10
10
  import "./chunk-VCRFFCLY.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-6NM3JD5W.js.map
20
+ //# sourceMappingURL=http-3WOABXYN.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-OWZF23WR.js";
9
+ } from "./chunk-RMATODGT.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-HSCOLYYK.js.map
19
+ //# sourceMappingURL=http-6F3OLGWX.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.53.4";
45
+ __version__ = "0.53.5";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -5525,14 +5525,24 @@ var DatasetsClient = class {
5525
5525
  }
5526
5526
  /**
5527
5527
  * List datasets, scoped to one trace function when `traceFunctionKey` is
5528
- * given and organization-wide otherwise.
5528
+ * given and organization-wide otherwise. Fetches all pages automatically.
5529
5529
  */
5530
5530
  async list(params = {}) {
5531
- const query = params.traceFunctionKey === void 0 ? "" : `?traceFunctionKey=${encodeURIComponent(params.traceFunctionKey)}`;
5532
- const response = await this.httpClient.get(
5533
- `/api/sdk/datasets${query}`
5534
- );
5535
- return response.datasets;
5531
+ const datasets = [];
5532
+ let cursor;
5533
+ do {
5534
+ const query = new URLSearchParams({ limit: "100" });
5535
+ if (params.traceFunctionKey !== void 0) {
5536
+ query.set("traceFunctionKey", params.traceFunctionKey);
5537
+ }
5538
+ if (cursor !== void 0) {
5539
+ query.set("cursor", cursor);
5540
+ }
5541
+ const response = await this.httpClient.get(`/api/sdk/datasets?${query}`);
5542
+ datasets.push(...response.datasets);
5543
+ cursor = response.nextCursor ?? void 0;
5544
+ } while (cursor !== void 0);
5545
+ return datasets;
5536
5546
  }
5537
5547
  /** Fetch one dataset by id. Rejects with a 404 `BitfabError` when it is not in this organization. */
5538
5548
  async get(datasetId) {
@@ -5541,11 +5551,18 @@ var DatasetsClient = class {
5541
5551
  );
5542
5552
  return response.dataset;
5543
5553
  }
5544
- /** The ids of every trace in the dataset, the same membership a replay with `datasetId` selects. */
5554
+ /** Fetches all trace-ID pages, the same membership a replay with `datasetId` selects. */
5545
5555
  async listTraces(datasetId) {
5546
- return this.httpClient.get(
5547
- datasetPath(datasetId, "/traces")
5548
- );
5556
+ const traceIds = [];
5557
+ const query = new URLSearchParams({ limit: "100" });
5558
+ for (; ; ) {
5559
+ const page = await this.httpClient.get(`${datasetPath(datasetId, "/traces")}?${query}`);
5560
+ traceIds.push(...page.traceIds);
5561
+ if (page.nextCursor === void 0 || page.nextCursor === null) {
5562
+ return { datasetId: page.datasetId, traceIds };
5563
+ }
5564
+ query.set("cursor", page.nextCursor);
5565
+ }
5549
5566
  }
5550
5567
  /**
5551
5568
  * Add traces to the dataset (1 to 100 ids per call). Traces outside the