@aerol-ai/aerolvm-sdk 0.8.0 → 0.8.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/MicroVM.d.ts +133 -51
- package/dist/MicroVM.js +207 -99
- package/dist/errors.d.ts +52 -0
- package/dist/errors.js +89 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/internal/client.d.ts +223 -34
- package/dist/internal/client.js +1116 -85
- package/dist/internal/tar.d.ts +14 -0
- package/dist/internal/tar.js +79 -0
- package/dist/types.d.ts +458 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Image } from "../Image.js";
|
|
2
|
-
import type { AddCustomDomainOptions, APITokenList, BinaryLike, BuildImageOptions, BuildImageResult, CreateAPITokenOptions, CreatedAPIToken, CreateOptions, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, PushWasmModuleOptions, PushWasmModuleResult, CustomDomain, CloneGeneration, CustomDomainDNSRecords, ExecRequest, ExecResult, ExecStreamHandle, ExecStreamOptions, ExposedPort, ExposePortOptions, ExposeResult, Failover, HealthStatus, IngressTarget, Lifecycle, GetOptions, ListOptions, MountSpecRedacted, NetworkUsage, AuditOptions, AuditPage, EgressProfile, EgressProfileList, EgressProfileOptions, EgressProfileRef, EgressRule, ListEgressProfilesOptions, NetworkLearned, NetworkPolicy, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, NetworkPolicyOptions, ListSnapshotsOptions, RegisterSnapshotOptions, SnapshotList, SetNetworkLimitsOptions, ResizeOptions, Sandbox, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions, Template, WasmModule, WhoAmI } from "../types.js";
|
|
2
|
+
import type { CallOptions, AddCustomDomainOptions, APITokenList, BinaryLike, BuildImageOptions, BuildImageResult, CreateAPITokenOptions, CreatedAPIToken, CreateOptions, CreateSandboxTokenOptions, RevokeSandboxTokensResult, SandboxToken, CreateSessionOptions, CreateTemplateOptions, CreateWasmModuleOptions, PushWasmModuleOptions, PushWasmModuleResult, CustomDomain, CloneGeneration, CustomDomainDNSRecords, ExecRequest, ExecResult, ExecStreamHandle, ExecStreamOptions, ExposedPort, ExposePortOptions, ExposeResult, Failover, FileEvent, FileWatchHandle, FileInfo, FileList, FileMatch, UploadFileOptions, DownloadFileOptions, ListFilesOptions, DeleteFileOptions, MakeDirOptions, MoveFileOptions, CopyFileOptions, HealthStatus, IngressTarget, Lifecycle, GetOptions, ListOptions, MountSpecRedacted, NetworkUsage, AuditOptions, AuditPage, EgressProfile, EgressProfileList, EgressProfileOptions, EgressProfileRef, TeamQuota, TeamQuotaOptions, IdentityRole, IdentityRoleList, IdentityRoleOptions, ListIdentityRolesOptions, SandboxIdentity, EgressRule, ListEgressProfilesOptions, WarmPool, WarmPoolOptions, NetworkLearned, NetworkPolicy, NetworkPolicyCheckOptions, NetworkPolicyCheckResult, NetworkPolicyOptions, ListSnapshotsOptions, CreateSnapshotOptions, RegisterSnapshotOptions, SnapshotList, SetNetworkLimitsOptions, ResizeOptions, Sandbox, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions, StatusReason, Template, WasmModule, WhoAmI, WatchFilesOptions } from "../types.js";
|
|
3
3
|
type FetchLike = typeof fetch;
|
|
4
4
|
/**
|
|
5
5
|
* The request header that selects which of a credential's teams a request
|
|
@@ -81,6 +81,8 @@ export interface APIClientConfig {
|
|
|
81
81
|
*/
|
|
82
82
|
signal?: AbortSignal;
|
|
83
83
|
}
|
|
84
|
+
/** The entry cap `listFiles` sends when the caller gives none. */
|
|
85
|
+
export declare const DEFAULT_LIST_LIMIT = 10000;
|
|
84
86
|
/**
|
|
85
87
|
* The header a sandbox create carries so the server can recognise a retry of
|
|
86
88
|
* it. Keep in sync with clustercreate.HeaderIdempotencyKey on the server.
|
|
@@ -121,6 +123,13 @@ export declare class APIClient {
|
|
|
121
123
|
private readonly versionPrefix;
|
|
122
124
|
private readonly retryConfig;
|
|
123
125
|
private readonly signal;
|
|
126
|
+
/** The client a {@link withSignal} view was made from; unset on a real client. */
|
|
127
|
+
private readonly root;
|
|
128
|
+
/**
|
|
129
|
+
* Features each sandbox's agent listed on /version (requireToolboxFeatures).
|
|
130
|
+
* Refreshed on a miss, because a restart can bring a newer agent.
|
|
131
|
+
*/
|
|
132
|
+
private readonly toolboxFeatures;
|
|
124
133
|
constructor(config: APIClientConfig);
|
|
125
134
|
/**
|
|
126
135
|
* Build a versioned API path. Pass the suffix beginning with "/" (e.g.
|
|
@@ -129,6 +138,15 @@ export declare class APIClient {
|
|
|
129
138
|
* apiVersion option without touching call sites.
|
|
130
139
|
*/
|
|
131
140
|
private versioned;
|
|
141
|
+
/**
|
|
142
|
+
* This client with `signal` added to its own: either one aborting ends a
|
|
143
|
+
* request and any retry wait. A per-call signal (plan S6) rides on a view
|
|
144
|
+
* like this rather than a parameter on every internal method. The view
|
|
145
|
+
* shares everything else, the per-sandbox feature cache included, and the
|
|
146
|
+
* sandboxes it returns hold the real client, so the call's signal never
|
|
147
|
+
* outlives the call. Without a signal it is this client.
|
|
148
|
+
*/
|
|
149
|
+
withSignal(signal: AbortSignal | undefined): APIClient;
|
|
132
150
|
create(options: CreateOptions): Promise<SandboxResource>;
|
|
133
151
|
/**
|
|
134
152
|
* Compile a fluent {@link Image} into a content-addressed image tag by
|
|
@@ -154,20 +172,58 @@ export declare class APIClient {
|
|
|
154
172
|
* the wrong sandbox.
|
|
155
173
|
*/
|
|
156
174
|
getByName(name: string, options?: GetOptions): Promise<SandboxResource | null>;
|
|
175
|
+
/**
|
|
176
|
+
* The caller's sandbox called `name`, created from `options` when there is
|
|
177
|
+
* none; `created` is true only when this call made it. Safe to retry and to
|
|
178
|
+
* run concurrently: names are unique per owner, so a caller that loses a
|
|
179
|
+
* race to create the name gets a 409 and reads the winner's sandbox.
|
|
180
|
+
*/
|
|
181
|
+
getOrCreate(name: string, options: CreateOptions): Promise<{
|
|
182
|
+
sandbox: SandboxResource;
|
|
183
|
+
created: boolean;
|
|
184
|
+
}>;
|
|
157
185
|
get(id: string, options?: GetOptions): Promise<SandboxResource>;
|
|
158
186
|
start(id: string): Promise<SandboxResource>;
|
|
159
187
|
stop(id: string): Promise<SandboxResource>;
|
|
160
|
-
createSnapshot(id: string, name: string): Promise<SandboxSnapshot>;
|
|
188
|
+
createSnapshot(id: string, name: string, options?: CreateSnapshotOptions): Promise<SandboxSnapshot>;
|
|
161
189
|
registerSnapshot(options: RegisterSnapshotOptions): Promise<SandboxSnapshot>;
|
|
162
190
|
registerSnapshotFromImage(name: string, image: Image, options?: Omit<RegisterSnapshotOptions, "name" | "image" | "dockerfileContent">): Promise<SandboxSnapshot>;
|
|
163
191
|
getSnapshot(name: string): Promise<SandboxSnapshot>;
|
|
164
192
|
listSnapshots(options?: ListSnapshotsOptions): Promise<SnapshotList>;
|
|
165
193
|
deleteSnapshot(name: string): Promise<void>;
|
|
166
194
|
destroy(id: string): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Deletes every sandbox carrying all of `tags`, one at a time, after
|
|
197
|
+
* listing every page; returns the IDs now gone. A 404 counts as deleted,
|
|
198
|
+
* so the call is safe to repeat. Any other failure stops it and is thrown.
|
|
199
|
+
*/
|
|
200
|
+
destroyAll(tags: Record<string, string>): Promise<string[]>;
|
|
167
201
|
resize(id: string, options: ResizeOptions): Promise<SandboxResource>;
|
|
168
202
|
updateLifecycle(id: string, lifecycle: Lifecycle): Promise<SandboxResource>;
|
|
203
|
+
/**
|
|
204
|
+
* Fails closed unless the sandbox's agent lists every feature. toolboxd
|
|
205
|
+
* ignores request options it does not know, so sending a newer option to an
|
|
206
|
+
* older agent would silently skip it.
|
|
207
|
+
*/
|
|
208
|
+
requireToolboxFeatures(id: string, ...features: string[]): Promise<void>;
|
|
169
209
|
exec(id: string, request: ExecRequest): Promise<ExecResult>;
|
|
170
210
|
execStream(id: string, options: ExecStreamOptions): ExecStreamHandle;
|
|
211
|
+
/**
|
|
212
|
+
* Watch a folder in the sandbox for changes. Resolves once the watch is in
|
|
213
|
+
* place, so a change made after it resolves is reported. gVisor and
|
|
214
|
+
* Firecracker sandboxes only: the others answer 501. Not retried: a stream
|
|
215
|
+
* is opened once.
|
|
216
|
+
*/
|
|
217
|
+
watchFiles(id: string, path: string, onEvent: (event: FileEvent) => void, options?: WatchFilesOptions): Promise<FileWatchHandle>;
|
|
218
|
+
/**
|
|
219
|
+
* Explains a watch whose WebSocket handshake failed. The WebSocket API
|
|
220
|
+
* hides a refused handshake's status and body, so the same request is sent
|
|
221
|
+
* again as plain HTTP: toolboxd checks the runtime, the path and its limits
|
|
222
|
+
* before the upgrade, so it answers with the real reason (501 on Docker or
|
|
223
|
+
* containerd, 404 for a missing folder, 429 at the watch limit). That GET
|
|
224
|
+
* is a diagnosis, sent once, never a retry of the stream.
|
|
225
|
+
*/
|
|
226
|
+
private fileWatchRefusal;
|
|
171
227
|
createSession(id: string, options: CreateSessionOptions): Promise<Session>;
|
|
172
228
|
listSessions(id: string): Promise<Session[]>;
|
|
173
229
|
getSession(id: string, sessionID: string): Promise<Session>;
|
|
@@ -177,8 +233,50 @@ export declare class APIClient {
|
|
|
177
233
|
sessionLog(id: string, sessionID: string): Promise<Uint8Array>;
|
|
178
234
|
sessionRecording(id: string, sessionID: string): Promise<Uint8Array>;
|
|
179
235
|
attachSession(id: string, sessionID: string, options?: SessionAttachOptions): SessionAttachHandle;
|
|
180
|
-
|
|
181
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Plain and atomic uploads retry on 421/429/502/503/504; `append` and
|
|
238
|
+
* `createOnly` only on 429/503, because a second send would append twice
|
|
239
|
+
* or find the first one's file.
|
|
240
|
+
*/
|
|
241
|
+
uploadFile(id: string, targetPath: string, data: BinaryLike, options?: UploadFileOptions): Promise<void>;
|
|
242
|
+
/** The upload route with the write options as query, after the /version check they need. */
|
|
243
|
+
private uploadPath;
|
|
244
|
+
/**
|
|
245
|
+
* Upload from a stream a piece at a time, so a large file never sits in
|
|
246
|
+
* memory. The options are {@link uploadFile}'s. The data is read as it is
|
|
247
|
+
* sent, so the request is sent once and never retried. Needs a `fetch` that
|
|
248
|
+
* can send a streamed body (Node.js 18 and later).
|
|
249
|
+
*/
|
|
250
|
+
uploadFileStream(id: string, targetPath: string, data: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: UploadFileOptions): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Copy the local folder `localDir` into `remoteDir` in the sandbox (made if
|
|
253
|
+
* missing). The folder is packed as a gzipped tar and the sandbox unpacks it
|
|
254
|
+
* safely: no entry can land outside `remoteDir`. Symlinks are sent as links,
|
|
255
|
+
* hard-linked files as separate files; devices, pipes and sockets are
|
|
256
|
+
* skipped. The archive is built in memory and sent once, never retried.
|
|
257
|
+
* Node.js only.
|
|
258
|
+
*/
|
|
259
|
+
uploadDir(id: string, localDir: string, remoteDir: string): Promise<void>;
|
|
260
|
+
downloadFile(id: string, targetPath: string, options?: DownloadFileOptions): Promise<Uint8Array>;
|
|
261
|
+
/**
|
|
262
|
+
* Open a file for reading a piece at a time, so a large file never sits in
|
|
263
|
+
* memory. With `maxBytes`, a larger file is refused before reading when the
|
|
264
|
+
* server states the size, and otherwise the stream errors as soon as more
|
|
265
|
+
* arrives. The request retries until the file starts to arrive.
|
|
266
|
+
*/
|
|
267
|
+
downloadFileStream(id: string, targetPath: string, options?: DownloadFileOptions): Promise<ReadableStream<Uint8Array>>;
|
|
268
|
+
private toolboxPath;
|
|
269
|
+
/** Sends a body-less file call and discards a success reply. */
|
|
270
|
+
private fileCall;
|
|
271
|
+
listFiles(id: string, path: string, options?: ListFilesOptions): Promise<FileList>;
|
|
272
|
+
getFileInfo(id: string, path: string): Promise<FileInfo>;
|
|
273
|
+
fileExists(id: string, path: string): Promise<boolean>;
|
|
274
|
+
deleteFile(id: string, path: string, options?: DeleteFileOptions): Promise<void>;
|
|
275
|
+
makeDir(id: string, path: string, options?: MakeDirOptions): Promise<void>;
|
|
276
|
+
moveFile(id: string, source: string, destination: string, options?: MoveFileOptions): Promise<void>;
|
|
277
|
+
copyFile(id: string, source: string, destination: string, options?: CopyFileOptions): Promise<void>;
|
|
278
|
+
searchFiles(id: string, path: string, pattern: string): Promise<string[]>;
|
|
279
|
+
findInFiles(id: string, path: string, text: string): Promise<FileMatch[]>;
|
|
182
280
|
/**
|
|
183
281
|
* Publish a sandbox container port. The chosen wire protocol is selected by
|
|
184
282
|
* `options.protocol` (defaults to `"http"`):
|
|
@@ -194,6 +292,20 @@ export declare class APIClient {
|
|
|
194
292
|
*/
|
|
195
293
|
exposePort(id: string, port: number, options?: ExposePortOptions): Promise<ExposeResult>;
|
|
196
294
|
unexposePort(id: string, port: number): Promise<void>;
|
|
295
|
+
/**
|
|
296
|
+
* Issue a signed token scoped to one sandbox (POST /v1/sandboxes/{id}/tokens).
|
|
297
|
+
* Not idempotent by nature: every call makes a new token, and the server
|
|
298
|
+
* stores none. It uses the normal retry tier: a retry after a lost answer
|
|
299
|
+
* makes a second token that nobody holds, which simply expires.
|
|
300
|
+
*/
|
|
301
|
+
createSandboxToken(id: string, options: CreateSandboxTokenOptions): Promise<SandboxToken>;
|
|
302
|
+
/**
|
|
303
|
+
* Make every token issued for one sandbox so far stop working
|
|
304
|
+
* (POST /v1/sandboxes/{id}/tokens/revoke). A token issued after it works.
|
|
305
|
+
* Safe to retry: a repeated call refuses the same tokens again (plus any
|
|
306
|
+
* issued in between), so it uses the normal retry tier.
|
|
307
|
+
*/
|
|
308
|
+
revokeSandboxTokens(id: string): Promise<RevokeSandboxTokensResult>;
|
|
197
309
|
/**
|
|
198
310
|
* Bind a custom hostname to a sandbox. The server lowercases the hostname
|
|
199
311
|
* and returns the post-add list of bindings (sorted by hostname). Calling
|
|
@@ -228,6 +340,19 @@ export declare class APIClient {
|
|
|
228
340
|
getEgressProfile(name: string): Promise<EgressProfile>;
|
|
229
341
|
listEgressProfiles(options?: ListEgressProfilesOptions): Promise<EgressProfileList>;
|
|
230
342
|
deleteEgressProfile(name: string): Promise<void>;
|
|
343
|
+
putWarmPool(image: string, options: WarmPoolOptions): Promise<WarmPool>;
|
|
344
|
+
getWarmPool(image: string): Promise<WarmPool>;
|
|
345
|
+
listWarmPools(): Promise<WarmPool[]>;
|
|
346
|
+
deleteWarmPool(image: string): Promise<void>;
|
|
347
|
+
putIdentityRole(tag: string, options: IdentityRoleOptions): Promise<IdentityRole>;
|
|
348
|
+
listIdentityRoles(options?: ListIdentityRolesOptions): Promise<IdentityRoleList>;
|
|
349
|
+
deleteIdentityRole(tag: string, options?: {
|
|
350
|
+
team?: string;
|
|
351
|
+
}): Promise<void>;
|
|
352
|
+
private identityRolePath;
|
|
353
|
+
putTeamQuota(team: string, options: TeamQuotaOptions): Promise<TeamQuota>;
|
|
354
|
+
getTeamQuota(team: string): Promise<TeamQuota>;
|
|
355
|
+
deleteTeamQuota(team: string): Promise<void>;
|
|
231
356
|
createTemplate(options: CreateTemplateOptions): Promise<Template>;
|
|
232
357
|
listTemplates(): Promise<Template[]>;
|
|
233
358
|
getTemplate(id: string): Promise<Template>;
|
|
@@ -264,6 +389,7 @@ export declare class APIClient {
|
|
|
264
389
|
* {@link retryDelayMs}). The client's `signal` ends the request and any
|
|
265
390
|
* wait.
|
|
266
391
|
*/
|
|
392
|
+
private authHeaders;
|
|
267
393
|
private request;
|
|
268
394
|
}
|
|
269
395
|
export declare class SandboxResource implements Sandbox {
|
|
@@ -294,35 +420,97 @@ export declare class SandboxResource implements Sandbox {
|
|
|
294
420
|
name?: string;
|
|
295
421
|
tags?: Record<string, string>;
|
|
296
422
|
lastError?: string;
|
|
423
|
+
statusReason?: StatusReason;
|
|
424
|
+
exitCode?: number;
|
|
297
425
|
containerCommand?: string[];
|
|
298
426
|
lifecycle: Lifecycle;
|
|
299
427
|
failover?: Failover;
|
|
300
428
|
runtime: Sandbox["runtime"];
|
|
429
|
+
identity?: SandboxIdentity;
|
|
301
430
|
protected readonly client: APIClient;
|
|
431
|
+
/**
|
|
432
|
+
* When true, leaving an `await using` block deletes the sandbox (see
|
|
433
|
+
* `[Symbol.asyncDispose]`). Off by default, so the block ends without
|
|
434
|
+
* touching it; set it here or with `destroyOnExit` on `create` and
|
|
435
|
+
* `getOrCreate`.
|
|
436
|
+
*/
|
|
437
|
+
destroyOnExit: boolean;
|
|
438
|
+
private disposed;
|
|
439
|
+
/** The client for one call: the real one, or a view carrying the call's signal. */
|
|
440
|
+
private api;
|
|
302
441
|
constructor(client: APIClient, sandbox: Sandbox);
|
|
303
|
-
|
|
304
|
-
|
|
442
|
+
/**
|
|
443
|
+
* Called when an `await using` block holding this sandbox ends. Deletes the
|
|
444
|
+
* sandbox only when {@link destroyOnExit} is true; otherwise does nothing.
|
|
445
|
+
* A sandbox that is already gone counts as deleted, and a second call does
|
|
446
|
+
* nothing.
|
|
447
|
+
*/
|
|
448
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
449
|
+
refresh(call?: CallOptions): Promise<this>;
|
|
450
|
+
exec(command: string | ExecRequest, call?: CallOptions): Promise<ExecResult>;
|
|
305
451
|
/**
|
|
306
452
|
* Read this sandbox's clone-generation token. The token changes whenever the
|
|
307
453
|
* sandbox is resumed from a snapshot. Use it to detect that a sandbox is a
|
|
308
454
|
* clone (e.g. to re-run setup). It does NOT reseed in-guest PRNGs — see the
|
|
309
455
|
* "Randomness in cloned sandboxes" docs page for the in-guest pattern.
|
|
310
456
|
*/
|
|
311
|
-
cloneGeneration(): Promise<CloneGeneration>;
|
|
457
|
+
cloneGeneration(call?: CallOptions): Promise<CloneGeneration>;
|
|
312
458
|
execStream(options: ExecStreamOptions): ExecStreamHandle;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
459
|
+
/**
|
|
460
|
+
* Watch a folder in this sandbox for changes; see
|
|
461
|
+
* {@link APIClient.watchFiles}. gVisor and Firecracker sandboxes only.
|
|
462
|
+
*/
|
|
463
|
+
watchFiles(path: string, onEvent: (event: FileEvent) => void, options?: WatchFilesOptions): Promise<FileWatchHandle>;
|
|
464
|
+
createSession(options: CreateSessionOptions, call?: CallOptions): Promise<Session>;
|
|
465
|
+
listSessions(call?: CallOptions): Promise<Session[]>;
|
|
466
|
+
getSession(sessionID: string, call?: CallOptions): Promise<Session>;
|
|
467
|
+
deleteSession(sessionID: string, call?: CallOptions): Promise<void>;
|
|
468
|
+
signalSession(sessionID: string, signal: string, call?: CallOptions): Promise<void>;
|
|
469
|
+
resizeSession(sessionID: string, cols: number, rows: number, call?: CallOptions): Promise<void>;
|
|
470
|
+
sessionLog(sessionID: string, call?: CallOptions): Promise<Uint8Array>;
|
|
471
|
+
sessionRecording(sessionID: string, call?: CallOptions): Promise<Uint8Array>;
|
|
321
472
|
attachSession(sessionID: string, options?: SessionAttachOptions): SessionAttachHandle;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
473
|
+
/** Copy a local folder into the sandbox (Node.js only). See {@link APIClient.uploadDir}. */
|
|
474
|
+
uploadDir(localDir: string, remoteDir: string, call?: CallOptions): Promise<void>;
|
|
475
|
+
/** Upload a file. See {@link UploadFileOptions} for append, create-only, atomic and mode. */
|
|
476
|
+
uploadFile(targetPath: string, data: BinaryLike, options?: UploadFileOptions, call?: CallOptions): Promise<void>;
|
|
477
|
+
downloadFile(targetPath: string, options?: DownloadFileOptions, call?: CallOptions): Promise<Uint8Array>;
|
|
478
|
+
/** Read a file as a stream. See {@link APIClient.downloadFileStream}. */
|
|
479
|
+
downloadFileStream(targetPath: string, options?: DownloadFileOptions, call?: CallOptions): Promise<ReadableStream<Uint8Array>>;
|
|
480
|
+
/** Upload from a stream, sent once. See {@link APIClient.uploadFileStream}. */
|
|
481
|
+
uploadFileStream(targetPath: string, data: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: UploadFileOptions, call?: CallOptions): Promise<void>;
|
|
482
|
+
/** List a folder. See {@link ListFilesOptions}; `truncated` means more entries exist. */
|
|
483
|
+
listFiles(path: string, options?: ListFilesOptions, call?: CallOptions): Promise<FileList>;
|
|
484
|
+
/** Describe one path. A symlink is followed. */
|
|
485
|
+
getFileInfo(path: string, call?: CallOptions): Promise<FileInfo>;
|
|
486
|
+
/** Whether a path exists. A missing sandbox throws; it is not `false`. */
|
|
487
|
+
fileExists(path: string, call?: CallOptions): Promise<boolean>;
|
|
488
|
+
/** Delete a file, or a folder and its contents with `recursive: true`. */
|
|
489
|
+
deleteFile(path: string, options?: DeleteFileOptions, call?: CallOptions): Promise<void>;
|
|
490
|
+
/** Make a folder; with `parents: true`, like `mkdir -p`. */
|
|
491
|
+
makeDir(path: string, options?: MakeDirOptions, call?: CallOptions): Promise<void>;
|
|
492
|
+
/** Move or rename a file or folder. Without `overwrite`, an existing destination is refused (409). */
|
|
493
|
+
moveFile(source: string, destination: string, options?: MoveFileOptions, call?: CallOptions): Promise<void>;
|
|
494
|
+
/** Copy a file, or a folder with `recursive: true`. */
|
|
495
|
+
copyFile(source: string, destination: string, options?: CopyFileOptions, call?: CallOptions): Promise<void>;
|
|
496
|
+
/** Paths under `path` whose name matches a glob such as `*.ts`. */
|
|
497
|
+
searchFiles(path: string, pattern: string, call?: CallOptions): Promise<string[]>;
|
|
498
|
+
/** Each line under `path` that contains `text` (plain text). */
|
|
499
|
+
findInFiles(path: string, text: string, call?: CallOptions): Promise<FileMatch[]>;
|
|
500
|
+
exposePort(port: number, options?: ExposePortOptions, call?: CallOptions): Promise<ExposeResult>;
|
|
501
|
+
unexposePort(port: number, call?: CallOptions): Promise<void>;
|
|
502
|
+
/**
|
|
503
|
+
* Issue a signed token for this sandbox only, to hand to a browser or an
|
|
504
|
+
* end user. See {@link CreateSandboxTokenOptions}. Each call makes a new
|
|
505
|
+
* token; the server keeps no copy.
|
|
506
|
+
*/
|
|
507
|
+
createToken(options: CreateSandboxTokenOptions, call?: CallOptions): Promise<SandboxToken>;
|
|
508
|
+
/**
|
|
509
|
+
* Make every token issued for this sandbox so far stop working, toolbox
|
|
510
|
+
* and port tokens alike. A token made after the call works. Safe to call
|
|
511
|
+
* again.
|
|
512
|
+
*/
|
|
513
|
+
revokeTokens(call?: CallOptions): Promise<RevokeSandboxTokensResult>;
|
|
326
514
|
/**
|
|
327
515
|
* Per-sandbox custom-hostname bindings. Exposed as a namespaced accessor
|
|
328
516
|
* (rather than `addCustomDomain`/`removeCustomDomain`/`listCustomDomains`
|
|
@@ -332,38 +520,39 @@ export declare class SandboxResource implements Sandbox {
|
|
|
332
520
|
* so the closures always see the current `id` even after `refresh()`.
|
|
333
521
|
*/
|
|
334
522
|
get customDomains(): {
|
|
335
|
-
add(hostname: string, options?: AddCustomDomainOptions): Promise<CustomDomain[]>;
|
|
336
|
-
remove(hostname: string): Promise<void>;
|
|
337
|
-
list(): Promise<CustomDomain[]>;
|
|
338
|
-
dns(): Promise<CustomDomainDNSRecords>;
|
|
523
|
+
add(hostname: string, options?: AddCustomDomainOptions, call?: CallOptions): Promise<CustomDomain[]>;
|
|
524
|
+
remove(hostname: string, call?: CallOptions): Promise<void>;
|
|
525
|
+
list(call?: CallOptions): Promise<CustomDomain[]>;
|
|
526
|
+
dns(call?: CallOptions): Promise<CustomDomainDNSRecords>;
|
|
339
527
|
};
|
|
340
|
-
createSnapshot(name: string): Promise<SandboxSnapshot>;
|
|
341
|
-
start(): Promise<this>;
|
|
342
|
-
stop(): Promise<this>;
|
|
343
|
-
destroy(): Promise<void>;
|
|
344
|
-
resize(options: ResizeOptions): Promise<this>;
|
|
345
|
-
updateLifecycle(lifecycle: Lifecycle): Promise<this>;
|
|
346
|
-
getNetworkUsage(): Promise<NetworkUsage>;
|
|
347
|
-
setNetworkLimits(options: SetNetworkLimitsOptions): Promise<NetworkUsage>;
|
|
528
|
+
createSnapshot(name: string, options?: CreateSnapshotOptions, call?: CallOptions): Promise<SandboxSnapshot>;
|
|
529
|
+
start(call?: CallOptions): Promise<this>;
|
|
530
|
+
stop(call?: CallOptions): Promise<this>;
|
|
531
|
+
destroy(call?: CallOptions): Promise<void>;
|
|
532
|
+
resize(options: ResizeOptions, call?: CallOptions): Promise<this>;
|
|
533
|
+
updateLifecycle(lifecycle: Lifecycle, call?: CallOptions): Promise<this>;
|
|
534
|
+
getNetworkUsage(call?: CallOptions): Promise<NetworkUsage>;
|
|
535
|
+
setNetworkLimits(options: SetNetworkLimitsOptions, call?: CallOptions): Promise<NetworkUsage>;
|
|
348
536
|
/**
|
|
349
537
|
* Replaces this sandbox's egress policy while it runs. The call returns
|
|
350
538
|
* once the new policy is enforced; sending the same policy again is a
|
|
351
539
|
* no-op, so it is safe to retry.
|
|
352
540
|
*/
|
|
353
|
-
setNetworkPolicy(options: NetworkPolicyOptions): Promise<NetworkPolicy>;
|
|
541
|
+
setNetworkPolicy(options: NetworkPolicyOptions, call?: CallOptions): Promise<NetworkPolicy>;
|
|
354
542
|
/**
|
|
355
543
|
* Reads what this sandbox reached in learn mode and the allow list that
|
|
356
544
|
* would have allowed it. A recording stays readable after the sandbox
|
|
357
545
|
* switches to enforce, until it is destroyed.
|
|
358
546
|
*/
|
|
359
|
-
learned(): Promise<NetworkLearned>;
|
|
547
|
+
learned(call?: CallOptions): Promise<NetworkLearned>;
|
|
360
548
|
/**
|
|
361
549
|
* Reads this sandbox's audit log: outbound connections and egress denials
|
|
362
550
|
* (`kind: "egress"`), and secret reads. Denials carry `result: "failure"`
|
|
363
551
|
* and the policy `reason`.
|
|
364
552
|
*/
|
|
365
|
-
audit(options?: AuditOptions): Promise<AuditPage>;
|
|
553
|
+
audit(options?: AuditOptions, call?: CallOptions): Promise<AuditPage>;
|
|
366
554
|
toJSON(): Sandbox;
|
|
367
555
|
private apply;
|
|
368
556
|
}
|
|
557
|
+
export declare const WATCH_START_TIMEOUT_MS = 60000;
|
|
369
558
|
export {};
|