@lizard-build/sdk 0.1.57 → 0.1.58

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
@@ -920,6 +920,8 @@ interface SandboxSnapshot {
920
920
  createdAt: number;
921
921
  /** Where it may be restored; see {@link SnapshotScope}. */
922
922
  scope: SnapshotScope;
923
+ /** Whether the source had a volume attached (a restore then cannot attach another); `null` for older snapshots, which cannot take one. */
924
+ sourceVolume: boolean | null;
923
925
  /** The user who took it; `null` for snapshots from before snapshots belonged to a user. */
924
926
  createdBy: string | null;
925
927
  }
@@ -1190,11 +1192,14 @@ declare class Sandbox extends SandboxClient {
1190
1192
  static getSnapshot(snapshotId: string, opts?: ConnectionOpts): Promise<SandboxSnapshot>;
1191
1193
  /**
1192
1194
  * Start a new sandbox from a snapshot, in its region. `projectId` puts it in another project,
1193
- * in any of your workspaces, as the snapshot's scope allows; default: the snapshot's own project.
1195
+ * in any of your workspaces, as the snapshot's scope allows; default: the volume's project, else
1196
+ * the snapshot's own. `volumeId` mounts that volume at `/workspace` (a Firecracker snapshot of a
1197
+ * sandbox that had no volume attached; the volume must be in the snapshot's region).
1194
1198
  */
1195
1199
  static restore(snapshotId: string, opts?: ConnectionOpts & {
1196
1200
  timeoutMs?: number;
1197
1201
  projectId?: string;
1202
+ volumeId?: string;
1198
1203
  }): Promise<Sandbox>;
1199
1204
  /** Change where a snapshot you took may be restored. */
1200
1205
  static setSnapshotScope(snapshotId: string, scope: SnapshotScope, opts?: ConnectionOpts): Promise<SandboxSnapshot>;
package/dist/index.d.ts CHANGED
@@ -920,6 +920,8 @@ interface SandboxSnapshot {
920
920
  createdAt: number;
921
921
  /** Where it may be restored; see {@link SnapshotScope}. */
922
922
  scope: SnapshotScope;
923
+ /** Whether the source had a volume attached (a restore then cannot attach another); `null` for older snapshots, which cannot take one. */
924
+ sourceVolume: boolean | null;
923
925
  /** The user who took it; `null` for snapshots from before snapshots belonged to a user. */
924
926
  createdBy: string | null;
925
927
  }
@@ -1190,11 +1192,14 @@ declare class Sandbox extends SandboxClient {
1190
1192
  static getSnapshot(snapshotId: string, opts?: ConnectionOpts): Promise<SandboxSnapshot>;
1191
1193
  /**
1192
1194
  * Start a new sandbox from a snapshot, in its region. `projectId` puts it in another project,
1193
- * in any of your workspaces, as the snapshot's scope allows; default: the snapshot's own project.
1195
+ * in any of your workspaces, as the snapshot's scope allows; default: the volume's project, else
1196
+ * the snapshot's own. `volumeId` mounts that volume at `/workspace` (a Firecracker snapshot of a
1197
+ * sandbox that had no volume attached; the volume must be in the snapshot's region).
1194
1198
  */
1195
1199
  static restore(snapshotId: string, opts?: ConnectionOpts & {
1196
1200
  timeoutMs?: number;
1197
1201
  projectId?: string;
1202
+ volumeId?: string;
1198
1203
  }): Promise<Sandbox>;
1199
1204
  /** Change where a snapshot you took may be restored. */
1200
1205
  static setSnapshotScope(snapshotId: string, scope: SnapshotScope, opts?: ConnectionOpts): Promise<SandboxSnapshot>;
package/dist/index.js CHANGED
@@ -1312,15 +1312,18 @@ var Sandbox = class extends SandboxClient {
1312
1312
  }
1313
1313
  /**
1314
1314
  * Start a new sandbox from a snapshot, in its region. `projectId` puts it in another project,
1315
- * in any of your workspaces, as the snapshot's scope allows; default: the snapshot's own project.
1315
+ * in any of your workspaces, as the snapshot's scope allows; default: the volume's project, else
1316
+ * the snapshot's own. `volumeId` mounts that volume at `/workspace` (a Firecracker snapshot of a
1317
+ * sandbox that had no volume attached; the volume must be in the snapshot's region).
1316
1318
  */
1317
1319
  static async restore(snapshotId, opts) {
1318
1320
  const client = new PlatformClient(opts ?? {});
1319
1321
  const snapshot = await this.getSnapshot(snapshotId, opts);
1320
1322
  const result = await client.post("/api/sandboxes", {
1321
1323
  snapshotId,
1322
- projectId: opts?.projectId ?? snapshot.projectId,
1324
+ projectId: opts?.projectId ?? (opts?.volumeId ? void 0 : snapshot.projectId),
1323
1325
  region: snapshot.region,
1326
+ volumeId: opts?.volumeId,
1324
1327
  timeoutMs: opts?.timeoutMs ?? DEFAULT_SANDBOX_TIMEOUT_MS
1325
1328
  });
1326
1329
  return new this({ ...opts, sandboxId: result.sandboxId ?? result.id });
package/dist/index.mjs CHANGED
@@ -1259,15 +1259,18 @@ var Sandbox = class extends SandboxClient {
1259
1259
  }
1260
1260
  /**
1261
1261
  * Start a new sandbox from a snapshot, in its region. `projectId` puts it in another project,
1262
- * in any of your workspaces, as the snapshot's scope allows; default: the snapshot's own project.
1262
+ * in any of your workspaces, as the snapshot's scope allows; default: the volume's project, else
1263
+ * the snapshot's own. `volumeId` mounts that volume at `/workspace` (a Firecracker snapshot of a
1264
+ * sandbox that had no volume attached; the volume must be in the snapshot's region).
1263
1265
  */
1264
1266
  static async restore(snapshotId, opts) {
1265
1267
  const client = new PlatformClient(opts ?? {});
1266
1268
  const snapshot = await this.getSnapshot(snapshotId, opts);
1267
1269
  const result = await client.post("/api/sandboxes", {
1268
1270
  snapshotId,
1269
- projectId: opts?.projectId ?? snapshot.projectId,
1271
+ projectId: opts?.projectId ?? (opts?.volumeId ? void 0 : snapshot.projectId),
1270
1272
  region: snapshot.region,
1273
+ volumeId: opts?.volumeId,
1271
1274
  timeoutMs: opts?.timeoutMs ?? DEFAULT_SANDBOX_TIMEOUT_MS
1272
1275
  });
1273
1276
  return new this({ ...opts, sandboxId: result.sandboxId ?? result.id });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "TypeScript SDK for Lizard: Firecracker microVM sandboxes, code execution and cloud apps.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",