@sandbox-engine/sdk 0.1.1 → 0.1.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/index.d.mts CHANGED
@@ -54,6 +54,18 @@ interface FileEntry {
54
54
  isDirectory: boolean;
55
55
  isFile: boolean;
56
56
  }
57
+ interface FileWriteEntry {
58
+ path: string;
59
+ content: string;
60
+ encoding?: BufferEncoding;
61
+ }
62
+ interface FileWriteManyResult {
63
+ results: Array<{
64
+ path: string;
65
+ success: boolean;
66
+ error?: string;
67
+ }>;
68
+ }
57
69
  interface PortMapping {
58
70
  containerPort: number;
59
71
  hostPort: number;
@@ -75,6 +87,8 @@ declare class Filesystem {
75
87
  read(filePath: string): Promise<string>;
76
88
  write(filePath: string, content: string): Promise<void>;
77
89
  list(dirPath: string): Promise<FileEntry[]>;
90
+ writeMany(files: FileWriteEntry[]): Promise<FileWriteManyResult>;
91
+ rename(oldPath: string, newPath: string): Promise<void>;
78
92
  delete(filePath: string): Promise<void>;
79
93
  }
80
94
 
@@ -125,4 +139,4 @@ declare class Sandbox {
125
139
  close(): Promise<void>;
126
140
  }
127
141
 
128
- export { type ExecOptions, type ExecResult, type FileEntry, Filesystem, type PortMapping, Process, type ProxyEnvResult, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
142
+ export { type ExecOptions, type ExecResult, type FileEntry, type FileWriteEntry, type FileWriteManyResult, Filesystem, type PortMapping, Process, type ProxyEnvResult, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
package/dist/index.d.ts CHANGED
@@ -54,6 +54,18 @@ interface FileEntry {
54
54
  isDirectory: boolean;
55
55
  isFile: boolean;
56
56
  }
57
+ interface FileWriteEntry {
58
+ path: string;
59
+ content: string;
60
+ encoding?: BufferEncoding;
61
+ }
62
+ interface FileWriteManyResult {
63
+ results: Array<{
64
+ path: string;
65
+ success: boolean;
66
+ error?: string;
67
+ }>;
68
+ }
57
69
  interface PortMapping {
58
70
  containerPort: number;
59
71
  hostPort: number;
@@ -75,6 +87,8 @@ declare class Filesystem {
75
87
  read(filePath: string): Promise<string>;
76
88
  write(filePath: string, content: string): Promise<void>;
77
89
  list(dirPath: string): Promise<FileEntry[]>;
90
+ writeMany(files: FileWriteEntry[]): Promise<FileWriteManyResult>;
91
+ rename(oldPath: string, newPath: string): Promise<void>;
78
92
  delete(filePath: string): Promise<void>;
79
93
  }
80
94
 
@@ -125,4 +139,4 @@ declare class Sandbox {
125
139
  close(): Promise<void>;
126
140
  }
127
141
 
128
- export { type ExecOptions, type ExecResult, type FileEntry, Filesystem, type PortMapping, Process, type ProxyEnvResult, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
142
+ export { type ExecOptions, type ExecResult, type FileEntry, type FileWriteEntry, type FileWriteManyResult, Filesystem, type PortMapping, Process, type ProxyEnvResult, Sandbox, type SandboxOptions, Terminal, type WsMessage, type WsMessageType };
package/dist/index.js CHANGED
@@ -126,6 +126,18 @@ var Filesystem = class {
126
126
  );
127
127
  return res.files;
128
128
  }
129
+ async writeMany(files) {
130
+ return this.client.post(
131
+ `/api/sandboxes/${this.sandboxId}/files/batch`,
132
+ { files }
133
+ );
134
+ }
135
+ async rename(oldPath, newPath) {
136
+ await this.client.post(`/api/sandboxes/${this.sandboxId}/files/rename`, {
137
+ from: oldPath,
138
+ to: newPath
139
+ });
140
+ }
129
141
  async delete(filePath) {
130
142
  await this.client.delete(`/api/sandboxes/${this.sandboxId}/files`, { path: filePath });
131
143
  }
package/dist/index.mjs CHANGED
@@ -87,6 +87,18 @@ var Filesystem = class {
87
87
  );
88
88
  return res.files;
89
89
  }
90
+ async writeMany(files) {
91
+ return this.client.post(
92
+ `/api/sandboxes/${this.sandboxId}/files/batch`,
93
+ { files }
94
+ );
95
+ }
96
+ async rename(oldPath, newPath) {
97
+ await this.client.post(`/api/sandboxes/${this.sandboxId}/files/rename`, {
98
+ from: oldPath,
99
+ to: newPath
100
+ });
101
+ }
90
102
  async delete(filePath) {
91
103
  await this.client.delete(`/api/sandboxes/${this.sandboxId}/files`, { path: filePath });
92
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandbox-engine/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "SDK for creating and managing isolated sandbox environments",
5
5
  "keywords": ["sandbox", "docker", "code-execution", "isolated", "e2b"],
6
6
  "license": "MIT",