@alineo-labs/opensandbox 0.3.1 → 0.3.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/index.d.mts CHANGED
@@ -262,12 +262,24 @@ export declare class ControlClient {
262
262
  withSignal(signal: AbortSignal): ControlClient;
263
263
  private request;
264
264
  createSandbox(options: CreateSandboxOptions): Promise<Sandbox>;
265
+ /**
266
+ * Every sandbox, optionally filtered by state. OpenSandbox paginates with `page`/`pageSize`
267
+ * (default 20, max 200) and ignores `limit`/`offset`, so this walks every page and applies
268
+ * `offset`/`limit` itself. Sending `limit`/`offset` as query parameters silently capped every
269
+ * listing at the server's first 20.
270
+ */
265
271
  listSandboxes(options?: ListSandboxesOptions): Promise<Sandbox[]>;
266
272
  getSandbox(id: string): Promise<Sandbox>;
267
273
  deleteSandbox(id: string): Promise<void>;
268
274
  pauseSandbox(id: string): Promise<void>;
269
275
  resumeSandbox(id: string): Promise<void>;
270
- renewExpiration(id: string): Promise<void>;
276
+ /**
277
+ * Move a sandbox's expiry to `expiresAt`, which must be in the future and later than its current
278
+ * expiry. Only meaningful for a sandbox created with a `timeout`: one created without it never
279
+ * expires (OpenSandbox's `CreateSandboxRequest.timeout` — "when omitted or null, the sandbox will
280
+ * not auto-terminate"). The countdown keeps running while a sandbox is paused.
281
+ */
282
+ renewExpiration(id: string, expiresAt: Date | string): Promise<void>;
271
283
  getEndpoint(sandboxId: string, port: number, useServerProxy?: boolean): Promise<SandboxEndpoint>;
272
284
  getDiagnosticLogs(sandboxId: string): Promise<DiagnosticLog[]>;
273
285
  getDiagnosticEvents(sandboxId: string): Promise<DiagnosticEvent[]>;
package/dist/index.mjs CHANGED
@@ -66,13 +66,26 @@ var ControlClient = class ControlClient {
66
66
  createSandbox(options) {
67
67
  return this.request("POST", "/v1/sandboxes", options);
68
68
  }
69
+ /**
70
+ * Every sandbox, optionally filtered by state. OpenSandbox paginates with `page`/`pageSize`
71
+ * (default 20, max 200) and ignores `limit`/`offset`, so this walks every page and applies
72
+ * `offset`/`limit` itself. Sending `limit`/`offset` as query parameters silently capped every
73
+ * listing at the server's first 20.
74
+ */
69
75
  async listSandboxes(options = {}) {
70
- const params = new URLSearchParams();
71
- if (options.state) params.set("state", options.state);
72
- if (options.limit !== void 0) params.set("limit", String(options.limit));
73
- if (options.offset !== void 0) params.set("offset", String(options.offset));
74
- const qs = params.toString();
75
- return (await this.request("GET", `/v1/sandboxes${qs ? `?${qs}` : ""}`)).items;
76
+ const all = [];
77
+ for (let page = 1;; page++) {
78
+ const params = new URLSearchParams({
79
+ page: String(page),
80
+ pageSize: "200"
81
+ });
82
+ if (options.state) params.set("state", options.state);
83
+ const res = await this.request("GET", `/v1/sandboxes?${params}`);
84
+ all.push(...res.items);
85
+ if (!res.pagination?.hasNextPage) break;
86
+ }
87
+ const start = options.offset ?? 0;
88
+ return all.slice(start, options.limit === void 0 ? void 0 : start + options.limit);
76
89
  }
77
90
  getSandbox(id) {
78
91
  return this.request("GET", `/v1/sandboxes/${id}`);
@@ -86,8 +99,15 @@ var ControlClient = class ControlClient {
86
99
  resumeSandbox(id) {
87
100
  return this.request("POST", `/v1/sandboxes/${id}/resume`);
88
101
  }
89
- renewExpiration(id) {
90
- return this.request("POST", `/v1/sandboxes/${id}/renew-expiration`);
102
+ /**
103
+ * Move a sandbox's expiry to `expiresAt`, which must be in the future and later than its current
104
+ * expiry. Only meaningful for a sandbox created with a `timeout`: one created without it never
105
+ * expires (OpenSandbox's `CreateSandboxRequest.timeout` — "when omitted or null, the sandbox will
106
+ * not auto-terminate"). The countdown keeps running while a sandbox is paused.
107
+ */
108
+ renewExpiration(id, expiresAt) {
109
+ const at = typeof expiresAt === "string" ? expiresAt : expiresAt.toISOString();
110
+ return this.request("POST", `/v1/sandboxes/${id}/renew-expiration`, { expiresAt: at });
91
111
  }
92
112
  getEndpoint(sandboxId, port, useServerProxy) {
93
113
  const qs = useServerProxy ? "?use_server_proxy=true" : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alineo-labs/opensandbox",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",