@blaxel/core 0.2.84 → 0.2.85
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/filesystem/filesystem.js +1 -1
- package/dist/cjs/sandbox/filesystem/filesystem.test.js +33 -0
- package/dist/cjs/types/sandbox/filesystem/filesystem.test.d.ts +1 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +1 -1
- package/dist/cjs-browser/sandbox/filesystem/filesystem.test.js +33 -0
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem.test.d.ts +1 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/filesystem/filesystem.js +1 -1
- package/dist/esm/sandbox/filesystem/filesystem.test.js +31 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +1 -1
- package/dist/esm-browser/sandbox/filesystem/filesystem.test.js +31 -0
- package/package.json +1 -1
|
@@ -11,8 +11,8 @@ const index_js_1 = require("../authentication/index.js");
|
|
|
11
11
|
const env_js_1 = require("../common/env.js");
|
|
12
12
|
const node_js_1 = require("../common/node.js");
|
|
13
13
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
14
|
-
const BUILD_VERSION = "0.2.
|
|
15
|
-
const BUILD_COMMIT = "
|
|
14
|
+
const BUILD_VERSION = "0.2.85";
|
|
15
|
+
const BUILD_COMMIT = "a9c088b49239125f1b129fbc95d1887556112a33";
|
|
16
16
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
17
17
|
const BLAXEL_API_VERSION = "2026-04-16";
|
|
18
18
|
// Cache for config.yaml tracking value
|
|
@@ -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 =
|
|
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) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const filesystem_js_1 = require("./filesystem.js");
|
|
5
|
+
const waitForPartUpload = () => new Promise((resolve) => setTimeout(resolve, 5));
|
|
6
|
+
(0, vitest_1.describe)("SandboxFileSystem multipart upload", () => {
|
|
7
|
+
(0, vitest_1.it)("limits concurrent part uploads", async () => {
|
|
8
|
+
const filesystem = Object.create(filesystem_js_1.SandboxFileSystem.prototype);
|
|
9
|
+
let inFlight = 0;
|
|
10
|
+
let maxInFlight = 0;
|
|
11
|
+
const uploadedParts = [];
|
|
12
|
+
let completedParts = [];
|
|
13
|
+
filesystem.initiateMultipartUpload = () => Promise.resolve({ uploadId: "upload-1" });
|
|
14
|
+
filesystem.uploadPart = async (_uploadId, partNumber) => {
|
|
15
|
+
inFlight += 1;
|
|
16
|
+
maxInFlight = Math.max(maxInFlight, inFlight);
|
|
17
|
+
await waitForPartUpload();
|
|
18
|
+
uploadedParts.push(partNumber);
|
|
19
|
+
inFlight -= 1;
|
|
20
|
+
return { partNumber, etag: `etag-${partNumber}` };
|
|
21
|
+
};
|
|
22
|
+
filesystem.completeMultipartUpload = (_uploadId, parts) => {
|
|
23
|
+
completedParts = parts;
|
|
24
|
+
return Promise.resolve({ message: "ok" });
|
|
25
|
+
};
|
|
26
|
+
filesystem.abortMultipartUpload = () => Promise.resolve({ message: "aborted" });
|
|
27
|
+
const blob = new Blob([new Uint8Array(16 * 1024 * 1024)]);
|
|
28
|
+
await filesystem.uploadWithMultipart("/tmp/large-file.bin", blob);
|
|
29
|
+
(0, vitest_1.expect)(maxInFlight).toBeLessThanOrEqual(3);
|
|
30
|
+
(0, vitest_1.expect)(uploadedParts.sort((a, b) => a - b)).toEqual([1, 2, 3, 4]);
|
|
31
|
+
(0, vitest_1.expect)(completedParts.map((part) => part.partNumber)).toEqual([1, 2, 3, 4]);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|