@blaxel/core 0.2.47-preview.106 → 0.2.48-preview.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/client/sdk.gen.js +117 -1
- package/dist/cjs/sandbox/filesystem/filesystem.js +139 -6
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +32 -2
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +238 -0
- package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +6 -1
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/client/sdk.gen.js +117 -1
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +139 -6
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +32 -2
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +238 -0
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +6 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/client/sdk.gen.js +110 -0
- package/dist/esm/sandbox/filesystem/filesystem.js +140 -7
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/client/sdk.gen.js +110 -0
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +140 -7
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getWatchFilesystemByPath = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = exports.getCodegenRerankingByPath = exports.putCodegenFastapplyByPath = exports.put = exports.post = exports.patch = exports.options = exports.get = exports.delete_ = void 0;
|
|
4
|
+
exports.getWatchFilesystemByPath = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = exports.postFilesystemMultipartInitiateByPath = exports.getFilesystemMultipartByUploadIdParts = exports.putFilesystemMultipartByUploadIdPart = exports.postFilesystemMultipartByUploadIdComplete = exports.deleteFilesystemMultipartByUploadIdAbort = exports.getFilesystemMultipart = exports.getCodegenRerankingByPath = exports.putCodegenFastapplyByPath = exports.put = exports.post = exports.patch = exports.options = exports.get = exports.delete_ = void 0;
|
|
5
|
+
const client_fetch_1 = require("@hey-api/client-fetch");
|
|
5
6
|
const client_gen_1 = require("./client.gen");
|
|
6
7
|
/**
|
|
7
8
|
* Welcome message
|
|
@@ -174,6 +175,121 @@ const getCodegenRerankingByPath = (options) => {
|
|
|
174
175
|
});
|
|
175
176
|
};
|
|
176
177
|
exports.getCodegenRerankingByPath = getCodegenRerankingByPath;
|
|
178
|
+
/**
|
|
179
|
+
* List multipart uploads
|
|
180
|
+
* List all active multipart uploads
|
|
181
|
+
*/
|
|
182
|
+
const getFilesystemMultipart = (options) => {
|
|
183
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
184
|
+
security: [
|
|
185
|
+
{
|
|
186
|
+
scheme: 'bearer',
|
|
187
|
+
type: 'http'
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
url: '/filesystem-multipart',
|
|
191
|
+
...options
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
exports.getFilesystemMultipart = getFilesystemMultipart;
|
|
195
|
+
/**
|
|
196
|
+
* Abort multipart upload
|
|
197
|
+
* Abort a multipart upload and clean up all parts
|
|
198
|
+
*/
|
|
199
|
+
const deleteFilesystemMultipartByUploadIdAbort = (options) => {
|
|
200
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
201
|
+
security: [
|
|
202
|
+
{
|
|
203
|
+
scheme: 'bearer',
|
|
204
|
+
type: 'http'
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
url: '/filesystem-multipart/{uploadId}/abort',
|
|
208
|
+
...options
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
exports.deleteFilesystemMultipartByUploadIdAbort = deleteFilesystemMultipartByUploadIdAbort;
|
|
212
|
+
/**
|
|
213
|
+
* Complete multipart upload
|
|
214
|
+
* Complete a multipart upload by assembling all parts
|
|
215
|
+
*/
|
|
216
|
+
const postFilesystemMultipartByUploadIdComplete = (options) => {
|
|
217
|
+
return (options.client ?? client_gen_1.client).post({
|
|
218
|
+
security: [
|
|
219
|
+
{
|
|
220
|
+
scheme: 'bearer',
|
|
221
|
+
type: 'http'
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
url: '/filesystem-multipart/{uploadId}/complete',
|
|
225
|
+
...options,
|
|
226
|
+
headers: {
|
|
227
|
+
'Content-Type': 'application/json',
|
|
228
|
+
...options?.headers
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
exports.postFilesystemMultipartByUploadIdComplete = postFilesystemMultipartByUploadIdComplete;
|
|
233
|
+
/**
|
|
234
|
+
* Upload part
|
|
235
|
+
* Upload a single part of a multipart upload
|
|
236
|
+
*/
|
|
237
|
+
const putFilesystemMultipartByUploadIdPart = (options) => {
|
|
238
|
+
return (options.client ?? client_gen_1.client).put({
|
|
239
|
+
...client_fetch_1.formDataBodySerializer,
|
|
240
|
+
security: [
|
|
241
|
+
{
|
|
242
|
+
scheme: 'bearer',
|
|
243
|
+
type: 'http'
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
url: '/filesystem-multipart/{uploadId}/part',
|
|
247
|
+
...options,
|
|
248
|
+
headers: {
|
|
249
|
+
'Content-Type': null,
|
|
250
|
+
...options?.headers
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
exports.putFilesystemMultipartByUploadIdPart = putFilesystemMultipartByUploadIdPart;
|
|
255
|
+
/**
|
|
256
|
+
* List parts
|
|
257
|
+
* List all uploaded parts for a multipart upload
|
|
258
|
+
*/
|
|
259
|
+
const getFilesystemMultipartByUploadIdParts = (options) => {
|
|
260
|
+
return (options.client ?? client_gen_1.client).get({
|
|
261
|
+
security: [
|
|
262
|
+
{
|
|
263
|
+
scheme: 'bearer',
|
|
264
|
+
type: 'http'
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
url: '/filesystem-multipart/{uploadId}/parts',
|
|
268
|
+
...options
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
exports.getFilesystemMultipartByUploadIdParts = getFilesystemMultipartByUploadIdParts;
|
|
272
|
+
/**
|
|
273
|
+
* Initiate multipart upload
|
|
274
|
+
* Initiate a multipart upload session for a file
|
|
275
|
+
*/
|
|
276
|
+
const postFilesystemMultipartInitiateByPath = (options) => {
|
|
277
|
+
return (options.client ?? client_gen_1.client).post({
|
|
278
|
+
security: [
|
|
279
|
+
{
|
|
280
|
+
scheme: 'bearer',
|
|
281
|
+
type: 'http'
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
url: '/filesystem-multipart/initiate/{path}',
|
|
285
|
+
...options,
|
|
286
|
+
headers: {
|
|
287
|
+
'Content-Type': 'application/json',
|
|
288
|
+
...options?.headers
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
exports.postFilesystemMultipartInitiateByPath = postFilesystemMultipartInitiateByPath;
|
|
177
293
|
/**
|
|
178
294
|
* Delete file or directory
|
|
179
295
|
* Delete a file or directory
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SandboxFileSystem = void 0;
|
|
4
4
|
const settings_js_1 = require("../../common/settings.js");
|
|
5
|
+
const node_js_1 = require("../../common/node.js");
|
|
5
6
|
const action_js_1 = require("../action.js");
|
|
6
7
|
const index_js_1 = require("../client/index.js");
|
|
7
|
-
|
|
8
|
+
// Multipart upload constants
|
|
9
|
+
const MULTIPART_THRESHOLD = 5 * 1024 * 1024; // 5MB
|
|
10
|
+
const CHUNK_SIZE = 5 * 1024 * 1024; // 5MB per part
|
|
11
|
+
const MAX_PARALLEL_UPLOADS = 3; // Number of parallel part uploads
|
|
8
12
|
class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
9
13
|
process;
|
|
10
14
|
constructor(sandbox, process) {
|
|
@@ -25,6 +29,14 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
25
29
|
}
|
|
26
30
|
async write(path, content) {
|
|
27
31
|
path = this.formatPath(path);
|
|
32
|
+
// Calculate content size in bytes
|
|
33
|
+
const contentSize = new Blob([content]).size;
|
|
34
|
+
// Use multipart upload for large files
|
|
35
|
+
if (contentSize > MULTIPART_THRESHOLD) {
|
|
36
|
+
const blob = new Blob([content]);
|
|
37
|
+
return await this.uploadWithMultipart(path, blob, "0644");
|
|
38
|
+
}
|
|
39
|
+
// Use regular upload for small files
|
|
28
40
|
const { response, data, error } = await (0, index_js_1.putFilesystemByPath)({
|
|
29
41
|
path: { path },
|
|
30
42
|
body: { content },
|
|
@@ -36,12 +48,20 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
36
48
|
}
|
|
37
49
|
async writeBinary(path, content) {
|
|
38
50
|
path = this.formatPath(path);
|
|
39
|
-
const formData = new FormData();
|
|
40
51
|
// Convert content to Blob regardless of input type
|
|
41
52
|
let fileBlob;
|
|
53
|
+
// Check if it's already a Blob or File (including duck-typing for cross-realm Blobs)
|
|
42
54
|
if (content instanceof Blob || content instanceof File) {
|
|
43
55
|
fileBlob = content;
|
|
44
56
|
}
|
|
57
|
+
else if (typeof content === 'object' && content !== null &&
|
|
58
|
+
'size' in content && 'type' in content &&
|
|
59
|
+
'arrayBuffer' in content &&
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
61
|
+
typeof content.arrayBuffer === 'function') {
|
|
62
|
+
// Handle Blob-like objects (cross-realm Blobs)
|
|
63
|
+
fileBlob = content;
|
|
64
|
+
}
|
|
45
65
|
else if (Buffer.isBuffer(content)) {
|
|
46
66
|
// Convert Buffer to Blob
|
|
47
67
|
fileBlob = new Blob([content]);
|
|
@@ -50,14 +70,29 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
50
70
|
// Convert Uint8Array to Blob
|
|
51
71
|
fileBlob = new Blob([content]);
|
|
52
72
|
}
|
|
73
|
+
else if (ArrayBuffer.isView(content)) {
|
|
74
|
+
// Handle other TypedArray views
|
|
75
|
+
fileBlob = new Blob([content]);
|
|
76
|
+
}
|
|
53
77
|
else if (typeof content === 'string') {
|
|
54
|
-
|
|
78
|
+
// Read file from local filesystem (Node.js only)
|
|
79
|
+
if (!node_js_1.fs) {
|
|
80
|
+
throw new Error("File path upload is only supported in Node.js environments");
|
|
81
|
+
}
|
|
82
|
+
const buffer = node_js_1.fs.readFileSync(content);
|
|
55
83
|
fileBlob = new Blob([buffer]);
|
|
56
84
|
}
|
|
57
85
|
else {
|
|
58
|
-
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
|
87
|
+
const typeName = content?.constructor?.name ?? typeof content;
|
|
88
|
+
throw new Error(`Unsupported content type: ${typeName}`);
|
|
89
|
+
}
|
|
90
|
+
// Use multipart upload for large files
|
|
91
|
+
if (fileBlob.size > MULTIPART_THRESHOLD) {
|
|
92
|
+
return await this.uploadWithMultipart(path, fileBlob, "0644");
|
|
59
93
|
}
|
|
60
|
-
//
|
|
94
|
+
// Use regular upload for small files
|
|
95
|
+
const formData = new FormData();
|
|
61
96
|
formData.append("file", fileBlob, "test-binary.bin");
|
|
62
97
|
formData.append("permissions", "0644");
|
|
63
98
|
formData.append("path", path);
|
|
@@ -132,10 +167,13 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
132
167
|
return data;
|
|
133
168
|
}
|
|
134
169
|
async download(src, destinationPath, { mode = 0o644 } = {}) {
|
|
170
|
+
if (!node_js_1.fs) {
|
|
171
|
+
throw new Error("File download to local filesystem is only supported in Node.js environments");
|
|
172
|
+
}
|
|
135
173
|
const blob = await this.readBinary(src);
|
|
136
174
|
const arrayBuffer = await blob.arrayBuffer();
|
|
137
175
|
const buffer = Buffer.from(arrayBuffer);
|
|
138
|
-
|
|
176
|
+
node_js_1.fs.writeFileSync(destinationPath, buffer, { mode: mode ?? 0o644 });
|
|
139
177
|
}
|
|
140
178
|
async rm(path, recursive = false) {
|
|
141
179
|
path = this.formatPath(path);
|
|
@@ -263,5 +301,100 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
263
301
|
formatPath(path) {
|
|
264
302
|
return path;
|
|
265
303
|
}
|
|
304
|
+
// Multipart upload helper methods
|
|
305
|
+
async initiateMultipartUpload(path, permissions = "0644") {
|
|
306
|
+
path = this.formatPath(path);
|
|
307
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
308
|
+
const { data } = await (0, index_js_1.postFilesystemMultipartInitiateByPath)({
|
|
309
|
+
path: { path },
|
|
310
|
+
body: { permissions },
|
|
311
|
+
baseUrl: this.url,
|
|
312
|
+
client: this.client,
|
|
313
|
+
throwOnError: true,
|
|
314
|
+
});
|
|
315
|
+
return data;
|
|
316
|
+
}
|
|
317
|
+
async uploadPart(uploadId, partNumber, fileBlob) {
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
319
|
+
const { data } = await (0, index_js_1.putFilesystemMultipartByUploadIdPart)({
|
|
320
|
+
path: { uploadId },
|
|
321
|
+
query: { partNumber },
|
|
322
|
+
body: { file: fileBlob },
|
|
323
|
+
baseUrl: this.url,
|
|
324
|
+
client: this.client,
|
|
325
|
+
throwOnError: true,
|
|
326
|
+
});
|
|
327
|
+
return data;
|
|
328
|
+
}
|
|
329
|
+
async completeMultipartUpload(uploadId, parts) {
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
331
|
+
const { data } = await (0, index_js_1.postFilesystemMultipartByUploadIdComplete)({
|
|
332
|
+
path: { uploadId },
|
|
333
|
+
body: { parts },
|
|
334
|
+
baseUrl: this.url,
|
|
335
|
+
client: this.client,
|
|
336
|
+
throwOnError: true,
|
|
337
|
+
});
|
|
338
|
+
return data;
|
|
339
|
+
}
|
|
340
|
+
async abortMultipartUpload(uploadId) {
|
|
341
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
342
|
+
await (0, index_js_1.deleteFilesystemMultipartByUploadIdAbort)({
|
|
343
|
+
path: { uploadId },
|
|
344
|
+
baseUrl: this.url,
|
|
345
|
+
client: this.client,
|
|
346
|
+
throwOnError: true,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async uploadWithMultipart(path, blob, permissions = "0644") {
|
|
350
|
+
// Initiate multipart upload
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
352
|
+
const initResponse = await this.initiateMultipartUpload(path, permissions);
|
|
353
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
354
|
+
const uploadId = initResponse.uploadId;
|
|
355
|
+
if (!uploadId) {
|
|
356
|
+
throw new Error("Failed to get upload ID from initiate response");
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const size = blob.size;
|
|
360
|
+
const numParts = Math.ceil(size / CHUNK_SIZE);
|
|
361
|
+
const parts = [];
|
|
362
|
+
// Upload parts in batches for parallel processing
|
|
363
|
+
for (let i = 0; i < numParts; i += MAX_PARALLEL_UPLOADS) {
|
|
364
|
+
const batch = [];
|
|
365
|
+
for (let j = 0; j < MAX_PARALLEL_UPLOADS && i + j < numParts; j++) {
|
|
366
|
+
const partNumber = i + j + 1;
|
|
367
|
+
const start = (partNumber - 1) * CHUNK_SIZE;
|
|
368
|
+
const end = Math.min(start + CHUNK_SIZE, size);
|
|
369
|
+
const chunk = blob.slice(start, end);
|
|
370
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
371
|
+
batch.push(this.uploadPart(uploadId, partNumber, chunk));
|
|
372
|
+
}
|
|
373
|
+
// Wait for batch to complete
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
375
|
+
const batchResults = await Promise.all(batch);
|
|
376
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
|
377
|
+
parts.push(...batchResults.map((r) => ({ partNumber: r.partNumber, etag: r.etag })));
|
|
378
|
+
}
|
|
379
|
+
// Sort parts by partNumber to ensure correct order
|
|
380
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
381
|
+
parts.sort((a, b) => (a.partNumber ?? 0) - (b.partNumber ?? 0));
|
|
382
|
+
// Complete the upload
|
|
383
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
384
|
+
return await this.completeMultipartUpload(uploadId, parts);
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
// Abort the upload on failure
|
|
388
|
+
try {
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
390
|
+
await this.abortMultipartUpload(uploadId);
|
|
391
|
+
}
|
|
392
|
+
catch (abortError) {
|
|
393
|
+
// Log but don't throw - we want to throw the original error
|
|
394
|
+
console.error('Failed to abort multipart upload:', abortError);
|
|
395
|
+
}
|
|
396
|
+
throw error;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
266
399
|
}
|
|
267
400
|
exports.SandboxFileSystem = SandboxFileSystem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { DeleteData, GetData, OptionsData, PatchData, PostData, PutData, PutCodegenFastapplyByPathData, GetCodegenRerankingByPathData, DeleteFilesystemByPathData, GetFilesystemByPathData, PutFilesystemByPathData, DeleteNetworkProcessByPidMonitorData, PostNetworkProcessByPidMonitorData, GetNetworkProcessByPidPortsData, GetProcessData, PostProcessData, DeleteProcessByIdentifierData, GetProcessByIdentifierData, DeleteProcessByIdentifierKillData, GetProcessByIdentifierLogsData, GetProcessByIdentifierLogsStreamData, GetWatchFilesystemByPathData } from './types.gen';
|
|
1
|
+
import { type Options as ClientOptions, type TDataShape, type Client } from '@hey-api/client-fetch';
|
|
2
|
+
import type { DeleteData, GetData, OptionsData, PatchData, PostData, PutData, PutCodegenFastapplyByPathData, GetCodegenRerankingByPathData, GetFilesystemMultipartData, DeleteFilesystemMultipartByUploadIdAbortData, PostFilesystemMultipartByUploadIdCompleteData, PutFilesystemMultipartByUploadIdPartData, GetFilesystemMultipartByUploadIdPartsData, PostFilesystemMultipartInitiateByPathData, DeleteFilesystemByPathData, GetFilesystemByPathData, PutFilesystemByPathData, DeleteNetworkProcessByPidMonitorData, PostNetworkProcessByPidMonitorData, GetNetworkProcessByPidPortsData, GetProcessData, PostProcessData, DeleteProcessByIdentifierData, GetProcessByIdentifierData, DeleteProcessByIdentifierKillData, GetProcessByIdentifierLogsData, GetProcessByIdentifierLogsStreamData, GetWatchFilesystemByPathData } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -84,6 +84,36 @@ export declare const putCodegenFastapplyByPath: <ThrowOnError extends boolean =
|
|
|
84
84
|
* The response will be a list of file paths and contents ordered from most relevant to least relevant.
|
|
85
85
|
*/
|
|
86
86
|
export declare const getCodegenRerankingByPath: <ThrowOnError extends boolean = false>(options: Options<GetCodegenRerankingByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").RerankingResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
87
|
+
/**
|
|
88
|
+
* List multipart uploads
|
|
89
|
+
* List all active multipart uploads
|
|
90
|
+
*/
|
|
91
|
+
export declare const getFilesystemMultipart: <ThrowOnError extends boolean = false>(options?: Options<GetFilesystemMultipartData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MultipartListUploadsResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
92
|
+
/**
|
|
93
|
+
* Abort multipart upload
|
|
94
|
+
* Abort a multipart upload and clean up all parts
|
|
95
|
+
*/
|
|
96
|
+
export declare const deleteFilesystemMultipartByUploadIdAbort: <ThrowOnError extends boolean = false>(options: Options<DeleteFilesystemMultipartByUploadIdAbortData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
97
|
+
/**
|
|
98
|
+
* Complete multipart upload
|
|
99
|
+
* Complete a multipart upload by assembling all parts
|
|
100
|
+
*/
|
|
101
|
+
export declare const postFilesystemMultipartByUploadIdComplete: <ThrowOnError extends boolean = false>(options: Options<PostFilesystemMultipartByUploadIdCompleteData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
102
|
+
/**
|
|
103
|
+
* Upload part
|
|
104
|
+
* Upload a single part of a multipart upload
|
|
105
|
+
*/
|
|
106
|
+
export declare const putFilesystemMultipartByUploadIdPart: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemMultipartByUploadIdPartData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MultipartUploadPartResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
107
|
+
/**
|
|
108
|
+
* List parts
|
|
109
|
+
* List all uploaded parts for a multipart upload
|
|
110
|
+
*/
|
|
111
|
+
export declare const getFilesystemMultipartByUploadIdParts: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemMultipartByUploadIdPartsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MultipartListPartsResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
112
|
+
/**
|
|
113
|
+
* Initiate multipart upload
|
|
114
|
+
* Initiate a multipart upload session for a file
|
|
115
|
+
*/
|
|
116
|
+
export declare const postFilesystemMultipartInitiateByPath: <ThrowOnError extends boolean = false>(options: Options<PostFilesystemMultipartInitiateByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").MultipartInitiateResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
87
117
|
/**
|
|
88
118
|
* Delete file or directory
|
|
89
119
|
* Delete a file or directory
|
|
@@ -46,6 +46,32 @@ export type FileWithContent = {
|
|
|
46
46
|
permissions: string;
|
|
47
47
|
size: number;
|
|
48
48
|
};
|
|
49
|
+
export type MultipartCompleteRequest = {
|
|
50
|
+
parts?: Array<MultipartPartInfo>;
|
|
51
|
+
};
|
|
52
|
+
export type MultipartInitiateRequest = {
|
|
53
|
+
permissions?: string;
|
|
54
|
+
};
|
|
55
|
+
export type MultipartInitiateResponse = {
|
|
56
|
+
path?: string;
|
|
57
|
+
uploadId?: string;
|
|
58
|
+
};
|
|
59
|
+
export type MultipartListPartsResponse = {
|
|
60
|
+
parts?: Array<FilesystemUploadedPart>;
|
|
61
|
+
uploadId?: string;
|
|
62
|
+
};
|
|
63
|
+
export type MultipartListUploadsResponse = {
|
|
64
|
+
uploads?: Array<FilesystemMultipartUpload>;
|
|
65
|
+
};
|
|
66
|
+
export type MultipartPartInfo = {
|
|
67
|
+
etag?: string;
|
|
68
|
+
partNumber?: number;
|
|
69
|
+
};
|
|
70
|
+
export type MultipartUploadPartResponse = {
|
|
71
|
+
etag?: string;
|
|
72
|
+
partNumber?: number;
|
|
73
|
+
size?: number;
|
|
74
|
+
};
|
|
49
75
|
export type PortMonitorRequest = {
|
|
50
76
|
/**
|
|
51
77
|
* URL to call when a new port is detected
|
|
@@ -107,6 +133,21 @@ export type WelcomeResponse = {
|
|
|
107
133
|
documentation?: string;
|
|
108
134
|
message?: string;
|
|
109
135
|
};
|
|
136
|
+
export type FilesystemMultipartUpload = {
|
|
137
|
+
initiatedAt?: string;
|
|
138
|
+
parts?: {
|
|
139
|
+
[key: string]: FilesystemUploadedPart;
|
|
140
|
+
};
|
|
141
|
+
path?: string;
|
|
142
|
+
permissions?: number;
|
|
143
|
+
uploadId?: string;
|
|
144
|
+
};
|
|
145
|
+
export type FilesystemUploadedPart = {
|
|
146
|
+
etag?: string;
|
|
147
|
+
partNumber?: number;
|
|
148
|
+
size?: number;
|
|
149
|
+
uploadedAt?: string;
|
|
150
|
+
};
|
|
110
151
|
export type DeleteData = {
|
|
111
152
|
body?: never;
|
|
112
153
|
path?: never;
|
|
@@ -271,6 +312,203 @@ export type GetCodegenRerankingByPathResponses = {
|
|
|
271
312
|
200: RerankingResponse;
|
|
272
313
|
};
|
|
273
314
|
export type GetCodegenRerankingByPathResponse = GetCodegenRerankingByPathResponses[keyof GetCodegenRerankingByPathResponses];
|
|
315
|
+
export type GetFilesystemMultipartData = {
|
|
316
|
+
body?: never;
|
|
317
|
+
path?: never;
|
|
318
|
+
query?: never;
|
|
319
|
+
url: '/filesystem-multipart';
|
|
320
|
+
};
|
|
321
|
+
export type GetFilesystemMultipartErrors = {
|
|
322
|
+
/**
|
|
323
|
+
* Internal server error
|
|
324
|
+
*/
|
|
325
|
+
500: ErrorResponse;
|
|
326
|
+
};
|
|
327
|
+
export type GetFilesystemMultipartError = GetFilesystemMultipartErrors[keyof GetFilesystemMultipartErrors];
|
|
328
|
+
export type GetFilesystemMultipartResponses = {
|
|
329
|
+
/**
|
|
330
|
+
* List of active uploads
|
|
331
|
+
*/
|
|
332
|
+
200: MultipartListUploadsResponse;
|
|
333
|
+
};
|
|
334
|
+
export type GetFilesystemMultipartResponse = GetFilesystemMultipartResponses[keyof GetFilesystemMultipartResponses];
|
|
335
|
+
export type DeleteFilesystemMultipartByUploadIdAbortData = {
|
|
336
|
+
body?: never;
|
|
337
|
+
path: {
|
|
338
|
+
/**
|
|
339
|
+
* Upload ID
|
|
340
|
+
*/
|
|
341
|
+
uploadId: string;
|
|
342
|
+
};
|
|
343
|
+
query?: never;
|
|
344
|
+
url: '/filesystem-multipart/{uploadId}/abort';
|
|
345
|
+
};
|
|
346
|
+
export type DeleteFilesystemMultipartByUploadIdAbortErrors = {
|
|
347
|
+
/**
|
|
348
|
+
* Bad request
|
|
349
|
+
*/
|
|
350
|
+
400: ErrorResponse;
|
|
351
|
+
/**
|
|
352
|
+
* Upload not found
|
|
353
|
+
*/
|
|
354
|
+
404: ErrorResponse;
|
|
355
|
+
/**
|
|
356
|
+
* Internal server error
|
|
357
|
+
*/
|
|
358
|
+
500: ErrorResponse;
|
|
359
|
+
};
|
|
360
|
+
export type DeleteFilesystemMultipartByUploadIdAbortError = DeleteFilesystemMultipartByUploadIdAbortErrors[keyof DeleteFilesystemMultipartByUploadIdAbortErrors];
|
|
361
|
+
export type DeleteFilesystemMultipartByUploadIdAbortResponses = {
|
|
362
|
+
/**
|
|
363
|
+
* Upload aborted
|
|
364
|
+
*/
|
|
365
|
+
200: SuccessResponse;
|
|
366
|
+
};
|
|
367
|
+
export type DeleteFilesystemMultipartByUploadIdAbortResponse = DeleteFilesystemMultipartByUploadIdAbortResponses[keyof DeleteFilesystemMultipartByUploadIdAbortResponses];
|
|
368
|
+
export type PostFilesystemMultipartByUploadIdCompleteData = {
|
|
369
|
+
/**
|
|
370
|
+
* List of parts
|
|
371
|
+
*/
|
|
372
|
+
body: MultipartCompleteRequest;
|
|
373
|
+
path: {
|
|
374
|
+
/**
|
|
375
|
+
* Upload ID
|
|
376
|
+
*/
|
|
377
|
+
uploadId: string;
|
|
378
|
+
};
|
|
379
|
+
query?: never;
|
|
380
|
+
url: '/filesystem-multipart/{uploadId}/complete';
|
|
381
|
+
};
|
|
382
|
+
export type PostFilesystemMultipartByUploadIdCompleteErrors = {
|
|
383
|
+
/**
|
|
384
|
+
* Bad request
|
|
385
|
+
*/
|
|
386
|
+
400: ErrorResponse;
|
|
387
|
+
/**
|
|
388
|
+
* Upload not found
|
|
389
|
+
*/
|
|
390
|
+
404: ErrorResponse;
|
|
391
|
+
/**
|
|
392
|
+
* Internal server error
|
|
393
|
+
*/
|
|
394
|
+
500: ErrorResponse;
|
|
395
|
+
};
|
|
396
|
+
export type PostFilesystemMultipartByUploadIdCompleteError = PostFilesystemMultipartByUploadIdCompleteErrors[keyof PostFilesystemMultipartByUploadIdCompleteErrors];
|
|
397
|
+
export type PostFilesystemMultipartByUploadIdCompleteResponses = {
|
|
398
|
+
/**
|
|
399
|
+
* Upload completed
|
|
400
|
+
*/
|
|
401
|
+
200: SuccessResponse;
|
|
402
|
+
};
|
|
403
|
+
export type PostFilesystemMultipartByUploadIdCompleteResponse = PostFilesystemMultipartByUploadIdCompleteResponses[keyof PostFilesystemMultipartByUploadIdCompleteResponses];
|
|
404
|
+
export type PutFilesystemMultipartByUploadIdPartData = {
|
|
405
|
+
body: {
|
|
406
|
+
/**
|
|
407
|
+
* Part data
|
|
408
|
+
*/
|
|
409
|
+
file: Blob | File;
|
|
410
|
+
};
|
|
411
|
+
path: {
|
|
412
|
+
/**
|
|
413
|
+
* Upload ID
|
|
414
|
+
*/
|
|
415
|
+
uploadId: string;
|
|
416
|
+
};
|
|
417
|
+
query: {
|
|
418
|
+
/**
|
|
419
|
+
* Part number (1-10000)
|
|
420
|
+
*/
|
|
421
|
+
partNumber: number;
|
|
422
|
+
};
|
|
423
|
+
url: '/filesystem-multipart/{uploadId}/part';
|
|
424
|
+
};
|
|
425
|
+
export type PutFilesystemMultipartByUploadIdPartErrors = {
|
|
426
|
+
/**
|
|
427
|
+
* Bad request
|
|
428
|
+
*/
|
|
429
|
+
400: ErrorResponse;
|
|
430
|
+
/**
|
|
431
|
+
* Upload not found
|
|
432
|
+
*/
|
|
433
|
+
404: ErrorResponse;
|
|
434
|
+
/**
|
|
435
|
+
* Internal server error
|
|
436
|
+
*/
|
|
437
|
+
500: ErrorResponse;
|
|
438
|
+
};
|
|
439
|
+
export type PutFilesystemMultipartByUploadIdPartError = PutFilesystemMultipartByUploadIdPartErrors[keyof PutFilesystemMultipartByUploadIdPartErrors];
|
|
440
|
+
export type PutFilesystemMultipartByUploadIdPartResponses = {
|
|
441
|
+
/**
|
|
442
|
+
* Part uploaded
|
|
443
|
+
*/
|
|
444
|
+
200: MultipartUploadPartResponse;
|
|
445
|
+
};
|
|
446
|
+
export type PutFilesystemMultipartByUploadIdPartResponse = PutFilesystemMultipartByUploadIdPartResponses[keyof PutFilesystemMultipartByUploadIdPartResponses];
|
|
447
|
+
export type GetFilesystemMultipartByUploadIdPartsData = {
|
|
448
|
+
body?: never;
|
|
449
|
+
path: {
|
|
450
|
+
/**
|
|
451
|
+
* Upload ID
|
|
452
|
+
*/
|
|
453
|
+
uploadId: string;
|
|
454
|
+
};
|
|
455
|
+
query?: never;
|
|
456
|
+
url: '/filesystem-multipart/{uploadId}/parts';
|
|
457
|
+
};
|
|
458
|
+
export type GetFilesystemMultipartByUploadIdPartsErrors = {
|
|
459
|
+
/**
|
|
460
|
+
* Bad request
|
|
461
|
+
*/
|
|
462
|
+
400: ErrorResponse;
|
|
463
|
+
/**
|
|
464
|
+
* Upload not found
|
|
465
|
+
*/
|
|
466
|
+
404: ErrorResponse;
|
|
467
|
+
/**
|
|
468
|
+
* Internal server error
|
|
469
|
+
*/
|
|
470
|
+
500: ErrorResponse;
|
|
471
|
+
};
|
|
472
|
+
export type GetFilesystemMultipartByUploadIdPartsError = GetFilesystemMultipartByUploadIdPartsErrors[keyof GetFilesystemMultipartByUploadIdPartsErrors];
|
|
473
|
+
export type GetFilesystemMultipartByUploadIdPartsResponses = {
|
|
474
|
+
/**
|
|
475
|
+
* List of parts
|
|
476
|
+
*/
|
|
477
|
+
200: MultipartListPartsResponse;
|
|
478
|
+
};
|
|
479
|
+
export type GetFilesystemMultipartByUploadIdPartsResponse = GetFilesystemMultipartByUploadIdPartsResponses[keyof GetFilesystemMultipartByUploadIdPartsResponses];
|
|
480
|
+
export type PostFilesystemMultipartInitiateByPathData = {
|
|
481
|
+
/**
|
|
482
|
+
* Optional permissions
|
|
483
|
+
*/
|
|
484
|
+
body?: MultipartInitiateRequest;
|
|
485
|
+
path: {
|
|
486
|
+
/**
|
|
487
|
+
* File path
|
|
488
|
+
*/
|
|
489
|
+
path: string;
|
|
490
|
+
};
|
|
491
|
+
query?: never;
|
|
492
|
+
url: '/filesystem-multipart/initiate/{path}';
|
|
493
|
+
};
|
|
494
|
+
export type PostFilesystemMultipartInitiateByPathErrors = {
|
|
495
|
+
/**
|
|
496
|
+
* Bad request
|
|
497
|
+
*/
|
|
498
|
+
400: ErrorResponse;
|
|
499
|
+
/**
|
|
500
|
+
* Internal server error
|
|
501
|
+
*/
|
|
502
|
+
500: ErrorResponse;
|
|
503
|
+
};
|
|
504
|
+
export type PostFilesystemMultipartInitiateByPathError = PostFilesystemMultipartInitiateByPathErrors[keyof PostFilesystemMultipartInitiateByPathErrors];
|
|
505
|
+
export type PostFilesystemMultipartInitiateByPathResponses = {
|
|
506
|
+
/**
|
|
507
|
+
* Upload session created
|
|
508
|
+
*/
|
|
509
|
+
200: MultipartInitiateResponse;
|
|
510
|
+
};
|
|
511
|
+
export type PostFilesystemMultipartInitiateByPathResponse = PostFilesystemMultipartInitiateByPathResponses[keyof PostFilesystemMultipartInitiateByPathResponses];
|
|
274
512
|
export type DeleteFilesystemByPathData = {
|
|
275
513
|
body?: never;
|
|
276
514
|
path: {
|
|
@@ -8,7 +8,7 @@ export declare class SandboxFileSystem extends SandboxAction {
|
|
|
8
8
|
constructor(sandbox: Sandbox, process: SandboxProcess);
|
|
9
9
|
mkdir(path: string, permissions?: string): Promise<SuccessResponse>;
|
|
10
10
|
write(path: string, content: string): Promise<SuccessResponse>;
|
|
11
|
-
writeBinary(path: string, content: Buffer | Blob | File | Uint8Array | string): Promise<
|
|
11
|
+
writeBinary(path: string, content: Buffer | Blob | File | Uint8Array | string): Promise<SuccessResponse>;
|
|
12
12
|
writeTree(files: SandboxFilesystemFile[], destinationPath?: string | null): Promise<Directory | undefined>;
|
|
13
13
|
read(path: string): Promise<string>;
|
|
14
14
|
readBinary(path: string): Promise<Blob>;
|
|
@@ -28,4 +28,9 @@ export declare class SandboxFileSystem extends SandboxAction {
|
|
|
28
28
|
close: () => void;
|
|
29
29
|
};
|
|
30
30
|
private formatPath;
|
|
31
|
+
private initiateMultipartUpload;
|
|
32
|
+
private uploadPart;
|
|
33
|
+
private completeMultipartUpload;
|
|
34
|
+
private abortMultipartUpload;
|
|
35
|
+
private uploadWithMultipart;
|
|
31
36
|
}
|