@blaxel/core 0.2.49-dev.208 → 0.2.49-dev.210

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