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