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