@blaxel/core 0.3.20 → 0.3.21

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.
Files changed (47) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/client/sdk.gen.js +95 -2
  3. package/dist/cjs/common/settings.js +2 -2
  4. package/dist/cjs/index.js +1 -0
  5. package/dist/cjs/sandbox/index.js +1 -0
  6. package/dist/cjs/sandbox/sandbox.js +9 -0
  7. package/dist/cjs/sandbox/snapshot.js +77 -0
  8. package/dist/cjs/snapshot/index.js +145 -0
  9. package/dist/cjs/types/client/sdk.gen.d.ts +26 -1
  10. package/dist/cjs/types/client/types.gen.d.ts +277 -11
  11. package/dist/cjs/types/index.d.ts +1 -0
  12. package/dist/cjs/types/sandbox/index.d.ts +1 -0
  13. package/dist/cjs/types/sandbox/sandbox.d.ts +10 -2
  14. package/dist/cjs/types/sandbox/snapshot.d.ts +40 -0
  15. package/dist/cjs/types/snapshot/index.d.ts +103 -0
  16. package/dist/cjs-browser/.tsbuildinfo +1 -1
  17. package/dist/cjs-browser/client/sdk.gen.js +95 -2
  18. package/dist/cjs-browser/common/settings.js +2 -2
  19. package/dist/cjs-browser/index.js +1 -0
  20. package/dist/cjs-browser/sandbox/index.js +1 -0
  21. package/dist/cjs-browser/sandbox/sandbox.js +9 -0
  22. package/dist/cjs-browser/sandbox/snapshot.js +77 -0
  23. package/dist/cjs-browser/snapshot/index.js +145 -0
  24. package/dist/cjs-browser/types/client/sdk.gen.d.ts +26 -1
  25. package/dist/cjs-browser/types/client/types.gen.d.ts +277 -11
  26. package/dist/cjs-browser/types/index.d.ts +1 -0
  27. package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
  28. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +10 -2
  29. package/dist/cjs-browser/types/sandbox/snapshot.d.ts +40 -0
  30. package/dist/cjs-browser/types/snapshot/index.d.ts +103 -0
  31. package/dist/esm/.tsbuildinfo +1 -1
  32. package/dist/esm/client/sdk.gen.js +88 -0
  33. package/dist/esm/common/settings.js +2 -2
  34. package/dist/esm/index.js +1 -0
  35. package/dist/esm/sandbox/index.js +1 -0
  36. package/dist/esm/sandbox/sandbox.js +9 -0
  37. package/dist/esm/sandbox/snapshot.js +73 -0
  38. package/dist/esm/snapshot/index.js +141 -0
  39. package/dist/esm-browser/.tsbuildinfo +1 -1
  40. package/dist/esm-browser/client/sdk.gen.js +88 -0
  41. package/dist/esm-browser/common/settings.js +2 -2
  42. package/dist/esm-browser/index.js +1 -0
  43. package/dist/esm-browser/sandbox/index.js +1 -0
  44. package/dist/esm-browser/sandbox/sandbox.js +9 -0
  45. package/dist/esm-browser/sandbox/snapshot.js +73 -0
  46. package/dist/esm-browser/snapshot/index.js +141 -0
  47. package/package.json +1 -1
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.shareImage = exports.listImageShares = exports.getImage = exports.deleteImage = exports.createImage = exports.listImages = exports.cleanupImages = exports.listFunctionRevisions = exports.updateFunction = exports.getFunction = exports.deleteFunction = exports.createFunction = exports.listFunctions = exports.testFeatureFlag = exports.getWorkspaceFeatures = exports.listAllEgressIps = exports.getEgressGatewayUsage = exports.listAllEgressGateways = exports.getDriveJwks = exports.getDriveByExternalId = exports.createDriveAccessToken = exports.updateDrive = exports.getDrive = exports.deleteDrive = exports.createDrive = exports.listDrives = exports.verifyCustomDomain = exports.unshareCustomDomain = exports.shareCustomDomain = exports.listCustomDomainShares = exports.updateCustomDomain = exports.getCustomDomain = exports.deleteCustomDomain = exports.createCustomDomain = exports.listCustomDomains = exports.getConfiguration = exports.getChangelog = exports.listApplicationRevisions = exports.createApplicationCustomDomain = exports.updateApplication = exports.getApplication = exports.deleteApplication = exports.createApplication = exports.listApplications = exports.listAgentRevisions = exports.updateAgent = exports.getAgent = exports.deleteAgent = exports.createAgent = exports.listAgents = void 0;
5
5
  exports.createSandboxPreview = exports.listSandboxPreviews = exports.forkSandbox = exports.archiveSandbox = exports.updateSandbox = exports.getSandbox = exports.deleteSandbox = exports.createSandbox = exports.listSandboxes = exports.listSandboxHubDefinitions = exports.listPublicIps = exports.getPolicyUsages = exports.updatePolicy = exports.getPolicy = exports.deletePolicy = exports.createPolicy = exports.listPolicies = exports.declineImageShare = exports.acceptImageShare = exports.listPendingImageShares = exports.listModelRevisions = exports.updateModel = exports.getModel = exports.deleteModel = exports.createModel = exports.listModels = exports.listMcpHubDefinitions = exports.listLocations = exports.listJobRevisions = exports.listJobExecutionTasks = exports.getJobExecution = exports.deleteJobExecution = exports.createJobExecution = exports.listJobExecutions = exports.updateJob = exports.getJob = exports.deleteJob = exports.createJob = exports.listJobs = exports.getIntegrationConnectionModel = exports.listIntegrationConnectionModels = exports.getIntegrationConnectionModelEndpointConfigurations = exports.updateIntegrationConnection = exports.getIntegrationConnection = exports.deleteIntegrationConnection = exports.createIntegrationConnection = exports.listIntegrationConnections = exports.getIntegration = exports.deleteImageTag = exports.unshareImage = void 0;
6
- exports.getVpc = exports.deleteVpc = exports.createVpc = exports.listVpcs = exports.getVolumeByExternalId = exports.updateVolume = exports.getVolume = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.deleteVolumeTemplateVersion = exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.getSandboxScheduleMetrics = exports.listSchedules = exports.listScheduleExecutions = exports.getSandboxByExternalId = exports.unarchiveSandbox = exports.restoreSandboxSnapshot = exports.deleteSandboxSnapshot = exports.createSandboxSnapshot = exports.listSandboxSnapshots = exports.updateSandboxSchedule = exports.getSandboxSchedule = exports.deleteSandboxSchedule = exports.createSandboxSchedule = exports.listSandboxSchedules = exports.listSandboxScheduleExecutions = exports.deleteSandboxPreviewToken = exports.createSandboxPreviewToken = exports.listSandboxPreviewTokens = exports.updateSandboxPreview = exports.getSandboxPreview = exports.deleteSandboxPreview = void 0;
7
- exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getEgressIp = exports.deleteEgressIp = exports.createEgressIp = exports.listEgressIps = exports.getEgressGateway = exports.deleteEgressGateway = exports.createEgressGateway = exports.listEgressGateways = void 0;
6
+ exports.updateVolume = exports.getVolume = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.deleteVolumeTemplateVersion = exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.forkSnapshot = exports.getSnapshot = exports.deleteSnapshot = exports.createSnapshot = exports.listSnapshots = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.getSandboxScheduleMetrics = exports.listSchedules = exports.listScheduleExecutions = exports.getSandboxByExternalId = exports.unarchiveSandbox = exports.restoreSandboxSnapshot = exports.deleteSandboxSnapshot = exports.createSandboxSnapshot = exports.listSandboxSnapshots = exports.updateSandboxSchedule = exports.getSandboxSchedule = exports.deleteSandboxSchedule = exports.createSandboxSchedule = exports.listSandboxSchedules = exports.listSandboxScheduleExecutions = exports.deleteSandboxPreviewToken = exports.createSandboxPreviewToken = exports.listSandboxPreviewTokens = exports.updateSandboxPreview = exports.getSandboxPreview = exports.deleteSandboxPreview = void 0;
7
+ exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getEgressIp = exports.deleteEgressIp = exports.createEgressIp = exports.listEgressIps = exports.getEgressGateway = exports.deleteEgressGateway = exports.createEgressGateway = exports.listEgressGateways = exports.getVpc = exports.deleteVpc = exports.createVpc = exports.listVpcs = exports.getVolumeByExternalId = void 0;
8
8
  const client_gen_1 = require("./client.gen");
9
9
  /**
10
10
  * List all agents
@@ -2302,6 +2302,99 @@ const deleteApiKeyForServiceAccount = (options) => {
2302
2302
  });
2303
2303
  };
2304
2304
  exports.deleteApiKeyForServiceAccount = deleteApiKeyForServiceAccount;
2305
+ /**
2306
+ * List snapshots
2307
+ * Returns the snapshots of the workspace, newest first by default, including the ones whose source object has been deleted. Starting with API version 2026-04-28 the response is wrapped in `{data, meta}` and supports cursor pagination via the `cursor` and `limit` query parameters; older versions keep returning a bare array.
2308
+ */
2309
+ const listSnapshots = (options) => {
2310
+ return (options?.client ?? client_gen_1.client).get({
2311
+ security: [
2312
+ {
2313
+ scheme: 'bearer',
2314
+ type: 'http'
2315
+ }
2316
+ ],
2317
+ url: '/snapshots',
2318
+ ...options
2319
+ });
2320
+ };
2321
+ exports.listSnapshots = listSnapshots;
2322
+ /**
2323
+ * Create snapshot
2324
+ * Captures a snapshot from a source object. The snapshot belongs to the workspace rather than to its source, so it survives the deletion of the object it was captured from, and carries what creating a sandbox or an application from it needs.
2325
+ */
2326
+ const createSnapshot = (options) => {
2327
+ return (options.client ?? client_gen_1.client).post({
2328
+ security: [
2329
+ {
2330
+ scheme: 'bearer',
2331
+ type: 'http'
2332
+ }
2333
+ ],
2334
+ url: '/snapshots',
2335
+ ...options,
2336
+ headers: {
2337
+ 'Content-Type': 'application/json',
2338
+ ...options?.headers
2339
+ }
2340
+ });
2341
+ };
2342
+ exports.createSnapshot = createSnapshot;
2343
+ /**
2344
+ * Delete snapshot
2345
+ * Deletes a snapshot. There is a single snapshot object, so this removes it for the whole workspace, whether or not the object it was captured from still exists.
2346
+ */
2347
+ const deleteSnapshot = (options) => {
2348
+ return (options.client ?? client_gen_1.client).delete({
2349
+ security: [
2350
+ {
2351
+ scheme: 'bearer',
2352
+ type: 'http'
2353
+ }
2354
+ ],
2355
+ url: '/snapshots/{snapshotName}',
2356
+ ...options
2357
+ });
2358
+ };
2359
+ exports.deleteSnapshot = deleteSnapshot;
2360
+ /**
2361
+ * Get snapshot
2362
+ * Returns a snapshot of the workspace by name.
2363
+ */
2364
+ const getSnapshot = (options) => {
2365
+ return (options.client ?? client_gen_1.client).get({
2366
+ security: [
2367
+ {
2368
+ scheme: 'bearer',
2369
+ type: 'http'
2370
+ }
2371
+ ],
2372
+ url: '/snapshots/{snapshotName}',
2373
+ ...options
2374
+ });
2375
+ };
2376
+ exports.getSnapshot = getSnapshot;
2377
+ /**
2378
+ * Fork snapshot
2379
+ * Creates a new sandbox or application from a snapshot. The snapshot is enough on its own, so this works after the object it was captured from has been deleted.
2380
+ */
2381
+ const forkSnapshot = (options) => {
2382
+ return (options.client ?? client_gen_1.client).post({
2383
+ security: [
2384
+ {
2385
+ scheme: 'bearer',
2386
+ type: 'http'
2387
+ }
2388
+ ],
2389
+ url: '/snapshots/{snapshotName}/fork',
2390
+ ...options,
2391
+ headers: {
2392
+ 'Content-Type': 'application/json',
2393
+ ...options?.headers
2394
+ }
2395
+ });
2396
+ };
2397
+ exports.forkSnapshot = forkSnapshot;
2305
2398
  /**
2306
2399
  * List deployment templates
2307
2400
  * Returns all deployment templates available for creating agents, functions, and other resources with pre-configured settings and code.
@@ -30,8 +30,8 @@ function missingCredentialsMessage() {
30
30
  return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
31
31
  }
32
32
  // Build info - these placeholders are replaced at build time by build:replace-imports
33
- const BUILD_VERSION = "0.3.20";
34
- const BUILD_COMMIT = "0be98e0951c3607a16d4c40b7612ad7a8c147703";
33
+ const BUILD_VERSION = "0.3.21";
34
+ const BUILD_COMMIT = "3ccc635cd5e9e15a606e3b4c4ae618f992bf4eed";
35
35
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
36
36
  const BLAXEL_API_VERSION = "2026-04-28";
37
37
  // Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
package/dist/cjs/index.js CHANGED
@@ -34,6 +34,7 @@ __exportStar(require("./jobs/index.js"), exports);
34
34
  __exportStar(require("./mcp/index.js"), exports);
35
35
  __exportStar(require("./models/index.js"), exports);
36
36
  __exportStar(require("./sandbox/index.js"), exports);
37
+ __exportStar(require("./snapshot/index.js"), exports);
37
38
  __exportStar(require("./telemetry/telemetry.js"), exports);
38
39
  __exportStar(require("./tools/index.js"), exports);
39
40
  __exportStar(require("./tools/types.js"), exports);
@@ -43,6 +43,7 @@ var index_js_2 = require("./drive/index.js");
43
43
  Object.defineProperty(exports, "SandboxDrive", { enumerable: true, get: function () { return index_js_2.SandboxDrive; } });
44
44
  __exportStar(require("./preview.js"), exports);
45
45
  __exportStar(require("./schedule.js"), exports);
46
+ __exportStar(require("./snapshot.js"), exports);
46
47
  __exportStar(require("./session.js"), exports);
47
48
  __exportStar(require("./sandbox.js"), exports);
48
49
  __exportStar(require("./system.js"), exports);
@@ -46,6 +46,7 @@ const index_js_5 = require("./network/index.js");
46
46
  const preview_js_1 = require("./preview.js");
47
47
  const index_js_6 = require("./process/index.js");
48
48
  const schedule_js_1 = require("./schedule.js");
49
+ const snapshot_js_1 = require("./snapshot.js");
49
50
  const session_js_1 = require("./session.js");
50
51
  const system_js_1 = require("./system.js");
51
52
  const types_js_1 = require("./types.js");
@@ -110,6 +111,7 @@ class SandboxInstance {
110
111
  codegen;
111
112
  system;
112
113
  drives;
114
+ snapshots;
113
115
  h2Session;
114
116
  constructor(sandbox) {
115
117
  this.sandbox = sandbox;
@@ -122,6 +124,7 @@ class SandboxInstance {
122
124
  this.codegen = new index_js_2.SandboxCodegen(sandbox);
123
125
  this.system = new system_js_1.SandboxSystem(sandbox);
124
126
  this.drives = new index_js_3.SandboxDrive(sandbox);
127
+ this.snapshots = new snapshot_js_1.SandboxSnapshotsResource(sandbox);
125
128
  this.h2Session = null;
126
129
  }
127
130
  get metadata() {
@@ -195,6 +198,7 @@ class SandboxInstance {
195
198
  * sandbox state and can be forked into new sandboxes or applications.
196
199
  *
197
200
  * @param name - Optional human-readable name for the snapshot.
201
+ * @deprecated Use `sandbox.snapshots.create(name)`.
198
202
  */
199
203
  async snapshot(name) {
200
204
  const { data } = await (0, index_js_1.createSandboxSnapshot)({
@@ -206,6 +210,8 @@ class SandboxInstance {
206
210
  }
207
211
  /**
208
212
  * List the snapshots of this sandbox.
213
+ *
214
+ * @deprecated Use `sandbox.snapshots.list()`.
209
215
  */
210
216
  async listSnapshots() {
211
217
  const { data } = await (0, index_js_1.listSandboxSnapshots)({
@@ -216,6 +222,8 @@ class SandboxInstance {
216
222
  }
217
223
  /**
218
224
  * Delete a snapshot of this sandbox by its ID.
225
+ *
226
+ * @deprecated Use `sandbox.snapshots.delete(name)`.
219
227
  */
220
228
  async deleteSnapshot(snapshotId) {
221
229
  await (0, index_js_1.deleteSandboxSnapshot)({
@@ -233,6 +241,7 @@ class SandboxInstance {
233
241
  * is: connections to a sandbox still resuming are retried by the gateway.
234
242
  *
235
243
  * @param snapshotId - ID of the snapshot to restore this sandbox to.
244
+ * @deprecated Use `sandbox.snapshots.restore(name)`.
236
245
  */
237
246
  async restore(snapshotId) {
238
247
  const { data } = await (0, index_js_1.restoreSandboxSnapshot)({
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SandboxSnapshotsResource = void 0;
4
+ const index_js_1 = require("../client/index.js");
5
+ const index_js_2 = require("../snapshot/index.js");
6
+ /**
7
+ * SandboxSnapshotsResource is the sandbox's view of the workspace's snapshots: the
8
+ * ones captured from it. A snapshot itself belongs to the workspace, so
9
+ * deleting one here deletes it everywhere, and it stays after this sandbox is
10
+ * deleted.
11
+ */
12
+ class SandboxSnapshotsResource {
13
+ sandbox;
14
+ constructor(sandbox) {
15
+ this.sandbox = sandbox;
16
+ }
17
+ get sandboxName() {
18
+ return this.sandbox.metadata.name;
19
+ }
20
+ /**
21
+ * Capture a snapshot of the sandbox.
22
+ *
23
+ * @param name - Name of the snapshot, unique among this sandbox's
24
+ * snapshots. Generated when omitted.
25
+ */
26
+ async create(name) {
27
+ return await index_js_2.Snapshot.create({
28
+ ...(name !== undefined ? { name } : {}),
29
+ source: { name: this.sandboxName, kind: "sandbox" },
30
+ });
31
+ }
32
+ /** List the snapshots captured from this sandbox. */
33
+ async list() {
34
+ const { data } = await (0, index_js_1.listSandboxSnapshots)({
35
+ path: { sandboxName: this.sandboxName },
36
+ throwOnError: true,
37
+ });
38
+ return data.map((snapshot) => new index_js_2.Snapshot(snapshot));
39
+ }
40
+ /**
41
+ * Find a snapshot captured from this sandbox by its name, or by its
42
+ * identifier. Names are only unique within the sandbox, which is why the
43
+ * workspace-level `Snapshot.get` takes the identifier instead.
44
+ */
45
+ async get(snapshotName) {
46
+ const snapshots = await this.list();
47
+ const found = snapshots.find((s) => s.name === snapshotName || s.id === snapshotName);
48
+ if (!found) {
49
+ throw new Error(`Snapshot ${snapshotName} not found on sandbox ${this.sandboxName}`);
50
+ }
51
+ return found;
52
+ }
53
+ /**
54
+ * Delete a snapshot captured from this sandbox. The snapshot is a workspace
55
+ * object, so it is removed for the whole workspace.
56
+ */
57
+ async delete(snapshotName) {
58
+ await (0, index_js_1.deleteSandboxSnapshot)({
59
+ path: { sandboxName: this.sandboxName, snapshotId: snapshotName },
60
+ throwOnError: true,
61
+ });
62
+ }
63
+ /**
64
+ * Restore the sandbox to one of its snapshots. The sandbox keeps its name,
65
+ * its URLs and its previews: the running instance is torn down and rebuilt
66
+ * from the snapshot, so everything written since it was taken is lost unless
67
+ * it was snapshotted too.
68
+ */
69
+ async restore(snapshotName) {
70
+ const { data } = await (0, index_js_1.restoreSandboxSnapshot)({
71
+ path: { sandboxName: this.sandboxName, snapshotId: snapshotName },
72
+ throwOnError: true,
73
+ });
74
+ return data;
75
+ }
76
+ }
77
+ exports.SandboxSnapshotsResource = SandboxSnapshotsResource;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Snapshot = void 0;
4
+ const index_js_1 = require("../client/index.js");
5
+ const pagination_js_1 = require("../common/pagination.js");
6
+ /**
7
+ * A snapshot is a workspace resource: it is captured from a sandbox, but it
8
+ * outlives it. Deleting the sandbox it came from leaves the snapshot in place,
9
+ * with `source.deleted` set, and it still carries what a fork needs to run.
10
+ */
11
+ class Snapshot {
12
+ snapshot;
13
+ constructor(snapshot) {
14
+ this.snapshot = snapshot;
15
+ }
16
+ get name() {
17
+ return this.snapshot.name;
18
+ }
19
+ /** Identifier of the snapshot on the compute plane. */
20
+ get id() {
21
+ return this.snapshot.id;
22
+ }
23
+ get status() {
24
+ return this.snapshot.status;
25
+ }
26
+ get workspace() {
27
+ return this.snapshot.workspace;
28
+ }
29
+ get createdAt() {
30
+ return this.snapshot.createdAt;
31
+ }
32
+ /** The object the snapshot was captured from, and whether it still exists. */
33
+ get source() {
34
+ return this.snapshot.source;
35
+ }
36
+ /** The configuration a fork of this snapshot runs with. */
37
+ get spec() {
38
+ return this.snapshot.spec;
39
+ }
40
+ /**
41
+ * Capture a snapshot of a source object.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const snapshot = await Snapshot.create({
46
+ * name: "my-snapshot",
47
+ * source: { name: "my-sandbox" },
48
+ * });
49
+ * ```
50
+ */
51
+ static async create(config) {
52
+ const { data } = await (0, index_js_1.createSnapshot)({
53
+ body: {
54
+ ...(config.name !== undefined ? { name: config.name } : {}),
55
+ source: {
56
+ name: config.source.name,
57
+ ...(config.source.kind !== undefined ? { kind: config.source.kind } : {}),
58
+ },
59
+ },
60
+ throwOnError: true,
61
+ });
62
+ return new Snapshot(data);
63
+ }
64
+ /**
65
+ * Fetch a snapshot by its identifier (`snapshot.id`). Names are only unique
66
+ * within the sandbox they were captured from, so the workspace-level routes
67
+ * take the identifier; use `sandbox.snapshots.get(name)` to address one by
68
+ * name.
69
+ */
70
+ static async get(snapshotId) {
71
+ const { data } = await (0, index_js_1.getSnapshot)({
72
+ path: { snapshotName: snapshotId },
73
+ throwOnError: true,
74
+ });
75
+ return new Snapshot(data);
76
+ }
77
+ /**
78
+ * List one page of the workspace's snapshots.
79
+ *
80
+ * The returned page exposes `data` for the current page, `meta` for cursor
81
+ * metadata, and `nextPage()` / `autoPagingEach()` / `autoPagingToArray()`
82
+ * helpers. Iterate it directly with `for await` to walk every page.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const page = await Snapshot.list({ limit: 50 });
87
+ * for await (const snapshot of page) {
88
+ * console.log(snapshot.name);
89
+ * }
90
+ * ```
91
+ */
92
+ static async list(query) {
93
+ const fetchPage = async (pageQuery) => {
94
+ const { data } = await (0, index_js_1.listSnapshots)({
95
+ query: pageQuery,
96
+ throwOnError: true,
97
+ });
98
+ return data;
99
+ };
100
+ return (0, pagination_js_1.createPaginatedList)({
101
+ response: await fetchPage(query),
102
+ fetchPage,
103
+ mapItem: (snapshot) => new Snapshot(snapshot),
104
+ query,
105
+ });
106
+ }
107
+ /**
108
+ * Delete a snapshot. There is one snapshot object, so this removes it for
109
+ * the whole workspace, whether or not the sandbox it came from still exists.
110
+ */
111
+ static async delete(snapshotId) {
112
+ const { data } = await (0, index_js_1.deleteSnapshot)({
113
+ path: { snapshotName: snapshotId },
114
+ throwOnError: true,
115
+ });
116
+ return data;
117
+ }
118
+ async delete() {
119
+ return await Snapshot.delete(this.id);
120
+ }
121
+ /**
122
+ * Create a sandbox or an application from this snapshot. This works after
123
+ * the sandbox the snapshot was captured from has been deleted.
124
+ *
125
+ * @param targetName - Name of the sandbox/application to create.
126
+ * @param options - Fork options (target type, port, traffic, ...).
127
+ */
128
+ async fork(targetName, options = {}) {
129
+ const { data } = await (0, index_js_1.forkSnapshot)({
130
+ path: { snapshotName: this.id },
131
+ body: {
132
+ targetName,
133
+ targetType: options.targetType ?? "sandbox",
134
+ ...(options.port !== undefined ? { port: options.port } : {}),
135
+ ...(options.traffic !== undefined ? { traffic: options.traffic } : {}),
136
+ ...(options.customDomain !== undefined ? { customDomain: options.customDomain } : {}),
137
+ ...(options.prefix !== undefined ? { prefix: options.prefix } : {}),
138
+ ...(options.envs !== undefined ? { envs: options.envs } : {}),
139
+ },
140
+ throwOnError: true,
141
+ });
142
+ return data;
143
+ }
144
+ }
145
+ exports.Snapshot = Snapshot;
@@ -1,5 +1,5 @@
1
1
  import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
2
- import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, ListApplicationsData, CreateApplicationData, DeleteApplicationData, GetApplicationData, UpdateApplicationData, CreateApplicationCustomDomainData, ListApplicationRevisionsData, GetChangelogData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, ListCustomDomainSharesData, ShareCustomDomainData, UnshareCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, GetDriveByExternalIdData, GetDriveJwksData, ListAllEgressGatewaysData, GetEgressGatewayUsageData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, CreateImageData, DeleteImageData, GetImageData, ListImageSharesData, ShareImageData, ShareImageResponse, UnshareImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobExecutionTasksData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPendingImageSharesData, AcceptImageShareData, DeclineImageShareData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, GetPolicyUsagesData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ArchiveSandboxData, ForkSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, CreateSandboxScheduleData, DeleteSandboxScheduleData, GetSandboxScheduleData, UpdateSandboxScheduleData, ListSandboxSnapshotsData, CreateSandboxSnapshotData, DeleteSandboxSnapshotData, RestoreSandboxSnapshotData, UnarchiveSandboxData, GetSandboxByExternalIdData, ListScheduleExecutionsData, ListSchedulesData, GetSandboxScheduleMetricsData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, GetVolumeByExternalIdData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
2
+ import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, ListApplicationsData, CreateApplicationData, DeleteApplicationData, GetApplicationData, UpdateApplicationData, CreateApplicationCustomDomainData, ListApplicationRevisionsData, GetChangelogData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, ListCustomDomainSharesData, ShareCustomDomainData, UnshareCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, GetDriveByExternalIdData, GetDriveJwksData, ListAllEgressGatewaysData, GetEgressGatewayUsageData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, CreateImageData, DeleteImageData, GetImageData, ListImageSharesData, ShareImageData, ShareImageResponse, UnshareImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobExecutionTasksData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPendingImageSharesData, AcceptImageShareData, DeclineImageShareData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, GetPolicyUsagesData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ArchiveSandboxData, ForkSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, CreateSandboxScheduleData, DeleteSandboxScheduleData, GetSandboxScheduleData, UpdateSandboxScheduleData, ListSandboxSnapshotsData, CreateSandboxSnapshotData, DeleteSandboxSnapshotData, RestoreSandboxSnapshotData, UnarchiveSandboxData, GetSandboxByExternalIdData, ListScheduleExecutionsData, ListSchedulesData, GetSandboxScheduleMetricsData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListSnapshotsData, CreateSnapshotData, DeleteSnapshotData, GetSnapshotData, ForkSnapshotData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, GetVolumeByExternalIdData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -703,6 +703,31 @@ export declare const createApiKeyForServiceAccount: <ThrowOnError extends boolea
703
703
  * Revokes an API key for a service account. The key becomes invalid immediately and any requests using it will fail authentication.
704
704
  */
705
705
  export declare const deleteApiKeyForServiceAccount: <ThrowOnError extends boolean = false>(options: Options<DeleteApiKeyForServiceAccountData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
706
+ /**
707
+ * List snapshots
708
+ * Returns the snapshots of the workspace, newest first by default, including the ones whose source object has been deleted. Starting with API version 2026-04-28 the response is wrapped in `{data, meta}` and supports cursor pagination via the `cursor` and `limit` query parameters; older versions keep returning a bare array.
709
+ */
710
+ export declare const listSnapshots: <ThrowOnError extends boolean = false>(options?: Options<ListSnapshotsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxSnapshotList, import("./types.gen.js")._Error, ThrowOnError>;
711
+ /**
712
+ * Create snapshot
713
+ * Captures a snapshot from a source object. The snapshot belongs to the workspace rather than to its source, so it survives the deletion of the object it was captured from, and carries what creating a sandbox or an application from it needs.
714
+ */
715
+ export declare const createSnapshot: <ThrowOnError extends boolean = false>(options: Options<CreateSnapshotData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxSnapshot, import("./types.gen.js")._Error, ThrowOnError>;
716
+ /**
717
+ * Delete snapshot
718
+ * Deletes a snapshot. There is a single snapshot object, so this removes it for the whole workspace, whether or not the object it was captured from still exists.
719
+ */
720
+ export declare const deleteSnapshot: <ThrowOnError extends boolean = false>(options: Options<DeleteSnapshotData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, import("./types.gen.js")._Error, ThrowOnError>;
721
+ /**
722
+ * Get snapshot
723
+ * Returns a snapshot of the workspace by name.
724
+ */
725
+ export declare const getSnapshot: <ThrowOnError extends boolean = false>(options: Options<GetSnapshotData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxSnapshot, import("./types.gen.js")._Error, ThrowOnError>;
726
+ /**
727
+ * Fork snapshot
728
+ * Creates a new sandbox or application from a snapshot. The snapshot is enough on its own, so this works after the object it was captured from has been deleted.
729
+ */
730
+ export declare const forkSnapshot: <ThrowOnError extends boolean = false>(options: Options<ForkSnapshotData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxForkResponse, import("./types.gen.js")._Error, ThrowOnError>;
706
731
  /**
707
732
  * List deployment templates
708
733
  * Returns all deployment templates available for creating agents, functions, and other resources with pre-configured settings and code.