@nocobase/plugin-workflow-javascript 2.1.0-beta.14 → 2.1.0-beta.15
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/externalVersion.js
CHANGED
|
@@ -13,11 +13,11 @@ module.exports = {
|
|
|
13
13
|
"antd-style": "3.7.1",
|
|
14
14
|
"@formily/antd-v5": "1.2.3",
|
|
15
15
|
"@ant-design/icons": "5.6.1",
|
|
16
|
-
"@nocobase/client": "2.1.0-beta.
|
|
17
|
-
"@nocobase/plugin-workflow": "2.1.0-beta.
|
|
16
|
+
"@nocobase/client": "2.1.0-beta.15",
|
|
17
|
+
"@nocobase/plugin-workflow": "2.1.0-beta.15",
|
|
18
18
|
"antd": "5.24.2",
|
|
19
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
19
|
+
"@nocobase/flow-engine": "2.1.0-beta.15",
|
|
20
20
|
"react-i18next": "11.18.6",
|
|
21
21
|
"winston": "3.13.0",
|
|
22
|
-
"@nocobase/server": "2.1.0-beta.
|
|
22
|
+
"@nocobase/server": "2.1.0-beta.15"
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"isolated-vm","version":"5.0.4","description":"Access to multiple isolates","main":"isolated-vm.js","types":"isolated-vm.d.ts","engines":{"node":">=18.0.0"},"scripts":{"install":"prebuild-install || (node-gyp rebuild --release -j max && node-gyp clean)","rebuild":"node-gyp rebuild --release -j max","lint":"find src -name '*.cc' | xargs -n1 clang-tidy","test":"node test.js"},"dependencies":{"prebuild-install":"^7.1.2"},"devDependencies":{"isolated-vm":".","prebuild":"^13.0.1"},"binary":{"module_path":"out"},"repository":{"type":"git","url":"git+https://github.com/laverdet/isolated-vm.git"},"author":"https://github.com/laverdet/","license":"ISC","gypfile":true,"bugs":{"url":"https://github.com/laverdet/isolated-vm/issues"},"homepage":"https://github.com/laverdet/isolated-vm#readme","_lastModified":"2026-04-
|
|
1
|
+
{"name":"isolated-vm","version":"5.0.4","description":"Access to multiple isolates","main":"isolated-vm.js","types":"isolated-vm.d.ts","engines":{"node":">=18.0.0"},"scripts":{"install":"prebuild-install || (node-gyp rebuild --release -j max && node-gyp clean)","rebuild":"node-gyp rebuild --release -j max","lint":"find src -name '*.cc' | xargs -n1 clang-tidy","test":"node test.js"},"dependencies":{"prebuild-install":"^7.1.2"},"devDependencies":{"isolated-vm":".","prebuild":"^13.0.1"},"binary":{"module_path":"out"},"repository":{"type":"git","url":"git+https://github.com/laverdet/isolated-vm.git"},"author":"https://github.com/laverdet/","license":"ISC","gypfile":true,"bugs":{"url":"https://github.com/laverdet/isolated-vm/issues"},"homepage":"https://github.com/laverdet/isolated-vm#readme","_lastModified":"2026-04-24T08:11:49.689Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"winston-transport","description":"Base stream implementations for winston@3 and up.","version":"4.7.0","main":"index.js","browser":"dist/index.js","scripts":{"lint":"eslint test/*.js index.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist","pretest":"npm run lint && npm run build","test":"nyc mocha test/*.test.js","report":"nyc report --reporter=lcov","build":"rimraf dist && babel *.js -d ./dist","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git@github.com:winstonjs/winston-transport.git"},"keywords":["winston","transport","winston3"],"author":"Charlie Robbins <charlie.robbins@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/winstonjs/winston-transport/issues"},"homepage":"https://github.com/winstonjs/winston-transport#readme","dependencies":{"logform":"^2.3.2","readable-stream":"^3.6.0","triple-beam":"^1.3.0"},"devDependencies":{"@types/node":"^20.8.6","abstract-winston-transport":">=0.5.1","assume":"^2.3.0","babel-cli":"^6.26.0","babel-preset-env":"^1.7.0","deep-equal":"^2.0.5","eslint":"^8.8.0","@dabh/eslint-config-populist":"^5.0.0","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^5.0.5","winston-compat":"^0.1.5"},"engines":{"node":">= 12.0.0"},"_lastModified":"2026-04-
|
|
1
|
+
{"name":"winston-transport","description":"Base stream implementations for winston@3 and up.","version":"4.7.0","main":"index.js","browser":"dist/index.js","scripts":{"lint":"eslint test/*.js index.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist","pretest":"npm run lint && npm run build","test":"nyc mocha test/*.test.js","report":"nyc report --reporter=lcov","build":"rimraf dist && babel *.js -d ./dist","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git@github.com:winstonjs/winston-transport.git"},"keywords":["winston","transport","winston3"],"author":"Charlie Robbins <charlie.robbins@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/winstonjs/winston-transport/issues"},"homepage":"https://github.com/winstonjs/winston-transport#readme","dependencies":{"logform":"^2.3.2","readable-stream":"^3.6.0","triple-beam":"^1.3.0"},"devDependencies":{"@types/node":"^20.8.6","abstract-winston-transport":">=0.5.1","assume":"^2.3.0","babel-cli":"^6.26.0","babel-preset-env":"^1.7.0","deep-equal":"^2.0.5","eslint":"^8.8.0","@dabh/eslint-config-populist":"^5.0.0","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^5.0.5","winston-compat":"^0.1.5"},"engines":{"node":">= 12.0.0"},"_lastModified":"2026-04-24T08:11:50.146Z"}
|
package/dist/server/Vm.js
CHANGED
|
@@ -11,184 +11,34 @@ const { parentPort, workerData } = require("node:worker_threads");
|
|
|
11
11
|
const { Script } = require("node:vm");
|
|
12
12
|
const Path = require("node:path");
|
|
13
13
|
let timer = null;
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function customRequire(m) {
|
|
15
|
+
var _a;
|
|
16
|
+
const configuredModules = (((_a = process.env.WORKFLOW_SCRIPT_MODULES) == null ? void 0 : _a.split(",")) ?? []).filter(Boolean);
|
|
17
|
+
let mainName;
|
|
18
|
+
if (Path.isAbsolute(m)) {
|
|
19
|
+
mainName = m;
|
|
20
|
+
} else if (m.startsWith(".")) {
|
|
21
|
+
mainName = m;
|
|
22
|
+
m = Path.resolve(process.cwd(), m);
|
|
23
|
+
} else {
|
|
24
|
+
mainName = m.split("/").slice(0, m.startsWith("@") ? 2 : 1).join("/");
|
|
25
|
+
}
|
|
26
|
+
if (configuredModules.includes(mainName)) {
|
|
27
|
+
return require(m);
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`module "${m}" not supported`);
|
|
30
|
+
}
|
|
31
|
+
function hardenFunction(fn) {
|
|
32
|
+
Object.setPrototypeOf(fn, null);
|
|
33
|
+
Object.defineProperty(fn, "constructor", {
|
|
17
34
|
value: null,
|
|
18
35
|
writable: false,
|
|
19
36
|
enumerable: false,
|
|
20
37
|
configurable: false
|
|
21
38
|
});
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
function createSandboxError(msg) {
|
|
25
|
-
return harden(new Error(msg));
|
|
26
|
-
}
|
|
27
|
-
function resolveProperty(obj, key) {
|
|
28
|
-
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
29
|
-
if (!desc) return void 0;
|
|
30
|
-
if ("value" in desc) return desc.value;
|
|
31
|
-
if (desc.get) {
|
|
32
|
-
try {
|
|
33
|
-
return desc.get.call(obj);
|
|
34
|
-
} catch (_) {
|
|
35
|
-
return void 0;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return void 0;
|
|
39
|
-
}
|
|
40
|
-
function sanitizeError(e) {
|
|
41
|
-
let msg;
|
|
42
|
-
try {
|
|
43
|
-
msg = e != null && typeof e.message === "string" ? e.message : String(e);
|
|
44
|
-
} catch (_) {
|
|
45
|
-
msg = "unknown error";
|
|
46
|
-
}
|
|
47
|
-
return createSandboxError(msg);
|
|
48
|
-
}
|
|
49
|
-
function sanitizeReturnValue(result) {
|
|
50
|
-
if (result === null || result === void 0) return result;
|
|
51
|
-
if (typeof result !== "object" && typeof result !== "function") return result;
|
|
52
|
-
if (typeof result.then === "function") {
|
|
53
|
-
const cleanThenable = /* @__PURE__ */ Object.create(null);
|
|
54
|
-
const originalThen = result.then.bind(result);
|
|
55
|
-
Object.defineProperty(cleanThenable, "then", {
|
|
56
|
-
value: harden(function(onFulfilled, onRejected) {
|
|
57
|
-
const next = originalThen(
|
|
58
|
-
typeof onFulfilled === "function" ? (v) => onFulfilled(sanitizeForSandbox(v, null, /* @__PURE__ */ new WeakMap())) : onFulfilled,
|
|
59
|
-
typeof onRejected === "function" ? (e) => onRejected(sanitizeError(e)) : onRejected
|
|
60
|
-
);
|
|
61
|
-
return sanitizeReturnValue(next);
|
|
62
|
-
}),
|
|
63
|
-
writable: false,
|
|
64
|
-
enumerable: true,
|
|
65
|
-
configurable: false
|
|
66
|
-
});
|
|
67
|
-
return cleanThenable;
|
|
68
|
-
}
|
|
69
|
-
return sanitizeForSandbox(result, null, /* @__PURE__ */ new WeakMap());
|
|
70
|
-
}
|
|
71
|
-
function sanitizeForSandbox(val, parent, cache) {
|
|
72
|
-
if (!cache) cache = /* @__PURE__ */ new WeakMap();
|
|
73
|
-
if (val === null || val === void 0) return val;
|
|
74
|
-
if (typeof val !== "object" && typeof val !== "function") return val;
|
|
75
|
-
if (cache.has(val)) return cache.get(val);
|
|
76
|
-
if (typeof val === "function") {
|
|
77
|
-
const fn = parent != null ? val.bind(parent) : val;
|
|
78
|
-
const wrapper = function(...args) {
|
|
79
|
-
let ret;
|
|
80
|
-
try {
|
|
81
|
-
ret = fn(...args);
|
|
82
|
-
} catch (e) {
|
|
83
|
-
throw sanitizeError(e);
|
|
84
|
-
}
|
|
85
|
-
return sanitizeReturnValue(ret);
|
|
86
|
-
};
|
|
87
|
-
cache.set(val, wrapper);
|
|
88
|
-
harden(wrapper);
|
|
89
|
-
const SKIP_PROPS = /* @__PURE__ */ new Set(["length", "name", "prototype", "caller", "arguments", "constructor"]);
|
|
90
|
-
for (const key of Object.getOwnPropertyNames(val)) {
|
|
91
|
-
if (SKIP_PROPS.has(key)) continue;
|
|
92
|
-
try {
|
|
93
|
-
const resolved = resolveProperty(val, key);
|
|
94
|
-
if (resolved !== void 0) {
|
|
95
|
-
Object.defineProperty(wrapper, key, {
|
|
96
|
-
value: sanitizeForSandbox(resolved, val, cache),
|
|
97
|
-
writable: false,
|
|
98
|
-
enumerable: true,
|
|
99
|
-
configurable: false
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
} catch (_) {
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return wrapper;
|
|
106
|
-
}
|
|
107
|
-
if (Array.isArray(val)) {
|
|
108
|
-
const len = val.length;
|
|
109
|
-
const cleanArr = /* @__PURE__ */ Object.create(null);
|
|
110
|
-
cache.set(val, cleanArr);
|
|
111
|
-
Object.defineProperty(cleanArr, "length", {
|
|
112
|
-
value: len,
|
|
113
|
-
writable: false,
|
|
114
|
-
enumerable: false,
|
|
115
|
-
configurable: false
|
|
116
|
-
});
|
|
117
|
-
for (let i = 0; i < len; i++) {
|
|
118
|
-
try {
|
|
119
|
-
cleanArr[i] = sanitizeForSandbox(val[i], null, cache);
|
|
120
|
-
} catch (_) {
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
Object.defineProperty(cleanArr, Symbol.iterator, {
|
|
124
|
-
value: harden(function() {
|
|
125
|
-
let idx = 0;
|
|
126
|
-
const iterator = /* @__PURE__ */ Object.create(null);
|
|
127
|
-
iterator.next = harden(function() {
|
|
128
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
129
|
-
if (idx < len) {
|
|
130
|
-
result.value = cleanArr[idx++];
|
|
131
|
-
result.done = false;
|
|
132
|
-
} else {
|
|
133
|
-
result.value = void 0;
|
|
134
|
-
result.done = true;
|
|
135
|
-
}
|
|
136
|
-
return result;
|
|
137
|
-
});
|
|
138
|
-
iterator[Symbol.iterator] = harden(function() {
|
|
139
|
-
return iterator;
|
|
140
|
-
});
|
|
141
|
-
return iterator;
|
|
142
|
-
}),
|
|
143
|
-
writable: false,
|
|
144
|
-
enumerable: false,
|
|
145
|
-
configurable: false
|
|
146
|
-
});
|
|
147
|
-
return cleanArr;
|
|
148
|
-
}
|
|
149
|
-
const clean = /* @__PURE__ */ Object.create(null);
|
|
150
|
-
cache.set(val, clean);
|
|
151
|
-
let proto = val;
|
|
152
|
-
while (proto !== null && proto !== Object.prototype) {
|
|
153
|
-
for (const key of Object.getOwnPropertyNames(proto)) {
|
|
154
|
-
if (key === "constructor" || key in clean) continue;
|
|
155
|
-
try {
|
|
156
|
-
const resolved = resolveProperty(proto, key);
|
|
157
|
-
if (resolved !== void 0) {
|
|
158
|
-
clean[key] = sanitizeForSandbox(resolved, val, cache);
|
|
159
|
-
}
|
|
160
|
-
} catch (_) {
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
proto = Object.getPrototypeOf(proto);
|
|
164
|
-
}
|
|
165
|
-
return clean;
|
|
39
|
+
return fn;
|
|
166
40
|
}
|
|
167
|
-
|
|
168
|
-
var _a;
|
|
169
|
-
try {
|
|
170
|
-
if (typeof m !== "string") {
|
|
171
|
-
throw new Error("module name must be a string");
|
|
172
|
-
}
|
|
173
|
-
const configuredModules = (((_a = process.env.WORKFLOW_SCRIPT_MODULES) == null ? void 0 : _a.split(",")) ?? []).filter(Boolean);
|
|
174
|
-
let mainName;
|
|
175
|
-
if (Path.isAbsolute(m)) {
|
|
176
|
-
mainName = m;
|
|
177
|
-
} else if (m.startsWith(".")) {
|
|
178
|
-
mainName = m;
|
|
179
|
-
m = Path.resolve(process.cwd(), m);
|
|
180
|
-
} else {
|
|
181
|
-
mainName = m.split("/").slice(0, m.startsWith("@") ? 2 : 1).join("/");
|
|
182
|
-
}
|
|
183
|
-
if (configuredModules.includes(mainName)) {
|
|
184
|
-
return sanitizeForSandbox(require(m));
|
|
185
|
-
}
|
|
186
|
-
throw new Error(`module "${m}" not supported`);
|
|
187
|
-
} catch (e) {
|
|
188
|
-
throw sanitizeError(e);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
harden(customRequire);
|
|
41
|
+
hardenFunction(customRequire);
|
|
192
42
|
function createSafeConsole(originalConsole) {
|
|
193
43
|
const safe = /* @__PURE__ */ Object.create(null);
|
|
194
44
|
const allowedMethods = [
|
|
@@ -214,7 +64,8 @@ function createSafeConsole(originalConsole) {
|
|
|
214
64
|
];
|
|
215
65
|
for (const key of allowedMethods) {
|
|
216
66
|
if (typeof originalConsole[key] === "function") {
|
|
217
|
-
const bound =
|
|
67
|
+
const bound = originalConsole[key].bind(originalConsole);
|
|
68
|
+
hardenFunction(bound);
|
|
218
69
|
Object.defineProperty(safe, key, {
|
|
219
70
|
value: bound,
|
|
220
71
|
writable: false,
|
|
@@ -223,7 +74,13 @@ function createSafeConsole(originalConsole) {
|
|
|
223
74
|
});
|
|
224
75
|
}
|
|
225
76
|
}
|
|
226
|
-
|
|
77
|
+
Object.defineProperty(safe, "constructor", {
|
|
78
|
+
value: null,
|
|
79
|
+
writable: false,
|
|
80
|
+
enumerable: false,
|
|
81
|
+
configurable: false
|
|
82
|
+
});
|
|
83
|
+
return Object.freeze(safe);
|
|
227
84
|
}
|
|
228
85
|
async function main() {
|
|
229
86
|
const { source, args = {}, options = {} } = workerData;
|
|
@@ -248,17 +105,8 @@ async function main() {
|
|
|
248
105
|
const result = script.runInNewContext(context, { timeout: options.timeout });
|
|
249
106
|
return result;
|
|
250
107
|
}
|
|
251
|
-
function toJsonResult(value) {
|
|
252
|
-
if (value === null || value === void 0) return value;
|
|
253
|
-
if (typeof value !== "object" && typeof value !== "function") return value;
|
|
254
|
-
try {
|
|
255
|
-
return JSON.parse(JSON.stringify(value));
|
|
256
|
-
} catch (_) {
|
|
257
|
-
return value;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
108
|
main().then((result) => {
|
|
261
|
-
parentPort.postMessage({ type: "result", result
|
|
109
|
+
parentPort.postMessage({ type: "result", result });
|
|
262
110
|
}).catch((error) => {
|
|
263
111
|
throw error;
|
|
264
112
|
}).finally(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-workflow-javascript",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.15",
|
|
4
4
|
"displayName": "Workflow: JavaScript",
|
|
5
5
|
"displayName.zh-CN": "工作流:JavaScript 节点",
|
|
6
6
|
"description": "Execute a piece of JavaScript in an isolated Node.js environment.",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"Workflow"
|
|
38
38
|
],
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "dc1aceea6357e6ab149976c2a236fc4b6bee1370"
|
|
41
41
|
}
|
package/.env.example
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# This is an example of environment variables for the plugin-workflow-javascript plugin.
|
|
2
|
-
# You can merge this file with your existing .env file and customize the values as needed.
|
|
3
|
-
#
|
|
4
|
-
# --- SECURITY WARNING ---
|
|
5
|
-
# * By default, no modules are allowed to be used in the JavaScript node. Your script will be executed in a sandboxed environment by `isolated-vm`.
|
|
6
|
-
#
|
|
7
|
-
# * By setting any module in WORKFLOW_SCRIPT_MODULES, the JavaScript node will use `node:vm` to execute the script,
|
|
8
|
-
# which will cause potential security risks. Please make sure the script content is managed by privileged users,
|
|
9
|
-
# and use it with caution. This will be at your own risk.
|
|
10
|
-
#
|
|
11
|
-
# See the documentation for more details: https://docs.nocobase.com/workflow/nodes/javascript#safe-mode-default
|
|
12
|
-
#
|
|
13
|
-
# Example: lodash,dayjs
|
|
14
|
-
# WORKFLOW_SCRIPT_MODULES=lodash,dayjs
|
|
15
|
-
WORKFLOW_SCRIPT_MODULES=
|