@brimble/sandbox 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/sandbox",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "TypeScript SDK for the Brimble Sandbox API",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -6,6 +6,8 @@ import { HttpTransport } from '../transport/http';
6
6
  import type { BatchFileUploadInput, BatchFileUploadResponse, CodeInput, CreateSnapshotInput, ExecInput, ExecResult, FileUploadBody, Paginated, Pagination, Snapshot, Stats, StatsQuery } from '../types';
7
7
  import type { RequestOptions } from '../transport/http';
8
8
  export declare class ScopedSandboxResource {
9
+ private readonly transport;
10
+ private readonly sandboxId;
9
11
  /** Lower-level exec/code runner resource. */
10
12
  readonly execResource: ExecResource;
11
13
  /** File upload/download resource. */
@@ -16,6 +18,8 @@ export declare class ScopedSandboxResource {
16
18
  readonly statsResource: StatsResource;
17
19
  /** @internal Create a sandbox-scoped resource wrapper. */
18
20
  constructor(transport: HttpTransport, sandboxId: string);
21
+ /** Destroy this sandbox. */
22
+ destroy(options?: RequestOptions): Promise<void>;
19
23
  /** Run a shell command in this sandbox. */
20
24
  exec(input: ExecInput & {
21
25
  stream: true;
@@ -6,6 +6,8 @@ const files_1 = require("./files");
6
6
  const snapshots_1 = require("./snapshots");
7
7
  const stats_1 = require("./stats");
8
8
  class ScopedSandboxResource {
9
+ transport;
10
+ sandboxId;
9
11
  /** Lower-level exec/code runner resource. */
10
12
  execResource;
11
13
  /** File upload/download resource. */
@@ -16,11 +18,21 @@ class ScopedSandboxResource {
16
18
  statsResource;
17
19
  /** @internal Create a sandbox-scoped resource wrapper. */
18
20
  constructor(transport, sandboxId) {
21
+ this.transport = transport;
22
+ this.sandboxId = sandboxId;
19
23
  this.execResource = new exec_1.ExecResource(transport, sandboxId);
20
24
  this.files = new files_1.FilesResource(transport, sandboxId);
21
25
  this.snapshots = new snapshots_1.SnapshotScopeResource(transport, sandboxId);
22
26
  this.statsResource = new stats_1.StatsResource(transport, sandboxId);
23
27
  }
28
+ /** Destroy this sandbox. */
29
+ async destroy(options) {
30
+ await this.transport.requestJson({
31
+ endpoint: `/sandboxes/${this.sandboxId}`,
32
+ method: 'DELETE',
33
+ ...options,
34
+ });
35
+ }
24
36
  exec(input, options) {
25
37
  return this.execResource.exec(input, options);
26
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/sandbox",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "TypeScript SDK for the Brimble Sandbox API",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",