@daytonaio/sdk 0.128.0-alpha.1 → 0.128.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.
Files changed (276) hide show
  1. package/package.json +8 -20
  2. package/{cjs → src}/CodeInterpreter.d.ts +0 -1
  3. package/src/CodeInterpreter.js.map +1 -0
  4. package/{esm → src}/ComputerUse.d.ts +0 -1
  5. package/src/ComputerUse.js.map +1 -0
  6. package/{cjs → src}/Daytona.d.ts +1 -2
  7. package/{cjs → src}/Daytona.js +8 -6
  8. package/{cjs → src}/Daytona.js.map +1 -1
  9. package/{esm → src}/FileSystem.d.ts +0 -1
  10. package/src/FileSystem.js.map +1 -0
  11. package/{esm → src}/Git.d.ts +0 -1
  12. package/src/Git.js.map +1 -0
  13. package/{cjs → src}/Image.d.ts +0 -21
  14. package/{cjs → src}/Image.js +91 -123
  15. package/src/Image.js.map +1 -0
  16. package/{cjs → src}/LspServer.d.ts +0 -1
  17. package/src/LspServer.js.map +1 -0
  18. package/{esm → src}/ObjectStorage.d.ts +0 -1
  19. package/src/ObjectStorage.js.map +1 -0
  20. package/{cjs → src}/Process.d.ts +0 -1
  21. package/src/Process.js.map +1 -0
  22. package/{cjs → src}/PtyHandle.d.ts +0 -1
  23. package/src/PtyHandle.js.map +1 -0
  24. package/{cjs → src}/Sandbox.d.ts +17 -2
  25. package/{cjs → src}/Sandbox.js +27 -1
  26. package/src/Sandbox.js.map +1 -0
  27. package/{cjs → src}/Snapshot.d.ts +0 -2
  28. package/{cjs → src}/Snapshot.js +1 -9
  29. package/src/Snapshot.js.map +1 -0
  30. package/{esm → src}/Volume.d.ts +0 -1
  31. package/src/Volume.js.map +1 -0
  32. package/{cjs → src}/code-toolbox/SandboxJsCodeToolbox.d.ts +0 -1
  33. package/src/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
  34. package/{cjs → src}/code-toolbox/SandboxPythonCodeToolbox.d.ts +0 -1
  35. package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
  36. package/{cjs → src}/code-toolbox/SandboxTsCodeToolbox.d.ts +0 -1
  37. package/src/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
  38. package/{esm → src}/errors/DaytonaError.d.ts +0 -1
  39. package/src/errors/DaytonaError.js.map +1 -0
  40. package/{cjs → src}/index.d.ts +0 -1
  41. package/src/index.js.map +1 -0
  42. package/{esm → src}/types/Charts.d.ts +0 -1
  43. package/src/types/Charts.js.map +1 -0
  44. package/{esm → src}/types/CodeInterpreter.d.ts +0 -1
  45. package/src/types/CodeInterpreter.js.map +1 -0
  46. package/{cjs → src}/types/ExecuteResponse.d.ts +0 -1
  47. package/src/types/ExecuteResponse.js.map +1 -0
  48. package/{cjs → src}/types/Pty.d.ts +0 -1
  49. package/src/types/Pty.js.map +1 -0
  50. package/{cjs → src}/utils/ArtifactParser.d.ts +0 -1
  51. package/src/utils/ArtifactParser.js.map +1 -0
  52. package/{esm → src}/utils/Binary.d.ts +0 -1
  53. package/src/utils/Binary.js.map +1 -0
  54. package/{cjs → src}/utils/FileTransfer.d.ts +0 -1
  55. package/src/utils/FileTransfer.js.map +1 -0
  56. package/{cjs → src}/utils/Import.d.ts +15 -2
  57. package/src/utils/Import.js +77 -0
  58. package/src/utils/Import.js.map +1 -0
  59. package/{esm → src}/utils/Multipart.d.ts +0 -1
  60. package/src/utils/Multipart.js.map +1 -0
  61. package/{cjs → src}/utils/Runtime.d.ts +0 -1
  62. package/src/utils/Runtime.js.map +1 -0
  63. package/{cjs → src}/utils/Stream.d.ts +0 -1
  64. package/src/utils/Stream.js.map +1 -0
  65. package/{esm → src}/utils/WebSocket.d.ts +0 -1
  66. package/src/utils/WebSocket.js.map +1 -0
  67. package/LICENSE +0 -190
  68. package/cjs/CodeInterpreter.d.ts.map +0 -1
  69. package/cjs/CodeInterpreter.js.map +0 -1
  70. package/cjs/ComputerUse.d.ts +0 -443
  71. package/cjs/ComputerUse.d.ts.map +0 -1
  72. package/cjs/ComputerUse.js.map +0 -1
  73. package/cjs/Daytona.d.ts.map +0 -1
  74. package/cjs/FileSystem.d.ts +0 -328
  75. package/cjs/FileSystem.d.ts.map +0 -1
  76. package/cjs/FileSystem.js.map +0 -1
  77. package/cjs/Git.d.ts +0 -203
  78. package/cjs/Git.d.ts.map +0 -1
  79. package/cjs/Git.js.map +0 -1
  80. package/cjs/Image.d.ts.map +0 -1
  81. package/cjs/Image.js.map +0 -1
  82. package/cjs/LspServer.d.ts.map +0 -1
  83. package/cjs/LspServer.js.map +0 -1
  84. package/cjs/ObjectStorage.d.ts +0 -79
  85. package/cjs/ObjectStorage.d.ts.map +0 -1
  86. package/cjs/ObjectStorage.js.map +0 -1
  87. package/cjs/Process.d.ts.map +0 -1
  88. package/cjs/Process.js.map +0 -1
  89. package/cjs/PtyHandle.d.ts.map +0 -1
  90. package/cjs/PtyHandle.js.map +0 -1
  91. package/cjs/README.md +0 -147
  92. package/cjs/Sandbox.d.ts.map +0 -1
  93. package/cjs/Sandbox.js.map +0 -1
  94. package/cjs/Snapshot.d.ts.map +0 -1
  95. package/cjs/Snapshot.js.map +0 -1
  96. package/cjs/Volume.d.ts +0 -84
  97. package/cjs/Volume.d.ts.map +0 -1
  98. package/cjs/Volume.js.map +0 -1
  99. package/cjs/code-toolbox/SandboxJsCodeToolbox.d.ts.map +0 -1
  100. package/cjs/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
  101. package/cjs/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +0 -1
  102. package/cjs/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
  103. package/cjs/code-toolbox/SandboxTsCodeToolbox.d.ts.map +0 -1
  104. package/cjs/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
  105. package/cjs/errors/DaytonaError.d.ts +0 -32
  106. package/cjs/errors/DaytonaError.d.ts.map +0 -1
  107. package/cjs/errors/DaytonaError.js.map +0 -1
  108. package/cjs/index.d.ts.map +0 -1
  109. package/cjs/index.js.map +0 -1
  110. package/cjs/package.json +0 -3
  111. package/cjs/types/Charts.d.ts +0 -152
  112. package/cjs/types/Charts.d.ts.map +0 -1
  113. package/cjs/types/Charts.js.map +0 -1
  114. package/cjs/types/CodeInterpreter.d.ts +0 -77
  115. package/cjs/types/CodeInterpreter.d.ts.map +0 -1
  116. package/cjs/types/CodeInterpreter.js.map +0 -1
  117. package/cjs/types/ExecuteResponse.d.ts.map +0 -1
  118. package/cjs/types/ExecuteResponse.js.map +0 -1
  119. package/cjs/types/Pty.d.ts.map +0 -1
  120. package/cjs/types/Pty.js.map +0 -1
  121. package/cjs/utils/ArtifactParser.d.ts.map +0 -1
  122. package/cjs/utils/ArtifactParser.js.map +0 -1
  123. package/cjs/utils/Binary.d.ts +0 -39
  124. package/cjs/utils/Binary.d.ts.map +0 -1
  125. package/cjs/utils/Binary.js.map +0 -1
  126. package/cjs/utils/FileTransfer.d.ts.map +0 -1
  127. package/cjs/utils/FileTransfer.js.map +0 -1
  128. package/cjs/utils/Import.d.ts.map +0 -1
  129. package/cjs/utils/Import.js +0 -81
  130. package/cjs/utils/Import.js.map +0 -1
  131. package/cjs/utils/Multipart.d.ts +0 -27
  132. package/cjs/utils/Multipart.d.ts.map +0 -1
  133. package/cjs/utils/Multipart.js.map +0 -1
  134. package/cjs/utils/Runtime.d.ts.map +0 -1
  135. package/cjs/utils/Runtime.js.map +0 -1
  136. package/cjs/utils/Stream.d.ts.map +0 -1
  137. package/cjs/utils/Stream.js.map +0 -1
  138. package/cjs/utils/WebSocket.d.ts +0 -10
  139. package/cjs/utils/WebSocket.d.ts.map +0 -1
  140. package/cjs/utils/WebSocket.js.map +0 -1
  141. package/esm/CodeInterpreter.d.ts +0 -96
  142. package/esm/CodeInterpreter.d.ts.map +0 -1
  143. package/esm/CodeInterpreter.js +0 -295
  144. package/esm/CodeInterpreter.js.map +0 -1
  145. package/esm/ComputerUse.d.ts.map +0 -1
  146. package/esm/ComputerUse.js +0 -509
  147. package/esm/ComputerUse.js.map +0 -1
  148. package/esm/Daytona.d.ts +0 -354
  149. package/esm/Daytona.d.ts.map +0 -1
  150. package/esm/Daytona.js +0 -410
  151. package/esm/Daytona.js.map +0 -1
  152. package/esm/FileSystem.d.ts.map +0 -1
  153. package/esm/FileSystem.js +0 -331
  154. package/esm/FileSystem.js.map +0 -1
  155. package/esm/Git.d.ts.map +0 -1
  156. package/esm/Git.js +0 -260
  157. package/esm/Git.js.map +0 -1
  158. package/esm/Image.d.ts +0 -285
  159. package/esm/Image.d.ts.map +0 -1
  160. package/esm/Image.js +0 -569
  161. package/esm/Image.js.map +0 -1
  162. package/esm/LspServer.d.ts +0 -172
  163. package/esm/LspServer.d.ts.map +0 -1
  164. package/esm/LspServer.js +0 -204
  165. package/esm/LspServer.js.map +0 -1
  166. package/esm/ObjectStorage.d.ts.map +0 -1
  167. package/esm/ObjectStorage.js +0 -187
  168. package/esm/ObjectStorage.js.map +0 -1
  169. package/esm/Process.d.ts +0 -442
  170. package/esm/Process.d.ts.map +0 -1
  171. package/esm/Process.js +0 -644
  172. package/esm/Process.js.map +0 -1
  173. package/esm/PtyHandle.d.ts +0 -155
  174. package/esm/PtyHandle.d.ts.map +0 -1
  175. package/esm/PtyHandle.js +0 -374
  176. package/esm/PtyHandle.js.map +0 -1
  177. package/esm/README.md +0 -147
  178. package/esm/Sandbox.d.ts +0 -359
  179. package/esm/Sandbox.d.ts.map +0 -1
  180. package/esm/Sandbox.js +0 -532
  181. package/esm/Sandbox.js.map +0 -1
  182. package/esm/Snapshot.d.ts +0 -138
  183. package/esm/Snapshot.d.ts.map +0 -1
  184. package/esm/Snapshot.js +0 -207
  185. package/esm/Snapshot.js.map +0 -1
  186. package/esm/Volume.d.ts.map +0 -1
  187. package/esm/Volume.js +0 -95
  188. package/esm/Volume.js.map +0 -1
  189. package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts +0 -6
  190. package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts.map +0 -1
  191. package/esm/code-toolbox/SandboxJsCodeToolbox.js +0 -13
  192. package/esm/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
  193. package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts +0 -12
  194. package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +0 -1
  195. package/esm/code-toolbox/SandboxPythonCodeToolbox.js +0 -355
  196. package/esm/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
  197. package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts +0 -6
  198. package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts.map +0 -1
  199. package/esm/code-toolbox/SandboxTsCodeToolbox.js +0 -14
  200. package/esm/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
  201. package/esm/errors/DaytonaError.d.ts.map +0 -1
  202. package/esm/errors/DaytonaError.js +0 -44
  203. package/esm/errors/DaytonaError.js.map +0 -1
  204. package/esm/index.d.ts +0 -22
  205. package/esm/index.d.ts.map +0 -1
  206. package/esm/index.js +0 -22
  207. package/esm/index.js.map +0 -1
  208. package/esm/package.json +0 -3
  209. package/esm/types/Charts.d.ts.map +0 -1
  210. package/esm/types/Charts.js +0 -42
  211. package/esm/types/Charts.js.map +0 -1
  212. package/esm/types/CodeInterpreter.d.ts.map +0 -1
  213. package/esm/types/CodeInterpreter.js +0 -6
  214. package/esm/types/CodeInterpreter.js.map +0 -1
  215. package/esm/types/ExecuteResponse.d.ts +0 -26
  216. package/esm/types/ExecuteResponse.d.ts.map +0 -1
  217. package/esm/types/ExecuteResponse.js +0 -6
  218. package/esm/types/ExecuteResponse.js.map +0 -1
  219. package/esm/types/Pty.d.ts +0 -48
  220. package/esm/types/Pty.d.ts.map +0 -1
  221. package/esm/types/Pty.js +0 -6
  222. package/esm/types/Pty.js.map +0 -1
  223. package/esm/utils/ArtifactParser.d.ts +0 -14
  224. package/esm/utils/ArtifactParser.d.ts.map +0 -1
  225. package/esm/utils/ArtifactParser.js +0 -51
  226. package/esm/utils/ArtifactParser.js.map +0 -1
  227. package/esm/utils/Binary.d.ts.map +0 -1
  228. package/esm/utils/Binary.js +0 -157
  229. package/esm/utils/Binary.js.map +0 -1
  230. package/esm/utils/FileTransfer.d.ts +0 -15
  231. package/esm/utils/FileTransfer.d.ts.map +0 -1
  232. package/esm/utils/FileTransfer.js +0 -209
  233. package/esm/utils/FileTransfer.js.map +0 -1
  234. package/esm/utils/Import.d.ts +0 -211
  235. package/esm/utils/Import.d.ts.map +0 -1
  236. package/esm/utils/Import.js +0 -45
  237. package/esm/utils/Import.js.map +0 -1
  238. package/esm/utils/Multipart.d.ts.map +0 -1
  239. package/esm/utils/Multipart.js +0 -107
  240. package/esm/utils/Multipart.js.map +0 -1
  241. package/esm/utils/Runtime.d.ts +0 -37
  242. package/esm/utils/Runtime.d.ts.map +0 -1
  243. package/esm/utils/Runtime.js +0 -57
  244. package/esm/utils/Runtime.js.map +0 -1
  245. package/esm/utils/Stream.d.ts +0 -20
  246. package/esm/utils/Stream.d.ts.map +0 -1
  247. package/esm/utils/Stream.js +0 -360
  248. package/esm/utils/Stream.js.map +0 -1
  249. package/esm/utils/WebSocket.d.ts.map +0 -1
  250. package/esm/utils/WebSocket.js +0 -22
  251. package/esm/utils/WebSocket.js.map +0 -1
  252. /package/{cjs → src}/CodeInterpreter.js +0 -0
  253. /package/{cjs → src}/ComputerUse.js +0 -0
  254. /package/{cjs → src}/FileSystem.js +0 -0
  255. /package/{cjs → src}/Git.js +0 -0
  256. /package/{cjs → src}/LspServer.js +0 -0
  257. /package/{cjs → src}/ObjectStorage.js +0 -0
  258. /package/{cjs → src}/Process.js +0 -0
  259. /package/{cjs → src}/PtyHandle.js +0 -0
  260. /package/{cjs → src}/Volume.js +0 -0
  261. /package/{cjs → src}/code-toolbox/SandboxJsCodeToolbox.js +0 -0
  262. /package/{cjs → src}/code-toolbox/SandboxPythonCodeToolbox.js +0 -0
  263. /package/{cjs → src}/code-toolbox/SandboxTsCodeToolbox.js +0 -0
  264. /package/{cjs → src}/errors/DaytonaError.js +0 -0
  265. /package/{cjs → src}/index.js +0 -0
  266. /package/{cjs → src}/types/Charts.js +0 -0
  267. /package/{cjs → src}/types/CodeInterpreter.js +0 -0
  268. /package/{cjs → src}/types/ExecuteResponse.js +0 -0
  269. /package/{cjs → src}/types/Pty.js +0 -0
  270. /package/{cjs → src}/utils/ArtifactParser.js +0 -0
  271. /package/{cjs → src}/utils/Binary.js +0 -0
  272. /package/{cjs → src}/utils/FileTransfer.js +0 -0
  273. /package/{cjs → src}/utils/Multipart.js +0 -0
  274. /package/{cjs → src}/utils/Runtime.js +0 -0
  275. /package/{cjs → src}/utils/Stream.js +0 -0
  276. /package/{cjs → src}/utils/WebSocket.js +0 -0
package/esm/Snapshot.d.ts DELETED
@@ -1,138 +0,0 @@
1
- import { ObjectStorageApi, SnapshotDto, SnapshotsApi, Configuration, PaginatedSnapshots as PaginatedSnapshotsDto } from '@daytonaio/api-client';
2
- import { Image } from './Image.js';
3
- import { Resources } from './Daytona.js';
4
- /**
5
- * Represents a Daytona Snapshot which is a pre-configured sandbox.
6
- *
7
- * @property {string} id - Unique identifier for the Snapshot.
8
- * @property {string} organizationId - Organization ID that owns the Snapshot.
9
- * @property {boolean} general - Whether the Snapshot is general.
10
- * @property {string} name - Name of the Snapshot.
11
- * @property {string} imageName - Name of the Image of the Snapshot.
12
- * @property {SnapshotState} state - Current state of the Snapshot.
13
- * @property {number} size - Size of the Snapshot.
14
- * @property {string[]} entrypoint - Entrypoint of the Snapshot.
15
- * @property {number} cpu - CPU of the Snapshot.
16
- * @property {number} gpu - GPU of the Snapshot.
17
- * @property {number} mem - Memory of the Snapshot in GiB.
18
- * @property {number} disk - Disk of the Snapshot in GiB.
19
- * @property {string} errorReason - Error reason of the Snapshot.
20
- * @property {Date} createdAt - Timestamp when the Snapshot was created.
21
- * @property {Date} updatedAt - Timestamp when the Snapshot was last updated.
22
- * @property {Date} lastUsedAt - Timestamp when the Snapshot was last used.
23
- */
24
- export type Snapshot = SnapshotDto & {
25
- __brand: 'Snapshot';
26
- };
27
- /**
28
- * Represents a paginated list of Daytona Snapshots.
29
- *
30
- * @property {Snapshot[]} items - List of Snapshot instances in the current page.
31
- * @property {number} total - Total number of Snapshots across all pages.
32
- * @property {number} page - Current page number.
33
- * @property {number} totalPages - Total number of pages available.
34
- */
35
- export interface PaginatedSnapshots extends Omit<PaginatedSnapshotsDto, 'items'> {
36
- items: Snapshot[];
37
- }
38
- /**
39
- * Parameters for creating a new snapshot.
40
- *
41
- * @property {string} name - Name of the snapshot.
42
- * @property {string | Image} image - Image of the snapshot. If a string is provided, it should be available on some registry.
43
- * If an Image instance is provided, it will be used to create a new image in Daytona.
44
- * @property {Resources} resources - Resources of the snapshot.
45
- * @property {string[]} entrypoint - Entrypoint of the snapshot.
46
- */
47
- export type CreateSnapshotParams = {
48
- name: string;
49
- image: string | Image;
50
- resources?: Resources;
51
- entrypoint?: string[];
52
- skipValidation?: boolean;
53
- };
54
- /**
55
- * Service for managing Daytona Snapshots. Can be used to list, get, create and delete Snapshots.
56
- *
57
- * @class
58
- */
59
- export declare class SnapshotService {
60
- private clientConfig;
61
- private snapshotsApi;
62
- private objectStorageApi;
63
- constructor(clientConfig: Configuration, snapshotsApi: SnapshotsApi, objectStorageApi: ObjectStorageApi);
64
- /**
65
- * List paginated list of Snapshots.
66
- *
67
- * @param {number} [page] - Page number for pagination (starting from 1)
68
- * @param {number} [limit] - Maximum number of items per page
69
- * @returns {Promise<PaginatedSnapshots>} Paginated list of Snapshots
70
- *
71
- * @example
72
- * const daytona = new Daytona();
73
- * const result = await daytona.snapshot.list(2, 10);
74
- * console.log(`Found ${result.total} snapshots`);
75
- * result.items.forEach(snapshot => console.log(`${snapshot.name} (${snapshot.imageName})`));
76
- */
77
- list(page?: number, limit?: number): Promise<PaginatedSnapshots>;
78
- /**
79
- * Gets a Snapshot by its name.
80
- *
81
- * @param {string} name - Name of the Snapshot to retrieve
82
- * @returns {Promise<Snapshot>} The requested Snapshot
83
- * @throws {Error} If the Snapshot does not exist or cannot be accessed
84
- *
85
- * @example
86
- * const daytona = new Daytona();
87
- * const snapshot = await daytona.snapshot.get("snapshot-name");
88
- * console.log(`Snapshot ${snapshot.name} is in state ${snapshot.state}`);
89
- */
90
- get(name: string): Promise<Snapshot>;
91
- /**
92
- * Deletes a Snapshot.
93
- *
94
- * @param {Snapshot} snapshot - Snapshot to delete
95
- * @returns {Promise<void>}
96
- * @throws {Error} If the Snapshot does not exist or cannot be deleted
97
- *
98
- * @example
99
- * const daytona = new Daytona();
100
- * const snapshot = await daytona.snapshot.get("snapshot-name");
101
- * await daytona.snapshot.delete(snapshot);
102
- * console.log("Snapshot deleted successfully");
103
- */
104
- delete(snapshot: Snapshot): Promise<void>;
105
- /**
106
- * Creates and registers a new snapshot from the given Image definition.
107
- *
108
- * @param {CreateSnapshotParams} params - Parameters for snapshot creation.
109
- * @param {object} options - Options for the create operation.
110
- * @param {boolean} options.onLogs - This callback function handles snapshot creation logs.
111
- * @param {number} options.timeout - Default is no timeout. Timeout in seconds (0 means no timeout).
112
- * @returns {Promise<void>}
113
- *
114
- * @example
115
- * const image = Image.debianSlim('3.12').pipInstall('numpy');
116
- * await daytona.snapshot.create({ name: 'my-snapshot', image: image }, { onLogs: console.log });
117
- */
118
- create(params: CreateSnapshotParams, options?: {
119
- onLogs?: (chunk: string) => void;
120
- timeout?: number;
121
- }): Promise<Snapshot>;
122
- /**
123
- * Activates a snapshot.
124
- *
125
- * @param {Snapshot} snapshot - Snapshot to activate
126
- * @returns {Promise<Snapshot>} The activated Snapshot instance
127
- */
128
- activate(snapshot: Snapshot): Promise<Snapshot>;
129
- /**
130
- * Processes the image contexts by uploading them to object storage
131
- *
132
- * @private
133
- * @param {Image} image - The Image instance.
134
- * @returns {Promise<string[]>} The list of context hashes stored in object storage.
135
- */
136
- static processImageContext(objectStorageApi: ObjectStorageApi, image: Image): Promise<string[]>;
137
- }
138
- //# sourceMappingURL=Snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Snapshot.d.ts","sourceRoot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AQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;;;;;;;;;;;OAYG;IACU,MAAM,CACjB,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GACnE,OAAO,CAAC,QAAQ,CAAC;IAmGpB;;;;;OAKG;IACG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIrD;;;;;;OAMG;WACU,mBAAmB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CA2BtG"}
package/esm/Snapshot.js DELETED
@@ -1,207 +0,0 @@
1
- /*
2
- * Copyright 2025 Daytona Platforms Inc.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { SnapshotState, } from '@daytonaio/api-client';
6
- import { DaytonaError } from './errors/DaytonaError.js';
7
- import { processStreamingResponse } from './utils/Stream.js';
8
- import { dynamicImport } from './utils/Import.js';
9
- /**
10
- * Service for managing Daytona Snapshots. Can be used to list, get, create and delete Snapshots.
11
- *
12
- * @class
13
- */
14
- export class SnapshotService {
15
- clientConfig;
16
- snapshotsApi;
17
- objectStorageApi;
18
- constructor(clientConfig, snapshotsApi, objectStorageApi) {
19
- this.clientConfig = clientConfig;
20
- this.snapshotsApi = snapshotsApi;
21
- this.objectStorageApi = objectStorageApi;
22
- }
23
- /**
24
- * List paginated list of Snapshots.
25
- *
26
- * @param {number} [page] - Page number for pagination (starting from 1)
27
- * @param {number} [limit] - Maximum number of items per page
28
- * @returns {Promise<PaginatedSnapshots>} Paginated list of Snapshots
29
- *
30
- * @example
31
- * const daytona = new Daytona();
32
- * const result = await daytona.snapshot.list(2, 10);
33
- * console.log(`Found ${result.total} snapshots`);
34
- * result.items.forEach(snapshot => console.log(`${snapshot.name} (${snapshot.imageName})`));
35
- */
36
- async list(page, limit) {
37
- const response = await this.snapshotsApi.getAllSnapshots(undefined, page, limit);
38
- return {
39
- items: response.data.items.map((snapshot) => snapshot),
40
- total: response.data.total,
41
- page: response.data.page,
42
- totalPages: response.data.totalPages,
43
- };
44
- }
45
- /**
46
- * Gets a Snapshot by its name.
47
- *
48
- * @param {string} name - Name of the Snapshot to retrieve
49
- * @returns {Promise<Snapshot>} The requested Snapshot
50
- * @throws {Error} If the Snapshot does not exist or cannot be accessed
51
- *
52
- * @example
53
- * const daytona = new Daytona();
54
- * const snapshot = await daytona.snapshot.get("snapshot-name");
55
- * console.log(`Snapshot ${snapshot.name} is in state ${snapshot.state}`);
56
- */
57
- async get(name) {
58
- const response = await this.snapshotsApi.getSnapshot(name);
59
- return response.data;
60
- }
61
- /**
62
- * Deletes a Snapshot.
63
- *
64
- * @param {Snapshot} snapshot - Snapshot to delete
65
- * @returns {Promise<void>}
66
- * @throws {Error} If the Snapshot does not exist or cannot be deleted
67
- *
68
- * @example
69
- * const daytona = new Daytona();
70
- * const snapshot = await daytona.snapshot.get("snapshot-name");
71
- * await daytona.snapshot.delete(snapshot);
72
- * console.log("Snapshot deleted successfully");
73
- */
74
- async delete(snapshot) {
75
- await this.snapshotsApi.removeSnapshot(snapshot.id);
76
- }
77
- /**
78
- * Creates and registers a new snapshot from the given Image definition.
79
- *
80
- * @param {CreateSnapshotParams} params - Parameters for snapshot creation.
81
- * @param {object} options - Options for the create operation.
82
- * @param {boolean} options.onLogs - This callback function handles snapshot creation logs.
83
- * @param {number} options.timeout - Default is no timeout. Timeout in seconds (0 means no timeout).
84
- * @returns {Promise<void>}
85
- *
86
- * @example
87
- * const image = Image.debianSlim('3.12').pipInstall('numpy');
88
- * await daytona.snapshot.create({ name: 'my-snapshot', image: image }, { onLogs: console.log });
89
- */
90
- async create(params, options = {}) {
91
- const createSnapshotReq = {
92
- name: params.name,
93
- };
94
- if (typeof params.image === 'string') {
95
- createSnapshotReq.imageName = params.image;
96
- createSnapshotReq.entrypoint = params.entrypoint;
97
- }
98
- else {
99
- const contextHashes = await SnapshotService.processImageContext(this.objectStorageApi, params.image);
100
- createSnapshotReq.buildInfo = {
101
- contextHashes,
102
- dockerfileContent: params.entrypoint
103
- ? params.image.entrypoint(params.entrypoint).dockerfile
104
- : params.image.dockerfile,
105
- };
106
- }
107
- if (params.resources) {
108
- createSnapshotReq.cpu = params.resources.cpu;
109
- createSnapshotReq.gpu = params.resources.gpu;
110
- createSnapshotReq.memory = params.resources.memory;
111
- createSnapshotReq.disk = params.resources.disk;
112
- }
113
- if (params.skipValidation !== undefined) {
114
- createSnapshotReq.skipValidation = params.skipValidation;
115
- }
116
- let createdSnapshot = (await this.snapshotsApi.createSnapshot(createSnapshotReq, undefined, {
117
- timeout: (options.timeout || 0) * 1000,
118
- })).data;
119
- if (!createdSnapshot) {
120
- throw new DaytonaError("Failed to create snapshot. Didn't receive a snapshot from the server API.");
121
- }
122
- const terminalStates = [SnapshotState.ACTIVE, SnapshotState.ERROR, SnapshotState.BUILD_FAILED];
123
- const logTerminalStates = [
124
- ...terminalStates,
125
- SnapshotState.PENDING_VALIDATION,
126
- SnapshotState.VALIDATING,
127
- ];
128
- const snapshotRef = { createdSnapshot: createdSnapshot };
129
- let streamPromise;
130
- // eslint-disable-next-line @typescript-eslint/no-empty-function
131
- const startLogStreaming = async (onChunk = () => { }) => {
132
- if (!streamPromise) {
133
- const url = `${this.clientConfig.basePath}/snapshots/${createdSnapshot.id}/build-logs?follow=true`;
134
- streamPromise = processStreamingResponse(() => fetch(url, { method: 'GET', headers: this.clientConfig.baseOptions.headers }), (chunk) => onChunk(chunk.trimEnd()), async () => logTerminalStates.includes(snapshotRef.createdSnapshot.state));
135
- }
136
- };
137
- if (options.onLogs) {
138
- options.onLogs(`Creating snapshot ${createdSnapshot.name} (${createdSnapshot.state})`);
139
- if (createdSnapshot.state !== SnapshotState.PENDING) {
140
- await startLogStreaming(options.onLogs);
141
- }
142
- }
143
- let previousState = createdSnapshot.state;
144
- while (!terminalStates.includes(createdSnapshot.state)) {
145
- if (options.onLogs && previousState !== createdSnapshot.state) {
146
- if (createdSnapshot.state !== SnapshotState.PENDING && !streamPromise) {
147
- await startLogStreaming(options.onLogs);
148
- }
149
- options.onLogs(`Creating snapshot ${createdSnapshot.name} (${createdSnapshot.state})`);
150
- previousState = createdSnapshot.state;
151
- }
152
- await new Promise((resolve) => setTimeout(resolve, 1000));
153
- createdSnapshot = await this.get(createdSnapshot.name);
154
- snapshotRef.createdSnapshot = createdSnapshot;
155
- }
156
- if (options.onLogs) {
157
- if (streamPromise) {
158
- await streamPromise;
159
- }
160
- if (createdSnapshot.state === SnapshotState.ACTIVE) {
161
- options.onLogs(`Created snapshot ${createdSnapshot.name} (${createdSnapshot.state})`);
162
- }
163
- }
164
- if (createdSnapshot.state === SnapshotState.ERROR || createdSnapshot.state === SnapshotState.BUILD_FAILED) {
165
- const errMsg = `Failed to create snapshot. Name: ${createdSnapshot.name} Reason: ${createdSnapshot.errorReason}`;
166
- throw new DaytonaError(errMsg);
167
- }
168
- return createdSnapshot;
169
- }
170
- /**
171
- * Activates a snapshot.
172
- *
173
- * @param {Snapshot} snapshot - Snapshot to activate
174
- * @returns {Promise<Snapshot>} The activated Snapshot instance
175
- */
176
- async activate(snapshot) {
177
- return (await this.snapshotsApi.activateSnapshot(snapshot.id)).data;
178
- }
179
- /**
180
- * Processes the image contexts by uploading them to object storage
181
- *
182
- * @private
183
- * @param {Image} image - The Image instance.
184
- * @returns {Promise<string[]>} The list of context hashes stored in object storage.
185
- */
186
- static async processImageContext(objectStorageApi, image) {
187
- if (!image.contextList || !image.contextList.length) {
188
- return [];
189
- }
190
- const ObjectStorageModule = await dynamicImport('ObjectStorage', '"processImageContext" is not supported: ');
191
- const pushAccessCreds = (await objectStorageApi.getPushAccess()).data;
192
- const objectStorage = new ObjectStorageModule.ObjectStorage({
193
- endpointUrl: pushAccessCreds.storageUrl,
194
- accessKeyId: pushAccessCreds.accessKey,
195
- secretAccessKey: pushAccessCreds.secret,
196
- sessionToken: pushAccessCreds.sessionToken,
197
- bucketName: pushAccessCreds.bucket,
198
- });
199
- const contextHashes = [];
200
- for (const context of image.contextList) {
201
- const contextHash = await objectStorage.upload(context.sourcePath, pushAccessCreds.organizationId, context.archivePath);
202
- contextHashes.push(contextHash);
203
- }
204
- return contextHashes;
205
- }
206
- }
207
- //# sourceMappingURL=Snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Snapshot.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Snapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIL,aAAa,GAId,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAqD9C;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAEhB;IACA;IACA;IAHV,YACU,YAA2B,EAC3B,YAA0B,EAC1B,gBAAkC;QAFlC,iBAAY,GAAZ,YAAY,CAAe;QAC3B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,qBAAgB,GAAhB,gBAAgB,CAAkB;IACzC,CAAC;IAEJ;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,IAAI,CAAC,IAAa,EAAE,KAAc;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;QAChF,OAAO;YACL,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAoB,CAAC;YAClE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK;YAC1B,IAAI,EAAE,QAAQ,CAAC,IAAI,CAA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;;;;;;;OAWG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK3C;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5C"}
package/esm/Volume.js DELETED
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright 2025 Daytona Platforms Inc.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { DaytonaNotFoundError } from './errors/DaytonaError.js';
6
- /**
7
- * Service for managing Daytona Volumes.
8
- *
9
- * This service provides methods to list, get, create, and delete Volumes.
10
- *
11
- * Volumes can be mounted to Sandboxes with an optional subpath parameter to mount
12
- * only a specific S3 prefix within the volume. When no subpath is specified,
13
- * the entire volume is mounted.
14
- *
15
- * @class
16
- */
17
- export class VolumeService {
18
- volumesApi;
19
- constructor(volumesApi) {
20
- this.volumesApi = volumesApi;
21
- }
22
- /**
23
- * Lists all available Volumes.
24
- *
25
- * @returns {Promise<Volume[]>} List of all Volumes accessible to the user
26
- *
27
- * @example
28
- * const daytona = new Daytona();
29
- * const volumes = await daytona.volume.list();
30
- * console.log(`Found ${volumes.length} volumes`);
31
- * volumes.forEach(vol => console.log(`${vol.name} (${vol.id})`));
32
- */
33
- async list() {
34
- const response = await this.volumesApi.listVolumes();
35
- return response.data;
36
- }
37
- /**
38
- * Gets a Volume by its name.
39
- *
40
- * @param {string} name - Name of the Volume to retrieve
41
- * @param {boolean} create - Whether to create the Volume if it does not exist
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", true);
48
- * console.log(`Volume ${volume.name} is in state ${volume.state}`);
49
- */
50
- async get(name, create = false) {
51
- try {
52
- const response = await this.volumesApi.getVolumeByName(name);
53
- return response.data;
54
- }
55
- catch (error) {
56
- if (error instanceof DaytonaNotFoundError && create) {
57
- return await this.create(name);
58
- }
59
- throw error;
60
- }
61
- }
62
- /**
63
- * Creates a new Volume with the specified name.
64
- *
65
- * @param {string} name - Name for the new Volume
66
- * @returns {Promise<Volume>} The newly created Volume
67
- * @throws {Error} If the Volume cannot be created
68
- *
69
- * @example
70
- * const daytona = new Daytona();
71
- * const volume = await daytona.volume.create("my-data-volume");
72
- * console.log(`Created volume ${volume.name} with ID ${volume.id}`);
73
- */
74
- async create(name) {
75
- const response = await this.volumesApi.createVolume({ name });
76
- return response.data;
77
- }
78
- /**
79
- * Deletes a Volume.
80
- *
81
- * @param {Volume} volume - Volume to delete
82
- * @returns {Promise<void>}
83
- * @throws {Error} If the Volume does not exist or cannot be deleted
84
- *
85
- * @example
86
- * const daytona = new Daytona();
87
- * const volume = await daytona.volume.get("volume-name");
88
- * await daytona.volume.delete(volume);
89
- * console.log("Volume deleted successfully");
90
- */
91
- async delete(volume) {
92
- await this.volumesApi.deleteVolume(volume.id);
93
- }
94
- }
95
- //# sourceMappingURL=Volume.js.map
package/esm/Volume.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Volume.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Volume.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAe5D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C;;;;;;;;;;OAUG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA;QACpD,OAAO,QAAQ,CAAC,IAAgB,CAAA;IAClC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,MAAM,GAAG,KAAK;QACpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAC5D,OAAO,QAAQ,CAAC,IAAc,CAAA;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,oBAAoB,IAAI,MAAM,EAAE,CAAC;gBACpD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAChC,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QAC7D,OAAO,QAAQ,CAAC,IAAc,CAAA;IAChC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC/C,CAAC;CACF"}
@@ -1,6 +0,0 @@
1
- import { SandboxCodeToolbox } from '../Sandbox.js';
2
- import { CodeRunParams } from '../Process.js';
3
- export declare class SandboxJsCodeToolbox implements SandboxCodeToolbox {
4
- getRunCommand(code: string, params?: CodeRunParams): string;
5
- }
6
- //# sourceMappingURL=SandboxJsCodeToolbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SandboxJsCodeToolbox.d.ts","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/code-toolbox/SandboxJsCodeToolbox.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG1C,qBAAa,oBAAqB,YAAW,kBAAkB;IACtD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM;CAMnE"}
@@ -1,13 +0,0 @@
1
- /*
2
- * Copyright 2025 Daytona Platforms Inc.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { Buffer } from 'buffer';
6
- export class SandboxJsCodeToolbox {
7
- getRunCommand(code, params) {
8
- const base64Code = Buffer.from(code).toString('base64');
9
- const argv = params?.argv ? params.argv.join(' ') : '';
10
- return `sh -c 'echo ${base64Code} | base64 --decode | node -e "$(cat)" ${argv} 2>&1 | grep -vE "npm notice"'`;
11
- }
12
- }
13
- //# sourceMappingURL=SandboxJsCodeToolbox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SandboxJsCodeToolbox.js","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/code-toolbox/SandboxJsCodeToolbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,OAAO,oBAAoB;IACxB,aAAa,CAAC,IAAY,EAAE,MAAsB;QACvD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACvD,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAEtD,OAAO,eAAe,UAAU,yCAAyC,IAAI,gCAAgC,CAAA;IAC/G,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- import { SandboxCodeToolbox } from '../Sandbox.js';
2
- import { CodeRunParams } from '../Process.js';
3
- export declare class SandboxPythonCodeToolbox implements SandboxCodeToolbox {
4
- getRunCommand(code: string, params?: CodeRunParams): string;
5
- /**
6
- * Checks if matplotlib is imported in the given Python code string.
7
- * @param codeString Python code as a string
8
- * @returns True if matplotlib is imported, false otherwise
9
- */
10
- private static isMatplotlibImported;
11
- }
12
- //# sourceMappingURL=SandboxPythonCodeToolbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SandboxPythonCodeToolbox.d.ts","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/code-toolbox/SandboxPythonCodeToolbox.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG1C,qBAAa,wBAAyB,YAAW,kBAAkB;IAC1D,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM;IAoBlE;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAyBpC"}