freestyle-sandboxes 0.0.74 → 0.0.75-1
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/index.cjs +6 -13
- package/dist/index.mjs +6 -13
- package/package.json +1 -1
- package/src/index.ts +19 -6
package/dist/index.cjs
CHANGED
|
@@ -63,12 +63,6 @@ const handleExecOnEphemeralDevServer = (options) => {
|
|
|
63
63
|
url: "/ephemeral/v1/dev-servers/exec"
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
|
-
const handleWriteFileFromEphemeralDevServer = (options) => {
|
|
67
|
-
return (options?.client ?? client).put({
|
|
68
|
-
...options,
|
|
69
|
-
url: "/ephemeral/v1/dev-servers/files/{*filepath}"
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
66
|
const handleReadFileFromEphemeralDevServer = (options) => {
|
|
73
67
|
return (options?.client ?? client).post({
|
|
74
68
|
...options,
|
|
@@ -1001,20 +995,19 @@ ${response.error.message}`);
|
|
|
1001
995
|
},
|
|
1002
996
|
async writeFile(path, content, encoding = "utf-8") {
|
|
1003
997
|
const contentStr = typeof content === "string" ? content : Buffer.from(content).toString(encoding);
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
path: {
|
|
1007
|
-
filepath: path
|
|
1008
|
-
},
|
|
998
|
+
await client.put({
|
|
999
|
+
url: `/ephemeral/v1/dev-servers/files/${path}`,
|
|
1009
1000
|
body: {
|
|
1010
1001
|
devServer: devServerInstance,
|
|
1011
1002
|
content: contentStr,
|
|
1012
1003
|
encoding
|
|
1013
1004
|
}
|
|
1005
|
+
}).then((response2) => {
|
|
1006
|
+
console.log("Request PATH: ", response2.request.url);
|
|
1014
1007
|
});
|
|
1015
|
-
if (
|
|
1008
|
+
if (response.error) {
|
|
1016
1009
|
throw new Error(
|
|
1017
|
-
`Failed to write file: ${JSON.stringify(
|
|
1010
|
+
`Failed to write file: ${JSON.stringify(response.error)}`
|
|
1018
1011
|
);
|
|
1019
1012
|
}
|
|
1020
1013
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -61,12 +61,6 @@ const handleExecOnEphemeralDevServer = (options) => {
|
|
|
61
61
|
url: "/ephemeral/v1/dev-servers/exec"
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
const handleWriteFileFromEphemeralDevServer = (options) => {
|
|
65
|
-
return (options?.client ?? client).put({
|
|
66
|
-
...options,
|
|
67
|
-
url: "/ephemeral/v1/dev-servers/files/{*filepath}"
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
64
|
const handleReadFileFromEphemeralDevServer = (options) => {
|
|
71
65
|
return (options?.client ?? client).post({
|
|
72
66
|
...options,
|
|
@@ -999,20 +993,19 @@ ${response.error.message}`);
|
|
|
999
993
|
},
|
|
1000
994
|
async writeFile(path, content, encoding = "utf-8") {
|
|
1001
995
|
const contentStr = typeof content === "string" ? content : Buffer.from(content).toString(encoding);
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
path: {
|
|
1005
|
-
filepath: path
|
|
1006
|
-
},
|
|
996
|
+
await client.put({
|
|
997
|
+
url: `/ephemeral/v1/dev-servers/files/${path}`,
|
|
1007
998
|
body: {
|
|
1008
999
|
devServer: devServerInstance,
|
|
1009
1000
|
content: contentStr,
|
|
1010
1001
|
encoding
|
|
1011
1002
|
}
|
|
1003
|
+
}).then((response2) => {
|
|
1004
|
+
console.log("Request PATH: ", response2.request.url);
|
|
1012
1005
|
});
|
|
1013
|
-
if (
|
|
1006
|
+
if (response.error) {
|
|
1014
1007
|
throw new Error(
|
|
1015
|
-
`Failed to write file: ${JSON.stringify(
|
|
1008
|
+
`Failed to write file: ${JSON.stringify(response.error)}`
|
|
1016
1009
|
);
|
|
1017
1010
|
}
|
|
1018
1011
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1083,17 +1083,30 @@ export class FreestyleSandboxes {
|
|
|
1083
1083
|
? content
|
|
1084
1084
|
: Buffer.from(content).toString(encoding);
|
|
1085
1085
|
|
|
1086
|
-
const response =
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1086
|
+
// const response =
|
|
1087
|
+
// await sandbox_openapi.handleWriteFileFromEphemeralDevServer({
|
|
1088
|
+
// client,
|
|
1089
|
+
|
|
1090
|
+
// path: {
|
|
1091
|
+
// filepath: path,
|
|
1092
|
+
// },
|
|
1093
|
+
// body: {
|
|
1094
|
+
// devServer: devServerInstance,
|
|
1095
|
+
// content: contentStr,
|
|
1096
|
+
// encoding,
|
|
1097
|
+
// },
|
|
1098
|
+
// });
|
|
1099
|
+
await client
|
|
1100
|
+
.put({
|
|
1101
|
+
url: `/ephemeral/v1/dev-servers/files/${path}`,
|
|
1092
1102
|
body: {
|
|
1093
1103
|
devServer: devServerInstance,
|
|
1094
1104
|
content: contentStr,
|
|
1095
1105
|
encoding,
|
|
1096
1106
|
},
|
|
1107
|
+
})
|
|
1108
|
+
.then((response) => {
|
|
1109
|
+
console.log("Request PATH: ", response.request.url);
|
|
1097
1110
|
});
|
|
1098
1111
|
|
|
1099
1112
|
if (response.error) {
|