n8n-nodes-daytona-tool 0.1.5 → 0.1.6
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,6 +8,7 @@ type SandboxCreateInput = {
|
|
|
8
8
|
name?: string;
|
|
9
9
|
sessionId?: string;
|
|
10
10
|
runtime?: string;
|
|
11
|
+
envVars?: Record<string, string>;
|
|
11
12
|
};
|
|
12
13
|
export declare const createDaytonaClient: (config: DaytonaConfig) => Daytona;
|
|
13
14
|
export declare const createSandbox: (client: any, input: SandboxCreateInput) => Promise<any>;
|
|
@@ -33,6 +33,7 @@ const createSandbox = async (client, input) => {
|
|
|
33
33
|
const createArgs = {
|
|
34
34
|
name: input.name,
|
|
35
35
|
language: input.runtime,
|
|
36
|
+
envVars: input.envVars,
|
|
36
37
|
labels: input.sessionId ? { sessionId: input.sessionId } : undefined,
|
|
37
38
|
};
|
|
38
39
|
return createFn.call((_a = client === null || client === void 0 ? void 0 : client.sandbox) !== null && _a !== void 0 ? _a : client, createArgs);
|
|
@@ -45,11 +45,41 @@ class CreateSandbox {
|
|
|
45
45
|
default: 'nodejs',
|
|
46
46
|
description: 'Runtime/language to provision in the sandbox.',
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Env Vars',
|
|
50
|
+
name: 'envVars',
|
|
51
|
+
type: 'fixedCollection',
|
|
52
|
+
typeOptions: {
|
|
53
|
+
multipleValues: true,
|
|
54
|
+
},
|
|
55
|
+
default: {},
|
|
56
|
+
description: 'Environment variables to set in the sandbox.',
|
|
57
|
+
options: [
|
|
58
|
+
{
|
|
59
|
+
name: 'entries',
|
|
60
|
+
displayName: 'Entry',
|
|
61
|
+
values: [
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Key',
|
|
64
|
+
name: 'key',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: '',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Value',
|
|
70
|
+
name: 'value',
|
|
71
|
+
type: 'string',
|
|
72
|
+
default: '',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
48
78
|
],
|
|
49
79
|
};
|
|
50
80
|
}
|
|
51
81
|
async execute() {
|
|
52
|
-
var _a, _b, _c, _d;
|
|
82
|
+
var _a, _b, _c, _d, _e;
|
|
53
83
|
const items = this.getInputData();
|
|
54
84
|
const credentials = await this.getCredentials('daytonaApi');
|
|
55
85
|
const client = (0, daytonaClient_1.createDaytonaClient)({
|
|
@@ -61,16 +91,29 @@ class CreateSandbox {
|
|
|
61
91
|
const sessionId = this.getNodeParameter('sessionId', i);
|
|
62
92
|
const sandboxName = this.getNodeParameter('sandboxName', i);
|
|
63
93
|
const runtime = this.getNodeParameter('runtime', i);
|
|
94
|
+
const envVarsRaw = this.getNodeParameter('envVars', i);
|
|
95
|
+
const envVars = ((_a = envVarsRaw === null || envVarsRaw === void 0 ? void 0 : envVarsRaw.entries) === null || _a === void 0 ? void 0 : _a.length)
|
|
96
|
+
? envVarsRaw.entries.reduce((acc, entry) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const key = ((entry === null || entry === void 0 ? void 0 : entry.key) || '').trim();
|
|
99
|
+
if (!key) {
|
|
100
|
+
return acc;
|
|
101
|
+
}
|
|
102
|
+
acc[key] = (_a = entry === null || entry === void 0 ? void 0 : entry.value) !== null && _a !== void 0 ? _a : '';
|
|
103
|
+
return acc;
|
|
104
|
+
}, {})
|
|
105
|
+
: undefined;
|
|
64
106
|
const sandbox = await (0, daytonaClient_1.createSandbox)(client, {
|
|
65
107
|
name: sandboxName || undefined,
|
|
66
108
|
sessionId,
|
|
67
109
|
runtime,
|
|
110
|
+
envVars,
|
|
68
111
|
});
|
|
69
112
|
returnData.push({
|
|
70
113
|
json: {
|
|
71
114
|
sessionId,
|
|
72
|
-
sandboxId: (
|
|
73
|
-
name: (
|
|
115
|
+
sandboxId: (_c = (_b = sandbox === null || sandbox === void 0 ? void 0 : sandbox.id) !== null && _b !== void 0 ? _b : sandbox === null || sandbox === void 0 ? void 0 : sandbox.sandboxId) !== null && _c !== void 0 ? _c : (_d = sandbox === null || sandbox === void 0 ? void 0 : sandbox.metadata) === null || _d === void 0 ? void 0 : _d.id,
|
|
116
|
+
name: (_e = sandbox === null || sandbox === void 0 ? void 0 : sandbox.name) !== null && _e !== void 0 ? _e : sandboxName,
|
|
74
117
|
runtime,
|
|
75
118
|
raw: sandbox !== null && sandbox !== void 0 ? sandbox : null,
|
|
76
119
|
},
|