n8n-nodes-daytona-tool 0.1.3 → 0.1.4
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Daytona } from '@daytonaio/sdk';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
2
3
|
type DaytonaConfig = {
|
|
3
4
|
baseUrl: string;
|
|
4
5
|
token: string;
|
|
@@ -16,6 +17,6 @@ export declare const runNodeCode: (sandbox: any, code: string, timeoutMs?: numbe
|
|
|
16
17
|
export declare const disposeSandbox: (sandbox: any) => Promise<any>;
|
|
17
18
|
export declare const startSandbox: (sandbox: any) => Promise<any>;
|
|
18
19
|
export declare const stopSandbox: (sandbox: any) => Promise<any>;
|
|
19
|
-
export declare const createSandboxFile: (content: string, name: string, contentType?: string) =>
|
|
20
|
-
export declare const uploadSandboxFile: (sandbox: any, remotePath: string, file:
|
|
20
|
+
export declare const createSandboxFile: (content: string, name: string, contentType?: string) => Readable;
|
|
21
|
+
export declare const uploadSandboxFile: (sandbox: any, remotePath: string, file: any) => Promise<any>;
|
|
21
22
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadSandboxFile = exports.createSandboxFile = exports.stopSandbox = exports.startSandbox = exports.disposeSandbox = exports.runNodeCode = exports.getSandboxByName = exports.getSandbox = exports.createSandbox = exports.createDaytonaClient = void 0;
|
|
4
4
|
const sdk_1 = require("@daytonaio/sdk");
|
|
5
|
+
const node_stream_1 = require("node:stream");
|
|
5
6
|
const getCreateFn = (client) => { var _a, _b; return (_a = client === null || client === void 0 ? void 0 : client.create) !== null && _a !== void 0 ? _a : (_b = client === null || client === void 0 ? void 0 : client.sandbox) === null || _b === void 0 ? void 0 : _b.create; };
|
|
6
7
|
const getFetchFn = (client) => { var _a, _b, _c, _d; return (_c = (_a = client === null || client === void 0 ? void 0 : client.get) !== null && _a !== void 0 ? _a : (_b = client === null || client === void 0 ? void 0 : client.sandbox) === null || _b === void 0 ? void 0 : _b.get) !== null && _c !== void 0 ? _c : (_d = client === null || client === void 0 ? void 0 : client.sandbox) === null || _d === void 0 ? void 0 : _d.connect; };
|
|
7
8
|
const getDisposeFn = (sandbox) => { var _a, _b; return (_b = (_a = sandbox === null || sandbox === void 0 ? void 0 : sandbox.dispose) !== null && _a !== void 0 ? _a : sandbox === null || sandbox === void 0 ? void 0 : sandbox.destroy) !== null && _b !== void 0 ? _b : sandbox === null || sandbox === void 0 ? void 0 : sandbox.remove; };
|
|
@@ -94,14 +95,12 @@ const stopSandbox = async (sandbox) => {
|
|
|
94
95
|
};
|
|
95
96
|
exports.stopSandbox = stopSandbox;
|
|
96
97
|
const createSandboxFile = (content, name, contentType) => {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return
|
|
103
|
-
type: contentType || 'text/plain',
|
|
104
|
-
});
|
|
98
|
+
const buffer = Buffer.from(content, 'utf8');
|
|
99
|
+
const stream = node_stream_1.Readable.from(buffer);
|
|
100
|
+
stream.name = name;
|
|
101
|
+
stream.type = contentType || 'text/plain';
|
|
102
|
+
stream.size = buffer.length;
|
|
103
|
+
return stream;
|
|
105
104
|
};
|
|
106
105
|
exports.createSandboxFile = createSandboxFile;
|
|
107
106
|
const uploadSandboxFile = async (sandbox, remotePath, file) => {
|