@daytonaio/sdk 0.127.0 → 0.128.0-alpha.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.
- package/LICENSE +190 -0
- package/{src → cjs}/CodeInterpreter.d.ts +1 -0
- package/cjs/CodeInterpreter.d.ts.map +1 -0
- package/cjs/CodeInterpreter.js.map +1 -0
- package/{src → cjs}/ComputerUse.d.ts +1 -0
- package/cjs/ComputerUse.d.ts.map +1 -0
- package/cjs/ComputerUse.js.map +1 -0
- package/{src → cjs}/Daytona.d.ts +1 -0
- package/cjs/Daytona.d.ts.map +1 -0
- package/{src → cjs}/Daytona.js +1 -0
- package/cjs/Daytona.js.map +1 -0
- package/{src → cjs}/FileSystem.d.ts +1 -0
- package/cjs/FileSystem.d.ts.map +1 -0
- package/cjs/FileSystem.js.map +1 -0
- package/{src → cjs}/Git.d.ts +1 -0
- package/cjs/Git.d.ts.map +1 -0
- package/cjs/Git.js.map +1 -0
- package/{src → cjs}/Image.d.ts +21 -0
- package/cjs/Image.d.ts.map +1 -0
- package/{src → cjs}/Image.js +123 -91
- package/cjs/Image.js.map +1 -0
- package/{src → cjs}/LspServer.d.ts +1 -0
- package/cjs/LspServer.d.ts.map +1 -0
- package/cjs/LspServer.js.map +1 -0
- package/{src → cjs}/ObjectStorage.d.ts +1 -0
- package/cjs/ObjectStorage.d.ts.map +1 -0
- package/cjs/ObjectStorage.js.map +1 -0
- package/{src → cjs}/Process.d.ts +1 -0
- package/cjs/Process.d.ts.map +1 -0
- package/cjs/Process.js.map +1 -0
- package/{src → cjs}/PtyHandle.d.ts +1 -0
- package/cjs/PtyHandle.d.ts.map +1 -0
- package/cjs/PtyHandle.js.map +1 -0
- package/cjs/README.md +147 -0
- package/{src → cjs}/Sandbox.d.ts +2 -17
- package/cjs/Sandbox.d.ts.map +1 -0
- package/{src → cjs}/Sandbox.js +1 -27
- package/cjs/Sandbox.js.map +1 -0
- package/{src → cjs}/Snapshot.d.ts +2 -0
- package/cjs/Snapshot.d.ts.map +1 -0
- package/{src → cjs}/Snapshot.js +9 -1
- package/cjs/Snapshot.js.map +1 -0
- package/{src → cjs}/Volume.d.ts +1 -0
- package/cjs/Volume.d.ts.map +1 -0
- package/cjs/Volume.js.map +1 -0
- package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.d.ts +1 -0
- package/cjs/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
- package/cjs/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
- package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.d.ts +1 -0
- package/cjs/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
- package/cjs/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
- package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.d.ts +1 -0
- package/cjs/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
- package/cjs/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
- package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
- package/cjs/errors/DaytonaError.d.ts.map +1 -0
- package/cjs/errors/DaytonaError.js.map +1 -0
- package/{src → cjs}/index.d.ts +1 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js.map +1 -0
- package/cjs/package.json +3 -0
- package/{src → cjs}/types/Charts.d.ts +1 -0
- package/cjs/types/Charts.d.ts.map +1 -0
- package/cjs/types/Charts.js.map +1 -0
- package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
- package/cjs/types/CodeInterpreter.d.ts.map +1 -0
- package/cjs/types/CodeInterpreter.js.map +1 -0
- package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
- package/cjs/types/ExecuteResponse.d.ts.map +1 -0
- package/cjs/types/ExecuteResponse.js.map +1 -0
- package/{src → cjs}/types/Pty.d.ts +1 -0
- package/cjs/types/Pty.d.ts.map +1 -0
- package/cjs/types/Pty.js.map +1 -0
- package/{src → cjs}/utils/ArtifactParser.d.ts +1 -0
- package/cjs/utils/ArtifactParser.d.ts.map +1 -0
- package/cjs/utils/ArtifactParser.js.map +1 -0
- package/{src → cjs}/utils/Binary.d.ts +1 -0
- package/cjs/utils/Binary.d.ts.map +1 -0
- package/cjs/utils/Binary.js.map +1 -0
- package/{src → cjs}/utils/FileTransfer.d.ts +1 -0
- package/cjs/utils/FileTransfer.d.ts.map +1 -0
- package/cjs/utils/FileTransfer.js.map +1 -0
- package/{src → cjs}/utils/Import.d.ts +2 -15
- package/cjs/utils/Import.d.ts.map +1 -0
- package/cjs/utils/Import.js +81 -0
- package/cjs/utils/Import.js.map +1 -0
- package/{src → cjs}/utils/Multipart.d.ts +1 -0
- package/cjs/utils/Multipart.d.ts.map +1 -0
- package/cjs/utils/Multipart.js.map +1 -0
- package/{src → cjs}/utils/Runtime.d.ts +1 -0
- package/cjs/utils/Runtime.d.ts.map +1 -0
- package/cjs/utils/Runtime.js.map +1 -0
- package/{src → cjs}/utils/Stream.d.ts +1 -0
- package/cjs/utils/Stream.d.ts.map +1 -0
- package/cjs/utils/Stream.js.map +1 -0
- package/{src → cjs}/utils/WebSocket.d.ts +1 -0
- package/cjs/utils/WebSocket.d.ts.map +1 -0
- package/cjs/utils/WebSocket.js.map +1 -0
- package/esm/CodeInterpreter.d.ts +96 -0
- package/esm/CodeInterpreter.d.ts.map +1 -0
- package/esm/CodeInterpreter.js +295 -0
- package/esm/CodeInterpreter.js.map +1 -0
- package/esm/ComputerUse.d.ts +443 -0
- package/esm/ComputerUse.d.ts.map +1 -0
- package/esm/ComputerUse.js +509 -0
- package/esm/ComputerUse.js.map +1 -0
- package/esm/Daytona.d.ts +354 -0
- package/esm/Daytona.d.ts.map +1 -0
- package/esm/Daytona.js +410 -0
- package/esm/Daytona.js.map +1 -0
- package/esm/FileSystem.d.ts +328 -0
- package/esm/FileSystem.d.ts.map +1 -0
- package/esm/FileSystem.js +331 -0
- package/esm/FileSystem.js.map +1 -0
- package/esm/Git.d.ts +203 -0
- package/esm/Git.d.ts.map +1 -0
- package/esm/Git.js +260 -0
- package/esm/Git.js.map +1 -0
- package/esm/Image.d.ts +285 -0
- package/esm/Image.d.ts.map +1 -0
- package/esm/Image.js +569 -0
- package/esm/Image.js.map +1 -0
- package/esm/LspServer.d.ts +172 -0
- package/esm/LspServer.d.ts.map +1 -0
- package/esm/LspServer.js +204 -0
- package/esm/LspServer.js.map +1 -0
- package/esm/ObjectStorage.d.ts +79 -0
- package/esm/ObjectStorage.d.ts.map +1 -0
- package/esm/ObjectStorage.js +187 -0
- package/esm/ObjectStorage.js.map +1 -0
- package/esm/Process.d.ts +442 -0
- package/esm/Process.d.ts.map +1 -0
- package/esm/Process.js +644 -0
- package/esm/Process.js.map +1 -0
- package/esm/PtyHandle.d.ts +155 -0
- package/esm/PtyHandle.d.ts.map +1 -0
- package/esm/PtyHandle.js +374 -0
- package/esm/PtyHandle.js.map +1 -0
- package/esm/README.md +147 -0
- package/esm/Sandbox.d.ts +359 -0
- package/esm/Sandbox.d.ts.map +1 -0
- package/esm/Sandbox.js +532 -0
- package/esm/Sandbox.js.map +1 -0
- package/esm/Snapshot.d.ts +138 -0
- package/esm/Snapshot.d.ts.map +1 -0
- package/esm/Snapshot.js +207 -0
- package/esm/Snapshot.js.map +1 -0
- package/esm/Volume.d.ts +84 -0
- package/esm/Volume.d.ts.map +1 -0
- package/esm/Volume.js +95 -0
- package/esm/Volume.js.map +1 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts +6 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts.map +1 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.js +13 -0
- package/esm/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts +12 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +1 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.js +355 -0
- package/esm/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts +6 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts.map +1 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.js +14 -0
- package/esm/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
- package/esm/errors/DaytonaError.d.ts +32 -0
- package/esm/errors/DaytonaError.d.ts.map +1 -0
- package/esm/errors/DaytonaError.js +44 -0
- package/esm/errors/DaytonaError.js.map +1 -0
- package/esm/index.d.ts +22 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +22 -0
- package/esm/index.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/types/Charts.d.ts +152 -0
- package/esm/types/Charts.d.ts.map +1 -0
- package/esm/types/Charts.js +42 -0
- package/esm/types/Charts.js.map +1 -0
- package/esm/types/CodeInterpreter.d.ts +77 -0
- package/esm/types/CodeInterpreter.d.ts.map +1 -0
- package/esm/types/CodeInterpreter.js +6 -0
- package/esm/types/CodeInterpreter.js.map +1 -0
- package/esm/types/ExecuteResponse.d.ts +26 -0
- package/esm/types/ExecuteResponse.d.ts.map +1 -0
- package/esm/types/ExecuteResponse.js +6 -0
- package/esm/types/ExecuteResponse.js.map +1 -0
- package/esm/types/Pty.d.ts +48 -0
- package/esm/types/Pty.d.ts.map +1 -0
- package/esm/types/Pty.js +6 -0
- package/esm/types/Pty.js.map +1 -0
- package/esm/utils/ArtifactParser.d.ts +14 -0
- package/esm/utils/ArtifactParser.d.ts.map +1 -0
- package/esm/utils/ArtifactParser.js +51 -0
- package/esm/utils/ArtifactParser.js.map +1 -0
- package/esm/utils/Binary.d.ts +39 -0
- package/esm/utils/Binary.d.ts.map +1 -0
- package/esm/utils/Binary.js +157 -0
- package/esm/utils/Binary.js.map +1 -0
- package/esm/utils/FileTransfer.d.ts +15 -0
- package/esm/utils/FileTransfer.d.ts.map +1 -0
- package/esm/utils/FileTransfer.js +209 -0
- package/esm/utils/FileTransfer.js.map +1 -0
- package/esm/utils/Import.d.ts +211 -0
- package/esm/utils/Import.d.ts.map +1 -0
- package/esm/utils/Import.js +45 -0
- package/esm/utils/Import.js.map +1 -0
- package/esm/utils/Multipart.d.ts +27 -0
- package/esm/utils/Multipart.d.ts.map +1 -0
- package/esm/utils/Multipart.js +107 -0
- package/esm/utils/Multipart.js.map +1 -0
- package/esm/utils/Runtime.d.ts +37 -0
- package/esm/utils/Runtime.d.ts.map +1 -0
- package/esm/utils/Runtime.js +57 -0
- package/esm/utils/Runtime.js.map +1 -0
- package/esm/utils/Stream.d.ts +20 -0
- package/esm/utils/Stream.d.ts.map +1 -0
- package/esm/utils/Stream.js +360 -0
- package/esm/utils/Stream.js.map +1 -0
- package/esm/utils/WebSocket.d.ts +10 -0
- package/esm/utils/WebSocket.d.ts.map +1 -0
- package/esm/utils/WebSocket.js +22 -0
- package/esm/utils/WebSocket.js.map +1 -0
- package/package.json +20 -8
- package/src/CodeInterpreter.js.map +0 -1
- package/src/ComputerUse.js.map +0 -1
- package/src/Daytona.js.map +0 -1
- package/src/FileSystem.js.map +0 -1
- package/src/Git.js.map +0 -1
- package/src/Image.js.map +0 -1
- package/src/LspServer.js.map +0 -1
- package/src/ObjectStorage.js.map +0 -1
- package/src/Process.js.map +0 -1
- package/src/PtyHandle.js.map +0 -1
- package/src/Sandbox.js.map +0 -1
- package/src/Snapshot.js.map +0 -1
- package/src/Volume.js.map +0 -1
- package/src/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
- package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
- package/src/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
- package/src/errors/DaytonaError.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/types/Charts.js.map +0 -1
- package/src/types/CodeInterpreter.js.map +0 -1
- package/src/types/ExecuteResponse.js.map +0 -1
- package/src/types/Pty.js.map +0 -1
- package/src/utils/ArtifactParser.js.map +0 -1
- package/src/utils/Binary.js.map +0 -1
- package/src/utils/FileTransfer.js.map +0 -1
- package/src/utils/Import.js +0 -77
- package/src/utils/Import.js.map +0 -1
- package/src/utils/Multipart.js.map +0 -1
- package/src/utils/Runtime.js.map +0 -1
- package/src/utils/Stream.js.map +0 -1
- package/src/utils/WebSocket.js.map +0 -1
- /package/{src → cjs}/CodeInterpreter.js +0 -0
- /package/{src → cjs}/ComputerUse.js +0 -0
- /package/{src → cjs}/FileSystem.js +0 -0
- /package/{src → cjs}/Git.js +0 -0
- /package/{src → cjs}/LspServer.js +0 -0
- /package/{src → cjs}/ObjectStorage.js +0 -0
- /package/{src → cjs}/Process.js +0 -0
- /package/{src → cjs}/PtyHandle.js +0 -0
- /package/{src → cjs}/Volume.js +0 -0
- /package/{src → cjs}/code-toolbox/SandboxJsCodeToolbox.js +0 -0
- /package/{src → cjs}/code-toolbox/SandboxPythonCodeToolbox.js +0 -0
- /package/{src → cjs}/code-toolbox/SandboxTsCodeToolbox.js +0 -0
- /package/{src → cjs}/errors/DaytonaError.js +0 -0
- /package/{src → cjs}/index.js +0 -0
- /package/{src → cjs}/types/Charts.js +0 -0
- /package/{src → cjs}/types/CodeInterpreter.js +0 -0
- /package/{src → cjs}/types/ExecuteResponse.js +0 -0
- /package/{src → cjs}/types/Pty.js +0 -0
- /package/{src → cjs}/utils/ArtifactParser.js +0 -0
- /package/{src → cjs}/utils/Binary.js +0 -0
- /package/{src → cjs}/utils/FileTransfer.js +0 -0
- /package/{src → cjs}/utils/Multipart.js +0 -0
- /package/{src → cjs}/utils/Runtime.js +0 -0
- /package/{src → cjs}/utils/Stream.js +0 -0
- /package/{src → cjs}/utils/WebSocket.js +0 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { Configuration, FileInfo, Match, ReplaceResult, SearchFilesResponse } from '@daytonaio/toolbox-api-client';
|
|
2
|
+
import { FileSystemApi } from '@daytonaio/toolbox-api-client';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for setting file permissions in the Sandbox.
|
|
5
|
+
*
|
|
6
|
+
* @interface
|
|
7
|
+
* @property {string} [mode] - File mode/permissions in octal format (e.g. "644")
|
|
8
|
+
* @property {string} [owner] - User owner of the file
|
|
9
|
+
* @property {string} [group] - Group owner of the file
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const permissions: FilePermissionsParams = {
|
|
13
|
+
* mode: '644',
|
|
14
|
+
* owner: 'daytona',
|
|
15
|
+
* group: 'users'
|
|
16
|
+
* };
|
|
17
|
+
*/
|
|
18
|
+
export type FilePermissionsParams = {
|
|
19
|
+
/** Group owner of the file */
|
|
20
|
+
group?: string;
|
|
21
|
+
/** File mode/permissions in octal format (e.g. "644") */
|
|
22
|
+
mode?: string;
|
|
23
|
+
/** User owner of the file */
|
|
24
|
+
owner?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Represents a file to be uploaded to the Sandbox.
|
|
28
|
+
*
|
|
29
|
+
* @interface
|
|
30
|
+
* @property {string | Buffer} source - File to upload. If a Buffer, it is interpreted as the file content which is loaded into memory.
|
|
31
|
+
* Make sure it fits into memory, otherwise use the local file path which content will be streamed to the Sandbox.
|
|
32
|
+
* @property {string} destination - Absolute destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
|
|
33
|
+
*/
|
|
34
|
+
export interface FileUpload {
|
|
35
|
+
source: string | Buffer;
|
|
36
|
+
destination: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Represents a request to download a single file from the Sandbox.
|
|
40
|
+
*
|
|
41
|
+
* @interface
|
|
42
|
+
* @property {string} source - Source path in the Sandbox. Relative paths are resolved based on the user's
|
|
43
|
+
* root directory.
|
|
44
|
+
* @property {string} [destination] - Destination path in the local filesystem where the file content will be
|
|
45
|
+
* streamed to. If not provided, the file will be downloaded in the bytes buffer (might cause memory issues if the file is large).
|
|
46
|
+
*/
|
|
47
|
+
export interface FileDownloadRequest {
|
|
48
|
+
source: string;
|
|
49
|
+
destination?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents the response to a single file download request.
|
|
53
|
+
*
|
|
54
|
+
* @interface
|
|
55
|
+
* @property {string} source - The original source path requested for download.
|
|
56
|
+
* @property {Buffer | string | undefined} [result] - The download result - file path (if destination provided in the request)
|
|
57
|
+
* or bytes content (if no destination in the request), undefined if failed or no data received.
|
|
58
|
+
* @property {string | undefined} [error] - Error message if the download failed, undefined if successful.
|
|
59
|
+
*/
|
|
60
|
+
export interface FileDownloadResponse {
|
|
61
|
+
source: string;
|
|
62
|
+
result?: Buffer | string;
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents metadata for a file download operation.
|
|
67
|
+
*
|
|
68
|
+
* @interface
|
|
69
|
+
* @property {string | undefined} [destination] - Destination path in the local filesystem where the file content will be streamed to.
|
|
70
|
+
* @property {string | undefined} [error] - Error message if the download failed, undefined if successful.
|
|
71
|
+
* @property {Buffer | string | Uint8Array | undefined} [result] - The download result - file path (if destination provided in the request)
|
|
72
|
+
* or bytes content (if no destination in the request), undefined if failed or no data received.
|
|
73
|
+
*/
|
|
74
|
+
export interface DownloadMetadata {
|
|
75
|
+
destination?: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
result?: Buffer | string | Uint8Array;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Provides file system operations within a Sandbox.
|
|
81
|
+
*
|
|
82
|
+
* @class
|
|
83
|
+
*/
|
|
84
|
+
export declare class FileSystem {
|
|
85
|
+
private readonly clientConfig;
|
|
86
|
+
private readonly apiClient;
|
|
87
|
+
private readonly ensureToolboxUrl;
|
|
88
|
+
constructor(clientConfig: Configuration, apiClient: FileSystemApi, ensureToolboxUrl: () => Promise<void>);
|
|
89
|
+
/**
|
|
90
|
+
* Create a new directory in the Sandbox with specified permissions.
|
|
91
|
+
*
|
|
92
|
+
* @param {string} path - Path where the directory should be created. Relative paths are resolved based on the sandbox working directory.
|
|
93
|
+
* @param {string} mode - Directory permissions in octal format (e.g. "755")
|
|
94
|
+
* @returns {Promise<void>}
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Create a directory with standard permissions
|
|
98
|
+
* await fs.createFolder('app/data', '755');
|
|
99
|
+
*/
|
|
100
|
+
createFolder(path: string, mode: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Deletes a file or directory from the Sandbox.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the sandbox working directory.
|
|
105
|
+
* @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
|
|
106
|
+
* @returns {Promise<void>}
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* // Delete a file
|
|
110
|
+
* await fs.deleteFile('app/temp.log');
|
|
111
|
+
*/
|
|
112
|
+
deleteFile(path: string, recursive?: boolean): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Downloads a file from the Sandbox. This method loads the entire file into memory, so it is not recommended
|
|
115
|
+
* for downloading large files.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} remotePath - Path to the file to download. Relative paths are resolved based on the sandbox working directory.
|
|
118
|
+
* @param {number} [timeout] - Timeout for the download operation in seconds. 0 means no timeout.
|
|
119
|
+
* Default is 30 minutes.
|
|
120
|
+
* @returns {Promise<Buffer>} The file contents as a Buffer.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* // Download and process a file
|
|
124
|
+
* const fileBuffer = await fs.downloadFile('tmp/data.json');
|
|
125
|
+
* console.log('File content:', fileBuffer.toString());
|
|
126
|
+
*/
|
|
127
|
+
downloadFile(remotePath: string, timeout?: number): Promise<Buffer>;
|
|
128
|
+
/**
|
|
129
|
+
* Downloads a file from the Sandbox and saves it to a local file. This method uses streaming to download the file,
|
|
130
|
+
* so it is recommended for downloading larger files.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} remotePath - Path to the file to download in the Sandbox. Relative paths are resolved based on the sandbox working directory.
|
|
133
|
+
* @param {string} localPath - Path to save the downloaded file.
|
|
134
|
+
* @param {number} [timeout] - Timeout for the download operation in seconds. 0 means no timeout.
|
|
135
|
+
* Default is 30 minutes.
|
|
136
|
+
* @returns {Promise<void>}
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // Download and save a file
|
|
140
|
+
* await fs.downloadFile('tmp/data.json', 'local_file.json');
|
|
141
|
+
*/
|
|
142
|
+
downloadFile(remotePath: string, localPath: string, timeout?: number): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Downloads multiple files from the Sandbox. If the files already exist locally, they will be overwritten.
|
|
145
|
+
*
|
|
146
|
+
* @param {FileDownloadRequest[]} files - Array of file download requests.
|
|
147
|
+
* @param {number} [timeoutSec] - Timeout for the download operation in seconds. 0 means no timeout.
|
|
148
|
+
* Default is 30 minutes.
|
|
149
|
+
* @returns {Promise<FileDownloadResponse[]>} Array of download results.
|
|
150
|
+
*
|
|
151
|
+
* @throws {DaytonaError} If the request itself fails (network issues, invalid request/response, etc.). Individual
|
|
152
|
+
* file download errors are returned in the `FileDownloadResponse.error` field.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* // Download multiple files
|
|
156
|
+
* const results = await fs.downloadFiles([
|
|
157
|
+
* { source: 'tmp/data.json' },
|
|
158
|
+
* { source: 'tmp/config.json', destination: 'local_config.json' }
|
|
159
|
+
* ]);
|
|
160
|
+
* results.forEach(result => {
|
|
161
|
+
* if (result.error) {
|
|
162
|
+
* console.error(`Error downloading ${result.source}: ${result.error}`);
|
|
163
|
+
* } else if (result.result) {
|
|
164
|
+
* console.log(`Downloaded ${result.source} to ${result.result}`);
|
|
165
|
+
* }
|
|
166
|
+
* });
|
|
167
|
+
*/
|
|
168
|
+
downloadFiles(files: FileDownloadRequest[], timeoutSec?: number): Promise<FileDownloadResponse[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Searches for text patterns within files in the Sandbox.
|
|
171
|
+
*
|
|
172
|
+
* @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
|
|
173
|
+
* @param {string} pattern - Search pattern
|
|
174
|
+
* @returns {Promise<Array<Match>>} Array of matches with file and line information
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* // Find all TODO comments in TypeScript files
|
|
178
|
+
* const matches = await fs.findFiles('app/src', 'TODO:');
|
|
179
|
+
* matches.forEach(match => {
|
|
180
|
+
* console.log(`${match.file}:${match.line}: ${match.content}`);
|
|
181
|
+
* });
|
|
182
|
+
*/
|
|
183
|
+
findFiles(path: string, pattern: string): Promise<Array<Match>>;
|
|
184
|
+
/**
|
|
185
|
+
* Retrieves detailed information about a file or directory.
|
|
186
|
+
*
|
|
187
|
+
* @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
|
|
188
|
+
* @returns {Promise<FileInfo>} Detailed file information including size, permissions, modification time
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* // Get file details
|
|
192
|
+
* const info = await fs.getFileDetails('app/config.json');
|
|
193
|
+
* console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
|
|
194
|
+
*/
|
|
195
|
+
getFileDetails(path: string): Promise<FileInfo>;
|
|
196
|
+
/**
|
|
197
|
+
* Lists contents of a directory in the Sandbox.
|
|
198
|
+
*
|
|
199
|
+
* @param {string} path - Directory path to list. Relative paths are resolved based on the sandbox working directory.
|
|
200
|
+
* @returns {Promise<FileInfo[]>} Array of file and directory information
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* // List directory contents
|
|
204
|
+
* const files = await fs.listFiles('app/src');
|
|
205
|
+
* files.forEach(file => {
|
|
206
|
+
* console.log(`${file.name} (${file.size} bytes)`);
|
|
207
|
+
* });
|
|
208
|
+
*/
|
|
209
|
+
listFiles(path: string): Promise<FileInfo[]>;
|
|
210
|
+
/**
|
|
211
|
+
* Moves or renames a file or directory.
|
|
212
|
+
*
|
|
213
|
+
* @param {string} source - Source path. Relative paths are resolved based on the sandbox working directory.
|
|
214
|
+
* @param {string} destination - Destination path. Relative paths are resolved based on the sandbox working directory.
|
|
215
|
+
* @returns {Promise<void>}
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* // Move a file to a new location
|
|
219
|
+
* await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
|
|
220
|
+
*/
|
|
221
|
+
moveFiles(source: string, destination: string): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Replaces text content in multiple files.
|
|
224
|
+
*
|
|
225
|
+
* @param {string[]} files - Array of file paths to process. Relative paths are resolved based on the sandbox working directory.
|
|
226
|
+
* @param {string} pattern - Pattern to replace
|
|
227
|
+
* @param {string} newValue - Replacement text
|
|
228
|
+
* @returns {Promise<Array<ReplaceResult>>} Results of the replace operation for each file
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* // Update version number across multiple files
|
|
232
|
+
* const results = await fs.replaceInFiles(
|
|
233
|
+
* ['app/package.json', 'app/version.ts'],
|
|
234
|
+
* '"version": "1.0.0"',
|
|
235
|
+
* '"version": "1.1.0"'
|
|
236
|
+
* );
|
|
237
|
+
*/
|
|
238
|
+
replaceInFiles(files: string[], pattern: string, newValue: string): Promise<Array<ReplaceResult>>;
|
|
239
|
+
/**
|
|
240
|
+
* Searches for files and directories by name pattern in the Sandbox.
|
|
241
|
+
*
|
|
242
|
+
* @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
|
|
243
|
+
* @param {string} pattern - File name pattern (supports globs)
|
|
244
|
+
* @returns {Promise<SearchFilesResponse>} Search results with matching files
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* // Find all TypeScript files
|
|
248
|
+
* const result = await fs.searchFiles('app', '*.ts');
|
|
249
|
+
* result.files.forEach(file => console.log(file));
|
|
250
|
+
*/
|
|
251
|
+
searchFiles(path: string, pattern: string): Promise<SearchFilesResponse>;
|
|
252
|
+
/**
|
|
253
|
+
* Sets permissions and ownership for a file or directory.
|
|
254
|
+
*
|
|
255
|
+
* @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
|
|
256
|
+
* @param {FilePermissionsParams} permissions - Permission settings
|
|
257
|
+
* @returns {Promise<void>}
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* // Set file permissions and ownership
|
|
261
|
+
* await fs.setFilePermissions('app/script.sh', {
|
|
262
|
+
* owner: 'daytona',
|
|
263
|
+
* group: 'users',
|
|
264
|
+
* mode: '755' // Execute permission for shell script
|
|
265
|
+
* });
|
|
266
|
+
*/
|
|
267
|
+
setFilePermissions(path: string, permissions: FilePermissionsParams): Promise<void>;
|
|
268
|
+
/**
|
|
269
|
+
* Uploads a file to the Sandbox. This method loads the entire file into memory, so it is not recommended
|
|
270
|
+
* for uploading large files.
|
|
271
|
+
*
|
|
272
|
+
* @param {Buffer} file - Buffer of the file to upload.
|
|
273
|
+
* @param {string} remotePath - Destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
|
|
274
|
+
* @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
|
|
275
|
+
* Default is 30 minutes.
|
|
276
|
+
* @returns {Promise<void>}
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* // Upload a configuration file
|
|
280
|
+
* await fs.uploadFile(Buffer.from('{"setting": "value"}'), 'tmp/config.json');
|
|
281
|
+
*/
|
|
282
|
+
uploadFile(file: Buffer, remotePath: string, timeout?: number): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Uploads a file from the local file system to the Sandbox. This method uses streaming to upload the file,
|
|
285
|
+
* so it is recommended for uploading larger files.
|
|
286
|
+
*
|
|
287
|
+
* @param {string} localPath - Path to the local file to upload.
|
|
288
|
+
* @param {string} remotePath - Destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
|
|
289
|
+
* @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
|
|
290
|
+
* Default is 30 minutes.
|
|
291
|
+
* @returns {Promise<void>}
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* // Upload a local file
|
|
295
|
+
* await fs.uploadFile('local_file.txt', 'tmp/file.txt');
|
|
296
|
+
*/
|
|
297
|
+
uploadFile(localPath: string, remotePath: string, timeout?: number): Promise<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Uploads multiple files to the Sandbox. If files already exist at the destination paths,
|
|
300
|
+
* they will be overwritten.
|
|
301
|
+
*
|
|
302
|
+
* @param {FileUpload[]} files - Array of files to upload.
|
|
303
|
+
* @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
|
|
304
|
+
* Default is 30 minutes.
|
|
305
|
+
* @returns {Promise<void>}
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* // Upload multiple text files
|
|
309
|
+
* const files = [
|
|
310
|
+
* {
|
|
311
|
+
* source: Buffer.from('Content of file 1'),
|
|
312
|
+
* destination: '/tmp/file1.txt'
|
|
313
|
+
* },
|
|
314
|
+
* {
|
|
315
|
+
* source: 'app/data/file2.txt',
|
|
316
|
+
* destination: '/tmp/file2.txt'
|
|
317
|
+
* },
|
|
318
|
+
* {
|
|
319
|
+
* source: Buffer.from('{"key": "value"}'),
|
|
320
|
+
* destination: '/tmp/config.json'
|
|
321
|
+
* }
|
|
322
|
+
* ];
|
|
323
|
+
* await fs.uploadFiles(files);
|
|
324
|
+
*/
|
|
325
|
+
uploadFiles(files: FileUpload[], timeout?: number): Promise<void>;
|
|
326
|
+
private makeFilePayload;
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=FileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/FileSystem.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,EAEL,aAAa,EACb,mBAAmB,EACpB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAU7D;;;;;;;;;;;;;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EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhG;;;;;;;;;;;;;OAaG;IACU,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1F;;;;;;;;;;;;;OAaG;IACU,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/F;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACU,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,OAAO,GAAE,MAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;YAgCzE,eAAe;CAiB9B"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import * as pathe from 'pathe';
|
|
6
|
+
import { dynamicImport } from './utils/Import.js';
|
|
7
|
+
import { RUNTIME, Runtime } from './utils/Runtime.js';
|
|
8
|
+
import { DaytonaError } from './errors/DaytonaError.js';
|
|
9
|
+
import { normalizeResponseStream, processDownloadFilesResponseWithBusboy, processDownloadFilesResponseWithBuffered, } from './utils/FileTransfer.js';
|
|
10
|
+
/**
|
|
11
|
+
* Provides file system operations within a Sandbox.
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
export class FileSystem {
|
|
16
|
+
clientConfig;
|
|
17
|
+
apiClient;
|
|
18
|
+
ensureToolboxUrl;
|
|
19
|
+
constructor(clientConfig, apiClient, ensureToolboxUrl) {
|
|
20
|
+
this.clientConfig = clientConfig;
|
|
21
|
+
this.apiClient = apiClient;
|
|
22
|
+
this.ensureToolboxUrl = ensureToolboxUrl;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a new directory in the Sandbox with specified permissions.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} path - Path where the directory should be created. Relative paths are resolved based on the sandbox working directory.
|
|
28
|
+
* @param {string} mode - Directory permissions in octal format (e.g. "755")
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Create a directory with standard permissions
|
|
33
|
+
* await fs.createFolder('app/data', '755');
|
|
34
|
+
*/
|
|
35
|
+
async createFolder(path, mode) {
|
|
36
|
+
const response = await this.apiClient.createFolder(path, mode);
|
|
37
|
+
return response.data;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Deletes a file or directory from the Sandbox.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the sandbox working directory.
|
|
43
|
+
* @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
|
|
44
|
+
* @returns {Promise<void>}
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Delete a file
|
|
48
|
+
* await fs.deleteFile('app/temp.log');
|
|
49
|
+
*/
|
|
50
|
+
async deleteFile(path, recursive) {
|
|
51
|
+
const response = await this.apiClient.deleteFile(path, recursive);
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
async downloadFile(src, dst, timeout = 30 * 60) {
|
|
55
|
+
const remotePath = src;
|
|
56
|
+
if (typeof dst !== 'string') {
|
|
57
|
+
if (dst) {
|
|
58
|
+
timeout = dst;
|
|
59
|
+
}
|
|
60
|
+
const response = await this.downloadFiles([{ source: remotePath }], timeout);
|
|
61
|
+
if (response[0].error) {
|
|
62
|
+
throw new DaytonaError(response[0].error);
|
|
63
|
+
}
|
|
64
|
+
return response[0].result;
|
|
65
|
+
}
|
|
66
|
+
const response = await this.downloadFiles([{ source: remotePath, destination: dst }], timeout);
|
|
67
|
+
if (response[0].error) {
|
|
68
|
+
throw new DaytonaError(response[0].error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Downloads multiple files from the Sandbox. If the files already exist locally, they will be overwritten.
|
|
73
|
+
*
|
|
74
|
+
* @param {FileDownloadRequest[]} files - Array of file download requests.
|
|
75
|
+
* @param {number} [timeoutSec] - Timeout for the download operation in seconds. 0 means no timeout.
|
|
76
|
+
* Default is 30 minutes.
|
|
77
|
+
* @returns {Promise<FileDownloadResponse[]>} Array of download results.
|
|
78
|
+
*
|
|
79
|
+
* @throws {DaytonaError} If the request itself fails (network issues, invalid request/response, etc.). Individual
|
|
80
|
+
* file download errors are returned in the `FileDownloadResponse.error` field.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* // Download multiple files
|
|
84
|
+
* const results = await fs.downloadFiles([
|
|
85
|
+
* { source: 'tmp/data.json' },
|
|
86
|
+
* { source: 'tmp/config.json', destination: 'local_config.json' }
|
|
87
|
+
* ]);
|
|
88
|
+
* results.forEach(result => {
|
|
89
|
+
* if (result.error) {
|
|
90
|
+
* console.error(`Error downloading ${result.source}: ${result.error}`);
|
|
91
|
+
* } else if (result.result) {
|
|
92
|
+
* console.log(`Downloaded ${result.source} to ${result.result}`);
|
|
93
|
+
* }
|
|
94
|
+
* });
|
|
95
|
+
*/
|
|
96
|
+
async downloadFiles(files, timeoutSec = 30 * 60) {
|
|
97
|
+
if (files.length === 0)
|
|
98
|
+
return [];
|
|
99
|
+
const isNonStreamingRuntime = RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS;
|
|
100
|
+
// Prepare destinations and metadata
|
|
101
|
+
const metadataMap = new Map();
|
|
102
|
+
for (const f of files) {
|
|
103
|
+
metadataMap.set(f.source, { destination: f.destination });
|
|
104
|
+
if (f.destination) {
|
|
105
|
+
const fs = await dynamicImport('fs', 'Downloading files to local files is not supported: ');
|
|
106
|
+
await fs.promises.mkdir(pathe.dirname(f.destination), { recursive: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const response = await this.apiClient.downloadFiles({ paths: files.map((f) => f.source) }, {
|
|
110
|
+
responseType: isNonStreamingRuntime ? 'arraybuffer' : 'stream',
|
|
111
|
+
timeout: timeoutSec * 1000,
|
|
112
|
+
});
|
|
113
|
+
const stream = normalizeResponseStream(response.data);
|
|
114
|
+
// Node.js path: use busboy for efficient streaming
|
|
115
|
+
if (isNonStreamingRuntime) {
|
|
116
|
+
await processDownloadFilesResponseWithBuffered(stream, response.headers, metadataMap);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
await processDownloadFilesResponseWithBusboy(stream, response.headers, metadataMap);
|
|
120
|
+
}
|
|
121
|
+
return files.map((f) => {
|
|
122
|
+
const metadata = metadataMap.get(f.source);
|
|
123
|
+
const error = metadata?.error || (!metadata?.result ? 'No data received for this file' : undefined);
|
|
124
|
+
return {
|
|
125
|
+
source: f.source,
|
|
126
|
+
result: error ? undefined : metadata.result,
|
|
127
|
+
error,
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Searches for text patterns within files in the Sandbox.
|
|
133
|
+
*
|
|
134
|
+
* @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
|
|
135
|
+
* @param {string} pattern - Search pattern
|
|
136
|
+
* @returns {Promise<Array<Match>>} Array of matches with file and line information
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // Find all TODO comments in TypeScript files
|
|
140
|
+
* const matches = await fs.findFiles('app/src', 'TODO:');
|
|
141
|
+
* matches.forEach(match => {
|
|
142
|
+
* console.log(`${match.file}:${match.line}: ${match.content}`);
|
|
143
|
+
* });
|
|
144
|
+
*/
|
|
145
|
+
async findFiles(path, pattern) {
|
|
146
|
+
const response = await this.apiClient.findInFiles(path, pattern);
|
|
147
|
+
return response.data;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Retrieves detailed information about a file or directory.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
|
|
153
|
+
* @returns {Promise<FileInfo>} Detailed file information including size, permissions, modification time
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* // Get file details
|
|
157
|
+
* const info = await fs.getFileDetails('app/config.json');
|
|
158
|
+
* console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
|
|
159
|
+
*/
|
|
160
|
+
async getFileDetails(path) {
|
|
161
|
+
const response = await this.apiClient.getFileInfo(path);
|
|
162
|
+
return response.data;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Lists contents of a directory in the Sandbox.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} path - Directory path to list. Relative paths are resolved based on the sandbox working directory.
|
|
168
|
+
* @returns {Promise<FileInfo[]>} Array of file and directory information
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* // List directory contents
|
|
172
|
+
* const files = await fs.listFiles('app/src');
|
|
173
|
+
* files.forEach(file => {
|
|
174
|
+
* console.log(`${file.name} (${file.size} bytes)`);
|
|
175
|
+
* });
|
|
176
|
+
*/
|
|
177
|
+
async listFiles(path) {
|
|
178
|
+
const response = await this.apiClient.listFiles(path);
|
|
179
|
+
return response.data;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Moves or renames a file or directory.
|
|
183
|
+
*
|
|
184
|
+
* @param {string} source - Source path. Relative paths are resolved based on the sandbox working directory.
|
|
185
|
+
* @param {string} destination - Destination path. Relative paths are resolved based on the sandbox working directory.
|
|
186
|
+
* @returns {Promise<void>}
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* // Move a file to a new location
|
|
190
|
+
* await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
|
|
191
|
+
*/
|
|
192
|
+
async moveFiles(source, destination) {
|
|
193
|
+
const response = await this.apiClient.moveFile(source, destination);
|
|
194
|
+
return response.data;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Replaces text content in multiple files.
|
|
198
|
+
*
|
|
199
|
+
* @param {string[]} files - Array of file paths to process. Relative paths are resolved based on the sandbox working directory.
|
|
200
|
+
* @param {string} pattern - Pattern to replace
|
|
201
|
+
* @param {string} newValue - Replacement text
|
|
202
|
+
* @returns {Promise<Array<ReplaceResult>>} Results of the replace operation for each file
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* // Update version number across multiple files
|
|
206
|
+
* const results = await fs.replaceInFiles(
|
|
207
|
+
* ['app/package.json', 'app/version.ts'],
|
|
208
|
+
* '"version": "1.0.0"',
|
|
209
|
+
* '"version": "1.1.0"'
|
|
210
|
+
* );
|
|
211
|
+
*/
|
|
212
|
+
async replaceInFiles(files, pattern, newValue) {
|
|
213
|
+
const replaceRequest = {
|
|
214
|
+
files,
|
|
215
|
+
newValue,
|
|
216
|
+
pattern,
|
|
217
|
+
};
|
|
218
|
+
const response = await this.apiClient.replaceInFiles(replaceRequest);
|
|
219
|
+
return response.data;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Searches for files and directories by name pattern in the Sandbox.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
|
|
225
|
+
* @param {string} pattern - File name pattern (supports globs)
|
|
226
|
+
* @returns {Promise<SearchFilesResponse>} Search results with matching files
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* // Find all TypeScript files
|
|
230
|
+
* const result = await fs.searchFiles('app', '*.ts');
|
|
231
|
+
* result.files.forEach(file => console.log(file));
|
|
232
|
+
*/
|
|
233
|
+
async searchFiles(path, pattern) {
|
|
234
|
+
const response = await this.apiClient.searchFiles(path, pattern);
|
|
235
|
+
return response.data;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Sets permissions and ownership for a file or directory.
|
|
239
|
+
*
|
|
240
|
+
* @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
|
|
241
|
+
* @param {FilePermissionsParams} permissions - Permission settings
|
|
242
|
+
* @returns {Promise<void>}
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* // Set file permissions and ownership
|
|
246
|
+
* await fs.setFilePermissions('app/script.sh', {
|
|
247
|
+
* owner: 'daytona',
|
|
248
|
+
* group: 'users',
|
|
249
|
+
* mode: '755' // Execute permission for shell script
|
|
250
|
+
* });
|
|
251
|
+
*/
|
|
252
|
+
async setFilePermissions(path, permissions) {
|
|
253
|
+
const response = await this.apiClient.setFilePermissions(path, permissions.owner, permissions.group, permissions.mode);
|
|
254
|
+
return response.data;
|
|
255
|
+
}
|
|
256
|
+
async uploadFile(src, dst, timeout = 30 * 60) {
|
|
257
|
+
await this.uploadFiles([{ source: src, destination: dst }], timeout);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Uploads multiple files to the Sandbox. If files already exist at the destination paths,
|
|
261
|
+
* they will be overwritten.
|
|
262
|
+
*
|
|
263
|
+
* @param {FileUpload[]} files - Array of files to upload.
|
|
264
|
+
* @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
|
|
265
|
+
* Default is 30 minutes.
|
|
266
|
+
* @returns {Promise<void>}
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* // Upload multiple text files
|
|
270
|
+
* const files = [
|
|
271
|
+
* {
|
|
272
|
+
* source: Buffer.from('Content of file 1'),
|
|
273
|
+
* destination: '/tmp/file1.txt'
|
|
274
|
+
* },
|
|
275
|
+
* {
|
|
276
|
+
* source: 'app/data/file2.txt',
|
|
277
|
+
* destination: '/tmp/file2.txt'
|
|
278
|
+
* },
|
|
279
|
+
* {
|
|
280
|
+
* source: Buffer.from('{"key": "value"}'),
|
|
281
|
+
* destination: '/tmp/config.json'
|
|
282
|
+
* }
|
|
283
|
+
* ];
|
|
284
|
+
* await fs.uploadFiles(files);
|
|
285
|
+
*/
|
|
286
|
+
async uploadFiles(files, timeout = 30 * 60) {
|
|
287
|
+
const isNonStreamingRuntime = RUNTIME === Runtime.DENO || RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS;
|
|
288
|
+
const FormDataClass = isNonStreamingRuntime
|
|
289
|
+
? FormData
|
|
290
|
+
: (await dynamicImport('form-data', 'Uploading files is not supported: '));
|
|
291
|
+
const form = new FormDataClass();
|
|
292
|
+
for (const [i, { source, destination }] of files.entries()) {
|
|
293
|
+
form.append(`files[${i}].path`, destination);
|
|
294
|
+
const payload = await this.makeFilePayload(source);
|
|
295
|
+
form.append(`files[${i}].file`, payload, destination);
|
|
296
|
+
}
|
|
297
|
+
if (isNonStreamingRuntime) {
|
|
298
|
+
await this.ensureToolboxUrl();
|
|
299
|
+
const url = `${this.clientConfig.basePath}/files/bulk-upload`;
|
|
300
|
+
await fetch(url, {
|
|
301
|
+
method: 'POST',
|
|
302
|
+
headers: this.clientConfig.baseOptions.headers,
|
|
303
|
+
body: form,
|
|
304
|
+
signal: timeout ? AbortSignal.timeout(timeout * 1000) : undefined,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
await this.apiClient.uploadFiles({
|
|
309
|
+
data: form,
|
|
310
|
+
maxRedirects: 0,
|
|
311
|
+
timeout: timeout * 1000,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
async makeFilePayload(source) {
|
|
316
|
+
// String = file path
|
|
317
|
+
if (typeof source === 'string') {
|
|
318
|
+
const fs = await dynamicImport('fs', 'Uploading file from local file system is not supported: ');
|
|
319
|
+
return fs.createReadStream(source);
|
|
320
|
+
}
|
|
321
|
+
// Blob
|
|
322
|
+
if (RUNTIME === Runtime.BROWSER || RUNTIME === Runtime.SERVERLESS || RUNTIME === Runtime.DENO) {
|
|
323
|
+
// Use .slice() to ensure we have a concrete ArrayBuffer, not ArrayBufferLike
|
|
324
|
+
return new Blob([source.slice()], { type: 'application/octet-stream' });
|
|
325
|
+
}
|
|
326
|
+
// Readable stream
|
|
327
|
+
const stream = await dynamicImport('stream', 'Uploading file is not supported: ');
|
|
328
|
+
return stream.Readable.from(source);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=FileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/FileSystem.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,uBAAuB,EACvB,sCAAsC,EACtC,wCAAwC,GACzC,MAAM,sBAAsB,CAAA;AAmF7B;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAEF;IACA;IACA;IAHnB,YACmB,YAA2B,EAC3B,SAAwB,EACxB,gBAAqC;QAFrC,iBAAY,GAAZ,YAAY,CAAe;QAC3B,cAAS,GAAT,SAAS,CAAe;QACxB,qBAAgB,GAAhB,gBAAgB,CAAqB;IACrD,CAAC;IAEJ;;;;;;;;;;OAUG;IACI,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,IAAY;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC9D,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,SAAmB;QACvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QACjE,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAgCM,KAAK,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