@vercel/sandbox 2.0.0-beta.1 → 2.0.0-beta.10
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/README.md +40 -1
- package/dist/api-client/api-client.d.ts +232 -161
- package/dist/api-client/api-client.js +69 -68
- package/dist/api-client/api-client.js.map +1 -1
- package/dist/api-client/api-error.d.ts +6 -4
- package/dist/api-client/api-error.js +4 -3
- package/dist/api-client/api-error.js.map +1 -1
- package/dist/api-client/base-client.js +24 -9
- package/dist/api-client/base-client.js.map +1 -1
- package/dist/api-client/file-writer.d.ts +10 -0
- package/dist/api-client/file-writer.js +2 -2
- package/dist/api-client/file-writer.js.map +1 -1
- package/dist/api-client/validators.d.ts +1273 -1246
- package/dist/api-client/validators.js +33 -53
- package/dist/api-client/validators.js.map +1 -1
- package/dist/command.d.ts +9 -9
- package/dist/command.js +10 -10
- package/dist/sandbox.d.ts +200 -116
- package/dist/sandbox.js +127 -56
- package/dist/sandbox.js.map +1 -1
- package/dist/session.d.ts +29 -23
- package/dist/session.js +93 -72
- package/dist/session.js.map +1 -1
- package/dist/snapshot.d.ts +6 -7
- package/dist/snapshot.js +5 -4
- package/dist/snapshot.js.map +1 -1
- package/dist/utils/convert-sandbox.d.ts +3 -3
- package/dist/utils/convert-sandbox.js +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SessionMetaData, SandboxRouteData, SandboxMetaData } from "./api-client";
|
|
2
2
|
import { APIClient } from "./api-client";
|
|
3
3
|
import { type Credentials } from "./utils/get-credentials";
|
|
4
4
|
import { type WithPrivate } from "./utils/types";
|
|
@@ -7,7 +7,7 @@ import type { RUNTIMES } from "./constants";
|
|
|
7
7
|
import { Session, type RunCommandParams } from "./session";
|
|
8
8
|
import type { Command, CommandFinished } from "./command";
|
|
9
9
|
import type { Snapshot } from "./snapshot";
|
|
10
|
-
import type {
|
|
10
|
+
import type { ConvertedSession } from "./utils/convert-sandbox";
|
|
11
11
|
import type { NetworkPolicy } from "./network-policy";
|
|
12
12
|
export type { NetworkPolicy };
|
|
13
13
|
/** @inline */
|
|
@@ -82,14 +82,25 @@ export interface BaseCreateSandboxParams {
|
|
|
82
82
|
* await sandbox.runCommand("node", ["app.js"]);
|
|
83
83
|
*/
|
|
84
84
|
env?: Record<string, string>;
|
|
85
|
+
/**
|
|
86
|
+
* Key-value tags to associate with the sandbox. Maximum 5 tags.
|
|
87
|
+
* @example { env: "staging", team: "infra" }
|
|
88
|
+
*/
|
|
89
|
+
tags?: Record<string, string>;
|
|
85
90
|
/**
|
|
86
91
|
* An AbortSignal to cancel sandbox creation.
|
|
87
92
|
*/
|
|
88
93
|
signal?: AbortSignal;
|
|
89
94
|
/**
|
|
90
|
-
*
|
|
95
|
+
* Enable or disable automatic restore of the filesystem between sessions.
|
|
91
96
|
*/
|
|
92
97
|
persistent?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Default snapshot expiration in milliseconds.
|
|
100
|
+
* When set, snapshots created for this sandbox will expire after this duration.
|
|
101
|
+
* Use `0` for no expiration.
|
|
102
|
+
*/
|
|
103
|
+
snapshotExpiration?: number;
|
|
93
104
|
}
|
|
94
105
|
export type CreateSandboxParams = BaseCreateSandboxParams | (Omit<BaseCreateSandboxParams, "runtime" | "source"> & {
|
|
95
106
|
source: {
|
|
@@ -120,14 +131,18 @@ interface GetSandboxParams {
|
|
|
120
131
|
export declare class Sandbox {
|
|
121
132
|
private readonly client;
|
|
122
133
|
private readonly projectId;
|
|
134
|
+
/**
|
|
135
|
+
* In-flight resume promise, used to deduplicate concurrent resume calls.
|
|
136
|
+
*/
|
|
137
|
+
private resumePromise;
|
|
123
138
|
/**
|
|
124
139
|
* Internal Session instance for the current VM.
|
|
125
140
|
*/
|
|
126
141
|
private session;
|
|
127
142
|
/**
|
|
128
|
-
* Internal metadata about the
|
|
143
|
+
* Internal metadata about the sandbox.
|
|
129
144
|
*/
|
|
130
|
-
private
|
|
145
|
+
private sandbox;
|
|
131
146
|
/**
|
|
132
147
|
* The name of this sandbox.
|
|
133
148
|
*/
|
|
@@ -144,17 +159,17 @@ export declare class Sandbox {
|
|
|
144
159
|
/**
|
|
145
160
|
* The region this sandbox runs in.
|
|
146
161
|
*/
|
|
147
|
-
get region(): string;
|
|
162
|
+
get region(): string | undefined;
|
|
148
163
|
/**
|
|
149
164
|
* Number of virtual CPUs allocated.
|
|
150
165
|
*/
|
|
151
|
-
get vcpus(): number;
|
|
166
|
+
get vcpus(): number | undefined;
|
|
152
167
|
/**
|
|
153
168
|
* Memory allocated in MB.
|
|
154
169
|
*/
|
|
155
|
-
get memory(): number;
|
|
170
|
+
get memory(): number | undefined;
|
|
156
171
|
/** Runtime identifier (e.g. "node24", "python3.13"). */
|
|
157
|
-
get runtime(): string;
|
|
172
|
+
get runtime(): string | undefined;
|
|
158
173
|
/**
|
|
159
174
|
* Cumulative egress bytes across all sessions.
|
|
160
175
|
*/
|
|
@@ -175,6 +190,10 @@ export declare class Sandbox {
|
|
|
175
190
|
* When this sandbox was last updated.
|
|
176
191
|
*/
|
|
177
192
|
get updatedAt(): Date;
|
|
193
|
+
/**
|
|
194
|
+
* When the sandbox status was last updated.
|
|
195
|
+
*/
|
|
196
|
+
get statusUpdatedAt(): Date | undefined;
|
|
178
197
|
/**
|
|
179
198
|
* When this sandbox was created.
|
|
180
199
|
*/
|
|
@@ -186,11 +205,15 @@ export declare class Sandbox {
|
|
|
186
205
|
/**
|
|
187
206
|
* The status of the current session.
|
|
188
207
|
*/
|
|
189
|
-
get status():
|
|
208
|
+
get status(): SessionMetaData["status"];
|
|
190
209
|
/**
|
|
191
210
|
* The default timeout of this sandbox in milliseconds.
|
|
192
211
|
*/
|
|
193
|
-
get timeout(): number;
|
|
212
|
+
get timeout(): number | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Key-value tags attached to the sandbox.
|
|
215
|
+
*/
|
|
216
|
+
get tags(): Record<string, string> | undefined;
|
|
194
217
|
/**
|
|
195
218
|
* The default network policy of this sandbox.
|
|
196
219
|
*/
|
|
@@ -203,6 +226,10 @@ export declare class Sandbox {
|
|
|
203
226
|
* The current snapshot ID of this sandbox, if any.
|
|
204
227
|
*/
|
|
205
228
|
get currentSnapshotId(): string | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* The default snapshot expiration in milliseconds, if set.
|
|
231
|
+
*/
|
|
232
|
+
get snapshotExpiration(): number | undefined;
|
|
206
233
|
/**
|
|
207
234
|
* The amount of CPU used by the session. Only reported once the VM is stopped.
|
|
208
235
|
*/
|
|
@@ -219,57 +246,56 @@ export declare class Sandbox {
|
|
|
219
246
|
* It returns both the sandboxes and the pagination metadata to allow getting
|
|
220
247
|
* the next page of results.
|
|
221
248
|
*/
|
|
222
|
-
static list(params?: Partial<Parameters<APIClient["
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
vcpus: number;
|
|
227
|
-
region: string;
|
|
228
|
-
runtime: string;
|
|
229
|
-
timeout: number;
|
|
230
|
-
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
231
|
-
createdAt: number;
|
|
232
|
-
updatedAt: number;
|
|
233
|
-
name: string;
|
|
234
|
-
persistent: boolean;
|
|
235
|
-
currentSandboxId: string;
|
|
236
|
-
networkPolicy?: import("zod").objectInputType<{
|
|
237
|
-
mode: import("zod").ZodLiteral<"allow-all">;
|
|
238
|
-
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
239
|
-
mode: import("zod").ZodLiteral<"deny-all">;
|
|
240
|
-
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
241
|
-
mode: import("zod").ZodLiteral<"custom">;
|
|
242
|
-
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
243
|
-
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
244
|
-
deniedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
245
|
-
injectionRules: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
246
|
-
domain: import("zod").ZodString;
|
|
247
|
-
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
248
|
-
headerNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
249
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
250
|
-
domain: string;
|
|
251
|
-
headers?: Record<string, string> | undefined;
|
|
252
|
-
headerNames?: string[] | undefined;
|
|
253
|
-
}, {
|
|
254
|
-
domain: string;
|
|
255
|
-
headers?: Record<string, string> | undefined;
|
|
256
|
-
headerNames?: string[] | undefined;
|
|
257
|
-
}>, "many">>;
|
|
258
|
-
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
259
|
-
totalEgressBytes?: number | undefined;
|
|
260
|
-
totalIngressBytes?: number | undefined;
|
|
261
|
-
totalActiveCpuDurationMs?: number | undefined;
|
|
262
|
-
totalDurationMs?: number | undefined;
|
|
263
|
-
currentSnapshotId?: string | undefined;
|
|
264
|
-
}[];
|
|
265
|
-
pagination: {
|
|
266
|
-
count: number;
|
|
267
|
-
next: string | null;
|
|
268
|
-
total: number;
|
|
269
|
-
};
|
|
249
|
+
static list(params?: Partial<Parameters<APIClient["listSandboxes"]>[0]> & Partial<Credentials> & WithFetchOptions): Promise<{
|
|
250
|
+
pagination: {
|
|
251
|
+
count: number;
|
|
252
|
+
next: string | null;
|
|
270
253
|
};
|
|
271
|
-
|
|
272
|
-
|
|
254
|
+
sandboxes: {
|
|
255
|
+
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
256
|
+
createdAt: number;
|
|
257
|
+
updatedAt: number;
|
|
258
|
+
name: string;
|
|
259
|
+
persistent: boolean;
|
|
260
|
+
currentSessionId: string;
|
|
261
|
+
memory?: number | undefined;
|
|
262
|
+
vcpus?: number | undefined;
|
|
263
|
+
region?: string | undefined;
|
|
264
|
+
runtime?: string | undefined;
|
|
265
|
+
timeout?: number | undefined;
|
|
266
|
+
cwd?: string | undefined;
|
|
267
|
+
networkPolicy?: import("zod").objectInputType<{
|
|
268
|
+
mode: import("zod").ZodLiteral<"allow-all">;
|
|
269
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
270
|
+
mode: import("zod").ZodLiteral<"deny-all">;
|
|
271
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
272
|
+
mode: import("zod").ZodLiteral<"custom">;
|
|
273
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
274
|
+
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
275
|
+
deniedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
276
|
+
injectionRules: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
277
|
+
domain: import("zod").ZodString;
|
|
278
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
279
|
+
headerNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
280
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
281
|
+
domain: string;
|
|
282
|
+
headers?: Record<string, string> | undefined;
|
|
283
|
+
headerNames?: string[] | undefined;
|
|
284
|
+
}, {
|
|
285
|
+
domain: string;
|
|
286
|
+
headers?: Record<string, string> | undefined;
|
|
287
|
+
headerNames?: string[] | undefined;
|
|
288
|
+
}>, "many">>;
|
|
289
|
+
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
290
|
+
totalEgressBytes?: number | undefined;
|
|
291
|
+
totalIngressBytes?: number | undefined;
|
|
292
|
+
totalActiveCpuDurationMs?: number | undefined;
|
|
293
|
+
totalDurationMs?: number | undefined;
|
|
294
|
+
currentSnapshotId?: string | undefined;
|
|
295
|
+
statusUpdatedAt?: number | undefined;
|
|
296
|
+
tags?: Record<string, string> | undefined;
|
|
297
|
+
snapshotExpiration?: number | undefined;
|
|
298
|
+
}[];
|
|
273
299
|
}>;
|
|
274
300
|
/**
|
|
275
301
|
* Create a new sandbox.
|
|
@@ -291,11 +317,11 @@ export declare class Sandbox {
|
|
|
291
317
|
* @returns A promise resolving to the {@link Sandbox}.
|
|
292
318
|
*/
|
|
293
319
|
static get(params: WithPrivate<GetSandboxParams | (GetSandboxParams & Credentials)> & WithFetchOptions): Promise<Sandbox>;
|
|
294
|
-
constructor({ client, routes, session,
|
|
320
|
+
constructor({ client, routes, session, sandbox, projectId, }: {
|
|
295
321
|
client: APIClient;
|
|
296
322
|
routes: SandboxRouteData[];
|
|
297
|
-
session:
|
|
298
|
-
|
|
323
|
+
session: SessionMetaData;
|
|
324
|
+
sandbox: SandboxMetaData;
|
|
299
325
|
projectId: string;
|
|
300
326
|
});
|
|
301
327
|
/**
|
|
@@ -305,9 +331,10 @@ export declare class Sandbox {
|
|
|
305
331
|
*/
|
|
306
332
|
currentSession(): Session;
|
|
307
333
|
/**
|
|
308
|
-
* Resume this sandbox by creating a new session via `
|
|
334
|
+
* Resume this sandbox by creating a new session via `getSandbox`.
|
|
309
335
|
*/
|
|
310
336
|
private resume;
|
|
337
|
+
private doResume;
|
|
311
338
|
/**
|
|
312
339
|
* Poll until the current session reaches a terminal state, then resume.
|
|
313
340
|
*/
|
|
@@ -417,14 +444,21 @@ export declare class Sandbox {
|
|
|
417
444
|
* Defaults to writing to /vercel/sandbox unless an absolute path is specified.
|
|
418
445
|
* Writes files using the `vercel-sandbox` user.
|
|
419
446
|
*
|
|
420
|
-
* @param files - Array of files with path and
|
|
447
|
+
* @param files - Array of files with path, content, and optional mode (permissions)
|
|
421
448
|
* @param opts - Optional parameters.
|
|
422
449
|
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
423
450
|
* @returns A promise that resolves when the files are written
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* // Write an executable script
|
|
454
|
+
* await sandbox.writeFiles([
|
|
455
|
+
* { path: "/usr/local/bin/myscript", content: Buffer.from("#!/bin/bash\necho hello"), mode: 0o755 }
|
|
456
|
+
* ]);
|
|
424
457
|
*/
|
|
425
458
|
writeFiles(files: {
|
|
426
459
|
path: string;
|
|
427
460
|
content: Buffer;
|
|
461
|
+
mode?: number;
|
|
428
462
|
}[], opts?: {
|
|
429
463
|
signal?: AbortSignal;
|
|
430
464
|
}): Promise<void>;
|
|
@@ -442,15 +476,17 @@ export declare class Sandbox {
|
|
|
442
476
|
* @param opts - Optional parameters.
|
|
443
477
|
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
444
478
|
* @param opts.blocking - If true, poll until the sandbox has fully stopped and return the final state.
|
|
445
|
-
* @returns The sandbox
|
|
479
|
+
* @returns The sandbox at the time the stop was acknowledged, or after fully stopped if `blocking` is true.
|
|
446
480
|
*/
|
|
447
481
|
stop(opts?: {
|
|
448
482
|
signal?: AbortSignal;
|
|
449
483
|
blocking?: boolean;
|
|
450
|
-
}): Promise<
|
|
484
|
+
}): Promise<ConvertedSession>;
|
|
451
485
|
/**
|
|
452
486
|
* Update the network policy for this sandbox.
|
|
453
487
|
*
|
|
488
|
+
* @deprecated Use {@link Sandbox.update} instead.
|
|
489
|
+
*
|
|
454
490
|
* @param networkPolicy - The new network policy to apply.
|
|
455
491
|
* @param opts - Optional parameters.
|
|
456
492
|
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
@@ -517,69 +553,77 @@ export declare class Sandbox {
|
|
|
517
553
|
signal?: AbortSignal;
|
|
518
554
|
}): Promise<Snapshot>;
|
|
519
555
|
/**
|
|
520
|
-
* Update the
|
|
556
|
+
* Update the sandbox configuration.
|
|
521
557
|
*
|
|
522
558
|
* @param params - Fields to update.
|
|
523
559
|
* @param opts - Optional abort signal.
|
|
524
560
|
*/
|
|
525
561
|
update(params: {
|
|
562
|
+
persistent?: boolean;
|
|
526
563
|
resources?: {
|
|
527
564
|
vcpus?: number;
|
|
528
|
-
memory?: number;
|
|
529
565
|
};
|
|
530
|
-
runtime?: RUNTIMES | (string & {});
|
|
531
566
|
timeout?: number;
|
|
532
567
|
networkPolicy?: NetworkPolicy;
|
|
568
|
+
tags?: Record<string, string>;
|
|
569
|
+
snapshotExpiration?: number;
|
|
533
570
|
}, opts?: {
|
|
534
571
|
signal?: AbortSignal;
|
|
535
572
|
}): Promise<void>;
|
|
536
573
|
/**
|
|
537
|
-
* Delete this
|
|
574
|
+
* Delete this sandbox.
|
|
538
575
|
*
|
|
539
576
|
* After deletion the instance becomes inert — all further API calls will
|
|
540
577
|
* throw immediately.
|
|
541
578
|
*/
|
|
542
579
|
delete(opts?: {
|
|
543
|
-
preserveSnapshots?: boolean;
|
|
544
580
|
signal?: AbortSignal;
|
|
545
581
|
}): Promise<void>;
|
|
546
582
|
/**
|
|
547
|
-
* List sessions (VMs) that have been created for this
|
|
583
|
+
* List sessions (VMs) that have been created for this sandbox.
|
|
548
584
|
*
|
|
549
585
|
* @param params - Optional pagination parameters.
|
|
550
586
|
* @returns The list of sessions and pagination metadata.
|
|
551
587
|
*/
|
|
552
588
|
listSessions(params?: {
|
|
553
589
|
limit?: number;
|
|
554
|
-
|
|
555
|
-
|
|
590
|
+
cursor?: string;
|
|
591
|
+
sortOrder?: "asc" | "desc";
|
|
556
592
|
signal?: AbortSignal;
|
|
557
|
-
}): Promise<
|
|
558
|
-
|
|
559
|
-
id:
|
|
560
|
-
memory:
|
|
561
|
-
vcpus:
|
|
562
|
-
region:
|
|
563
|
-
runtime:
|
|
564
|
-
timeout:
|
|
565
|
-
status: "
|
|
566
|
-
requestedAt:
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
interactivePort
|
|
578
|
-
networkPolicy
|
|
593
|
+
}): Promise<{
|
|
594
|
+
sessions: import("zod").objectInputType<{
|
|
595
|
+
id: import("zod").ZodString;
|
|
596
|
+
memory: import("zod").ZodNumber;
|
|
597
|
+
vcpus: import("zod").ZodNumber;
|
|
598
|
+
region: import("zod").ZodString;
|
|
599
|
+
runtime: import("zod").ZodString;
|
|
600
|
+
timeout: import("zod").ZodNumber;
|
|
601
|
+
status: import("zod").ZodEnum<["pending", "running", "stopping", "stopped", "failed", "aborted", "snapshotting"]>;
|
|
602
|
+
requestedAt: import("zod").ZodNumber;
|
|
603
|
+
startedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
604
|
+
requestedStopAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
605
|
+
stoppedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
606
|
+
abortedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
607
|
+
duration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
608
|
+
sourceSnapshotId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
609
|
+
snapshottedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
610
|
+
createdAt: import("zod").ZodNumber;
|
|
611
|
+
cwd: import("zod").ZodString;
|
|
612
|
+
updatedAt: import("zod").ZodNumber;
|
|
613
|
+
interactivePort: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
614
|
+
networkPolicy: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
579
615
|
mode: import("zod").ZodLiteral<"allow-all">;
|
|
580
|
-
}, import("zod").ZodTypeAny,
|
|
616
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
617
|
+
mode: import("zod").ZodLiteral<"allow-all">;
|
|
618
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
619
|
+
mode: import("zod").ZodLiteral<"allow-all">;
|
|
620
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
|
581
621
|
mode: import("zod").ZodLiteral<"deny-all">;
|
|
582
|
-
}, import("zod").ZodTypeAny,
|
|
622
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
623
|
+
mode: import("zod").ZodLiteral<"deny-all">;
|
|
624
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
625
|
+
mode: import("zod").ZodLiteral<"deny-all">;
|
|
626
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
|
583
627
|
mode: import("zod").ZodLiteral<"custom">;
|
|
584
628
|
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
585
629
|
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
@@ -597,35 +641,75 @@ export declare class Sandbox {
|
|
|
597
641
|
headers?: Record<string, string> | undefined;
|
|
598
642
|
headerNames?: string[] | undefined;
|
|
599
643
|
}>, "many">>;
|
|
600
|
-
}, import("zod").ZodTypeAny, "
|
|
601
|
-
|
|
602
|
-
|
|
644
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
645
|
+
mode: import("zod").ZodLiteral<"custom">;
|
|
646
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
647
|
+
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
648
|
+
deniedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
649
|
+
injectionRules: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
650
|
+
domain: import("zod").ZodString;
|
|
651
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
652
|
+
headerNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
653
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
654
|
+
domain: string;
|
|
655
|
+
headers?: Record<string, string> | undefined;
|
|
656
|
+
headerNames?: string[] | undefined;
|
|
657
|
+
}, {
|
|
658
|
+
domain: string;
|
|
659
|
+
headers?: Record<string, string> | undefined;
|
|
660
|
+
headerNames?: string[] | undefined;
|
|
661
|
+
}>, "many">>;
|
|
662
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
663
|
+
mode: import("zod").ZodLiteral<"custom">;
|
|
664
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
665
|
+
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
666
|
+
deniedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
667
|
+
injectionRules: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
668
|
+
domain: import("zod").ZodString;
|
|
669
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
670
|
+
headerNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
671
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
672
|
+
domain: string;
|
|
673
|
+
headers?: Record<string, string> | undefined;
|
|
674
|
+
headerNames?: string[] | undefined;
|
|
675
|
+
}, {
|
|
676
|
+
domain: string;
|
|
677
|
+
headers?: Record<string, string> | undefined;
|
|
678
|
+
headerNames?: string[] | undefined;
|
|
679
|
+
}>, "many">>;
|
|
680
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>>;
|
|
681
|
+
activeCpuDurationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
682
|
+
networkTransfer: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
683
|
+
ingress: import("zod").ZodNumber;
|
|
684
|
+
egress: import("zod").ZodNumber;
|
|
685
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
603
686
|
ingress: number;
|
|
604
687
|
egress: number;
|
|
605
|
-
}
|
|
606
|
-
|
|
688
|
+
}, {
|
|
689
|
+
ingress: number;
|
|
690
|
+
egress: number;
|
|
691
|
+
}>>;
|
|
692
|
+
}, import("zod").ZodTypeAny, "passthrough">[];
|
|
607
693
|
pagination: {
|
|
608
694
|
count: number;
|
|
609
|
-
next:
|
|
610
|
-
prev: number | null;
|
|
695
|
+
next: string | null;
|
|
611
696
|
};
|
|
612
|
-
}
|
|
697
|
+
}>;
|
|
613
698
|
/**
|
|
614
|
-
* List snapshots that belong to this
|
|
699
|
+
* List snapshots that belong to this sandbox.
|
|
615
700
|
*
|
|
616
701
|
* @param params - Optional pagination parameters.
|
|
617
702
|
* @returns The list of snapshots and pagination metadata.
|
|
618
703
|
*/
|
|
619
704
|
listSnapshots(params?: {
|
|
620
705
|
limit?: number;
|
|
621
|
-
|
|
622
|
-
|
|
706
|
+
cursor?: string;
|
|
707
|
+
sortOrder?: "asc" | "desc";
|
|
623
708
|
signal?: AbortSignal;
|
|
624
|
-
}): Promise<
|
|
709
|
+
}): Promise<{
|
|
625
710
|
pagination: {
|
|
626
711
|
count: number;
|
|
627
|
-
next:
|
|
628
|
-
prev: number | null;
|
|
712
|
+
next: string | null;
|
|
629
713
|
};
|
|
630
714
|
snapshots: {
|
|
631
715
|
id: string;
|
|
@@ -633,9 +717,9 @@ export declare class Sandbox {
|
|
|
633
717
|
status: "failed" | "created" | "deleted";
|
|
634
718
|
createdAt: number;
|
|
635
719
|
updatedAt: number;
|
|
636
|
-
|
|
720
|
+
sourceSessionId: string;
|
|
637
721
|
sizeBytes: number;
|
|
638
722
|
expiresAt?: number | undefined;
|
|
639
723
|
}[];
|
|
640
|
-
}
|
|
724
|
+
}>;
|
|
641
725
|
}
|