@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
package/esm/Daytona.d.ts
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { SandboxVolume } from '@daytonaio/api-client';
|
|
2
|
+
import { Image } from './Image.js';
|
|
3
|
+
import { Sandbox, PaginatedSandboxes } from './Sandbox.js';
|
|
4
|
+
import { SnapshotService } from './Snapshot.js';
|
|
5
|
+
import { VolumeService } from './Volume.js';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a volume mount for a Sandbox.
|
|
8
|
+
*
|
|
9
|
+
* @interface
|
|
10
|
+
* @property {string} volumeId - ID of the Volume to mount
|
|
11
|
+
* @property {string} mountPath - Path on the Sandbox to mount the Volume
|
|
12
|
+
*/
|
|
13
|
+
export interface VolumeMount extends SandboxVolume {
|
|
14
|
+
volumeId: string;
|
|
15
|
+
mountPath: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration options for initializing the Daytona client.
|
|
19
|
+
*
|
|
20
|
+
* @interface
|
|
21
|
+
* @property {string} apiKey - API key for authentication with the Daytona API
|
|
22
|
+
* @property {string} jwtToken - JWT token for authentication with the Daytona API. If not set, it must be provided
|
|
23
|
+
* via the environment variable `DAYTONA_JWT_TOKEN`, or an API key must be provided instead.
|
|
24
|
+
* @property {string} organizationId - Organization ID used for JWT-based authentication. Required if a JWT token
|
|
25
|
+
* is provided, and must be set either here or in the environment variable `DAYTONA_ORGANIZATION_ID`.
|
|
26
|
+
* @property {string} apiUrl - URL of the Daytona API. Defaults to 'https://app.daytona.io/api'
|
|
27
|
+
* if not set here and not set in environment variable DAYTONA_API_URL.
|
|
28
|
+
* @property {string} target - Target location for Sandboxes
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const config: DaytonaConfig = {
|
|
32
|
+
* apiKey: "your-api-key",
|
|
33
|
+
* apiUrl: "https://your-api.com",
|
|
34
|
+
* target: "us"
|
|
35
|
+
* };
|
|
36
|
+
* const daytona = new Daytona(config);
|
|
37
|
+
*/
|
|
38
|
+
export interface DaytonaConfig {
|
|
39
|
+
/** API key for authentication with the Daytona API */
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
/** JWT token for authentication with the Daytona API */
|
|
42
|
+
jwtToken?: string;
|
|
43
|
+
/** Organization ID for authentication with the Daytona API */
|
|
44
|
+
organizationId?: string;
|
|
45
|
+
/** URL of the Daytona API.
|
|
46
|
+
*/
|
|
47
|
+
apiUrl?: string;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Use `apiUrl` instead. This property will be removed in future versions.
|
|
50
|
+
*/
|
|
51
|
+
serverUrl?: string;
|
|
52
|
+
/** Target environment for sandboxes */
|
|
53
|
+
target?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Supported programming languages for code execution
|
|
57
|
+
*
|
|
58
|
+
* Python is used as the default sandbox language when no language is explicitly specified.
|
|
59
|
+
*/
|
|
60
|
+
export declare enum CodeLanguage {
|
|
61
|
+
PYTHON = "python",
|
|
62
|
+
TYPESCRIPT = "typescript",
|
|
63
|
+
JAVASCRIPT = "javascript"
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resource allocation for a Sandbox.
|
|
67
|
+
*
|
|
68
|
+
* @interface
|
|
69
|
+
* @property {number} [cpu] - CPU allocation for the Sandbox in cores
|
|
70
|
+
* @property {number} [gpu] - GPU allocation for the Sandbox in units
|
|
71
|
+
* @property {number} [memory] - Memory allocation for the Sandbox in GiB
|
|
72
|
+
* @property {number} [disk] - Disk space allocation for the Sandbox in GiB
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* const resources: SandboxResources = {
|
|
76
|
+
* cpu: 2,
|
|
77
|
+
* memory: 4, // 4GiB RAM
|
|
78
|
+
* disk: 20 // 20GiB disk
|
|
79
|
+
* };
|
|
80
|
+
*/
|
|
81
|
+
export interface Resources {
|
|
82
|
+
/** CPU allocation for the Sandbox */
|
|
83
|
+
cpu?: number;
|
|
84
|
+
/** GPU allocation for the Sandbox */
|
|
85
|
+
gpu?: number;
|
|
86
|
+
/** Memory allocation for the Sandbox in GiB */
|
|
87
|
+
memory?: number;
|
|
88
|
+
/** Disk space allocation for the Sandbox in GiB */
|
|
89
|
+
disk?: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Base parameters for creating a new Sandbox.
|
|
93
|
+
*
|
|
94
|
+
* @interface
|
|
95
|
+
* @property {string} [user] - Optional os user to use for the Sandbox
|
|
96
|
+
* @property {CodeLanguage | string} [language] - Programming language for direct code execution. Defaults to "python" if not specified.
|
|
97
|
+
* @property {Record<string, string>} [envVars] - Optional environment variables to set in the Sandbox
|
|
98
|
+
* @property {Record<string, string>} [labels] - Sandbox labels
|
|
99
|
+
* @property {boolean} [public] - Is the Sandbox port preview public
|
|
100
|
+
* @property {number} [autoStopInterval] - Auto-stop interval in minutes (0 means disabled). Default is 15 minutes.
|
|
101
|
+
* @property {number} [autoArchiveInterval] - Auto-archive interval in minutes (0 means the maximum interval will be used). Default is 7 days.
|
|
102
|
+
* @property {number} [autoDeleteInterval] - Auto-delete interval in minutes (negative value means disabled, 0 means delete immediately upon stopping). By default, auto-delete is disabled.
|
|
103
|
+
* @property {VolumeMount[]} [volumes] - Optional array of volumes to mount to the Sandbox
|
|
104
|
+
* @property {boolean} [networkBlockAll] - Whether to block all network access for the Sandbox
|
|
105
|
+
* @property {string} [networkAllowList] - Comma-separated list of allowed CIDR network addresses for the Sandbox
|
|
106
|
+
* @property {boolean} [ephemeral] - Whether the Sandbox should be ephemeral. If true, autoDeleteInterval will be set to 0.
|
|
107
|
+
*/
|
|
108
|
+
export type CreateSandboxBaseParams = {
|
|
109
|
+
name?: string;
|
|
110
|
+
user?: string;
|
|
111
|
+
language?: CodeLanguage | string;
|
|
112
|
+
envVars?: Record<string, string>;
|
|
113
|
+
labels?: Record<string, string>;
|
|
114
|
+
public?: boolean;
|
|
115
|
+
autoStopInterval?: number;
|
|
116
|
+
autoArchiveInterval?: number;
|
|
117
|
+
autoDeleteInterval?: number;
|
|
118
|
+
volumes?: VolumeMount[];
|
|
119
|
+
networkBlockAll?: boolean;
|
|
120
|
+
networkAllowList?: string;
|
|
121
|
+
ephemeral?: boolean;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Parameters for creating a new Sandbox.
|
|
125
|
+
*
|
|
126
|
+
* @interface
|
|
127
|
+
* @property {string | Image} [image] - Custom Docker image to use for the Sandbox. If an Image object is provided,
|
|
128
|
+
* the image will be dynamically built.
|
|
129
|
+
* @property {Resources} [resources] - Resource allocation for the Sandbox. If not provided, sandbox will
|
|
130
|
+
* have default resources.
|
|
131
|
+
*/
|
|
132
|
+
export type CreateSandboxFromImageParams = CreateSandboxBaseParams & {
|
|
133
|
+
image: string | Image;
|
|
134
|
+
resources?: Resources;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Parameters for creating a new Sandbox from a snapshot.
|
|
138
|
+
*
|
|
139
|
+
* @interface
|
|
140
|
+
* @property {string} [snapshot] - Name of the snapshot to use for the Sandbox.
|
|
141
|
+
*/
|
|
142
|
+
export type CreateSandboxFromSnapshotParams = CreateSandboxBaseParams & {
|
|
143
|
+
snapshot?: string;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Filter for Sandboxes.
|
|
147
|
+
*
|
|
148
|
+
* @interface
|
|
149
|
+
* @property {string} [idOrName] - The ID or name of the Sandbox to retrieve
|
|
150
|
+
* @property {Record<string, string>} [labels] - Labels to filter Sandboxes
|
|
151
|
+
*/
|
|
152
|
+
export type SandboxFilter = {
|
|
153
|
+
idOrName?: string;
|
|
154
|
+
labels?: Record<string, string>;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Main class for interacting with the Daytona API.
|
|
158
|
+
* Provides methods for creating, managing, and interacting with Daytona Sandboxes.
|
|
159
|
+
* Can be initialized either with explicit configuration or using environment variables.
|
|
160
|
+
*
|
|
161
|
+
* @property {VolumeService} volume - Service for managing Daytona Volumes
|
|
162
|
+
* @property {SnapshotService} snapshot - Service for managing Daytona Snapshots
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* // Using environment variables
|
|
166
|
+
* // Uses DAYTONA_API_KEY, DAYTONA_API_URL, DAYTONA_TARGET
|
|
167
|
+
* const daytona = new Daytona();
|
|
168
|
+
* const sandbox = await daytona.create();
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* // Using explicit configuration
|
|
172
|
+
* const config: DaytonaConfig = {
|
|
173
|
+
* apiKey: "your-api-key",
|
|
174
|
+
* apiUrl: "https://your-api.com",
|
|
175
|
+
* target: "us"
|
|
176
|
+
* };
|
|
177
|
+
* const daytona = new Daytona(config);
|
|
178
|
+
*
|
|
179
|
+
* @class
|
|
180
|
+
*/
|
|
181
|
+
export declare class Daytona {
|
|
182
|
+
private readonly clientConfig;
|
|
183
|
+
private readonly sandboxApi;
|
|
184
|
+
private readonly objectStorageApi;
|
|
185
|
+
private readonly configApi;
|
|
186
|
+
private readonly target?;
|
|
187
|
+
private readonly apiKey?;
|
|
188
|
+
private readonly jwtToken?;
|
|
189
|
+
private readonly organizationId?;
|
|
190
|
+
private readonly apiUrl;
|
|
191
|
+
private proxyToolboxUrl?;
|
|
192
|
+
readonly volume: VolumeService;
|
|
193
|
+
readonly snapshot: SnapshotService;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a new Daytona client instance.
|
|
196
|
+
*
|
|
197
|
+
* @param {DaytonaConfig} [config] - Configuration options
|
|
198
|
+
* @throws {DaytonaError} - `DaytonaError` - When API key is missing
|
|
199
|
+
*/
|
|
200
|
+
constructor(config?: DaytonaConfig);
|
|
201
|
+
/**
|
|
202
|
+
* Creates Sandboxes from specified or default snapshot. You can specify various parameters,
|
|
203
|
+
* including language, image, environment variables, and volumes.
|
|
204
|
+
*
|
|
205
|
+
* @param {CreateSandboxFromSnapshotParams} [params] - Parameters for Sandbox creation from snapshot
|
|
206
|
+
* @param {object} [options] - Options for the create operation
|
|
207
|
+
* @param {number} [options.timeout] - Timeout in seconds (0 means no timeout, default is 60)
|
|
208
|
+
* @returns {Promise<Sandbox>} The created Sandbox instance
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* const sandbox = await daytona.create();
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* // Create a custom sandbox
|
|
215
|
+
* const params: CreateSandboxFromSnapshotParams = {
|
|
216
|
+
* language: 'typescript',
|
|
217
|
+
* snapshot: 'my-snapshot-id',
|
|
218
|
+
* envVars: {
|
|
219
|
+
* NODE_ENV: 'development',
|
|
220
|
+
* DEBUG: 'true'
|
|
221
|
+
* },
|
|
222
|
+
* autoStopInterval: 60,
|
|
223
|
+
* autoArchiveInterval: 60,
|
|
224
|
+
* autoDeleteInterval: 120
|
|
225
|
+
* };
|
|
226
|
+
* const sandbox = await daytona.create(params, { timeout: 100 });
|
|
227
|
+
*/
|
|
228
|
+
create(params?: CreateSandboxFromSnapshotParams, options?: {
|
|
229
|
+
timeout?: number;
|
|
230
|
+
}): Promise<Sandbox>;
|
|
231
|
+
/**
|
|
232
|
+
* Creates Sandboxes from specified image available on some registry or declarative Daytona Image. You can specify various parameters,
|
|
233
|
+
* including resources, language, image, environment variables, and volumes. Daytona creates snapshot from
|
|
234
|
+
* provided image and uses it to create Sandbox.
|
|
235
|
+
*
|
|
236
|
+
* @param {CreateSandboxFromImageParams} [params] - Parameters for Sandbox creation from image
|
|
237
|
+
* @param {object} [options] - Options for the create operation
|
|
238
|
+
* @param {number} [options.timeout] - Timeout in seconds (0 means no timeout, default is 60)
|
|
239
|
+
* @param {function} [options.onSnapshotCreateLogs] - Callback function to handle snapshot creation logs.
|
|
240
|
+
* @returns {Promise<Sandbox>} The created Sandbox instance
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* const sandbox = await daytona.create({ image: 'debian:12.9' }, { timeout: 90, onSnapshotCreateLogs: console.log });
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* // Create a custom sandbox
|
|
247
|
+
* const image = Image.base('alpine:3.18').pipInstall('numpy');
|
|
248
|
+
* const params: CreateSandboxFromImageParams = {
|
|
249
|
+
* language: 'typescript',
|
|
250
|
+
* image,
|
|
251
|
+
* envVars: {
|
|
252
|
+
* NODE_ENV: 'development',
|
|
253
|
+
* DEBUG: 'true'
|
|
254
|
+
* },
|
|
255
|
+
* resources: {
|
|
256
|
+
* cpu: 2,
|
|
257
|
+
* memory: 4 // 4GB RAM
|
|
258
|
+
* },
|
|
259
|
+
* autoStopInterval: 60,
|
|
260
|
+
* autoArchiveInterval: 60,
|
|
261
|
+
* autoDeleteInterval: 120
|
|
262
|
+
* };
|
|
263
|
+
* const sandbox = await daytona.create(params, { timeout: 100, onSnapshotCreateLogs: console.log });
|
|
264
|
+
*/
|
|
265
|
+
create(params?: CreateSandboxFromImageParams, options?: {
|
|
266
|
+
onSnapshotCreateLogs?: (chunk: string) => void;
|
|
267
|
+
timeout?: number;
|
|
268
|
+
}): Promise<Sandbox>;
|
|
269
|
+
/**
|
|
270
|
+
* Gets a Sandbox by its ID or name.
|
|
271
|
+
*
|
|
272
|
+
* @param {string} sandboxIdOrName - The ID or name of the Sandbox to retrieve
|
|
273
|
+
* @returns {Promise<Sandbox>} The Sandbox
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* const sandbox = await daytona.get('my-sandbox-id-or-name');
|
|
277
|
+
* console.log(`Sandbox state: ${sandbox.state}`);
|
|
278
|
+
*/
|
|
279
|
+
get(sandboxIdOrName: string): Promise<Sandbox>;
|
|
280
|
+
/**
|
|
281
|
+
* Finds a Sandbox by its ID or name or labels.
|
|
282
|
+
*
|
|
283
|
+
* @param {SandboxFilter} filter - Filter for Sandboxes
|
|
284
|
+
* @returns {Promise<Sandbox>} First Sandbox that matches the ID or name or labels.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* const sandbox = await daytona.findOne({ labels: { 'my-label': 'my-value' } });
|
|
288
|
+
* console.log(`Sandbox ID: ${sandbox.id}, State: ${sandbox.state}`);
|
|
289
|
+
*/
|
|
290
|
+
findOne(filter: SandboxFilter): Promise<Sandbox>;
|
|
291
|
+
/**
|
|
292
|
+
* Returns paginated list of Sandboxes filtered by labels.
|
|
293
|
+
*
|
|
294
|
+
* @param {Record<string, string>} [labels] - Labels to filter Sandboxes
|
|
295
|
+
* @param {number} [page] - Page number for pagination (starting from 1)
|
|
296
|
+
* @param {number} [limit] - Maximum number of items per page
|
|
297
|
+
* @returns {Promise<PaginatedSandboxes>} Paginated list of Sandboxes that match the labels.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* const result = await daytona.list({ 'my-label': 'my-value' }, 2, 10);
|
|
301
|
+
* for (const sandbox of result.items) {
|
|
302
|
+
* console.log(`${sandbox.id}: ${sandbox.state}`);
|
|
303
|
+
* }
|
|
304
|
+
*/
|
|
305
|
+
list(labels?: Record<string, string>, page?: number, limit?: number): Promise<PaginatedSandboxes>;
|
|
306
|
+
/**
|
|
307
|
+
* Starts a Sandbox and waits for it to be ready.
|
|
308
|
+
*
|
|
309
|
+
* @param {Sandbox} sandbox - The Sandbox to start
|
|
310
|
+
* @param {number} [timeout] - Optional timeout in seconds (0 means no timeout)
|
|
311
|
+
* @returns {Promise<void>}
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* const sandbox = await daytona.get('my-sandbox-id');
|
|
315
|
+
* // Wait up to 60 seconds for the sandbox to start
|
|
316
|
+
* await daytona.start(sandbox, 60);
|
|
317
|
+
*/
|
|
318
|
+
start(sandbox: Sandbox, timeout?: number): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Stops a Sandbox.
|
|
321
|
+
*
|
|
322
|
+
* @param {Sandbox} sandbox - The Sandbox to stop
|
|
323
|
+
* @returns {Promise<void>}
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const sandbox = await daytona.get('my-sandbox-id');
|
|
327
|
+
* await daytona.stop(sandbox);
|
|
328
|
+
*/
|
|
329
|
+
stop(sandbox: Sandbox): Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* Deletes a Sandbox.
|
|
332
|
+
*
|
|
333
|
+
* @param {Sandbox} sandbox - The Sandbox to delete
|
|
334
|
+
* @param {number} timeout - Timeout in seconds (0 means no timeout, default is 60)
|
|
335
|
+
* @returns {Promise<void>}
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* const sandbox = await daytona.get('my-sandbox-id');
|
|
339
|
+
* await daytona.delete(sandbox);
|
|
340
|
+
*/
|
|
341
|
+
delete(sandbox: Sandbox, timeout?: number): Promise<void>;
|
|
342
|
+
/**
|
|
343
|
+
* Gets the appropriate code toolbox based on language.
|
|
344
|
+
*
|
|
345
|
+
* @private
|
|
346
|
+
* @param {CodeLanguage} [language] - Programming language for the toolbox
|
|
347
|
+
* @returns {SandboxCodeToolbox} The appropriate code toolbox instance
|
|
348
|
+
* @throws {DaytonaError} - `DaytonaError` - When an unsupported language is specified
|
|
349
|
+
*/
|
|
350
|
+
private getCodeToolbox;
|
|
351
|
+
private createAxiosInstance;
|
|
352
|
+
getProxyToolboxUrl(): Promise<string>;
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=Daytona.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Daytona.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Daytona.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,aAAa,EAEd,MAAM,uBAAuB,CAAA;AAM9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAKxC;;;;;;GAMG;AAEH,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;OACG;I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