@logicflow/engine 0.0.11-beta.0 → 0.0.12
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/README.md +5 -2
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/es/EventEmitter.d.ts +34 -4
- package/es/EventEmitter.js +70 -48
- package/es/EventEmitter.js.map +1 -0
- package/es/FlowModel.d.ts +75 -73
- package/es/FlowModel.js +130 -173
- package/es/FlowModel.js.map +1 -0
- package/es/Scheduler.d.ts +50 -34
- package/es/Scheduler.js +134 -209
- package/es/Scheduler.js.map +1 -0
- package/es/constant/{constant.js → index.js} +8 -7
- package/es/constant/index.js.map +1 -0
- package/es/constant/logCode.js +29 -0
- package/es/constant/logCode.js.map +1 -0
- package/es/index.d.ts +135 -38
- package/es/index.js +92 -144
- package/es/index.js.map +1 -0
- package/es/nodes/base.d.ts +108 -0
- package/es/nodes/base.js +151 -0
- package/es/nodes/base.js.map +1 -0
- package/es/nodes/index.d.ts +3 -0
- package/es/nodes/index.js +4 -0
- package/es/nodes/index.js.map +1 -0
- package/es/nodes/{StartNode.d.ts → start.d.ts} +3 -2
- package/es/nodes/start.js +11 -0
- package/es/nodes/start.js.map +1 -0
- package/es/nodes/{TaskNode.d.ts → task.d.ts} +3 -2
- package/es/nodes/task.js +11 -0
- package/es/nodes/task.js.map +1 -0
- package/es/platform/browser/browserVm.d.ts +1 -0
- package/es/platform/browser/browserVm.js +66 -0
- package/es/platform/browser/browserVm.js.map +1 -0
- package/es/platform/browser/index.d.ts +4 -0
- package/es/platform/browser/index.js +23 -0
- package/es/platform/browser/index.js.map +1 -0
- package/es/platform/index.d.ts +1 -0
- package/es/platform/index.js +2 -0
- package/es/platform/index.js.map +1 -0
- package/es/platform/node/index.d.ts +4 -0
- package/es/platform/node/index.js +23 -0
- package/es/platform/node/index.js.map +1 -0
- package/es/platform/node/nodeVm.d.ts +1 -0
- package/es/platform/node/nodeVm.js +10 -0
- package/es/platform/node/nodeVm.js.map +1 -0
- package/es/recorder/index.d.ts +36 -10
- package/es/recorder/index.js +82 -135
- package/es/recorder/index.js.map +1 -0
- package/es/utils/global.d.ts +5 -0
- package/es/utils/global.js +27 -0
- package/es/utils/global.js.map +1 -0
- package/es/utils/id.js +14 -0
- package/es/utils/id.js.map +1 -0
- package/es/utils/index.d.ts +4 -0
- package/es/utils/index.js +5 -0
- package/es/utils/index.js.map +1 -0
- package/es/{util → utils}/storage.js +17 -16
- package/es/utils/storage.js.map +1 -0
- package/lib/EventEmitter.d.ts +37 -0
- package/lib/EventEmitter.js +94 -0
- package/lib/EventEmitter.js.map +1 -0
- package/lib/FlowModel.d.ts +146 -0
- package/lib/FlowModel.js +236 -0
- package/lib/FlowModel.js.map +1 -0
- package/lib/Scheduler.d.ts +78 -0
- package/lib/Scheduler.js +179 -0
- package/lib/Scheduler.js.map +1 -0
- package/lib/constant/index.d.ts +16 -0
- package/{cjs/constant/constant.js → lib/constant/index.js} +4 -3
- package/lib/constant/index.js.map +1 -0
- package/lib/constant/logCode.d.ts +12 -0
- package/{cjs/constant/LogCode.js → lib/constant/logCode.js} +16 -13
- package/lib/constant/logCode.js.map +1 -0
- package/lib/index.d.ts +157 -0
- package/lib/index.js +159 -0
- package/lib/index.js.map +1 -0
- package/lib/nodes/base.d.ts +108 -0
- package/lib/nodes/base.js +154 -0
- package/lib/nodes/base.js.map +1 -0
- package/lib/nodes/index.d.ts +3 -0
- package/lib/nodes/index.js +7 -0
- package/lib/nodes/index.js.map +1 -0
- package/lib/nodes/start.d.ts +6 -0
- package/lib/nodes/start.js +15 -0
- package/lib/nodes/start.js.map +1 -0
- package/lib/nodes/task.d.ts +6 -0
- package/lib/nodes/task.js +15 -0
- package/lib/nodes/task.js.map +1 -0
- package/lib/platform/browser/browserVm.d.ts +1 -0
- package/lib/platform/browser/browserVm.js +70 -0
- package/lib/platform/browser/browserVm.js.map +1 -0
- package/lib/platform/browser/index.d.ts +4 -0
- package/lib/platform/browser/index.js +28 -0
- package/lib/platform/browser/index.js.map +1 -0
- package/lib/platform/index.d.ts +1 -0
- package/lib/platform/index.js +5 -0
- package/lib/platform/index.js.map +1 -0
- package/lib/platform/node/index.d.ts +4 -0
- package/lib/platform/node/index.js +28 -0
- package/lib/platform/node/index.js.map +1 -0
- package/lib/platform/node/nodeVm.d.ts +1 -0
- package/lib/platform/node/nodeVm.js +14 -0
- package/lib/platform/node/nodeVm.js.map +1 -0
- package/lib/recorder/index.d.ts +46 -0
- package/lib/recorder/index.js +117 -0
- package/lib/recorder/index.js.map +1 -0
- package/lib/utils/global.d.ts +5 -0
- package/lib/utils/global.js +31 -0
- package/lib/utils/global.js.map +1 -0
- package/lib/utils/id.d.ts +3 -0
- package/lib/utils/id.js +20 -0
- package/lib/utils/id.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +9 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/storage.d.ts +7 -0
- package/{cjs/util → lib/utils}/storage.js +18 -17
- package/lib/utils/storage.js.map +1 -0
- package/package.json +30 -71
- package/src/EventEmitter.ts +103 -0
- package/src/FlowModel.ts +325 -0
- package/src/Scheduler.ts +244 -0
- package/src/constant/index.ts +23 -0
- package/src/constant/logCode.ts +34 -0
- package/src/index.ts +300 -0
- package/src/nodes/base.ts +236 -0
- package/src/nodes/index.ts +3 -0
- package/src/nodes/start.ts +8 -0
- package/src/nodes/task.ts +8 -0
- package/src/platform/browser/browserVm.ts +68 -0
- package/src/platform/browser/index.ts +28 -0
- package/src/platform/index.ts +1 -0
- package/src/platform/node/index.ts +28 -0
- package/src/platform/node/nodeVm.ts +14 -0
- package/src/recorder/index.ts +137 -0
- package/src/typings.d.ts +0 -0
- package/src/utils/global.ts +41 -0
- package/src/utils/id.ts +16 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/storage.ts +55 -0
- package/cjs/EventEmitter.js +0 -70
- package/cjs/FlowModel.js +0 -277
- package/cjs/Scheduler.js +0 -252
- package/cjs/expression/browserVm.js +0 -81
- package/cjs/expression/index.js +0 -57
- package/cjs/index.js +0 -210
- package/cjs/nodes/BaseNode.js +0 -252
- package/cjs/nodes/StartNode.js +0 -27
- package/cjs/nodes/TaskNode.js +0 -27
- package/cjs/recorder/index.js +0 -168
- package/cjs/util/ID.js +0 -16
- package/cjs/util/global.js +0 -32
- package/es/constant/LogCode.js +0 -28
- package/es/expression/browserVm.d.ts +0 -4
- package/es/expression/browserVm.js +0 -76
- package/es/expression/index.d.ts +0 -2
- package/es/expression/index.js +0 -54
- package/es/nodes/BaseNode.d.ts +0 -110
- package/es/nodes/BaseNode.js +0 -250
- package/es/nodes/StartNode.js +0 -25
- package/es/nodes/TaskNode.js +0 -25
- package/es/util/ID.js +0 -13
- package/es/util/global.d.ts +0 -5
- package/es/util/global.js +0 -26
- package/lib/main.js +0 -1
- /package/es/constant/{constant.d.ts → index.d.ts} +0 -0
- /package/es/constant/{LogCode.d.ts → logCode.d.ts} +0 -0
- /package/es/{util/ID.d.ts → utils/id.d.ts} +0 -0
- /package/es/{util → utils}/storage.d.ts +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Engine } from '..';
|
|
2
|
+
import { ActionStatus } from '../constant';
|
|
3
|
+
export interface IBaseNodeProps {
|
|
4
|
+
nodeConfig: BaseNode.NodeConfig;
|
|
5
|
+
context: Record<string, any>;
|
|
6
|
+
globalData: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare class BaseNode implements BaseNode.Base {
|
|
9
|
+
readonly baseType: string;
|
|
10
|
+
static nodeTypeName: string;
|
|
11
|
+
/**
|
|
12
|
+
* 节点的入边
|
|
13
|
+
*/
|
|
14
|
+
incoming: BaseNode.IncomingConfig[];
|
|
15
|
+
/**
|
|
16
|
+
* 节点的出边
|
|
17
|
+
*/
|
|
18
|
+
outgoing: BaseNode.OutgoingConfig[];
|
|
19
|
+
/**
|
|
20
|
+
* 节点的属性
|
|
21
|
+
*/
|
|
22
|
+
properties?: Record<string, unknown>;
|
|
23
|
+
nodeId: Engine.Key;
|
|
24
|
+
type: string;
|
|
25
|
+
/**
|
|
26
|
+
* 节点的上下文,是调用流程时传入的上下文
|
|
27
|
+
*/
|
|
28
|
+
context: Record<string, any>;
|
|
29
|
+
/**
|
|
30
|
+
* 节点的全局数据,是调用流程时传入的全局数据
|
|
31
|
+
* 在计算表达式时,即基于全局数据进行计算
|
|
32
|
+
*/
|
|
33
|
+
globalData: Record<string, unknown>;
|
|
34
|
+
constructor({ nodeConfig, context, globalData }: IBaseNodeProps);
|
|
35
|
+
/**
|
|
36
|
+
* 节点的执行逻辑
|
|
37
|
+
* @overridable 可以自定义节点重写此方法
|
|
38
|
+
* @param param.executionId 流程执行记录 ID
|
|
39
|
+
* @param param.actionId 此节点执行记录 ID
|
|
40
|
+
* @param param.nodeId 节点 ID
|
|
41
|
+
* @return 返回下一步的执行参数
|
|
42
|
+
* 当不返回时,表示此节点执行成功,流程会继续执行下一步。
|
|
43
|
+
* 当返回时,返回格式为
|
|
44
|
+
*/
|
|
45
|
+
action(param?: Engine.ActionParam): Promise<BaseNode.ActionResult | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* 节点重新恢复执行的逻辑
|
|
48
|
+
* @overridable 可以自定义节点重写此方法
|
|
49
|
+
* @param params.executionId 流程执行记录 ID
|
|
50
|
+
* @param params.actionId 此节点执行记录 ID
|
|
51
|
+
* @param params.nodeId 节点 ID
|
|
52
|
+
*/
|
|
53
|
+
onResume(params: Engine.ResumeParam): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* 判断该节点是否满足条件
|
|
56
|
+
*/
|
|
57
|
+
private isPass;
|
|
58
|
+
/**
|
|
59
|
+
* 获取当前节点执行的下一个节点
|
|
60
|
+
*/
|
|
61
|
+
private getOutgoing;
|
|
62
|
+
/**
|
|
63
|
+
* 节点的每一次执行都会生成一个唯一的 actionId
|
|
64
|
+
*/
|
|
65
|
+
execute(params: Engine.ExecParam): Promise<Engine.NextActionParam>;
|
|
66
|
+
resume(params: Engine.ExecResumeParam): Promise<undefined>;
|
|
67
|
+
}
|
|
68
|
+
export declare namespace BaseNode {
|
|
69
|
+
interface Base {
|
|
70
|
+
incoming: IncomingConfig[];
|
|
71
|
+
outgoing: OutgoingConfig[];
|
|
72
|
+
properties?: Record<string, unknown>;
|
|
73
|
+
nodeId: Engine.Key;
|
|
74
|
+
type: string;
|
|
75
|
+
readonly baseType: string;
|
|
76
|
+
execute(actionParam: Engine.ActionParam): Promise<Engine.NextActionParam>;
|
|
77
|
+
}
|
|
78
|
+
type IncomingConfig = {
|
|
79
|
+
id: Engine.Key;
|
|
80
|
+
source: string;
|
|
81
|
+
properties?: Record<string, unknown>;
|
|
82
|
+
};
|
|
83
|
+
type OutgoingConfig = {
|
|
84
|
+
id: Engine.Key;
|
|
85
|
+
target: string;
|
|
86
|
+
properties?: Record<string, unknown>;
|
|
87
|
+
result?: string | boolean;
|
|
88
|
+
};
|
|
89
|
+
type NodeConfig = {
|
|
90
|
+
id: Engine.Key;
|
|
91
|
+
type: string;
|
|
92
|
+
properties?: Record<string, unknown>;
|
|
93
|
+
incoming: IncomingConfig[];
|
|
94
|
+
outgoing: OutgoingConfig[];
|
|
95
|
+
};
|
|
96
|
+
type NodeConstructor = {
|
|
97
|
+
new (config: {
|
|
98
|
+
nodeConfig: NodeConfig;
|
|
99
|
+
context: Record<string, any>;
|
|
100
|
+
globalData: Record<string, unknown>;
|
|
101
|
+
}): BaseNode;
|
|
102
|
+
};
|
|
103
|
+
type ActionResult = {
|
|
104
|
+
status: ActionStatus;
|
|
105
|
+
detail?: Record<string, unknown>;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export default BaseNode;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseNode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const constant_1 = require("../constant");
|
|
6
|
+
const platform_1 = require("../platform");
|
|
7
|
+
class BaseNode {
|
|
8
|
+
constructor({ nodeConfig, context, globalData }) {
|
|
9
|
+
const { outgoing, incoming, id, type, properties } = nodeConfig;
|
|
10
|
+
this.baseType = 'base';
|
|
11
|
+
this.outgoing = outgoing;
|
|
12
|
+
this.incoming = incoming;
|
|
13
|
+
this.nodeId = id;
|
|
14
|
+
this.type = type;
|
|
15
|
+
this.properties = properties;
|
|
16
|
+
this.context = context;
|
|
17
|
+
this.globalData = globalData;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 节点的执行逻辑
|
|
21
|
+
* @overridable 可以自定义节点重写此方法
|
|
22
|
+
* @param param.executionId 流程执行记录 ID
|
|
23
|
+
* @param param.actionId 此节点执行记录 ID
|
|
24
|
+
* @param param.nodeId 节点 ID
|
|
25
|
+
* @return 返回下一步的执行参数
|
|
26
|
+
* 当不返回时,表示此节点执行成功,流程会继续执行下一步。
|
|
27
|
+
* 当返回时,返回格式为
|
|
28
|
+
*/
|
|
29
|
+
action(param) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
console.log('action param --->>>', param);
|
|
32
|
+
return undefined;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 节点重新恢复执行的逻辑
|
|
37
|
+
* @overridable 可以自定义节点重写此方法
|
|
38
|
+
* @param params.executionId 流程执行记录 ID
|
|
39
|
+
* @param params.actionId 此节点执行记录 ID
|
|
40
|
+
* @param params.nodeId 节点 ID
|
|
41
|
+
*/
|
|
42
|
+
onResume(params) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
console.log('onResume params --->>>', params);
|
|
45
|
+
return undefined;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 判断该节点是否满足条件
|
|
50
|
+
*/
|
|
51
|
+
isPass(properties) {
|
|
52
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
if (!properties)
|
|
54
|
+
return true;
|
|
55
|
+
const { conditionExpression } = properties;
|
|
56
|
+
if (!conditionExpression)
|
|
57
|
+
return true;
|
|
58
|
+
try {
|
|
59
|
+
// bug:uuid 创建的 NodeId 为 xxxx-xxxx-xxxx-zzzz 格式,eval 执行时会将 - 识别为数学减号,导致执行报错
|
|
60
|
+
// 解决方案: 赋值变量直接命名为 isPassResult, 因为每次执行 getExpressionResult 时,都会重新射程一个 context
|
|
61
|
+
return yield (0, platform_1.getExpressionResult)(`
|
|
62
|
+
const isPassResult = (${conditionExpression})
|
|
63
|
+
return isPassResult
|
|
64
|
+
`, Object.assign({}, this.globalData));
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 获取当前节点执行的下一个节点
|
|
73
|
+
*/
|
|
74
|
+
getOutgoing() {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const outgoing = [];
|
|
77
|
+
const expressions = [];
|
|
78
|
+
for (const item of this.outgoing) {
|
|
79
|
+
const { properties } = item;
|
|
80
|
+
expressions.push(this.isPass(properties));
|
|
81
|
+
}
|
|
82
|
+
const result = yield Promise.all(expressions);
|
|
83
|
+
result.forEach((item, index) => {
|
|
84
|
+
const out = this.outgoing[index];
|
|
85
|
+
out.result = item;
|
|
86
|
+
outgoing.push(out);
|
|
87
|
+
});
|
|
88
|
+
return outgoing;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 节点的每一次执行都会生成一个唯一的 actionId
|
|
93
|
+
*/
|
|
94
|
+
execute(params) {
|
|
95
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const { executionId, actionId } = params;
|
|
97
|
+
const res = yield this.action({
|
|
98
|
+
nodeId: this.nodeId,
|
|
99
|
+
executionId,
|
|
100
|
+
actionId,
|
|
101
|
+
});
|
|
102
|
+
const status = res ? res.status : 'success';
|
|
103
|
+
if (status === constant_1.ActionStatus.SUCCESS) {
|
|
104
|
+
const outgoing = yield this.getOutgoing();
|
|
105
|
+
const detail = res ? res.detail : {};
|
|
106
|
+
params.next({
|
|
107
|
+
status: constant_1.ActionStatus.SUCCESS,
|
|
108
|
+
detail,
|
|
109
|
+
nodeId: this.nodeId,
|
|
110
|
+
nodeType: this.type,
|
|
111
|
+
properties: this.properties,
|
|
112
|
+
executionId,
|
|
113
|
+
actionId,
|
|
114
|
+
outgoing,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
status,
|
|
119
|
+
detail: res === null || res === void 0 ? void 0 : res.detail,
|
|
120
|
+
executionId,
|
|
121
|
+
actionId,
|
|
122
|
+
nodeId: this.nodeId,
|
|
123
|
+
nodeType: this.type,
|
|
124
|
+
properties: this.properties,
|
|
125
|
+
outgoing: [],
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
resume(params) {
|
|
130
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const outgoing = yield this.getOutgoing();
|
|
132
|
+
yield this.onResume({
|
|
133
|
+
executionId: params.executionId,
|
|
134
|
+
actionId: params.actionId,
|
|
135
|
+
nodeId: params.nodeId,
|
|
136
|
+
data: params.data,
|
|
137
|
+
});
|
|
138
|
+
params.next({
|
|
139
|
+
executionId: params.executionId,
|
|
140
|
+
actionId: params.actionId,
|
|
141
|
+
nodeId: this.nodeId,
|
|
142
|
+
nodeType: this.type,
|
|
143
|
+
properties: this.properties,
|
|
144
|
+
outgoing,
|
|
145
|
+
status: constant_1.ActionStatus.SUCCESS,
|
|
146
|
+
});
|
|
147
|
+
return undefined;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
BaseNode.nodeTypeName = 'BaseNode';
|
|
152
|
+
exports.BaseNode = BaseNode;
|
|
153
|
+
exports.default = BaseNode;
|
|
154
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/nodes/base.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./base"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./start"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./task"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nodes/index.ts"],"names":[],"mappings":";;;AAAA,iDAAsB;AACtB,kDAAuB;AACvB,iDAAsB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StartNode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("./base"));
|
|
6
|
+
class StartNode extends base_1.default {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.baseType = 'start';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
StartNode.nodeTypeName = 'StartNode';
|
|
13
|
+
exports.default = StartNode;
|
|
14
|
+
exports.StartNode = StartNode;
|
|
15
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/nodes/start.ts"],"names":[],"mappings":";;;;AAAA,0DAA6B;AAE7B,MAAqB,SAAU,SAAQ,cAAQ;IAA/C;;QACW,aAAQ,GAAG,OAAO,CAAA;IAE7B,CAAC;;AADQ,sBAAY,GAAG,WAAW,AAAd,CAAc;kBAFd,SAAS;AAKrB,8BAAS"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskNode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("./base"));
|
|
6
|
+
class TaskNode extends base_1.default {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.baseType = 'task';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
TaskNode.nodeTypeName = 'TaskNode';
|
|
13
|
+
exports.default = TaskNode;
|
|
14
|
+
exports.TaskNode = TaskNode;
|
|
15
|
+
//# sourceMappingURL=task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/nodes/task.ts"],"names":[],"mappings":";;;;AAAA,0DAA6B;AAE7B,MAAqB,QAAS,SAAQ,cAAQ;IAA9C;;QACW,aAAQ,GAAG,MAAM,CAAA;IAE5B,CAAC;;AADQ,qBAAY,GAAG,UAAU,AAAb,CAAa;kBAFb,QAAQ;AAKpB,4BAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const runInBrowserContext: (code: string, globalData?: {}) => Promise<any>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import {
|
|
3
|
+
// ErrorCode,
|
|
4
|
+
// getErrorMsg,
|
|
5
|
+
// getWarningMsg,
|
|
6
|
+
// WarningCode,
|
|
7
|
+
// } from '../../constant/logCode'
|
|
8
|
+
//
|
|
9
|
+
// const createContext = (globalData: Record<string, unknown>) => {
|
|
10
|
+
// const iframe = document.createElement('iframe')
|
|
11
|
+
// iframe.style.display = 'none'
|
|
12
|
+
// if (!document || !document.body) {
|
|
13
|
+
// console.error(getErrorMsg(ErrorCode.NO_DOCUMENT_BODY))
|
|
14
|
+
// }
|
|
15
|
+
// document.body.appendChild(iframe)
|
|
16
|
+
// const iframeWindow = iframe.contentWindow
|
|
17
|
+
// if (iframeWindow) {
|
|
18
|
+
// // TODO: 确认是否需要该代码,parent 置为空是为了解决什么问题
|
|
19
|
+
// // @ts-ignore
|
|
20
|
+
// ;(iframeWindow!.parent as any) = null
|
|
21
|
+
// Object.keys(globalData).forEach((key) => {
|
|
22
|
+
// iframeWindow[key] = globalData[key]
|
|
23
|
+
// })
|
|
24
|
+
// }
|
|
25
|
+
// return iframeWindow
|
|
26
|
+
// }
|
|
27
|
+
//
|
|
28
|
+
// const runInContext = (code: string, context: any) => {
|
|
29
|
+
// try {
|
|
30
|
+
// const iframeEval = context.eval
|
|
31
|
+
// iframeEval.call(context, code)
|
|
32
|
+
// console.log('context --->>> ===>>>', context)
|
|
33
|
+
// if (context.frameElement) {
|
|
34
|
+
// document.body.removeChild(context.frameElement)
|
|
35
|
+
// }
|
|
36
|
+
// } catch (e) {
|
|
37
|
+
// console.warn(getWarningMsg(WarningCode.EXPRESSION_EXEC_ERROR), {
|
|
38
|
+
// code,
|
|
39
|
+
// context,
|
|
40
|
+
// e,
|
|
41
|
+
// })
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
//
|
|
45
|
+
// const runInBrowserContext = async (
|
|
46
|
+
// code: string,
|
|
47
|
+
// globalData = {},
|
|
48
|
+
// ): Promise<any> => {
|
|
49
|
+
// const context = createContext(globalData)
|
|
50
|
+
// runInContext(code, context)
|
|
51
|
+
// return context
|
|
52
|
+
// }
|
|
53
|
+
//
|
|
54
|
+
// export { createContext, runInContext, runInBrowserContext }
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.runInBrowserContext = void 0;
|
|
57
|
+
const tslib_1 = require("tslib");
|
|
58
|
+
const sandboxjs_1 = tslib_1.__importDefault(require("@nyariv/sandboxjs"));
|
|
59
|
+
const runInBrowserContext = (code, globalData = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
try {
|
|
61
|
+
const sandbox = new sandboxjs_1.default();
|
|
62
|
+
const exec = sandbox.compile(code);
|
|
63
|
+
return yield exec(globalData).run();
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
console.log('runInBrowserContext error --->>>', e);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
exports.runInBrowserContext = runInBrowserContext;
|
|
70
|
+
//# sourceMappingURL=browserVm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserVm.js","sourceRoot":"","sources":["../../../src/platform/browser/browserVm.ts"],"names":[],"mappings":";AAAA,WAAW;AACX,eAAe;AACf,iBAAiB;AACjB,mBAAmB;AACnB,iBAAiB;AACjB,kCAAkC;AAClC,EAAE;AACF,mEAAmE;AACnE,oDAAoD;AACpD,kCAAkC;AAClC,uCAAuC;AACvC,6DAA6D;AAC7D,MAAM;AACN,sCAAsC;AACtC,8CAA8C;AAC9C,wBAAwB;AACxB,6CAA6C;AAC7C,oBAAoB;AACpB,4CAA4C;AAC5C,iDAAiD;AACjD,4CAA4C;AAC5C,SAAS;AACT,MAAM;AACN,wBAAwB;AACxB,IAAI;AACJ,EAAE;AACF,yDAAyD;AACzD,UAAU;AACV,sCAAsC;AACtC,qCAAqC;AACrC,oDAAoD;AACpD,kCAAkC;AAClC,wDAAwD;AACxD,QAAQ;AACR,kBAAkB;AAClB,uEAAuE;AACvE,cAAc;AACd,iBAAiB;AACjB,WAAW;AACX,SAAS;AACT,MAAM;AACN,IAAI;AACJ,EAAE;AACF,sCAAsC;AACtC,kBAAkB;AAClB,qBAAqB;AACrB,uBAAuB;AACvB,8CAA8C;AAC9C,gCAAgC;AAChC,mBAAmB;AACnB,IAAI;AACJ,EAAE;AACF,8DAA8D;;;;AAE9D,0EAAuC;AAEhC,MAAM,mBAAmB,GAAG,CACjC,IAAY,EACZ,UAAU,GAAG,EAAE,EACD,EAAE;IAChB,IAAI;QACF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;QAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAClC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,CAAA;KACpC;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAA;KACnD;AACH,CAAC,CAAA,CAAA;AAXY,QAAA,mBAAmB,uBAW/B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExpressionResult = exports.globalScope = exports.isInBrowser = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const browserVm_1 = require("./browserVm");
|
|
6
|
+
const isInBrowser = typeof window === 'object' && window.window === window;
|
|
7
|
+
exports.isInBrowser = isInBrowser;
|
|
8
|
+
const globalScope = (() => {
|
|
9
|
+
if (isInBrowser) {
|
|
10
|
+
return window;
|
|
11
|
+
}
|
|
12
|
+
if (typeof self === 'object' && self.self === self) {
|
|
13
|
+
return self;
|
|
14
|
+
}
|
|
15
|
+
if (typeof globalThis === 'object') {
|
|
16
|
+
return globalThis;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
eval: () => undefined,
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
exports.globalScope = globalScope;
|
|
23
|
+
const getExpressionResult = (code, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const r = yield (0, browserVm_1.runInBrowserContext)(code, context);
|
|
25
|
+
return r;
|
|
26
|
+
});
|
|
27
|
+
exports.getExpressionResult = getExpressionResult;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/browser/index.ts"],"names":[],"mappings":";;;;AAAA,2CAAiD;AAEjD,MAAM,WAAW,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAA;AAyBjE,kCAAW;AAvBpB,MAAM,WAAW,GAAQ,CAAC,GAAG,EAAE;IAC7B,IAAI,WAAW,EAAE;QACf,OAAO,MAAM,CAAA;KACd;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;QAClD,OAAO,IAAI,CAAA;KACZ;IAED,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,OAAO,UAAU,CAAA;KAClB;IAED,OAAO;QACL,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;KACK,CAAA;AAC9B,CAAC,CAAC,EAAE,CAAA;AAOkB,kCAAW;AALjC,MAAM,mBAAmB,GAAG,CAAO,IAAY,EAAE,OAAY,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,MAAM,IAAA,+BAAmB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClD,OAAO,CAAC,CAAA;AACV,CAAC,CAAA,CAAA;AAEkC,kDAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './node';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":";;;AAAA,iDAAsB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExpressionResult = exports.globalScope = exports.isInNodeJS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const nodeVm_1 = require("./nodeVm");
|
|
6
|
+
const isInNodeJS = typeof global === 'object' && global.global === global;
|
|
7
|
+
exports.isInNodeJS = isInNodeJS;
|
|
8
|
+
const globalScope = (() => {
|
|
9
|
+
if (typeof self === 'object' && self.self === self) {
|
|
10
|
+
return self;
|
|
11
|
+
}
|
|
12
|
+
if (isInNodeJS) {
|
|
13
|
+
return global;
|
|
14
|
+
}
|
|
15
|
+
if (typeof globalThis === 'object') {
|
|
16
|
+
return globalThis;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
eval: () => undefined,
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
exports.globalScope = globalScope;
|
|
23
|
+
const getExpressionResult = (code, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const r = yield (0, nodeVm_1.runInNodeContext)(code, context);
|
|
25
|
+
return r;
|
|
26
|
+
});
|
|
27
|
+
exports.getExpressionResult = getExpressionResult;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/node/index.ts"],"names":[],"mappings":";;;;AAAA,qCAA2C;AAE3C,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAA;AAyBhE,gCAAU;AAvBnB,MAAM,WAAW,GAAQ,CAAC,GAAG,EAAE;IAC7B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;QAClD,OAAO,IAAI,CAAA;KACZ;IAED,IAAI,UAAU,EAAE;QACd,OAAO,MAAM,CAAA;KACd;IAED,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,OAAO,UAAU,CAAA;KAClB;IAED,OAAO;QACL,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;KACK,CAAA;AAC9B,CAAC,CAAC,EAAE,CAAA;AAOiB,kCAAW;AALhC,MAAM,mBAAmB,GAAG,CAAO,IAAY,EAAE,OAAY,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,MAAM,IAAA,yBAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC/C,OAAO,CAAC,CAAA;AACV,CAAC,CAAA,CAAA;AAEiC,kDAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const runInNodeContext: (code: string, globalData?: Record<string, unknown>) => Promise<any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runInNodeContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_vm_1 = tslib_1.__importDefault(require("node:vm"));
|
|
6
|
+
// const vm = require('node:vm');
|
|
7
|
+
const runInNodeContext = (code, globalData = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const context = node_vm_1.default.createContext(globalData);
|
|
9
|
+
node_vm_1.default.runInContext(code, context);
|
|
10
|
+
console.log('context ===>>>', context);
|
|
11
|
+
return context;
|
|
12
|
+
});
|
|
13
|
+
exports.runInNodeContext = runInNodeContext;
|
|
14
|
+
//# sourceMappingURL=nodeVm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeVm.js","sourceRoot":"","sources":["../../../src/platform/node/nodeVm.ts"],"names":[],"mappings":";;;;AAAA,8DAAwB;AACxB,iCAAiC;AAE1B,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,aAAsC,EAAE,EAC1B,EAAE;IAChB,MAAM,OAAO,GAAG,iBAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;IAC5C,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAE9B,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAEtC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA,CAAA;AAVY,QAAA,gBAAgB,oBAU5B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Engine } from '..';
|
|
2
|
+
export declare const MAX_RECORDER = 100;
|
|
3
|
+
export declare const MAX_INSTANCE = 100;
|
|
4
|
+
export declare const LOGICFLOW_ENGINE_INSTANCES = "LOGICFLOW_ENGINE_INSTANCES";
|
|
5
|
+
export declare class Recorder implements Recorder.Base {
|
|
6
|
+
instanceId: Engine.Key;
|
|
7
|
+
maxRecorder: number;
|
|
8
|
+
constructor({ instanceId }: {
|
|
9
|
+
instanceId: any;
|
|
10
|
+
});
|
|
11
|
+
setMaxRecorderNumber(max: number): void;
|
|
12
|
+
setItem(key: string | number, value: unknown): void;
|
|
13
|
+
getItem(key: string | number): any;
|
|
14
|
+
getExecutionActions(executionId: Engine.Key): Promise<any>;
|
|
15
|
+
getExecutionList(): Promise<any>;
|
|
16
|
+
private addExecution;
|
|
17
|
+
private popExecution;
|
|
18
|
+
private pushActionToExecution;
|
|
19
|
+
/**
|
|
20
|
+
* @param {Object} action
|
|
21
|
+
* {
|
|
22
|
+
* actionId: '',
|
|
23
|
+
* nodeId: '',
|
|
24
|
+
* executionId: '',
|
|
25
|
+
* nodeType: '',
|
|
26
|
+
* timestamp: '',
|
|
27
|
+
* properties: {},
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
addActionRecord(action: Recorder.Info): Promise<void>;
|
|
31
|
+
getActionRecord(actionId: Engine.Key): Promise<Recorder.Info>;
|
|
32
|
+
clear(): void;
|
|
33
|
+
clearInstance(instanceId: Engine.Key): void;
|
|
34
|
+
}
|
|
35
|
+
export declare namespace Recorder {
|
|
36
|
+
interface Base {
|
|
37
|
+
addActionRecord: (action: Info) => Promise<void>;
|
|
38
|
+
getActionRecord: (actionId: Engine.Key) => Promise<Info>;
|
|
39
|
+
getExecutionActions: (executionId: Engine.Key) => Promise<string[]>;
|
|
40
|
+
clear: () => void;
|
|
41
|
+
}
|
|
42
|
+
type Info = {
|
|
43
|
+
timestamp: number;
|
|
44
|
+
} & Engine.NextActionParam;
|
|
45
|
+
}
|
|
46
|
+
export default Recorder;
|