@daytonaio/sdk 0.170.0 → 0.171.0-alpha.3

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 (237) hide show
  1. package/LICENSE +190 -0
  2. package/cjs/CodeInterpreter.d.ts +95 -0
  3. package/cjs/CodeInterpreter.d.ts.map +1 -0
  4. package/cjs/CodeInterpreter.js +297 -0
  5. package/cjs/CodeInterpreter.js.map +1 -0
  6. package/cjs/ComputerUse.d.ts +539 -0
  7. package/cjs/ComputerUse.d.ts.map +1 -0
  8. package/cjs/ComputerUse.js +808 -0
  9. package/cjs/ComputerUse.js.map +1 -0
  10. package/cjs/Daytona.d.ts +355 -0
  11. package/cjs/Daytona.d.ts.map +1 -0
  12. package/cjs/Daytona.js +527 -0
  13. package/cjs/Daytona.js.map +1 -0
  14. package/cjs/FileSystem.d.ts +371 -0
  15. package/cjs/FileSystem.d.ts.map +1 -0
  16. package/cjs/FileSystem.js +489 -0
  17. package/cjs/FileSystem.js.map +1 -0
  18. package/cjs/Git.d.ts +203 -0
  19. package/cjs/Git.d.ts.map +1 -0
  20. package/cjs/Git.js +326 -0
  21. package/cjs/Git.js.map +1 -0
  22. package/cjs/Image.d.ts +265 -0
  23. package/cjs/Image.d.ts.map +1 -0
  24. package/cjs/Image.js +586 -0
  25. package/cjs/Image.js.map +1 -0
  26. package/cjs/LspServer.d.ts +172 -0
  27. package/cjs/LspServer.d.ts.map +1 -0
  28. package/cjs/LspServer.js +259 -0
  29. package/cjs/LspServer.js.map +1 -0
  30. package/cjs/ObjectStorage.d.ts +79 -0
  31. package/cjs/ObjectStorage.d.ts.map +1 -0
  32. package/cjs/ObjectStorage.js +199 -0
  33. package/cjs/ObjectStorage.js.map +1 -0
  34. package/cjs/Process.d.ts +490 -0
  35. package/cjs/Process.d.ts.map +1 -0
  36. package/cjs/Process.js +647 -0
  37. package/cjs/Process.js.map +1 -0
  38. package/cjs/PtyHandle.d.ts +155 -0
  39. package/cjs/PtyHandle.d.ts.map +1 -0
  40. package/cjs/PtyHandle.js +416 -0
  41. package/cjs/PtyHandle.js.map +1 -0
  42. package/cjs/README.md +180 -0
  43. package/cjs/Sandbox.d.ts +476 -0
  44. package/cjs/Sandbox.d.ts.map +1 -0
  45. package/cjs/Sandbox.js +905 -0
  46. package/cjs/Sandbox.js.map +1 -0
  47. package/cjs/Snapshot.d.ts +140 -0
  48. package/cjs/Snapshot.d.ts.map +1 -0
  49. package/cjs/Snapshot.js +248 -0
  50. package/cjs/Snapshot.js.map +1 -0
  51. package/cjs/Volume.d.ts +84 -0
  52. package/cjs/Volume.d.ts.map +1 -0
  53. package/cjs/Volume.js +119 -0
  54. package/cjs/Volume.js.map +1 -0
  55. package/cjs/__tests__/helpers.d.ts +6 -0
  56. package/cjs/__tests__/helpers.d.ts.map +1 -0
  57. package/cjs/__tests__/helpers.js +26 -0
  58. package/cjs/__tests__/helpers.js.map +1 -0
  59. package/cjs/errors/DaytonaError.d.ts +171 -0
  60. package/cjs/errors/DaytonaError.d.ts.map +1 -0
  61. package/cjs/errors/DaytonaError.js +258 -0
  62. package/cjs/errors/DaytonaError.js.map +1 -0
  63. package/cjs/index.d.ts +22 -0
  64. package/cjs/index.d.ts.map +1 -0
  65. package/cjs/index.js +49 -0
  66. package/cjs/index.js.map +1 -0
  67. package/cjs/package.json +3 -0
  68. package/cjs/types/Charts.d.ts +38 -0
  69. package/cjs/types/Charts.d.ts.map +1 -0
  70. package/cjs/types/Charts.js +37 -0
  71. package/cjs/types/Charts.js.map +1 -0
  72. package/cjs/types/CodeInterpreter.d.ts +77 -0
  73. package/cjs/types/CodeInterpreter.d.ts.map +1 -0
  74. package/cjs/types/CodeInterpreter.js +7 -0
  75. package/cjs/types/CodeInterpreter.js.map +1 -0
  76. package/cjs/types/ExecuteResponse.d.ts +26 -0
  77. package/cjs/types/ExecuteResponse.d.ts.map +1 -0
  78. package/cjs/types/ExecuteResponse.js +7 -0
  79. package/cjs/types/ExecuteResponse.js.map +1 -0
  80. package/cjs/types/Pty.d.ts +48 -0
  81. package/cjs/types/Pty.d.ts.map +1 -0
  82. package/cjs/types/Pty.js +7 -0
  83. package/cjs/types/Pty.js.map +1 -0
  84. package/cjs/utils/Binary.d.ts +39 -0
  85. package/cjs/utils/Binary.d.ts.map +1 -0
  86. package/cjs/utils/Binary.js +168 -0
  87. package/cjs/utils/Binary.js.map +1 -0
  88. package/cjs/utils/FileTransfer.d.ts +15 -0
  89. package/cjs/utils/FileTransfer.d.ts.map +1 -0
  90. package/cjs/utils/FileTransfer.js +261 -0
  91. package/cjs/utils/FileTransfer.js.map +1 -0
  92. package/cjs/utils/Import.d.ts +125 -0
  93. package/cjs/utils/Import.d.ts.map +1 -0
  94. package/cjs/utils/Import.js +112 -0
  95. package/cjs/utils/Import.js.map +1 -0
  96. package/cjs/utils/Multipart.d.ts +29 -0
  97. package/cjs/utils/Multipart.d.ts.map +1 -0
  98. package/cjs/utils/Multipart.js +115 -0
  99. package/cjs/utils/Multipart.js.map +1 -0
  100. package/cjs/utils/Runtime.d.ts +44 -0
  101. package/cjs/utils/Runtime.d.ts.map +1 -0
  102. package/cjs/utils/Runtime.js +95 -0
  103. package/cjs/utils/Runtime.js.map +1 -0
  104. package/cjs/utils/Stream.d.ts +20 -0
  105. package/cjs/utils/Stream.d.ts.map +1 -0
  106. package/cjs/utils/Stream.js +364 -0
  107. package/cjs/utils/Stream.js.map +1 -0
  108. package/cjs/utils/WebSocket.d.ts +10 -0
  109. package/cjs/utils/WebSocket.d.ts.map +1 -0
  110. package/cjs/utils/WebSocket.js +26 -0
  111. package/cjs/utils/WebSocket.js.map +1 -0
  112. package/cjs/utils/otel.decorator.d.ts +83 -0
  113. package/cjs/utils/otel.decorator.d.ts.map +1 -0
  114. package/cjs/utils/otel.decorator.js +141 -0
  115. package/cjs/utils/otel.decorator.js.map +1 -0
  116. package/esm/CodeInterpreter.d.ts +95 -0
  117. package/esm/CodeInterpreter.d.ts.map +1 -0
  118. package/esm/CodeInterpreter.js +292 -0
  119. package/esm/CodeInterpreter.js.map +1 -0
  120. package/esm/ComputerUse.d.ts +539 -0
  121. package/esm/ComputerUse.d.ts.map +1 -0
  122. package/esm/ComputerUse.js +799 -0
  123. package/esm/ComputerUse.js.map +1 -0
  124. package/esm/Daytona.d.ts +355 -0
  125. package/esm/Daytona.d.ts.map +1 -0
  126. package/esm/Daytona.js +523 -0
  127. package/esm/Daytona.js.map +1 -0
  128. package/esm/FileSystem.d.ts +371 -0
  129. package/esm/FileSystem.d.ts.map +1 -0
  130. package/esm/FileSystem.js +485 -0
  131. package/esm/FileSystem.js.map +1 -0
  132. package/esm/Git.d.ts +203 -0
  133. package/esm/Git.d.ts.map +1 -0
  134. package/esm/Git.js +322 -0
  135. package/esm/Git.js.map +1 -0
  136. package/esm/Image.d.ts +265 -0
  137. package/esm/Image.d.ts.map +1 -0
  138. package/esm/Image.js +581 -0
  139. package/esm/Image.js.map +1 -0
  140. package/esm/LspServer.d.ts +172 -0
  141. package/esm/LspServer.d.ts.map +1 -0
  142. package/esm/LspServer.js +255 -0
  143. package/esm/LspServer.js.map +1 -0
  144. package/esm/ObjectStorage.d.ts +79 -0
  145. package/esm/ObjectStorage.d.ts.map +1 -0
  146. package/esm/ObjectStorage.js +195 -0
  147. package/esm/ObjectStorage.js.map +1 -0
  148. package/esm/Process.d.ts +490 -0
  149. package/esm/Process.d.ts.map +1 -0
  150. package/esm/Process.js +642 -0
  151. package/esm/Process.js.map +1 -0
  152. package/esm/PtyHandle.d.ts +155 -0
  153. package/esm/PtyHandle.d.ts.map +1 -0
  154. package/esm/PtyHandle.js +412 -0
  155. package/esm/PtyHandle.js.map +1 -0
  156. package/esm/README.md +180 -0
  157. package/esm/Sandbox.d.ts +476 -0
  158. package/esm/Sandbox.d.ts.map +1 -0
  159. package/esm/Sandbox.js +901 -0
  160. package/esm/Sandbox.js.map +1 -0
  161. package/esm/Snapshot.d.ts +140 -0
  162. package/esm/Snapshot.d.ts.map +1 -0
  163. package/esm/Snapshot.js +244 -0
  164. package/esm/Snapshot.js.map +1 -0
  165. package/esm/Volume.d.ts +84 -0
  166. package/esm/Volume.d.ts.map +1 -0
  167. package/esm/Volume.js +115 -0
  168. package/esm/Volume.js.map +1 -0
  169. package/esm/__tests__/helpers.d.ts +6 -0
  170. package/esm/__tests__/helpers.d.ts.map +1 -0
  171. package/esm/__tests__/helpers.js +20 -0
  172. package/esm/__tests__/helpers.js.map +1 -0
  173. package/esm/errors/DaytonaError.d.ts +171 -0
  174. package/esm/errors/DaytonaError.d.ts.map +1 -0
  175. package/esm/errors/DaytonaError.js +243 -0
  176. package/esm/errors/DaytonaError.js.map +1 -0
  177. package/esm/index.d.ts +22 -0
  178. package/esm/index.d.ts.map +1 -0
  179. package/esm/index.js +21 -0
  180. package/esm/index.js.map +1 -0
  181. package/esm/package.json +3 -0
  182. package/esm/types/Charts.d.ts +38 -0
  183. package/esm/types/Charts.d.ts.map +1 -0
  184. package/esm/types/Charts.js +33 -0
  185. package/esm/types/Charts.js.map +1 -0
  186. package/esm/types/CodeInterpreter.d.ts +77 -0
  187. package/esm/types/CodeInterpreter.d.ts.map +1 -0
  188. package/esm/types/CodeInterpreter.js +6 -0
  189. package/esm/types/CodeInterpreter.js.map +1 -0
  190. package/esm/types/ExecuteResponse.d.ts +26 -0
  191. package/esm/types/ExecuteResponse.d.ts.map +1 -0
  192. package/esm/types/ExecuteResponse.js +6 -0
  193. package/esm/types/ExecuteResponse.js.map +1 -0
  194. package/esm/types/Pty.d.ts +48 -0
  195. package/esm/types/Pty.d.ts.map +1 -0
  196. package/esm/types/Pty.js +6 -0
  197. package/esm/types/Pty.js.map +1 -0
  198. package/esm/utils/Binary.d.ts +39 -0
  199. package/esm/utils/Binary.d.ts.map +1 -0
  200. package/esm/utils/Binary.js +157 -0
  201. package/esm/utils/Binary.js.map +1 -0
  202. package/esm/utils/FileTransfer.d.ts +15 -0
  203. package/esm/utils/FileTransfer.d.ts.map +1 -0
  204. package/esm/utils/FileTransfer.js +254 -0
  205. package/esm/utils/FileTransfer.js.map +1 -0
  206. package/esm/utils/Import.d.ts +95 -0
  207. package/esm/utils/Import.d.ts.map +1 -0
  208. package/esm/utils/Import.js +77 -0
  209. package/esm/utils/Import.js.map +1 -0
  210. package/esm/utils/Multipart.d.ts +29 -0
  211. package/esm/utils/Multipart.d.ts.map +1 -0
  212. package/esm/utils/Multipart.js +109 -0
  213. package/esm/utils/Multipart.js.map +1 -0
  214. package/esm/utils/Runtime.d.ts +44 -0
  215. package/esm/utils/Runtime.d.ts.map +1 -0
  216. package/esm/utils/Runtime.js +89 -0
  217. package/esm/utils/Runtime.js.map +1 -0
  218. package/esm/utils/Stream.d.ts +20 -0
  219. package/esm/utils/Stream.d.ts.map +1 -0
  220. package/esm/utils/Stream.js +360 -0
  221. package/esm/utils/Stream.js.map +1 -0
  222. package/esm/utils/WebSocket.d.ts +10 -0
  223. package/esm/utils/WebSocket.d.ts.map +1 -0
  224. package/esm/utils/WebSocket.js +22 -0
  225. package/esm/utils/WebSocket.js.map +1 -0
  226. package/esm/utils/otel.decorator.d.ts +83 -0
  227. package/esm/utils/otel.decorator.d.ts.map +1 -0
  228. package/esm/utils/otel.decorator.js +136 -0
  229. package/esm/utils/otel.decorator.js.map +1 -0
  230. package/package.json +20 -8
  231. package/src/ComputerUse.d.ts +4 -4
  232. package/src/ComputerUse.js +4 -4
  233. package/src/Sandbox.d.ts +1 -18
  234. package/src/Sandbox.js +0 -29
  235. package/src/Sandbox.js.map +1 -1
  236. package/src/__tests__/helpers.js +0 -2
  237. package/src/__tests__/helpers.js.map +1 -1
package/esm/Git.d.ts ADDED
@@ -0,0 +1,203 @@
1
+ import { GitApi, ListBranchResponse, GitStatus } from '@daytona/toolbox-api-client';
2
+ /**
3
+ * Response from the git commit.
4
+ *
5
+ * @interface
6
+ * @property {string} sha - The SHA of the commit
7
+ */
8
+ export interface GitCommitResponse {
9
+ sha: string;
10
+ }
11
+ /**
12
+ * Provides Git operations within a Sandbox.
13
+ *
14
+ * @class
15
+ */
16
+ export declare class Git {
17
+ private readonly apiClient;
18
+ constructor(apiClient: GitApi);
19
+ /**
20
+ * Stages the specified files for the next commit, similar to
21
+ * running 'git add' on the command line.
22
+ *
23
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
24
+ * @param {string[]} files - List of file paths or directories to stage, relative to the repository root
25
+ * @returns {Promise<void>}
26
+ *
27
+ * @example
28
+ * // Stage a single file
29
+ * await git.add('workspace/repo', ['file.txt']);
30
+ *
31
+ * @example
32
+ * // Stage whole repository
33
+ * await git.add('workspace/repo', ['.']);
34
+ */
35
+ add(path: string, files: string[]): Promise<void>;
36
+ /**
37
+ * List branches in the repository.
38
+ *
39
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
40
+ * @returns {Promise<ListBranchResponse>} List of branches in the repository
41
+ *
42
+ * @example
43
+ * const response = await git.branches('workspace/repo');
44
+ * console.log(`Branches: ${response.branches}`);
45
+ */
46
+ branches(path: string): Promise<ListBranchResponse>;
47
+ /**
48
+ * Create branch in the repository.
49
+ *
50
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
51
+ * @param {string} name - Name of the new branch to create
52
+ * @returns {Promise<void>}
53
+ *
54
+ * @example
55
+ * await git.createBranch('workspace/repo', 'new-feature');
56
+ */
57
+ createBranch(path: string, name: string): Promise<void>;
58
+ /**
59
+ * Delete branche in the repository.
60
+ *
61
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
62
+ * @param {string} name - Name of the branch to delete
63
+ * @returns {Promise<void>}
64
+ *
65
+ * @example
66
+ * await git.deleteBranch('workspace/repo', 'new-feature');
67
+ */
68
+ deleteBranch(path: string, name: string): Promise<void>;
69
+ /**
70
+ * Checkout branche in the repository.
71
+ *
72
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
73
+ * @param {string} branch - Name of the branch to checkout
74
+ * @returns {Promise<void>}
75
+ *
76
+ * @example
77
+ * await git.checkoutBranch('workspace/repo', 'new-feature');
78
+ */
79
+ checkoutBranch(path: string, branch: string): Promise<void>;
80
+ /**
81
+ * Clones a Git repository into the specified path. It supports
82
+ * cloning specific branches or commits, and can authenticate with the remote
83
+ * repository if credentials are provided.
84
+ *
85
+ * @param {string} url - Repository URL to clone from
86
+ * @param {string} path - Path where the repository should be cloned. Relative paths are resolved based on the sandbox working directory.
87
+ * @param {string} [branch] - Specific branch to clone. If not specified, clones the default branch
88
+ * @param {string} [commitId] - Specific commit to clone. If specified, the repository will be left in a detached HEAD state at this commit
89
+ * @param {string} [username] - Git username for authentication
90
+ * @param {string} [password] - Git password or token for authentication
91
+ * @returns {Promise<void>}
92
+ *
93
+ * @example
94
+ * // Clone the default branch
95
+ * await git.clone(
96
+ * 'https://github.com/user/repo.git',
97
+ * 'workspace/repo'
98
+ * );
99
+ *
100
+ * @example
101
+ * // Clone a specific branch with authentication
102
+ * await git.clone(
103
+ * 'https://github.com/user/private-repo.git',
104
+ * 'workspace/private',
105
+ * branch='develop',
106
+ * username='user',
107
+ * password='token'
108
+ * );
109
+ *
110
+ * @example
111
+ * // Clone a specific commit
112
+ * await git.clone(
113
+ * 'https://github.com/user/repo.git',
114
+ * 'workspace/repo-old',
115
+ * commitId='abc123'
116
+ * );
117
+ */
118
+ clone(url: string, path: string, branch?: string, commitId?: string, username?: string, password?: string): Promise<void>;
119
+ /**
120
+ * Commits staged changes.
121
+ *
122
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
123
+ * @param {string} message - Commit message describing the changes
124
+ * @param {string} author - Name of the commit author
125
+ * @param {string} email - Email address of the commit author
126
+ * @param {boolean} [allowEmpty] - Allow creating an empty commit when no changes are staged
127
+ * @returns {Promise<void>}
128
+ *
129
+ * @example
130
+ * // Stage and commit changes
131
+ * await git.add('workspace/repo', ['README.md']);
132
+ * await git.commit(
133
+ * 'workspace/repo',
134
+ * 'Update documentation',
135
+ * 'John Doe',
136
+ * 'john@example.com',
137
+ * true
138
+ * );
139
+ *
140
+ */
141
+ commit(path: string, message: string, author: string, email: string, allowEmpty?: boolean): Promise<GitCommitResponse>;
142
+ /**
143
+ * Push local changes to the remote repository.
144
+ *
145
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
146
+ * @param {string} [username] - Git username for authentication
147
+ * @param {string} [password] - Git password or token for authentication
148
+ * @returns {Promise<void>}
149
+ *
150
+ * @example
151
+ * // Push to a public repository
152
+ * await git.push('workspace/repo');
153
+ *
154
+ * @example
155
+ * // Push to a private repository
156
+ * await git.push(
157
+ * 'workspace/repo',
158
+ * 'user',
159
+ * 'token'
160
+ * );
161
+ */
162
+ push(path: string, username?: string, password?: string): Promise<void>;
163
+ /**
164
+ * Pulls changes from the remote repository.
165
+ *
166
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
167
+ * @param {string} [username] - Git username for authentication
168
+ * @param {string} [password] - Git password or token for authentication
169
+ * @returns {Promise<void>}
170
+ *
171
+ * @example
172
+ * // Pull from a public repository
173
+ * await git.pull('workspace/repo');
174
+ *
175
+ * @example
176
+ * // Pull from a private repository
177
+ * await git.pull(
178
+ * 'workspace/repo',
179
+ * 'user',
180
+ * 'token'
181
+ * );
182
+ */
183
+ pull(path: string, username?: string, password?: string): Promise<void>;
184
+ /**
185
+ * Gets the current status of the Git repository.
186
+ *
187
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
188
+ * @returns {Promise<GitStatus>} Current repository status including:
189
+ * - currentBranch: Name of the current branch
190
+ * - ahead: Number of commits ahead of the remote branch
191
+ * - behind: Number of commits behind the remote branch
192
+ * - branchPublished: Whether the branch has been published to the remote repository
193
+ * - fileStatus: List of file statuses
194
+ *
195
+ * @example
196
+ * const status = await sandbox.git.status('workspace/repo');
197
+ * console.log(`Current branch: ${status.currentBranch}`);
198
+ * console.log(`Commits ahead: ${status.ahead}`);
199
+ * console.log(`Commits behind: ${status.behind}`);
200
+ */
201
+ status(path: string): Promise<GitStatus>;
202
+ }
203
+ //# sourceMappingURL=Git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Git.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Git.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAGnF;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;GAIG;AACH,qBAAa,GAAG;IACF,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,MAAM;IAE9C;;;;;;;;;;;;;;;OAeG;IAEU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D;;;;;;;;;OASG;IAEU,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKhE;;;;;;;;;OASG;IAEU,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE;;;;;;;;;OASG;IAEU,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE;;;;;;;;;OASG;IAEU,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IAEU,KAAK,CAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAWhB;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,iBAAiB,CAAC;IAa7B;;;;;;;;;;;;;;;;;;;OAmBG;IAEU,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpF;;;;;;;;;;;;;;;;;;;OAmBG;IAEU,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpF;;;;;;;;;;;;;;;;OAgBG;IAEU,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAItD"}
package/esm/Git.js ADDED
@@ -0,0 +1,322 @@
1
+ /*
2
+ * Copyright 2025 Daytona Platforms Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { __decorate, __metadata } from "tslib";
6
+ import { WithInstrumentation } from './utils/otel.decorator.js';
7
+ /**
8
+ * Provides Git operations within a Sandbox.
9
+ *
10
+ * @class
11
+ */
12
+ export class Git {
13
+ apiClient;
14
+ constructor(apiClient) {
15
+ this.apiClient = apiClient;
16
+ }
17
+ /**
18
+ * Stages the specified files for the next commit, similar to
19
+ * running 'git add' on the command line.
20
+ *
21
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
22
+ * @param {string[]} files - List of file paths or directories to stage, relative to the repository root
23
+ * @returns {Promise<void>}
24
+ *
25
+ * @example
26
+ * // Stage a single file
27
+ * await git.add('workspace/repo', ['file.txt']);
28
+ *
29
+ * @example
30
+ * // Stage whole repository
31
+ * await git.add('workspace/repo', ['.']);
32
+ */
33
+ async add(path, files) {
34
+ await this.apiClient.addFiles({
35
+ path,
36
+ files,
37
+ });
38
+ }
39
+ /**
40
+ * List branches in the repository.
41
+ *
42
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
43
+ * @returns {Promise<ListBranchResponse>} List of branches in the repository
44
+ *
45
+ * @example
46
+ * const response = await git.branches('workspace/repo');
47
+ * console.log(`Branches: ${response.branches}`);
48
+ */
49
+ async branches(path) {
50
+ const response = await this.apiClient.listBranches(path);
51
+ return response.data;
52
+ }
53
+ /**
54
+ * Create branch in the repository.
55
+ *
56
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
57
+ * @param {string} name - Name of the new branch to create
58
+ * @returns {Promise<void>}
59
+ *
60
+ * @example
61
+ * await git.createBranch('workspace/repo', 'new-feature');
62
+ */
63
+ async createBranch(path, name) {
64
+ await this.apiClient.createBranch({
65
+ path,
66
+ name,
67
+ });
68
+ return;
69
+ }
70
+ /**
71
+ * Delete branche in the repository.
72
+ *
73
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
74
+ * @param {string} name - Name of the branch to delete
75
+ * @returns {Promise<void>}
76
+ *
77
+ * @example
78
+ * await git.deleteBranch('workspace/repo', 'new-feature');
79
+ */
80
+ async deleteBranch(path, name) {
81
+ await this.apiClient.deleteBranch({
82
+ path,
83
+ name,
84
+ });
85
+ return;
86
+ }
87
+ /**
88
+ * Checkout branche in the repository.
89
+ *
90
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
91
+ * @param {string} branch - Name of the branch to checkout
92
+ * @returns {Promise<void>}
93
+ *
94
+ * @example
95
+ * await git.checkoutBranch('workspace/repo', 'new-feature');
96
+ */
97
+ async checkoutBranch(path, branch) {
98
+ await this.apiClient.checkoutBranch({
99
+ path,
100
+ branch,
101
+ });
102
+ return;
103
+ }
104
+ /**
105
+ * Clones a Git repository into the specified path. It supports
106
+ * cloning specific branches or commits, and can authenticate with the remote
107
+ * repository if credentials are provided.
108
+ *
109
+ * @param {string} url - Repository URL to clone from
110
+ * @param {string} path - Path where the repository should be cloned. Relative paths are resolved based on the sandbox working directory.
111
+ * @param {string} [branch] - Specific branch to clone. If not specified, clones the default branch
112
+ * @param {string} [commitId] - Specific commit to clone. If specified, the repository will be left in a detached HEAD state at this commit
113
+ * @param {string} [username] - Git username for authentication
114
+ * @param {string} [password] - Git password or token for authentication
115
+ * @returns {Promise<void>}
116
+ *
117
+ * @example
118
+ * // Clone the default branch
119
+ * await git.clone(
120
+ * 'https://github.com/user/repo.git',
121
+ * 'workspace/repo'
122
+ * );
123
+ *
124
+ * @example
125
+ * // Clone a specific branch with authentication
126
+ * await git.clone(
127
+ * 'https://github.com/user/private-repo.git',
128
+ * 'workspace/private',
129
+ * branch='develop',
130
+ * username='user',
131
+ * password='token'
132
+ * );
133
+ *
134
+ * @example
135
+ * // Clone a specific commit
136
+ * await git.clone(
137
+ * 'https://github.com/user/repo.git',
138
+ * 'workspace/repo-old',
139
+ * commitId='abc123'
140
+ * );
141
+ */
142
+ async clone(url, path, branch, commitId, username, password) {
143
+ await this.apiClient.cloneRepository({
144
+ url: url,
145
+ branch: branch,
146
+ path,
147
+ username,
148
+ password,
149
+ commit_id: commitId,
150
+ });
151
+ }
152
+ /**
153
+ * Commits staged changes.
154
+ *
155
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
156
+ * @param {string} message - Commit message describing the changes
157
+ * @param {string} author - Name of the commit author
158
+ * @param {string} email - Email address of the commit author
159
+ * @param {boolean} [allowEmpty] - Allow creating an empty commit when no changes are staged
160
+ * @returns {Promise<void>}
161
+ *
162
+ * @example
163
+ * // Stage and commit changes
164
+ * await git.add('workspace/repo', ['README.md']);
165
+ * await git.commit(
166
+ * 'workspace/repo',
167
+ * 'Update documentation',
168
+ * 'John Doe',
169
+ * 'john@example.com',
170
+ * true
171
+ * );
172
+ *
173
+ */
174
+ async commit(path, message, author, email, allowEmpty) {
175
+ const response = await this.apiClient.commitChanges({
176
+ path,
177
+ message,
178
+ author,
179
+ email,
180
+ allow_empty: allowEmpty,
181
+ });
182
+ return {
183
+ sha: response.data.hash,
184
+ };
185
+ }
186
+ /**
187
+ * Push local changes to the remote repository.
188
+ *
189
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
190
+ * @param {string} [username] - Git username for authentication
191
+ * @param {string} [password] - Git password or token for authentication
192
+ * @returns {Promise<void>}
193
+ *
194
+ * @example
195
+ * // Push to a public repository
196
+ * await git.push('workspace/repo');
197
+ *
198
+ * @example
199
+ * // Push to a private repository
200
+ * await git.push(
201
+ * 'workspace/repo',
202
+ * 'user',
203
+ * 'token'
204
+ * );
205
+ */
206
+ async push(path, username, password) {
207
+ await this.apiClient.pushChanges({
208
+ path,
209
+ username,
210
+ password,
211
+ });
212
+ }
213
+ /**
214
+ * Pulls changes from the remote repository.
215
+ *
216
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
217
+ * @param {string} [username] - Git username for authentication
218
+ * @param {string} [password] - Git password or token for authentication
219
+ * @returns {Promise<void>}
220
+ *
221
+ * @example
222
+ * // Pull from a public repository
223
+ * await git.pull('workspace/repo');
224
+ *
225
+ * @example
226
+ * // Pull from a private repository
227
+ * await git.pull(
228
+ * 'workspace/repo',
229
+ * 'user',
230
+ * 'token'
231
+ * );
232
+ */
233
+ async pull(path, username, password) {
234
+ await this.apiClient.pullChanges({
235
+ path,
236
+ username,
237
+ password,
238
+ });
239
+ }
240
+ /**
241
+ * Gets the current status of the Git repository.
242
+ *
243
+ * @param {string} path - Path to the Git repository root. Relative paths are resolved based on the sandbox working directory.
244
+ * @returns {Promise<GitStatus>} Current repository status including:
245
+ * - currentBranch: Name of the current branch
246
+ * - ahead: Number of commits ahead of the remote branch
247
+ * - behind: Number of commits behind the remote branch
248
+ * - branchPublished: Whether the branch has been published to the remote repository
249
+ * - fileStatus: List of file statuses
250
+ *
251
+ * @example
252
+ * const status = await sandbox.git.status('workspace/repo');
253
+ * console.log(`Current branch: ${status.currentBranch}`);
254
+ * console.log(`Commits ahead: ${status.ahead}`);
255
+ * console.log(`Commits behind: ${status.behind}`);
256
+ */
257
+ async status(path) {
258
+ const response = await this.apiClient.getStatus(path);
259
+ return response.data;
260
+ }
261
+ }
262
+ __decorate([
263
+ WithInstrumentation(),
264
+ __metadata("design:type", Function),
265
+ __metadata("design:paramtypes", [String, Array]),
266
+ __metadata("design:returntype", Promise)
267
+ ], Git.prototype, "add", null);
268
+ __decorate([
269
+ WithInstrumentation(),
270
+ __metadata("design:type", Function),
271
+ __metadata("design:paramtypes", [String]),
272
+ __metadata("design:returntype", Promise)
273
+ ], Git.prototype, "branches", null);
274
+ __decorate([
275
+ WithInstrumentation(),
276
+ __metadata("design:type", Function),
277
+ __metadata("design:paramtypes", [String, String]),
278
+ __metadata("design:returntype", Promise)
279
+ ], Git.prototype, "createBranch", null);
280
+ __decorate([
281
+ WithInstrumentation(),
282
+ __metadata("design:type", Function),
283
+ __metadata("design:paramtypes", [String, String]),
284
+ __metadata("design:returntype", Promise)
285
+ ], Git.prototype, "deleteBranch", null);
286
+ __decorate([
287
+ WithInstrumentation(),
288
+ __metadata("design:type", Function),
289
+ __metadata("design:paramtypes", [String, String]),
290
+ __metadata("design:returntype", Promise)
291
+ ], Git.prototype, "checkoutBranch", null);
292
+ __decorate([
293
+ WithInstrumentation(),
294
+ __metadata("design:type", Function),
295
+ __metadata("design:paramtypes", [String, String, String, String, String, String]),
296
+ __metadata("design:returntype", Promise)
297
+ ], Git.prototype, "clone", null);
298
+ __decorate([
299
+ WithInstrumentation(),
300
+ __metadata("design:type", Function),
301
+ __metadata("design:paramtypes", [String, String, String, String, Boolean]),
302
+ __metadata("design:returntype", Promise)
303
+ ], Git.prototype, "commit", null);
304
+ __decorate([
305
+ WithInstrumentation(),
306
+ __metadata("design:type", Function),
307
+ __metadata("design:paramtypes", [String, String, String]),
308
+ __metadata("design:returntype", Promise)
309
+ ], Git.prototype, "push", null);
310
+ __decorate([
311
+ WithInstrumentation(),
312
+ __metadata("design:type", Function),
313
+ __metadata("design:paramtypes", [String, String, String]),
314
+ __metadata("design:returntype", Promise)
315
+ ], Git.prototype, "pull", null);
316
+ __decorate([
317
+ WithInstrumentation(),
318
+ __metadata("design:type", Function),
319
+ __metadata("design:paramtypes", [String]),
320
+ __metadata("design:returntype", Promise)
321
+ ], Git.prototype, "status", null);
322
+ //# sourceMappingURL=Git.js.map
package/esm/Git.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Git.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Git.ts"],"names":[],"mappings":"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"}