@vercel/sandbox 1.0.4 → 1.1.1

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.
@@ -7,7 +7,7 @@ export declare const Sandbox: z.ZodObject<{
7
7
  region: z.ZodString;
8
8
  runtime: z.ZodString;
9
9
  timeout: z.ZodNumber;
10
- status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed"]>;
10
+ status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "snapshotting"]>;
11
11
  requestedAt: z.ZodNumber;
12
12
  startedAt: z.ZodOptional<z.ZodNumber>;
13
13
  requestedStopAt: z.ZodOptional<z.ZodNumber>;
@@ -19,7 +19,7 @@ export declare const Sandbox: z.ZodObject<{
19
19
  interactivePort: z.ZodOptional<z.ZodNumber>;
20
20
  }, "strip", z.ZodTypeAny, {
21
21
  region: string;
22
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
22
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
23
23
  timeout: number;
24
24
  cwd: string;
25
25
  id: string;
@@ -36,7 +36,7 @@ export declare const Sandbox: z.ZodObject<{
36
36
  interactivePort?: number | undefined;
37
37
  }, {
38
38
  region: string;
39
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
39
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
40
40
  timeout: number;
41
41
  cwd: string;
42
42
  id: string;
@@ -66,6 +66,35 @@ export declare const SandboxRoute: z.ZodObject<{
66
66
  port: number;
67
67
  subdomain: string;
68
68
  }>;
69
+ export type SnapshotMetadata = z.infer<typeof Snapshot>;
70
+ export declare const Snapshot: z.ZodObject<{
71
+ id: z.ZodString;
72
+ sourceSandboxId: z.ZodString;
73
+ region: z.ZodString;
74
+ status: z.ZodEnum<["created", "deleted", "failed"]>;
75
+ sizeBytes: z.ZodNumber;
76
+ expiresAt: z.ZodNumber;
77
+ createdAt: z.ZodNumber;
78
+ updatedAt: z.ZodNumber;
79
+ }, "strip", z.ZodTypeAny, {
80
+ region: string;
81
+ status: "failed" | "created" | "deleted";
82
+ id: string;
83
+ createdAt: number;
84
+ updatedAt: number;
85
+ sourceSandboxId: string;
86
+ sizeBytes: number;
87
+ expiresAt: number;
88
+ }, {
89
+ region: string;
90
+ status: "failed" | "created" | "deleted";
91
+ id: string;
92
+ createdAt: number;
93
+ updatedAt: number;
94
+ sourceSandboxId: string;
95
+ sizeBytes: number;
96
+ expiresAt: number;
97
+ }>;
69
98
  export declare const Pagination: z.ZodObject<{
70
99
  /**
71
100
  * Amount of items in the current page.
@@ -125,7 +154,7 @@ export declare const SandboxResponse: z.ZodObject<{
125
154
  region: z.ZodString;
126
155
  runtime: z.ZodString;
127
156
  timeout: z.ZodNumber;
128
- status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed"]>;
157
+ status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "snapshotting"]>;
129
158
  requestedAt: z.ZodNumber;
130
159
  startedAt: z.ZodOptional<z.ZodNumber>;
131
160
  requestedStopAt: z.ZodOptional<z.ZodNumber>;
@@ -137,7 +166,7 @@ export declare const SandboxResponse: z.ZodObject<{
137
166
  interactivePort: z.ZodOptional<z.ZodNumber>;
138
167
  }, "strip", z.ZodTypeAny, {
139
168
  region: string;
140
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
169
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
141
170
  timeout: number;
142
171
  cwd: string;
143
172
  id: string;
@@ -154,7 +183,7 @@ export declare const SandboxResponse: z.ZodObject<{
154
183
  interactivePort?: number | undefined;
155
184
  }, {
156
185
  region: string;
157
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
186
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
158
187
  timeout: number;
159
188
  cwd: string;
160
189
  id: string;
@@ -173,7 +202,7 @@ export declare const SandboxResponse: z.ZodObject<{
173
202
  }, "strip", z.ZodTypeAny, {
174
203
  sandbox: {
175
204
  region: string;
176
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
205
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
177
206
  timeout: number;
178
207
  cwd: string;
179
208
  id: string;
@@ -192,7 +221,7 @@ export declare const SandboxResponse: z.ZodObject<{
192
221
  }, {
193
222
  sandbox: {
194
223
  region: string;
195
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
224
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
196
225
  timeout: number;
197
226
  cwd: string;
198
227
  id: string;
@@ -217,7 +246,7 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
217
246
  region: z.ZodString;
218
247
  runtime: z.ZodString;
219
248
  timeout: z.ZodNumber;
220
- status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed"]>;
249
+ status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "snapshotting"]>;
221
250
  requestedAt: z.ZodNumber;
222
251
  startedAt: z.ZodOptional<z.ZodNumber>;
223
252
  requestedStopAt: z.ZodOptional<z.ZodNumber>;
@@ -229,7 +258,7 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
229
258
  interactivePort: z.ZodOptional<z.ZodNumber>;
230
259
  }, "strip", z.ZodTypeAny, {
231
260
  region: string;
232
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
261
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
233
262
  timeout: number;
234
263
  cwd: string;
235
264
  id: string;
@@ -246,7 +275,7 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
246
275
  interactivePort?: number | undefined;
247
276
  }, {
248
277
  region: string;
249
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
278
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
250
279
  timeout: number;
251
280
  cwd: string;
252
281
  id: string;
@@ -279,7 +308,7 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
279
308
  }, "strip", z.ZodTypeAny, {
280
309
  sandbox: {
281
310
  region: string;
282
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
311
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
283
312
  timeout: number;
284
313
  cwd: string;
285
314
  id: string;
@@ -303,7 +332,7 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
303
332
  }, {
304
333
  sandbox: {
305
334
  region: string;
306
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
335
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
307
336
  timeout: number;
308
337
  cwd: string;
309
338
  id: string;
@@ -439,7 +468,7 @@ export declare const SandboxesResponse: z.ZodObject<{
439
468
  region: z.ZodString;
440
469
  runtime: z.ZodString;
441
470
  timeout: z.ZodNumber;
442
- status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed"]>;
471
+ status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "snapshotting"]>;
443
472
  requestedAt: z.ZodNumber;
444
473
  startedAt: z.ZodOptional<z.ZodNumber>;
445
474
  requestedStopAt: z.ZodOptional<z.ZodNumber>;
@@ -451,7 +480,7 @@ export declare const SandboxesResponse: z.ZodObject<{
451
480
  interactivePort: z.ZodOptional<z.ZodNumber>;
452
481
  }, "strip", z.ZodTypeAny, {
453
482
  region: string;
454
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
483
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
455
484
  timeout: number;
456
485
  cwd: string;
457
486
  id: string;
@@ -468,7 +497,7 @@ export declare const SandboxesResponse: z.ZodObject<{
468
497
  interactivePort?: number | undefined;
469
498
  }, {
470
499
  region: string;
471
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
500
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
472
501
  timeout: number;
473
502
  cwd: string;
474
503
  id: string;
@@ -512,7 +541,7 @@ export declare const SandboxesResponse: z.ZodObject<{
512
541
  }, "strip", z.ZodTypeAny, {
513
542
  sandboxes: {
514
543
  region: string;
515
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
544
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
516
545
  timeout: number;
517
546
  cwd: string;
518
547
  id: string;
@@ -536,7 +565,7 @@ export declare const SandboxesResponse: z.ZodObject<{
536
565
  }, {
537
566
  sandboxes: {
538
567
  region: string;
539
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
568
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
540
569
  timeout: number;
541
570
  cwd: string;
542
571
  id: string;
@@ -566,7 +595,127 @@ export declare const ExtendTimeoutResponse: z.ZodObject<{
566
595
  region: z.ZodString;
567
596
  runtime: z.ZodString;
568
597
  timeout: z.ZodNumber;
569
- status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed"]>;
598
+ status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "snapshotting"]>;
599
+ requestedAt: z.ZodNumber;
600
+ startedAt: z.ZodOptional<z.ZodNumber>;
601
+ requestedStopAt: z.ZodOptional<z.ZodNumber>;
602
+ stoppedAt: z.ZodOptional<z.ZodNumber>;
603
+ duration: z.ZodOptional<z.ZodNumber>;
604
+ createdAt: z.ZodNumber;
605
+ cwd: z.ZodString;
606
+ updatedAt: z.ZodNumber;
607
+ interactivePort: z.ZodOptional<z.ZodNumber>;
608
+ }, "strip", z.ZodTypeAny, {
609
+ region: string;
610
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
611
+ timeout: number;
612
+ cwd: string;
613
+ id: string;
614
+ memory: number;
615
+ vcpus: number;
616
+ runtime: string;
617
+ requestedAt: number;
618
+ createdAt: number;
619
+ updatedAt: number;
620
+ duration?: number | undefined;
621
+ startedAt?: number | undefined;
622
+ requestedStopAt?: number | undefined;
623
+ stoppedAt?: number | undefined;
624
+ interactivePort?: number | undefined;
625
+ }, {
626
+ region: string;
627
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
628
+ timeout: number;
629
+ cwd: string;
630
+ id: string;
631
+ memory: number;
632
+ vcpus: number;
633
+ runtime: string;
634
+ requestedAt: number;
635
+ createdAt: number;
636
+ updatedAt: number;
637
+ duration?: number | undefined;
638
+ startedAt?: number | undefined;
639
+ requestedStopAt?: number | undefined;
640
+ stoppedAt?: number | undefined;
641
+ interactivePort?: number | undefined;
642
+ }>;
643
+ }, "strip", z.ZodTypeAny, {
644
+ sandbox: {
645
+ region: string;
646
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
647
+ timeout: number;
648
+ cwd: string;
649
+ id: string;
650
+ memory: number;
651
+ vcpus: number;
652
+ runtime: string;
653
+ requestedAt: number;
654
+ createdAt: number;
655
+ updatedAt: number;
656
+ duration?: number | undefined;
657
+ startedAt?: number | undefined;
658
+ requestedStopAt?: number | undefined;
659
+ stoppedAt?: number | undefined;
660
+ interactivePort?: number | undefined;
661
+ };
662
+ }, {
663
+ sandbox: {
664
+ region: string;
665
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
666
+ timeout: number;
667
+ cwd: string;
668
+ id: string;
669
+ memory: number;
670
+ vcpus: number;
671
+ runtime: string;
672
+ requestedAt: number;
673
+ createdAt: number;
674
+ updatedAt: number;
675
+ duration?: number | undefined;
676
+ startedAt?: number | undefined;
677
+ requestedStopAt?: number | undefined;
678
+ stoppedAt?: number | undefined;
679
+ interactivePort?: number | undefined;
680
+ };
681
+ }>;
682
+ export declare const CreateSnapshotResponse: z.ZodObject<{
683
+ snapshot: z.ZodObject<{
684
+ id: z.ZodString;
685
+ sourceSandboxId: z.ZodString;
686
+ region: z.ZodString;
687
+ status: z.ZodEnum<["created", "deleted", "failed"]>;
688
+ sizeBytes: z.ZodNumber;
689
+ expiresAt: z.ZodNumber;
690
+ createdAt: z.ZodNumber;
691
+ updatedAt: z.ZodNumber;
692
+ }, "strip", z.ZodTypeAny, {
693
+ region: string;
694
+ status: "failed" | "created" | "deleted";
695
+ id: string;
696
+ createdAt: number;
697
+ updatedAt: number;
698
+ sourceSandboxId: string;
699
+ sizeBytes: number;
700
+ expiresAt: number;
701
+ }, {
702
+ region: string;
703
+ status: "failed" | "created" | "deleted";
704
+ id: string;
705
+ createdAt: number;
706
+ updatedAt: number;
707
+ sourceSandboxId: string;
708
+ sizeBytes: number;
709
+ expiresAt: number;
710
+ }>;
711
+ sandbox: z.ZodObject<{
712
+ id: z.ZodString;
713
+ memory: z.ZodNumber;
714
+ vcpus: z.ZodNumber;
715
+ region: z.ZodString;
716
+ runtime: z.ZodString;
717
+ timeout: z.ZodNumber;
718
+ status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "snapshotting"]>;
570
719
  requestedAt: z.ZodNumber;
571
720
  startedAt: z.ZodOptional<z.ZodNumber>;
572
721
  requestedStopAt: z.ZodOptional<z.ZodNumber>;
@@ -578,7 +727,7 @@ export declare const ExtendTimeoutResponse: z.ZodObject<{
578
727
  interactivePort: z.ZodOptional<z.ZodNumber>;
579
728
  }, "strip", z.ZodTypeAny, {
580
729
  region: string;
581
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
730
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
582
731
  timeout: number;
583
732
  cwd: string;
584
733
  id: string;
@@ -595,7 +744,7 @@ export declare const ExtendTimeoutResponse: z.ZodObject<{
595
744
  interactivePort?: number | undefined;
596
745
  }, {
597
746
  region: string;
598
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
747
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
599
748
  timeout: number;
600
749
  cwd: string;
601
750
  id: string;
@@ -612,9 +761,19 @@ export declare const ExtendTimeoutResponse: z.ZodObject<{
612
761
  interactivePort?: number | undefined;
613
762
  }>;
614
763
  }, "strip", z.ZodTypeAny, {
764
+ snapshot: {
765
+ region: string;
766
+ status: "failed" | "created" | "deleted";
767
+ id: string;
768
+ createdAt: number;
769
+ updatedAt: number;
770
+ sourceSandboxId: string;
771
+ sizeBytes: number;
772
+ expiresAt: number;
773
+ };
615
774
  sandbox: {
616
775
  region: string;
617
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
776
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
618
777
  timeout: number;
619
778
  cwd: string;
620
779
  id: string;
@@ -631,9 +790,19 @@ export declare const ExtendTimeoutResponse: z.ZodObject<{
631
790
  interactivePort?: number | undefined;
632
791
  };
633
792
  }, {
793
+ snapshot: {
794
+ region: string;
795
+ status: "failed" | "created" | "deleted";
796
+ id: string;
797
+ createdAt: number;
798
+ updatedAt: number;
799
+ sourceSandboxId: string;
800
+ sizeBytes: number;
801
+ expiresAt: number;
802
+ };
634
803
  sandbox: {
635
804
  region: string;
636
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
805
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
637
806
  timeout: number;
638
807
  cwd: string;
639
808
  id: string;
@@ -650,3 +819,55 @@ export declare const ExtendTimeoutResponse: z.ZodObject<{
650
819
  interactivePort?: number | undefined;
651
820
  };
652
821
  }>;
822
+ export declare const SnapshotResponse: z.ZodObject<{
823
+ snapshot: z.ZodObject<{
824
+ id: z.ZodString;
825
+ sourceSandboxId: z.ZodString;
826
+ region: z.ZodString;
827
+ status: z.ZodEnum<["created", "deleted", "failed"]>;
828
+ sizeBytes: z.ZodNumber;
829
+ expiresAt: z.ZodNumber;
830
+ createdAt: z.ZodNumber;
831
+ updatedAt: z.ZodNumber;
832
+ }, "strip", z.ZodTypeAny, {
833
+ region: string;
834
+ status: "failed" | "created" | "deleted";
835
+ id: string;
836
+ createdAt: number;
837
+ updatedAt: number;
838
+ sourceSandboxId: string;
839
+ sizeBytes: number;
840
+ expiresAt: number;
841
+ }, {
842
+ region: string;
843
+ status: "failed" | "created" | "deleted";
844
+ id: string;
845
+ createdAt: number;
846
+ updatedAt: number;
847
+ sourceSandboxId: string;
848
+ sizeBytes: number;
849
+ expiresAt: number;
850
+ }>;
851
+ }, "strip", z.ZodTypeAny, {
852
+ snapshot: {
853
+ region: string;
854
+ status: "failed" | "created" | "deleted";
855
+ id: string;
856
+ createdAt: number;
857
+ updatedAt: number;
858
+ sourceSandboxId: string;
859
+ sizeBytes: number;
860
+ expiresAt: number;
861
+ };
862
+ }, {
863
+ snapshot: {
864
+ region: string;
865
+ status: "failed" | "created" | "deleted";
866
+ id: string;
867
+ createdAt: number;
868
+ updatedAt: number;
869
+ sourceSandboxId: string;
870
+ sizeBytes: number;
871
+ expiresAt: number;
872
+ };
873
+ }>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExtendTimeoutResponse = exports.SandboxesResponse = exports.LogLine = exports.EmptyResponse = exports.CommandFinishedResponse = exports.CommandResponse = exports.SandboxAndRoutesResponse = exports.SandboxResponse = exports.Command = exports.Pagination = exports.SandboxRoute = exports.Sandbox = void 0;
3
+ exports.SnapshotResponse = exports.CreateSnapshotResponse = exports.ExtendTimeoutResponse = exports.SandboxesResponse = exports.LogLine = exports.EmptyResponse = exports.CommandFinishedResponse = exports.CommandResponse = exports.SandboxAndRoutesResponse = exports.SandboxResponse = exports.Command = exports.Pagination = exports.Snapshot = exports.SandboxRoute = exports.Sandbox = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.Sandbox = zod_1.z.object({
6
6
  id: zod_1.z.string(),
@@ -9,7 +9,14 @@ exports.Sandbox = zod_1.z.object({
9
9
  region: zod_1.z.string(),
10
10
  runtime: zod_1.z.string(),
11
11
  timeout: zod_1.z.number(),
12
- status: zod_1.z.enum(["pending", "running", "stopping", "stopped", "failed"]),
12
+ status: zod_1.z.enum([
13
+ "pending",
14
+ "running",
15
+ "stopping",
16
+ "stopped",
17
+ "failed",
18
+ "snapshotting",
19
+ ]),
13
20
  requestedAt: zod_1.z.number(),
14
21
  startedAt: zod_1.z.number().optional(),
15
22
  requestedStopAt: zod_1.z.number().optional(),
@@ -25,6 +32,16 @@ exports.SandboxRoute = zod_1.z.object({
25
32
  subdomain: zod_1.z.string(),
26
33
  port: zod_1.z.number(),
27
34
  });
35
+ exports.Snapshot = zod_1.z.object({
36
+ id: zod_1.z.string(),
37
+ sourceSandboxId: zod_1.z.string(),
38
+ region: zod_1.z.string(),
39
+ status: zod_1.z.enum(["created", "deleted", "failed"]),
40
+ sizeBytes: zod_1.z.number(),
41
+ expiresAt: zod_1.z.number(),
42
+ createdAt: zod_1.z.number(),
43
+ updatedAt: zod_1.z.number(),
44
+ });
28
45
  exports.Pagination = zod_1.z.object({
29
46
  /**
30
47
  * Amount of items in the current page.
@@ -78,4 +95,11 @@ exports.SandboxesResponse = zod_1.z.object({
78
95
  exports.ExtendTimeoutResponse = zod_1.z.object({
79
96
  sandbox: exports.Sandbox,
80
97
  });
98
+ exports.CreateSnapshotResponse = zod_1.z.object({
99
+ snapshot: exports.Snapshot,
100
+ sandbox: exports.Sandbox,
101
+ });
102
+ exports.SnapshotResponse = zod_1.z.object({
103
+ snapshot: exports.Snapshot,
104
+ });
81
105
  //# sourceMappingURL=validators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/api-client/validators.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAIX,QAAA,OAAO,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvE,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;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7D,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,oBAAY,CAAC;CAC9B,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,eAAO;CACjB,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,eAAe;CACzB,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE7B,QAAA,OAAO,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,eAAO,CAAC;IAC3B,UAAU,EAAE,kBAAU;CACvB,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,eAAO;CACjB,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,gBAAQ;IAClB,OAAO,EAAE,eAAO;CACjB,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,gBAAQ;CACnB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export type RUNTIMES = "node24" | "node22" | "python3.13";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":""}
package/dist/sandbox.d.ts CHANGED
@@ -4,8 +4,11 @@ import { APIClient } from "./api-client";
4
4
  import { Command, type CommandFinished } from "./command";
5
5
  import { type Credentials } from "./utils/get-credentials";
6
6
  import { WithPrivate } from "./utils/types";
7
+ import { WithFetchOptions } from "./api-client/api-client";
8
+ import { RUNTIMES } from "./constants";
9
+ import { Snapshot } from "./snapshot";
7
10
  /** @inline */
8
- export interface CreateSandboxParams {
11
+ export interface BaseCreateSandboxParams {
9
12
  /**
10
13
  * The source of the sandbox.
11
14
  *
@@ -50,15 +53,21 @@ export interface CreateSandboxParams {
50
53
  vcpus: number;
51
54
  };
52
55
  /**
53
- * The runtime of the sandbox, currently only `node22` and `python3.13` are supported.
56
+ * The runtime of the sandbox, currently only `node24`, `node22` and `python3.13` are supported.
54
57
  * If not specified, the default runtime `node22` will be used.
55
58
  */
56
- runtime?: "node22" | "python3.13" | (string & {});
59
+ runtime?: RUNTIMES | (string & {});
57
60
  /**
58
61
  * An AbortSignal to cancel sandbox creation.
59
62
  */
60
63
  signal?: AbortSignal;
61
64
  }
65
+ export type CreateSandboxParams = BaseCreateSandboxParams | (Omit<BaseCreateSandboxParams, "runtime" | "source"> & {
66
+ source: {
67
+ type: "snapshot";
68
+ snapshotId: string;
69
+ };
70
+ });
62
71
  /** @inline */
63
72
  interface GetSandboxParams {
64
73
  /**
@@ -144,10 +153,10 @@ export declare class Sandbox {
144
153
  * It returns both the sandboxes and the pagination metadata to allow getting
145
154
  * the next page of results.
146
155
  */
147
- static list(params: Parameters<APIClient["listSandboxes"]>[0] & Partial<Credentials>): Promise<import("./api-client/base-client").Parsed<{
156
+ static list(params: Parameters<APIClient["listSandboxes"]>[0] & Partial<Credentials> & WithFetchOptions): Promise<import("./api-client/base-client").Parsed<{
148
157
  sandboxes: {
149
158
  region: string;
150
- status: "pending" | "running" | "stopping" | "stopped" | "failed";
159
+ status: "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
151
160
  timeout: number;
152
161
  cwd: string;
153
162
  id: string;
@@ -175,14 +184,14 @@ export declare class Sandbox {
175
184
  * @param params - Creation parameters and optional credentials.
176
185
  * @returns A promise resolving to the created {@link Sandbox}.
177
186
  */
178
- static create(params?: WithPrivate<CreateSandboxParams | (CreateSandboxParams & Credentials)>): Promise<Sandbox>;
187
+ static create(params?: WithPrivate<CreateSandboxParams | (CreateSandboxParams & Credentials)> & WithFetchOptions): Promise<Sandbox>;
179
188
  /**
180
189
  * Retrieve an existing sandbox.
181
190
  *
182
191
  * @param params - Get parameters and optional credentials.
183
192
  * @returns A promise resolving to the {@link Sandbox}.
184
193
  */
185
- static get(params: WithPrivate<GetSandboxParams | (GetSandboxParams & Credentials)>): Promise<Sandbox>;
194
+ static get(params: WithPrivate<GetSandboxParams | (GetSandboxParams & Credentials)> & WithFetchOptions): Promise<Sandbox>;
186
195
  /**
187
196
  * Create a new Sandbox instance.
188
197
  *
@@ -319,5 +328,18 @@ export declare class Sandbox {
319
328
  extendTimeout(duration: number, opts?: {
320
329
  signal?: AbortSignal;
321
330
  }): Promise<void>;
331
+ /**
332
+ * Create a snapshot from this currently running sandbox. New sandboxes can
333
+ * then be created from this snapshot using {@link Sandbox.createFromSnapshot}.
334
+ *
335
+ * Note: this sandbox will be stopped as part of the snapshot creation process.
336
+ *
337
+ * @param opts - Optional parameters.
338
+ * @param opts.signal - An AbortSignal to cancel the operation.
339
+ * @returns A promise that resolves to the Snapshot instance
340
+ */
341
+ snapshot(opts?: {
342
+ signal?: AbortSignal;
343
+ }): Promise<Snapshot>;
322
344
  }
323
345
  export {};
package/dist/sandbox.js CHANGED
@@ -5,6 +5,7 @@ const api_client_1 = require("./api-client");
5
5
  const command_1 = require("./command");
6
6
  const get_credentials_1 = require("./utils/get-credentials");
7
7
  const types_1 = require("./utils/types");
8
+ const snapshot_1 = require("./snapshot");
8
9
  /**
9
10
  * A Sandbox is an isolated Linux MicroVM to run commands in.
10
11
  *
@@ -43,6 +44,7 @@ class Sandbox {
43
44
  const client = new api_client_1.APIClient({
44
45
  teamId: credentials.teamId,
45
46
  token: credentials.token,
47
+ fetch: params.fetch,
46
48
  });
47
49
  return client.listSandboxes({
48
50
  ...params,
@@ -60,6 +62,7 @@ class Sandbox {
60
62
  const client = new api_client_1.APIClient({
61
63
  teamId: credentials.teamId,
62
64
  token: credentials.token,
65
+ fetch: params?.fetch,
63
66
  });
64
67
  const privateParams = (0, types_1.getPrivateParams)(params);
65
68
  const sandbox = await client.createSandbox({
@@ -68,7 +71,7 @@ class Sandbox {
68
71
  ports: params?.ports ?? [],
69
72
  timeout: params?.timeout,
70
73
  resources: params?.resources,
71
- runtime: params?.runtime,
74
+ runtime: params && "runtime" in params ? params?.runtime : undefined,
72
75
  signal: params?.signal,
73
76
  ...privateParams,
74
77
  });
@@ -89,6 +92,7 @@ class Sandbox {
89
92
  const client = new api_client_1.APIClient({
90
93
  teamId: credentials.teamId,
91
94
  token: credentials.token,
95
+ fetch: params.fetch,
92
96
  });
93
97
  const privateParams = (0, types_1.getPrivateParams)(params);
94
98
  const sandbox = await client.getSandbox({
@@ -286,6 +290,27 @@ class Sandbox {
286
290
  // Update the internal sandbox metadata with the new timeout value
287
291
  this.sandbox = response.json.sandbox;
288
292
  }
293
+ /**
294
+ * Create a snapshot from this currently running sandbox. New sandboxes can
295
+ * then be created from this snapshot using {@link Sandbox.createFromSnapshot}.
296
+ *
297
+ * Note: this sandbox will be stopped as part of the snapshot creation process.
298
+ *
299
+ * @param opts - Optional parameters.
300
+ * @param opts.signal - An AbortSignal to cancel the operation.
301
+ * @returns A promise that resolves to the Snapshot instance
302
+ */
303
+ async snapshot(opts) {
304
+ const response = await this.client.createSnapshot({
305
+ sandboxId: this.sandbox.id,
306
+ signal: opts?.signal,
307
+ });
308
+ this.sandbox = response.json.sandbox;
309
+ return new snapshot_1.Snapshot({
310
+ client: this.client,
311
+ snapshot: response.json.snapshot,
312
+ });
313
+ }
289
314
  }
290
315
  exports.Sandbox = Sandbox;
291
316
  //# sourceMappingURL=sandbox.js.map