@blaxel/core 0.2.43-preview.93 → 0.2.43
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 +12 -13
- package/dist/cjs/sandbox/sandbox.js +2 -2
- package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +6 -2
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +12 -13
- package/dist/cjs-browser/sandbox/sandbox.js +2 -2
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +6 -2
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/filesystem/filesystem.js +13 -14
- package/dist/esm/sandbox/sandbox.js +2 -2
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +13 -14
- package/dist/esm-browser/sandbox/sandbox.js +2 -2
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ function getPackageVersion() {
|
|
|
7
7
|
if (typeof require !== "undefined") {
|
|
8
8
|
// Try to require package.json (Node.js only, gracefully fails in browser)
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
10
|
-
const packageJson = {"version":"0.2.43
|
|
10
|
+
const packageJson = {"version":"0.2.43","commit":"cd1ac6fc23a55e6c222dd82b803154ac95c06f05"};
|
|
11
11
|
return packageJson.version || "unknown";
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
@@ -59,7 +59,7 @@ function getCommitHash() {
|
|
|
59
59
|
if (typeof require !== "undefined") {
|
|
60
60
|
// Try to require package.json and look for commit field (set during build)
|
|
61
61
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
62
|
-
const packageJson = {"version":"0.2.43
|
|
62
|
+
const packageJson = {"version":"0.2.43","commit":"cd1ac6fc23a55e6c222dd82b803154ac95c06f05"};
|
|
63
63
|
// Check for commit in various possible locations
|
|
64
64
|
const commit = packageJson.commit || packageJson.buildInfo?.commit;
|
|
65
65
|
if (commit) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { settings } from "../../common/settings.js";
|
|
2
2
|
import { SandboxAction } from "../action.js";
|
|
3
|
-
import { deleteFilesystemByPath, getFilesystemByPath, getWatchFilesystemByPath, putFilesystemByPath
|
|
3
|
+
import { deleteFilesystemByPath, getFilesystemByPath, getWatchFilesystemByPath, putFilesystemByPath } from "../client/index.js";
|
|
4
4
|
export class SandboxFileSystem extends SandboxAction {
|
|
5
|
-
|
|
5
|
+
process;
|
|
6
|
+
constructor(sandbox, process) {
|
|
6
7
|
super(sandbox);
|
|
8
|
+
this.process = process;
|
|
9
|
+
this.process = process;
|
|
7
10
|
}
|
|
8
11
|
async mkdir(path, permissions = "0755") {
|
|
9
12
|
path = this.formatPath(path);
|
|
@@ -80,7 +83,7 @@ export class SandboxFileSystem extends SandboxAction {
|
|
|
80
83
|
baseUrl: this.url,
|
|
81
84
|
client: this.client,
|
|
82
85
|
};
|
|
83
|
-
const path = destinationPath ?? "";
|
|
86
|
+
const path = this.formatPath(destinationPath ?? "");
|
|
84
87
|
const { response, data, error } = await this.client.put({
|
|
85
88
|
url: `/filesystem/tree/${path}`,
|
|
86
89
|
...options,
|
|
@@ -128,18 +131,14 @@ export class SandboxFileSystem extends SandboxAction {
|
|
|
128
131
|
}
|
|
129
132
|
return data;
|
|
130
133
|
}
|
|
131
|
-
async cp(source, destination) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const process = {
|
|
135
|
-
command: `cp -r ${source} ${destination}`
|
|
136
|
-
};
|
|
137
|
-
const { response, data, error } = await postProcess({
|
|
138
|
-
body: process,
|
|
139
|
-
baseUrl: this.url,
|
|
140
|
-
client: this.client,
|
|
134
|
+
async cp(source, destination, { maxWait = 180000 } = {}) {
|
|
135
|
+
let process = await this.process.exec({
|
|
136
|
+
command: `cp -r ${source} ${destination}`,
|
|
141
137
|
});
|
|
142
|
-
this.
|
|
138
|
+
process = await this.process.wait(process.pid, { maxWait, interval: 100 });
|
|
139
|
+
if (process.status === "failed") {
|
|
140
|
+
throw new Error(`Could not copy ${source} to ${destination} cause: ${process.logs}`);
|
|
141
|
+
}
|
|
143
142
|
return {
|
|
144
143
|
message: "Files copied",
|
|
145
144
|
source,
|
|
@@ -17,9 +17,9 @@ export class SandboxInstance {
|
|
|
17
17
|
sessions;
|
|
18
18
|
constructor(sandbox) {
|
|
19
19
|
this.sandbox = sandbox;
|
|
20
|
-
this.fs = new SandboxFileSystem(sandbox);
|
|
21
|
-
this.network = new SandboxNetwork(sandbox);
|
|
22
20
|
this.process = new SandboxProcess(sandbox);
|
|
21
|
+
this.fs = new SandboxFileSystem(sandbox, this.process);
|
|
22
|
+
this.network = new SandboxNetwork(sandbox);
|
|
23
23
|
this.previews = new SandboxPreviews(sandbox);
|
|
24
24
|
this.sessions = new SandboxSessions(sandbox);
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/core",
|
|
3
|
-
"version": "0.2.43
|
|
3
|
+
"version": "0.2.43",
|
|
4
4
|
"description": "Blaxel Core SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"vite": "^5.2.0",
|
|
75
75
|
"vitest": "^1.5.0"
|
|
76
76
|
},
|
|
77
|
-
"commit": "
|
|
77
|
+
"commit": "cd1ac6fc23a55e6c222dd82b803154ac95c06f05",
|
|
78
78
|
"scripts": {
|
|
79
79
|
"lint": "eslint src/",
|
|
80
80
|
"dev": "tsc --watch",
|