@blaxel/core 0.2.49-preview.108 → 0.2.49-preview.109

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.
@@ -8,7 +8,7 @@ const index_js_1 = require("../client/index.js");
8
8
  // Multipart upload constants
9
9
  const MULTIPART_THRESHOLD = 5 * 1024 * 1024; // 5MB
10
10
  const CHUNK_SIZE = 5 * 1024 * 1024; // 5MB per part
11
- const MAX_PARALLEL_UPLOADS = 3; // Number of parallel part uploads
11
+ const MAX_PARALLEL_UPLOADS = 20; // Number of parallel part uploads
12
12
  class SandboxFileSystem extends action_js_1.SandboxAction {
13
13
  process;
14
14
  constructor(sandbox, process) {
@@ -304,7 +304,6 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
304
304
  // Multipart upload helper methods
305
305
  async initiateMultipartUpload(path, permissions = "0644") {
306
306
  path = this.formatPath(path);
307
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
308
307
  const { data } = await (0, index_js_1.postFilesystemMultipartInitiateByPath)({
309
308
  path: { path },
310
309
  body: { permissions },
@@ -315,7 +314,6 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
315
314
  return data;
316
315
  }
317
316
  async uploadPart(uploadId, partNumber, fileBlob) {
318
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
319
317
  const { data } = await (0, index_js_1.putFilesystemMultipartByUploadIdPart)({
320
318
  path: { uploadId },
321
319
  query: { partNumber },
@@ -327,7 +325,6 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
327
325
  return data;
328
326
  }
329
327
  async completeMultipartUpload(uploadId, parts) {
330
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
331
328
  const { data } = await (0, index_js_1.postFilesystemMultipartByUploadIdComplete)({
332
329
  path: { uploadId },
333
330
  body: { parts },
@@ -338,19 +335,17 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
338
335
  return data;
339
336
  }
340
337
  async abortMultipartUpload(uploadId) {
341
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
342
- await (0, index_js_1.deleteFilesystemMultipartByUploadIdAbort)({
338
+ const { data } = await (0, index_js_1.deleteFilesystemMultipartByUploadIdAbort)({
343
339
  path: { uploadId },
344
340
  baseUrl: this.url,
345
341
  client: this.client,
346
342
  throwOnError: true,
347
343
  });
344
+ return data;
348
345
  }
349
346
  async uploadWithMultipart(path, blob, permissions = "0644") {
350
347
  // Initiate multipart upload
351
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
352
348
  const initResponse = await this.initiateMultipartUpload(path, permissions);
353
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
354
349
  const uploadId = initResponse.uploadId;
355
350
  if (!uploadId) {
356
351
  throw new Error("Failed to get upload ID from initiate response");
@@ -367,26 +362,20 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
367
362
  const start = (partNumber - 1) * CHUNK_SIZE;
368
363
  const end = Math.min(start + CHUNK_SIZE, size);
369
364
  const chunk = blob.slice(start, end);
370
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
371
365
  batch.push(this.uploadPart(uploadId, partNumber, chunk));
372
366
  }
373
367
  // Wait for batch to complete
374
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
375
368
  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 })));
369
+ parts.push(...batchResults);
378
370
  }
379
371
  // Sort parts by partNumber to ensure correct order
380
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
381
372
  parts.sort((a, b) => (a.partNumber ?? 0) - (b.partNumber ?? 0));
382
373
  // Complete the upload
383
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
384
374
  return await this.completeMultipartUpload(uploadId, parts);
385
375
  }
386
376
  catch (error) {
387
377
  // Abort the upload on failure
388
378
  try {
389
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
390
379
  await this.abortMultipartUpload(uploadId);
391
380
  }
392
381
  catch (abortError) {