@daytonaio/sdk 0.162.0 → 0.164.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/CodeInterpreter.js +4 -4
- package/src/CodeInterpreter.js.map +1 -1
- package/src/Daytona.d.ts +1 -9
- package/src/Daytona.js +23 -66
- package/src/Daytona.js.map +1 -1
- package/src/FileSystem.d.ts +19 -1
- package/src/FileSystem.js +11 -3
- package/src/FileSystem.js.map +1 -1
- package/src/Image.js +51 -11
- package/src/Image.js.map +1 -1
- package/src/LspServer.js +2 -1
- package/src/LspServer.js.map +1 -1
- package/src/ObjectStorage.js +1 -1
- package/src/ObjectStorage.js.map +1 -1
- package/src/Process.d.ts +2 -3
- package/src/Process.js +42 -177
- package/src/Process.js.map +1 -1
- package/src/PtyHandle.js +4 -4
- package/src/PtyHandle.js.map +1 -1
- package/src/Sandbox.d.ts +2 -14
- package/src/Sandbox.js +16 -19
- package/src/Sandbox.js.map +1 -1
- package/src/errors/DaytonaError.d.ts +146 -7
- package/src/errors/DaytonaError.js +222 -15
- package/src/errors/DaytonaError.js.map +1 -1
- package/src/index.d.ts +4 -4
- package/src/index.js +6 -2
- package/src/index.js.map +1 -1
- package/src/types/Charts.d.ts +18 -132
- package/src/types/Charts.js +9 -18
- package/src/types/Charts.js.map +1 -1
- package/src/types/ExecuteResponse.d.ts +1 -1
- package/src/utils/FileTransfer.d.ts +1 -1
- package/src/utils/FileTransfer.js +54 -12
- package/src/utils/FileTransfer.js.map +1 -1
- package/src/utils/Multipart.d.ts +3 -1
- package/src/utils/Multipart.js +4 -2
- package/src/utils/Multipart.js.map +1 -1
- package/src/code-toolbox/SandboxJsCodeToolbox.d.ts +0 -5
- package/src/code-toolbox/SandboxJsCodeToolbox.js +0 -20
- package/src/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
- package/src/code-toolbox/SandboxPythonCodeToolbox.d.ts +0 -11
- package/src/code-toolbox/SandboxPythonCodeToolbox.js +0 -359
- package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
- package/src/code-toolbox/SandboxTsCodeToolbox.d.ts +0 -5
- package/src/code-toolbox/SandboxTsCodeToolbox.js +0 -29
- package/src/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
- package/src/utils/ArtifactParser.d.ts +0 -13
- package/src/utils/ArtifactParser.js +0 -55
- package/src/utils/ArtifactParser.js.map +0 -1
|
@@ -4,48 +4,255 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DaytonaTimeoutError = exports.DaytonaRateLimitError = exports.DaytonaNotFoundError = exports.DaytonaError = void 0;
|
|
7
|
+
exports.DaytonaConnectionError = exports.DaytonaTimeoutError = exports.DaytonaValidationError = exports.DaytonaConflictError = exports.DaytonaAuthorizationError = exports.DaytonaAuthenticationError = exports.DaytonaRateLimitError = exports.DaytonaNotFoundError = exports.DaytonaError = void 0;
|
|
8
|
+
exports.errorClassFromStatusCode = errorClassFromStatusCode;
|
|
9
|
+
exports.createDaytonaError = createDaytonaError;
|
|
10
|
+
exports.createAxiosDaytonaError = createAxiosDaytonaError;
|
|
8
11
|
/**
|
|
9
12
|
* Base error for Daytona SDK.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* try {
|
|
17
|
+
* await daytona.get('missing-sandbox')
|
|
18
|
+
* } catch (error) {
|
|
19
|
+
* if (error instanceof DaytonaError) {
|
|
20
|
+
* console.log(error.statusCode)
|
|
21
|
+
* console.log(error.errorCode)
|
|
22
|
+
* console.log(error.message)
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
10
26
|
*/
|
|
11
27
|
class DaytonaError extends Error {
|
|
12
28
|
/** HTTP status code if available */
|
|
13
29
|
statusCode;
|
|
30
|
+
/** Machine-readable error code if available */
|
|
31
|
+
errorCode;
|
|
14
32
|
/** Response headers if available */
|
|
15
33
|
headers;
|
|
16
|
-
constructor(message, statusCode, headers) {
|
|
34
|
+
constructor(message, statusCode, headers, errorCode) {
|
|
17
35
|
super(message);
|
|
18
|
-
this.name =
|
|
36
|
+
this.name = new.target.name;
|
|
19
37
|
this.statusCode = statusCode;
|
|
20
38
|
this.headers = headers;
|
|
39
|
+
this.errorCode = errorCode;
|
|
21
40
|
}
|
|
22
41
|
}
|
|
23
42
|
exports.DaytonaError = DaytonaError;
|
|
43
|
+
/**
|
|
44
|
+
* Error thrown when a resource is not found (HTTP 404).
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* try {
|
|
49
|
+
* await sandbox.fs.downloadFile('/workspace/missing.txt')
|
|
50
|
+
* } catch (error) {
|
|
51
|
+
* if (error instanceof DaytonaNotFoundError) {
|
|
52
|
+
* console.log(error.statusCode)
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
24
57
|
class DaytonaNotFoundError extends DaytonaError {
|
|
25
|
-
constructor(message, statusCode, headers) {
|
|
26
|
-
super(message, statusCode, headers);
|
|
27
|
-
this.name = 'DaytonaNotFoundError';
|
|
28
|
-
}
|
|
29
58
|
}
|
|
30
59
|
exports.DaytonaNotFoundError = DaytonaNotFoundError;
|
|
31
60
|
/**
|
|
32
61
|
* Error thrown when rate limit is exceeded.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* try {
|
|
66
|
+
* await daytona.list()
|
|
67
|
+
* } catch (error) {
|
|
68
|
+
* if (error instanceof DaytonaRateLimitError) {
|
|
69
|
+
* console.log(error.errorCode)
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
33
73
|
*/
|
|
34
74
|
class DaytonaRateLimitError extends DaytonaError {
|
|
35
|
-
constructor(message, statusCode, headers) {
|
|
36
|
-
super(message, statusCode, headers);
|
|
37
|
-
this.name = 'DaytonaRateLimitError';
|
|
38
|
-
}
|
|
39
75
|
}
|
|
40
76
|
exports.DaytonaRateLimitError = DaytonaRateLimitError;
|
|
77
|
+
/**
|
|
78
|
+
* Error thrown when authentication fails (HTTP 401).
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* try {
|
|
83
|
+
* await daytona.list()
|
|
84
|
+
* } catch (error) {
|
|
85
|
+
* if (error instanceof DaytonaAuthenticationError) {
|
|
86
|
+
* console.log(error.statusCode)
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
class DaytonaAuthenticationError extends DaytonaError {
|
|
92
|
+
}
|
|
93
|
+
exports.DaytonaAuthenticationError = DaytonaAuthenticationError;
|
|
94
|
+
/**
|
|
95
|
+
* Error thrown when the request is forbidden (HTTP 403).
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* try {
|
|
100
|
+
* await daytona.get('sandbox-without-access')
|
|
101
|
+
* } catch (error) {
|
|
102
|
+
* if (error instanceof DaytonaAuthorizationError) {
|
|
103
|
+
* console.log(error.message)
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
class DaytonaAuthorizationError extends DaytonaError {
|
|
109
|
+
}
|
|
110
|
+
exports.DaytonaAuthorizationError = DaytonaAuthorizationError;
|
|
111
|
+
/**
|
|
112
|
+
* Error thrown when a resource conflict occurs (HTTP 409).
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* try {
|
|
117
|
+
* await daytona.create({ name: 'existing-sandbox' })
|
|
118
|
+
* } catch (error) {
|
|
119
|
+
* if (error instanceof DaytonaConflictError) {
|
|
120
|
+
* console.log(error.errorCode)
|
|
121
|
+
* }
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
class DaytonaConflictError extends DaytonaError {
|
|
126
|
+
}
|
|
127
|
+
exports.DaytonaConflictError = DaytonaConflictError;
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when input validation fails (HTTP 400 or client-side validation).
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* try {
|
|
134
|
+
* Image.debianSlim('3.8' as never)
|
|
135
|
+
* } catch (error) {
|
|
136
|
+
* if (error instanceof DaytonaValidationError) {
|
|
137
|
+
* console.log(error.message)
|
|
138
|
+
* }
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
class DaytonaValidationError extends DaytonaError {
|
|
143
|
+
}
|
|
144
|
+
exports.DaytonaValidationError = DaytonaValidationError;
|
|
41
145
|
/**
|
|
42
146
|
* Error thrown when a timeout occurs.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* try {
|
|
151
|
+
* await sandbox.waitUntilStarted(1)
|
|
152
|
+
* } catch (error) {
|
|
153
|
+
* if (error instanceof DaytonaTimeoutError) {
|
|
154
|
+
* console.log(error.message)
|
|
155
|
+
* }
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
43
158
|
*/
|
|
44
159
|
class DaytonaTimeoutError extends DaytonaError {
|
|
45
|
-
constructor(message, statusCode, headers) {
|
|
46
|
-
super(message, statusCode, headers);
|
|
47
|
-
this.name = 'DaytonaTimeoutError';
|
|
48
|
-
}
|
|
49
160
|
}
|
|
50
161
|
exports.DaytonaTimeoutError = DaytonaTimeoutError;
|
|
162
|
+
/**
|
|
163
|
+
* Error thrown when a network connection fails.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* try {
|
|
168
|
+
* await ptyHandle.waitForConnection()
|
|
169
|
+
* } catch (error) {
|
|
170
|
+
* if (error instanceof DaytonaConnectionError) {
|
|
171
|
+
* console.log(error.message)
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
class DaytonaConnectionError extends DaytonaError {
|
|
177
|
+
}
|
|
178
|
+
exports.DaytonaConnectionError = DaytonaConnectionError;
|
|
179
|
+
const STATUS_CODE_TO_ERROR = {
|
|
180
|
+
400: DaytonaValidationError,
|
|
181
|
+
401: DaytonaAuthenticationError,
|
|
182
|
+
403: DaytonaAuthorizationError,
|
|
183
|
+
404: DaytonaNotFoundError,
|
|
184
|
+
409: DaytonaConflictError,
|
|
185
|
+
429: DaytonaRateLimitError,
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Maps an HTTP status code to the corresponding Daytona error class.
|
|
189
|
+
*/
|
|
190
|
+
function errorClassFromStatusCode(statusCode) {
|
|
191
|
+
if (statusCode === undefined) {
|
|
192
|
+
return DaytonaError;
|
|
193
|
+
}
|
|
194
|
+
return STATUS_CODE_TO_ERROR[statusCode] || DaytonaError;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Creates the appropriate Daytona error subclass from structured error metadata.
|
|
198
|
+
*/
|
|
199
|
+
function createDaytonaError(message, statusCode, headers, errorCode) {
|
|
200
|
+
const ErrorClass = errorClassFromStatusCode(statusCode);
|
|
201
|
+
return new ErrorClass(message, statusCode, headers, errorCode);
|
|
202
|
+
}
|
|
203
|
+
function isAxiosTimeoutError(error) {
|
|
204
|
+
return error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT' || error.message.includes('timeout of');
|
|
205
|
+
}
|
|
206
|
+
function getAxiosResponseDataObject(error) {
|
|
207
|
+
if (!error.response?.data || typeof error.response.data !== 'object') {
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
return error.response.data;
|
|
211
|
+
}
|
|
212
|
+
function extractAxiosErrorCode(responseData) {
|
|
213
|
+
if (typeof responseData?.code === 'string') {
|
|
214
|
+
return responseData.code;
|
|
215
|
+
}
|
|
216
|
+
if (typeof responseData?.error_code === 'string') {
|
|
217
|
+
return responseData.error_code;
|
|
218
|
+
}
|
|
219
|
+
if (typeof responseData?.error === 'string') {
|
|
220
|
+
return responseData.error;
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
function extractAxiosErrorMessage(error) {
|
|
225
|
+
if (isAxiosTimeoutError(error)) {
|
|
226
|
+
return 'Operation timed out';
|
|
227
|
+
}
|
|
228
|
+
const responseData = getAxiosResponseDataObject(error);
|
|
229
|
+
const responseMessage = responseData?.message || error.response?.data;
|
|
230
|
+
const message = responseMessage || error.message || String(error);
|
|
231
|
+
if (typeof message === 'object') {
|
|
232
|
+
try {
|
|
233
|
+
return JSON.stringify(message);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return String(message);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return String(message);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Creates the appropriate Daytona error subclass from an Axios error.
|
|
243
|
+
*/
|
|
244
|
+
function createAxiosDaytonaError(error) {
|
|
245
|
+
const message = extractAxiosErrorMessage(error);
|
|
246
|
+
const statusCode = error.response?.status;
|
|
247
|
+
const headers = error.response?.headers;
|
|
248
|
+
const responseData = getAxiosResponseDataObject(error);
|
|
249
|
+
const errorCode = extractAxiosErrorCode(responseData);
|
|
250
|
+
if (isAxiosTimeoutError(error)) {
|
|
251
|
+
return new DaytonaTimeoutError(message, statusCode, headers, errorCode);
|
|
252
|
+
}
|
|
253
|
+
if (!error.response && (error.request || error.code)) {
|
|
254
|
+
return new DaytonaConnectionError(message, statusCode, headers, errorCode);
|
|
255
|
+
}
|
|
256
|
+
return createDaytonaError(message, statusCode, headers, errorCode);
|
|
257
|
+
}
|
|
51
258
|
//# sourceMappingURL=DaytonaError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DaytonaError.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/errors/DaytonaError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"DaytonaError.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/errors/DaytonaError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA+LH,4DAMC;AAKD,gDAQC;AAqDD,0DAgBC;AA7QD;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,oCAAoC;IAC7B,UAAU,CAAS;IAC1B,+CAA+C;IACxC,SAAS,CAAS;IACzB,oCAAoC;IAC7B,OAAO,CAAkB;IAEhC,YAAY,OAAe,EAAE,UAAmB,EAAE,OAAyB,EAAE,SAAkB;QAC7F,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAA;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;CACF;AAfD,oCAeC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,oBAAqB,SAAQ,YAAY;CACrD;AADD,oDACC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,qBAAsB,SAAQ,YAAY;CACtD;AADD,sDACC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,0BAA2B,SAAQ,YAAY;CAC3D;AADD,gEACC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,yBAA0B,SAAQ,YAAY;CAC1D;AADD,8DACC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,oBAAqB,SAAQ,YAAY;CACrD;AADD,oDACC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,sBAAuB,SAAQ,YAAY;CACvD;AADD,wDACC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,mBAAoB,SAAQ,YAAY;CACpD;AADD,kDACC;AAED;;;;;;;;;;;;;GAa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AAY,CAAC,CAAA;IAErD,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;IACzE,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACrD,OAAO,IAAI,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;IAC5E,CAAC;IAED,OAAO,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;AACpE,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export { CodeLanguage, Daytona } from './Daytona';
|
|
2
2
|
export type { CreateSandboxBaseParams, CreateSandboxFromImageParams, CreateSandboxFromSnapshotParams, DaytonaConfig, Resources, VolumeMount, } from './Daytona';
|
|
3
3
|
export { FileSystem } from './FileSystem';
|
|
4
|
+
export type { DownloadMetadata, FileDownloadErrorDetails, FileDownloadRequest, FileDownloadResponse, FilePermissionsParams, FileUpload, } from './FileSystem';
|
|
4
5
|
export { Git } from './Git';
|
|
5
6
|
export { LspLanguageId } from './LspServer';
|
|
6
7
|
export { Process } from './Process';
|
|
7
|
-
export { DaytonaError, DaytonaNotFoundError, DaytonaRateLimitError, DaytonaTimeoutError } from './errors/DaytonaError';
|
|
8
|
+
export { DaytonaAuthenticationError, DaytonaAuthorizationError, DaytonaConflictError, DaytonaConnectionError, DaytonaError, DaytonaNotFoundError, DaytonaRateLimitError, DaytonaTimeoutError, DaytonaValidationError, } from './errors/DaytonaError';
|
|
8
9
|
export { Image } from './Image';
|
|
9
10
|
export { Sandbox } from './Sandbox';
|
|
10
|
-
export type { SandboxCodeToolbox } from './Sandbox';
|
|
11
11
|
export type { CreateSnapshotParams } from './Snapshot';
|
|
12
12
|
export { ComputerUse, Mouse, Keyboard, Screenshot, Display } from './ComputerUse';
|
|
13
|
-
export type {
|
|
13
|
+
export type { BarChart, BarData, BoxAndWhiskerChart, BoxAndWhiskerData, Chart, Chart2D, ChartElement, CompositeChart, LineChart, PieChart, PieData, PointChart, PointData, ScatterChart, } from './types/Charts';
|
|
14
14
|
export { ChartType } from './types/Charts';
|
|
15
|
-
export type {
|
|
15
|
+
export type { ExecutionError, ExecutionResult, OutputMessage, RunCodeOptions } from './types/CodeInterpreter';
|
|
16
16
|
export { SandboxState } from '@daytona/api-client';
|
|
17
17
|
export type { FileInfo, GitStatus, ListBranchResponse, Match, ReplaceResult, SearchFilesResponse, } from '@daytona/toolbox-api-client';
|
|
18
18
|
export type { ScreenshotRegion, ScreenshotOptions } from './ComputerUse';
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SandboxState = exports.ChartType = exports.Display = exports.Screenshot = exports.Keyboard = exports.Mouse = exports.ComputerUse = exports.Sandbox = exports.Image = exports.DaytonaTimeoutError = exports.DaytonaRateLimitError = exports.DaytonaNotFoundError = exports.DaytonaError = exports.Process = exports.LspLanguageId = exports.Git = exports.FileSystem = exports.Daytona = exports.CodeLanguage = void 0;
|
|
7
|
+
exports.SandboxState = exports.ChartType = exports.Display = exports.Screenshot = exports.Keyboard = exports.Mouse = exports.ComputerUse = exports.Sandbox = exports.Image = exports.DaytonaValidationError = exports.DaytonaTimeoutError = exports.DaytonaRateLimitError = exports.DaytonaNotFoundError = exports.DaytonaError = exports.DaytonaConnectionError = exports.DaytonaConflictError = exports.DaytonaAuthorizationError = exports.DaytonaAuthenticationError = exports.Process = exports.LspLanguageId = exports.Git = exports.FileSystem = exports.Daytona = exports.CodeLanguage = void 0;
|
|
8
8
|
const tslib_1 = require("tslib");
|
|
9
9
|
var Daytona_1 = require("./Daytona");
|
|
10
10
|
Object.defineProperty(exports, "CodeLanguage", { enumerable: true, get: function () { return Daytona_1.CodeLanguage; } });
|
|
@@ -20,10 +20,15 @@ Object.defineProperty(exports, "Process", { enumerable: true, get: function () {
|
|
|
20
20
|
// export { LspServer } from './LspServer'
|
|
21
21
|
// export type { LspLanguageId, Position } from './LspServer'
|
|
22
22
|
var DaytonaError_1 = require("./errors/DaytonaError");
|
|
23
|
+
Object.defineProperty(exports, "DaytonaAuthenticationError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaAuthenticationError; } });
|
|
24
|
+
Object.defineProperty(exports, "DaytonaAuthorizationError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaAuthorizationError; } });
|
|
25
|
+
Object.defineProperty(exports, "DaytonaConflictError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaConflictError; } });
|
|
26
|
+
Object.defineProperty(exports, "DaytonaConnectionError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaConnectionError; } });
|
|
23
27
|
Object.defineProperty(exports, "DaytonaError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaError; } });
|
|
24
28
|
Object.defineProperty(exports, "DaytonaNotFoundError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaNotFoundError; } });
|
|
25
29
|
Object.defineProperty(exports, "DaytonaRateLimitError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaRateLimitError; } });
|
|
26
30
|
Object.defineProperty(exports, "DaytonaTimeoutError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaTimeoutError; } });
|
|
31
|
+
Object.defineProperty(exports, "DaytonaValidationError", { enumerable: true, get: function () { return DaytonaError_1.DaytonaValidationError; } });
|
|
27
32
|
var Image_1 = require("./Image");
|
|
28
33
|
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return Image_1.Image; } });
|
|
29
34
|
var Sandbox_1 = require("./Sandbox");
|
|
@@ -34,7 +39,6 @@ Object.defineProperty(exports, "Mouse", { enumerable: true, get: function () { r
|
|
|
34
39
|
Object.defineProperty(exports, "Keyboard", { enumerable: true, get: function () { return ComputerUse_1.Keyboard; } });
|
|
35
40
|
Object.defineProperty(exports, "Screenshot", { enumerable: true, get: function () { return ComputerUse_1.Screenshot; } });
|
|
36
41
|
Object.defineProperty(exports, "Display", { enumerable: true, get: function () { return ComputerUse_1.Display; } });
|
|
37
|
-
// Chart and artifact types
|
|
38
42
|
var Charts_1 = require("./types/Charts");
|
|
39
43
|
Object.defineProperty(exports, "ChartType", { enumerable: true, get: function () { return Charts_1.ChartType; } });
|
|
40
44
|
var api_client_1 = require("@daytona/api-client");
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,qCAAiD;AAAxC,uGAAA,YAAY,OAAA;AAAE,kGAAA,OAAO,OAAA;AAS9B,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/sdk-typescript/src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,qCAAiD;AAAxC,uGAAA,YAAY,OAAA;AAAE,kGAAA,OAAO,OAAA;AAS9B,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AASnB,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,yCAA2C;AAAlC,0GAAA,aAAa,OAAA;AACtB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,0CAA0C;AAC1C,6DAA6D;AAC7D,sDAU8B;AAT5B,0HAAA,0BAA0B,OAAA;AAC1B,yHAAA,yBAAyB,OAAA;AACzB,oHAAA,oBAAoB,OAAA;AACpB,sHAAA,sBAAsB,OAAA;AACtB,4GAAA,YAAY,OAAA;AACZ,oHAAA,oBAAoB,OAAA;AACpB,qHAAA,qBAAqB,OAAA;AACrB,mHAAA,mBAAmB,OAAA;AACnB,sHAAA,sBAAsB,OAAA;AAExB,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,6CAAiF;AAAxE,0GAAA,WAAW,OAAA;AAAE,oGAAA,KAAK,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,sGAAA,OAAO,OAAA;AAiB1D,yCAA0C;AAAjC,mGAAA,SAAS,OAAA;AAGlB,kDAAkD;AAAzC,0GAAA,YAAY,OAAA;AAYrB,oDAAyB;AACzB,sDAA2B;AAC3B,sDAA2B"}
|
package/src/types/Charts.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Chart types
|
|
3
|
-
*/
|
|
1
|
+
import type { Chart as GeneratedChart, ChartElement as GeneratedChartElement } from '@daytona/toolbox-api-client';
|
|
4
2
|
export declare enum ChartType {
|
|
5
3
|
LINE = "line",
|
|
6
4
|
SCATTER = "scatter",
|
|
@@ -10,142 +8,30 @@ export declare enum ChartType {
|
|
|
10
8
|
COMPOSITE_CHART = "composite_chart",
|
|
11
9
|
UNKNOWN = "unknown"
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type
|
|
17
|
-
/** The type of chart */
|
|
18
|
-
type: ChartType;
|
|
19
|
-
/** The title of the chart */
|
|
20
|
-
title: string;
|
|
21
|
-
/** The elements of the chart */
|
|
22
|
-
elements: any[];
|
|
23
|
-
/** The PNG representation of the chart encoded in base64 */
|
|
24
|
-
png?: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Represents a 2D chart with metadata.
|
|
28
|
-
*/
|
|
29
|
-
export type Chart2D = Chart & {
|
|
30
|
-
/** The label of the x-axis */
|
|
31
|
-
x_label?: string;
|
|
32
|
-
/** The label of the y-axis */
|
|
33
|
-
y_label?: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Represents a point in a 2D chart.
|
|
37
|
-
*/
|
|
38
|
-
export type PointData = {
|
|
39
|
-
/** The label of the point */
|
|
40
|
-
label: string;
|
|
41
|
-
/** The points of the chart */
|
|
42
|
-
points: [number | string, number | string][];
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Represents a point chart with metadata.
|
|
46
|
-
*/
|
|
47
|
-
export type PointChart = Chart2D & {
|
|
48
|
-
/** The ticks of the x-axis */
|
|
49
|
-
x_ticks: (number | string)[];
|
|
50
|
-
/** The scale of the x-axis */
|
|
51
|
-
x_scale: string;
|
|
52
|
-
/** The labels of the x-axis */
|
|
53
|
-
x_tick_labels: string[];
|
|
54
|
-
/** The ticks of the y-axis */
|
|
55
|
-
y_ticks: (number | string)[];
|
|
56
|
-
/** The scale of the y-axis */
|
|
57
|
-
y_scale: string;
|
|
58
|
-
/** The labels of the y-axis */
|
|
59
|
-
y_tick_labels: string[];
|
|
60
|
-
/** The points of the chart */
|
|
61
|
-
elements: PointData[];
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Represents a line chart with metadata.
|
|
65
|
-
*/
|
|
11
|
+
export type Chart = GeneratedChart;
|
|
12
|
+
export type ChartElement = GeneratedChartElement;
|
|
13
|
+
export type Chart2D = Pick<GeneratedChart, 'type' | 'title' | 'png' | 'x_label' | 'y_label' | 'elements'>;
|
|
14
|
+
export type PointChart = Pick<GeneratedChart, 'type' | 'title' | 'png' | 'x_label' | 'y_label' | 'x_ticks' | 'y_ticks' | 'x_tick_labels' | 'y_tick_labels' | 'x_scale' | 'y_scale' | 'elements'>;
|
|
66
15
|
export type LineChart = PointChart & {
|
|
67
|
-
|
|
68
|
-
type: ChartType.LINE;
|
|
16
|
+
type: 'line';
|
|
69
17
|
};
|
|
70
|
-
/**
|
|
71
|
-
* Represents a scatter chart with metadata.
|
|
72
|
-
*/
|
|
73
18
|
export type ScatterChart = PointChart & {
|
|
74
|
-
|
|
75
|
-
type: ChartType.SCATTER;
|
|
19
|
+
type: 'scatter';
|
|
76
20
|
};
|
|
77
|
-
/**
|
|
78
|
-
* Represents a bar in a bar chart.
|
|
79
|
-
*/
|
|
80
|
-
export type BarData = {
|
|
81
|
-
/** The label of the bar */
|
|
82
|
-
label: string;
|
|
83
|
-
/** The value of the bar */
|
|
84
|
-
value: string;
|
|
85
|
-
/** The group of the bar */
|
|
86
|
-
group: string;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Represents a bar chart with metadata.
|
|
90
|
-
*/
|
|
91
21
|
export type BarChart = Chart2D & {
|
|
92
|
-
|
|
93
|
-
type: ChartType.BAR;
|
|
94
|
-
/** The bars of the chart */
|
|
95
|
-
elements: BarData[];
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Represents a pie slice in a pie chart.
|
|
99
|
-
*/
|
|
100
|
-
export type PieData = {
|
|
101
|
-
/** The label of the pie slice */
|
|
102
|
-
label: string;
|
|
103
|
-
/** The angle of the pie slice */
|
|
104
|
-
angle: number;
|
|
105
|
-
/** The radius of the pie slice */
|
|
106
|
-
radius: number;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Represents a pie chart with metadata.
|
|
110
|
-
*/
|
|
111
|
-
export type PieChart = Chart & {
|
|
112
|
-
/** The type of chart */
|
|
113
|
-
type: ChartType.PIE;
|
|
114
|
-
/** The pie slices of the chart */
|
|
115
|
-
elements: PieData[];
|
|
22
|
+
type: 'bar';
|
|
116
23
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*/
|
|
120
|
-
export type BoxAndWhiskerData = {
|
|
121
|
-
/** The label of the box and whisker */
|
|
122
|
-
label: string;
|
|
123
|
-
/** The minimum value of the box and whisker */
|
|
124
|
-
min: number;
|
|
125
|
-
/** The first quartile of the box and whisker */
|
|
126
|
-
first_quartile: number;
|
|
127
|
-
/** The median of the box and whisker */
|
|
128
|
-
median: number;
|
|
129
|
-
/** The third quartile of the box and whisker */
|
|
130
|
-
max: number;
|
|
131
|
-
outliers: number[];
|
|
24
|
+
export type PieChart = Pick<GeneratedChart, 'type' | 'title' | 'png' | 'elements'> & {
|
|
25
|
+
type: 'pie';
|
|
132
26
|
};
|
|
133
|
-
/**
|
|
134
|
-
* Represents a box and whisker chart with metadata.
|
|
135
|
-
*/
|
|
136
27
|
export type BoxAndWhiskerChart = Chart2D & {
|
|
137
|
-
|
|
138
|
-
type: ChartType.BOX_AND_WHISKER;
|
|
139
|
-
/** The box and whiskers of the chart */
|
|
140
|
-
elements: BoxAndWhiskerData[];
|
|
28
|
+
type: 'box_and_whisker';
|
|
141
29
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*/
|
|
145
|
-
export type CompositeChart = Chart & {
|
|
146
|
-
/** The type of chart */
|
|
147
|
-
type: ChartType.COMPOSITE_CHART;
|
|
148
|
-
/** The charts of the composite chart */
|
|
149
|
-
elements: Chart[];
|
|
30
|
+
export type CompositeChart = Pick<GeneratedChart, 'type' | 'title' | 'png' | 'elements'> & {
|
|
31
|
+
type: 'composite_chart';
|
|
150
32
|
};
|
|
151
|
-
export
|
|
33
|
+
export type PointData = Pick<GeneratedChartElement, 'label' | 'points'>;
|
|
34
|
+
export type BarData = Pick<GeneratedChartElement, 'group' | 'label' | 'value'>;
|
|
35
|
+
export type PieData = Pick<GeneratedChartElement, 'angle' | 'label' | 'radius'>;
|
|
36
|
+
export type BoxAndWhiskerData = Pick<GeneratedChartElement, 'first_quartile' | 'label' | 'max' | 'median' | 'min' | 'outliers'>;
|
|
37
|
+
export declare function parseChart(chart: GeneratedChart): Chart;
|
package/src/types/Charts.js
CHANGED
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ChartType = void 0;
|
|
8
8
|
exports.parseChart = parseChart;
|
|
9
|
-
/**
|
|
10
|
-
* Chart types
|
|
11
|
-
*/
|
|
12
9
|
var ChartType;
|
|
13
10
|
(function (ChartType) {
|
|
14
11
|
ChartType["LINE"] = "line";
|
|
@@ -19,28 +16,22 @@ var ChartType;
|
|
|
19
16
|
ChartType["COMPOSITE_CHART"] = "composite_chart";
|
|
20
17
|
ChartType["UNKNOWN"] = "unknown";
|
|
21
18
|
})(ChartType || (exports.ChartType = ChartType = {}));
|
|
22
|
-
function parseChart(
|
|
23
|
-
switch (
|
|
19
|
+
function parseChart(chart) {
|
|
20
|
+
switch (chart.type) {
|
|
24
21
|
case ChartType.LINE:
|
|
25
|
-
return
|
|
22
|
+
return chart;
|
|
26
23
|
case ChartType.SCATTER:
|
|
27
|
-
return
|
|
24
|
+
return chart;
|
|
28
25
|
case ChartType.BAR:
|
|
29
|
-
return
|
|
26
|
+
return chart;
|
|
30
27
|
case ChartType.PIE:
|
|
31
|
-
return
|
|
28
|
+
return chart;
|
|
32
29
|
case ChartType.BOX_AND_WHISKER:
|
|
33
|
-
return
|
|
30
|
+
return chart;
|
|
34
31
|
case ChartType.COMPOSITE_CHART:
|
|
35
|
-
|
|
36
|
-
const charts = data.elements.map((g) => parseChart(g));
|
|
37
|
-
delete data.data;
|
|
38
|
-
return {
|
|
39
|
-
...data,
|
|
40
|
-
data: charts,
|
|
41
|
-
};
|
|
32
|
+
return chart;
|
|
42
33
|
default:
|
|
43
|
-
return
|
|
34
|
+
return chart;
|
|
44
35
|
}
|
|
45
36
|
}
|
|
46
37
|
//# sourceMappingURL=Charts.js.map
|
package/src/types/Charts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charts.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/types/Charts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"Charts.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/types/Charts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgDH,gCAiBC;AA7DD,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,gCAAmB,CAAA;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,gCAAmB,CAAA;AACrB,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAoCD,SAAgB,UAAU,CAAC,KAAqB;IAC9C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,KAAkB,CAAA;QAC3B,KAAK,SAAS,CAAC,OAAO;YACpB,OAAO,KAAqB,CAAA;QAC9B,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,KAAiB,CAAA;QAC1B,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,KAAiB,CAAA;QAC1B,KAAK,SAAS,CAAC,eAAe;YAC5B,OAAO,KAA2B,CAAA;QACpC,KAAK,SAAS,CAAC,eAAe;YAC5B,OAAO,KAAuB,CAAA;QAChC;YACE,OAAO,KAAK,CAAA;IAChB,CAAC;AACH,CAAC"}
|