@blaxel/core 0.2.96-preview.205 → 0.3.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.
@@ -22,8 +22,8 @@ function missingCredentialsMessage() {
22
22
  return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
23
23
  }
24
24
  // Build info - these placeholders are replaced at build time by build:replace-imports
25
- const BUILD_VERSION = "0.2.96-preview.205";
26
- const BUILD_COMMIT = "b2439e6cde8dee15ff0ff166366670a4f48d8ade";
25
+ const BUILD_VERSION = "0.3.0";
26
+ const BUILD_COMMIT = "f48d4c2e1e8d3bd3ee61decfacc3cd4f3ab0323d";
27
27
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
28
28
  const BLAXEL_API_VERSION = "2026-04-28";
29
29
  // Cache for config.yaml tracking value
@@ -1,13 +1,5 @@
1
1
  import { createSandboxSchedule, deleteSandboxSchedule, getSandboxSchedule, listSandboxScheduleExecutions, listSandboxSchedules, updateSandboxSchedule } from "../client/index.js";
2
- // Schedule list endpoints return a bare array on older API versions and a
3
- // cursor-paginated `{ data, meta }` envelope starting on Blaxel-Version
4
- // 2026-04-28. Handle both so the wrapper works regardless of the SDK's default
5
- // version.
6
- function unwrapPage(data) {
7
- if (Array.isArray(data))
8
- return data;
9
- return data?.data ?? [];
10
- }
2
+ import { createPaginatedList } from "../common/pagination.js";
11
3
  // SandboxSchedules manages a sandbox's schedules. A schedule entry is a flat
12
4
  // record (id/type/value/input) with no sub-resource of its own, so methods
13
5
  // return the raw SandboxScheduleEntry rather than a wrapper class (the generated
@@ -20,15 +12,38 @@ export class SandboxSchedules {
20
12
  get sandboxName() {
21
13
  return this.sandbox.metadata.name;
22
14
  }
15
+ /**
16
+ * List one page of the sandbox's schedules.
17
+ *
18
+ * The returned page exposes `data` for the current page, `meta` for cursor
19
+ * metadata, and `nextPage()` / `autoPagingEach()` / `autoPagingToArray()`
20
+ * helpers. Iterate it directly with `for await` to walk every page.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const page = await sandbox.schedules.list({ limit: 50 });
25
+ * for await (const schedule of page) {
26
+ * console.log(schedule.id);
27
+ * }
28
+ * ```
29
+ */
23
30
  async list(options = {}) {
24
- const { data } = await listSandboxSchedules({
25
- path: {
26
- sandboxName: this.sandboxName,
27
- },
31
+ const fetchPage = async (query) => {
32
+ const { data } = await listSandboxSchedules({
33
+ path: {
34
+ sandboxName: this.sandboxName,
35
+ },
36
+ query,
37
+ throwOnError: true,
38
+ });
39
+ return data;
40
+ };
41
+ return createPaginatedList({
42
+ response: await fetchPage(options),
43
+ fetchPage,
44
+ mapItem: (entry) => entry,
28
45
  query: options,
29
- throwOnError: true,
30
46
  });
31
- return unwrapPage(data);
32
47
  }
33
48
  async create(schedule) {
34
49
  const { data } = await createSandboxSchedule({
@@ -74,14 +89,29 @@ export class SandboxSchedules {
74
89
  // List the execution history of every schedule on the sandbox, newest first.
75
90
  // Executions are sandbox-scoped, not per-schedule; filter by `scheduleId` on
76
91
  // the returned records to isolate a single schedule's runs.
92
+ /**
93
+ * List one page of schedule executions, newest first.
94
+ *
95
+ * The returned page exposes `data`, `meta`, and `nextPage()` /
96
+ * `autoPagingEach()` / `autoPagingToArray()` helpers. Iterate it directly
97
+ * with `for await` to walk every page.
98
+ */
77
99
  async executions(options = {}) {
78
- const { data } = await listSandboxScheduleExecutions({
79
- path: {
80
- sandboxName: this.sandboxName,
81
- },
100
+ const fetchPage = async (query) => {
101
+ const { data } = await listSandboxScheduleExecutions({
102
+ path: {
103
+ sandboxName: this.sandboxName,
104
+ },
105
+ query,
106
+ throwOnError: true,
107
+ });
108
+ return data;
109
+ };
110
+ return createPaginatedList({
111
+ response: await fetchPage(options),
112
+ fetchPage,
113
+ mapItem: (execution) => execution,
82
114
  query: options,
83
- throwOnError: true,
84
115
  });
85
- return unwrapPage(data);
86
116
  }
87
117
  }