@daytonaio/sdk 0.15.0 → 0.16.0-alpha.0
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/Daytona.d.ts +18 -2
- package/dist/Daytona.js +4 -1
- package/dist/Volume.d.ts +78 -0
- package/dist/Volume.js +79 -0
- package/dist/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/Daytona.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import { CreateWorkspaceTargetEnum as SandboxTargetRegion } from '@daytonaio/api-client';
|
|
1
|
+
import { CreateWorkspaceTargetEnum as SandboxTargetRegion, WorkspaceVolume } from '@daytonaio/api-client';
|
|
2
2
|
import { Sandbox, Sandbox as Workspace } from './Sandbox';
|
|
3
|
+
import { VolumeService } from './Volume';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a volume mount for a Sandbox.
|
|
6
|
+
*
|
|
7
|
+
* @interface
|
|
8
|
+
* @property {string} volumeId - ID of the Volume to mount
|
|
9
|
+
* @property {string} mountPath - Path on the Sandbox to mount the Volume
|
|
10
|
+
* @extends {WorkspaceVolume}
|
|
11
|
+
*/
|
|
12
|
+
export interface VolumeMount extends WorkspaceVolume {
|
|
13
|
+
volumeId: string;
|
|
14
|
+
mountPath: string;
|
|
15
|
+
}
|
|
3
16
|
/**
|
|
4
17
|
* Configuration options for initializing the Daytona client.
|
|
5
18
|
*
|
|
@@ -126,6 +139,8 @@ export type CreateSandboxParams = {
|
|
|
126
139
|
timeout?: number;
|
|
127
140
|
/** Auto-stop interval in minutes (0 means disabled) (must be a non-negative integer) */
|
|
128
141
|
autoStopInterval?: number;
|
|
142
|
+
/** List of volumes to mount in the Sandbox */
|
|
143
|
+
volumes?: VolumeMount[];
|
|
129
144
|
};
|
|
130
145
|
/**
|
|
131
146
|
* Filter for Sandboxes.
|
|
@@ -140,10 +155,10 @@ export type SandboxFilter = {
|
|
|
140
155
|
};
|
|
141
156
|
/**
|
|
142
157
|
* Main class for interacting with the Daytona API.
|
|
143
|
-
*
|
|
144
158
|
* Provides methods for creating, managing, and interacting with Daytona Sandboxes.
|
|
145
159
|
* Can be initialized either with explicit configuration or using environment variables.
|
|
146
160
|
*
|
|
161
|
+
* @property {VolumeService} volume - Service for managing Daytona Volumes
|
|
147
162
|
*
|
|
148
163
|
* @example
|
|
149
164
|
* // Using environment variables
|
|
@@ -170,6 +185,7 @@ export declare class Daytona {
|
|
|
170
185
|
private readonly jwtToken?;
|
|
171
186
|
private readonly organizationId?;
|
|
172
187
|
private readonly apiUrl;
|
|
188
|
+
readonly volume: VolumeService;
|
|
173
189
|
/**
|
|
174
190
|
* Creates a new Daytona client instance.
|
|
175
191
|
*
|
package/dist/Daytona.js
CHANGED
|
@@ -44,6 +44,7 @@ const SandboxPythonCodeToolbox_1 = require("./code-toolbox/SandboxPythonCodeTool
|
|
|
44
44
|
const SandboxTsCodeToolbox_1 = require("./code-toolbox/SandboxTsCodeToolbox");
|
|
45
45
|
const DaytonaError_1 = require("./errors/DaytonaError");
|
|
46
46
|
const Sandbox_1 = require("./Sandbox");
|
|
47
|
+
const Volume_1 = require("./Volume");
|
|
47
48
|
/**
|
|
48
49
|
* Supported programming languages for code execution
|
|
49
50
|
*/
|
|
@@ -55,10 +56,10 @@ var CodeLanguage;
|
|
|
55
56
|
})(CodeLanguage || (exports.CodeLanguage = CodeLanguage = {}));
|
|
56
57
|
/**
|
|
57
58
|
* Main class for interacting with the Daytona API.
|
|
58
|
-
*
|
|
59
59
|
* Provides methods for creating, managing, and interacting with Daytona Sandboxes.
|
|
60
60
|
* Can be initialized either with explicit configuration or using environment variables.
|
|
61
61
|
*
|
|
62
|
+
* @property {VolumeService} volume - Service for managing Daytona Volumes
|
|
62
63
|
*
|
|
63
64
|
* @example
|
|
64
65
|
* // Using environment variables
|
|
@@ -149,6 +150,7 @@ class Daytona {
|
|
|
149
150
|
});
|
|
150
151
|
this.sandboxApi = new api_client_1.WorkspaceApi(configuration, '', axiosInstance);
|
|
151
152
|
this.toolboxApi = new api_client_1.ToolboxApi(configuration, '', axiosInstance);
|
|
153
|
+
this.volume = new Volume_1.VolumeService(new api_client_1.VolumesApi(configuration, '', axiosInstance));
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
154
156
|
* Creates Sandboxes with default or custom configurations. You can specify various parameters,
|
|
@@ -212,6 +214,7 @@ class Daytona {
|
|
|
212
214
|
memory: (_c = params.resources) === null || _c === void 0 ? void 0 : _c.memory,
|
|
213
215
|
disk: (_d = params.resources) === null || _d === void 0 ? void 0 : _d.disk,
|
|
214
216
|
autoStopInterval: params.autoStopInterval,
|
|
217
|
+
volumes: params.volumes,
|
|
215
218
|
}, undefined, {
|
|
216
219
|
timeout: effectiveTimeout * 1000,
|
|
217
220
|
});
|
package/dist/Volume.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { VolumeDto, VolumesApi } from '@daytonaio/api-client';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a Daytona Volume which is a shared storage volume for Sandboxes.
|
|
4
|
+
*
|
|
5
|
+
* @property {string} id - Unique identifier for the Volume
|
|
6
|
+
* @property {string} name - Name of the Volume
|
|
7
|
+
* @property {string} organizationId - Organization ID that owns the Volume
|
|
8
|
+
* @property {string} state - Current state of the Volume
|
|
9
|
+
* @property {string} createdAt - Date and time when the Volume was created
|
|
10
|
+
* @property {string} updatedAt - Date and time when the Volume was last updated
|
|
11
|
+
* @property {string} lastUsedAt - Date and time when the Volume was last used
|
|
12
|
+
*/
|
|
13
|
+
export type Volume = VolumeDto & {
|
|
14
|
+
__brand: 'Volume';
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Service for managing Daytona Volumes.
|
|
18
|
+
*
|
|
19
|
+
* This service provides methods to list, get, create, and delete Volumes.
|
|
20
|
+
*
|
|
21
|
+
* @class
|
|
22
|
+
*/
|
|
23
|
+
export declare class VolumeService {
|
|
24
|
+
private volumesApi;
|
|
25
|
+
constructor(volumesApi: VolumesApi);
|
|
26
|
+
/**
|
|
27
|
+
* Lists all available Volumes.
|
|
28
|
+
*
|
|
29
|
+
* @returns {Promise<Volume[]>} List of all Volumes accessible to the user
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const daytona = new Daytona();
|
|
33
|
+
* const volumes = await daytona.volume.list();
|
|
34
|
+
* console.log(`Found ${volumes.length} volumes`);
|
|
35
|
+
* volumes.forEach(vol => console.log(`${vol.name} (${vol.id})`));
|
|
36
|
+
*/
|
|
37
|
+
list(): Promise<Volume[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets a Volume by its name.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} name - Name of the Volume to retrieve
|
|
42
|
+
* @returns {Promise<Volume>} The requested Volume
|
|
43
|
+
* @throws {Error} If the Volume does not exist or cannot be accessed
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const daytona = new Daytona();
|
|
47
|
+
* const volume = await daytona.volume.get("volume-name");
|
|
48
|
+
* console.log(`Volume ${volume.name} is in state ${volume.state}`);
|
|
49
|
+
*/
|
|
50
|
+
get(name: string): Promise<Volume>;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new Volume with the specified name.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} name - Name for the new Volume
|
|
55
|
+
* @returns {Promise<Volume>} The newly created Volume
|
|
56
|
+
* @throws {Error} If the Volume cannot be created
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* const daytona = new Daytona();
|
|
60
|
+
* const volume = await daytona.volume.create("my-data-volume");
|
|
61
|
+
* console.log(`Created volume ${volume.name} with ID ${volume.id}`);
|
|
62
|
+
*/
|
|
63
|
+
create(name: string): Promise<Volume>;
|
|
64
|
+
/**
|
|
65
|
+
* Deletes a Volume.
|
|
66
|
+
*
|
|
67
|
+
* @param {Volume} volume - Volume to delete
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
* @throws {Error} If the Volume does not exist or cannot be deleted
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const daytona = new Daytona();
|
|
73
|
+
* const volume = await daytona.volume.get("volume-name");
|
|
74
|
+
* await daytona.volume.delete(volume);
|
|
75
|
+
* console.log("Volume deleted successfully");
|
|
76
|
+
*/
|
|
77
|
+
delete(volume: Volume): Promise<void>;
|
|
78
|
+
}
|
package/dist/Volume.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolumeService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for managing Daytona Volumes.
|
|
6
|
+
*
|
|
7
|
+
* This service provides methods to list, get, create, and delete Volumes.
|
|
8
|
+
*
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
class VolumeService {
|
|
12
|
+
constructor(volumesApi) {
|
|
13
|
+
this.volumesApi = volumesApi;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Lists all available Volumes.
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<Volume[]>} List of all Volumes accessible to the user
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const daytona = new Daytona();
|
|
22
|
+
* const volumes = await daytona.volume.list();
|
|
23
|
+
* console.log(`Found ${volumes.length} volumes`);
|
|
24
|
+
* volumes.forEach(vol => console.log(`${vol.name} (${vol.id})`));
|
|
25
|
+
*/
|
|
26
|
+
async list() {
|
|
27
|
+
const response = await this.volumesApi.listVolumes();
|
|
28
|
+
return response.data;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets a Volume by its name.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} name - Name of the Volume to retrieve
|
|
34
|
+
* @returns {Promise<Volume>} The requested Volume
|
|
35
|
+
* @throws {Error} If the Volume does not exist or cannot be accessed
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* const daytona = new Daytona();
|
|
39
|
+
* const volume = await daytona.volume.get("volume-name");
|
|
40
|
+
* console.log(`Volume ${volume.name} is in state ${volume.state}`);
|
|
41
|
+
*/
|
|
42
|
+
async get(name) {
|
|
43
|
+
const response = await this.volumesApi.getVolumeByName(name);
|
|
44
|
+
return response.data;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new Volume with the specified name.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} name - Name for the new Volume
|
|
50
|
+
* @returns {Promise<Volume>} The newly created Volume
|
|
51
|
+
* @throws {Error} If the Volume cannot be created
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* const daytona = new Daytona();
|
|
55
|
+
* const volume = await daytona.volume.create("my-data-volume");
|
|
56
|
+
* console.log(`Created volume ${volume.name} with ID ${volume.id}`);
|
|
57
|
+
*/
|
|
58
|
+
async create(name) {
|
|
59
|
+
const response = await this.volumesApi.createVolume({ name });
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Deletes a Volume.
|
|
64
|
+
*
|
|
65
|
+
* @param {Volume} volume - Volume to delete
|
|
66
|
+
* @returns {Promise<void>}
|
|
67
|
+
* @throws {Error} If the Volume does not exist or cannot be deleted
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const daytona = new Daytona();
|
|
71
|
+
* const volume = await daytona.volume.get("volume-name");
|
|
72
|
+
* await daytona.volume.delete(volume);
|
|
73
|
+
* console.log("Volume deleted successfully");
|
|
74
|
+
*/
|
|
75
|
+
async delete(volume) {
|
|
76
|
+
await this.volumesApi.deleteVolume(volume.id);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.VolumeService = VolumeService;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CodeLanguage, Daytona } from './Daytona';
|
|
2
|
-
export type { CreateSandboxParams, DaytonaConfig, SandboxResources } from './Daytona';
|
|
2
|
+
export type { CreateSandboxParams, DaytonaConfig, SandboxResources, VolumeMount } from './Daytona';
|
|
3
3
|
export { FileSystem } from './FileSystem';
|
|
4
4
|
export { Git } from './Git';
|
|
5
5
|
export { LspLanguageId } from './LspServer';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daytonaio/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0-alpha.0",
|
|
4
4
|
"description": "Daytona client library for AI Agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typescript": "^5.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@daytonaio/api-client": "^0.
|
|
37
|
+
"@daytonaio/api-client": "^0.18.0-alpha.0",
|
|
38
38
|
"uuid": "^11.0.3",
|
|
39
39
|
"@dotenvx/dotenvx": "^1.25.1"
|
|
40
40
|
}
|