@logicflow/engine 0.0.11-beta.0 → 0.0.12-beta.0

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.
Files changed (170) hide show
  1. package/README.md +5 -2
  2. package/dist/index.js +2 -0
  3. package/dist/index.js.map +1 -0
  4. package/es/EventEmitter.d.ts +34 -4
  5. package/es/EventEmitter.js +70 -48
  6. package/es/EventEmitter.js.map +1 -0
  7. package/es/FlowModel.d.ts +75 -73
  8. package/es/FlowModel.js +130 -173
  9. package/es/FlowModel.js.map +1 -0
  10. package/es/Scheduler.d.ts +50 -34
  11. package/es/Scheduler.js +134 -209
  12. package/es/Scheduler.js.map +1 -0
  13. package/es/constant/{constant.js → index.js} +8 -7
  14. package/es/constant/index.js.map +1 -0
  15. package/es/constant/logCode.js +29 -0
  16. package/es/constant/logCode.js.map +1 -0
  17. package/es/index.d.ts +135 -38
  18. package/es/index.js +92 -144
  19. package/es/index.js.map +1 -0
  20. package/es/nodes/base.d.ts +108 -0
  21. package/es/nodes/base.js +151 -0
  22. package/es/nodes/base.js.map +1 -0
  23. package/es/nodes/index.d.ts +3 -0
  24. package/es/nodes/index.js +4 -0
  25. package/es/nodes/index.js.map +1 -0
  26. package/es/nodes/{StartNode.d.ts → start.d.ts} +3 -2
  27. package/es/nodes/start.js +11 -0
  28. package/es/nodes/start.js.map +1 -0
  29. package/es/nodes/{TaskNode.d.ts → task.d.ts} +3 -2
  30. package/es/nodes/task.js +11 -0
  31. package/es/nodes/task.js.map +1 -0
  32. package/es/platform/browser/browserVm.d.ts +1 -0
  33. package/es/platform/browser/browserVm.js +66 -0
  34. package/es/platform/browser/browserVm.js.map +1 -0
  35. package/es/platform/browser/index.d.ts +4 -0
  36. package/es/platform/browser/index.js +23 -0
  37. package/es/platform/browser/index.js.map +1 -0
  38. package/es/platform/index.d.ts +1 -0
  39. package/es/platform/index.js +2 -0
  40. package/es/platform/index.js.map +1 -0
  41. package/es/platform/node/index.d.ts +4 -0
  42. package/es/platform/node/index.js +23 -0
  43. package/es/platform/node/index.js.map +1 -0
  44. package/es/platform/node/nodeVm.d.ts +1 -0
  45. package/es/platform/node/nodeVm.js +9 -0
  46. package/es/platform/node/nodeVm.js.map +1 -0
  47. package/es/recorder/index.d.ts +36 -10
  48. package/es/recorder/index.js +82 -135
  49. package/es/recorder/index.js.map +1 -0
  50. package/es/utils/global.d.ts +5 -0
  51. package/es/utils/global.js +27 -0
  52. package/es/utils/global.js.map +1 -0
  53. package/es/utils/id.js +14 -0
  54. package/es/utils/id.js.map +1 -0
  55. package/es/utils/index.d.ts +4 -0
  56. package/es/utils/index.js +5 -0
  57. package/es/utils/index.js.map +1 -0
  58. package/es/{util → utils}/storage.js +17 -16
  59. package/es/utils/storage.js.map +1 -0
  60. package/lib/EventEmitter.d.ts +37 -0
  61. package/lib/EventEmitter.js +94 -0
  62. package/lib/EventEmitter.js.map +1 -0
  63. package/lib/FlowModel.d.ts +146 -0
  64. package/lib/FlowModel.js +236 -0
  65. package/lib/FlowModel.js.map +1 -0
  66. package/lib/Scheduler.d.ts +78 -0
  67. package/lib/Scheduler.js +179 -0
  68. package/lib/Scheduler.js.map +1 -0
  69. package/lib/constant/index.d.ts +16 -0
  70. package/{cjs/constant/constant.js → lib/constant/index.js} +4 -3
  71. package/lib/constant/index.js.map +1 -0
  72. package/lib/constant/logCode.d.ts +12 -0
  73. package/{cjs/constant/LogCode.js → lib/constant/logCode.js} +16 -13
  74. package/lib/constant/logCode.js.map +1 -0
  75. package/lib/index.d.ts +157 -0
  76. package/lib/index.js +159 -0
  77. package/lib/index.js.map +1 -0
  78. package/lib/nodes/base.d.ts +108 -0
  79. package/lib/nodes/base.js +154 -0
  80. package/lib/nodes/base.js.map +1 -0
  81. package/lib/nodes/index.d.ts +3 -0
  82. package/lib/nodes/index.js +7 -0
  83. package/lib/nodes/index.js.map +1 -0
  84. package/lib/nodes/start.d.ts +6 -0
  85. package/lib/nodes/start.js +15 -0
  86. package/lib/nodes/start.js.map +1 -0
  87. package/lib/nodes/task.d.ts +6 -0
  88. package/lib/nodes/task.js +15 -0
  89. package/lib/nodes/task.js.map +1 -0
  90. package/lib/platform/browser/browserVm.d.ts +1 -0
  91. package/lib/platform/browser/browserVm.js +70 -0
  92. package/lib/platform/browser/browserVm.js.map +1 -0
  93. package/lib/platform/browser/index.d.ts +4 -0
  94. package/lib/platform/browser/index.js +28 -0
  95. package/lib/platform/browser/index.js.map +1 -0
  96. package/lib/platform/index.d.ts +1 -0
  97. package/lib/platform/index.js +5 -0
  98. package/lib/platform/index.js.map +1 -0
  99. package/lib/platform/node/index.d.ts +4 -0
  100. package/lib/platform/node/index.js +28 -0
  101. package/lib/platform/node/index.js.map +1 -0
  102. package/lib/platform/node/nodeVm.d.ts +1 -0
  103. package/lib/platform/node/nodeVm.js +13 -0
  104. package/lib/platform/node/nodeVm.js.map +1 -0
  105. package/lib/recorder/index.d.ts +46 -0
  106. package/lib/recorder/index.js +117 -0
  107. package/lib/recorder/index.js.map +1 -0
  108. package/lib/utils/global.d.ts +5 -0
  109. package/lib/utils/global.js +31 -0
  110. package/lib/utils/global.js.map +1 -0
  111. package/lib/utils/id.d.ts +3 -0
  112. package/lib/utils/id.js +20 -0
  113. package/lib/utils/id.js.map +1 -0
  114. package/lib/utils/index.d.ts +4 -0
  115. package/lib/utils/index.js +9 -0
  116. package/lib/utils/index.js.map +1 -0
  117. package/lib/utils/storage.d.ts +7 -0
  118. package/{cjs/util → lib/utils}/storage.js +18 -17
  119. package/lib/utils/storage.js.map +1 -0
  120. package/package.json +31 -71
  121. package/src/EventEmitter.ts +103 -0
  122. package/src/FlowModel.ts +325 -0
  123. package/src/Scheduler.ts +244 -0
  124. package/src/constant/index.ts +23 -0
  125. package/src/constant/logCode.ts +34 -0
  126. package/src/index.ts +300 -0
  127. package/src/nodes/base.ts +236 -0
  128. package/src/nodes/index.ts +3 -0
  129. package/src/nodes/start.ts +8 -0
  130. package/src/nodes/task.ts +8 -0
  131. package/src/platform/browser/browserVm.ts +68 -0
  132. package/src/platform/browser/index.ts +28 -0
  133. package/src/platform/index.ts +1 -0
  134. package/src/platform/node/index.ts +28 -0
  135. package/src/platform/node/nodeVm.ts +12 -0
  136. package/src/recorder/index.ts +137 -0
  137. package/src/typings.d.ts +0 -0
  138. package/src/utils/global.ts +41 -0
  139. package/src/utils/id.ts +16 -0
  140. package/src/utils/index.ts +5 -0
  141. package/src/utils/storage.ts +55 -0
  142. package/cjs/EventEmitter.js +0 -70
  143. package/cjs/FlowModel.js +0 -277
  144. package/cjs/Scheduler.js +0 -252
  145. package/cjs/expression/browserVm.js +0 -81
  146. package/cjs/expression/index.js +0 -57
  147. package/cjs/index.js +0 -210
  148. package/cjs/nodes/BaseNode.js +0 -252
  149. package/cjs/nodes/StartNode.js +0 -27
  150. package/cjs/nodes/TaskNode.js +0 -27
  151. package/cjs/recorder/index.js +0 -168
  152. package/cjs/util/ID.js +0 -16
  153. package/cjs/util/global.js +0 -32
  154. package/es/constant/LogCode.js +0 -28
  155. package/es/expression/browserVm.d.ts +0 -4
  156. package/es/expression/browserVm.js +0 -76
  157. package/es/expression/index.d.ts +0 -2
  158. package/es/expression/index.js +0 -54
  159. package/es/nodes/BaseNode.d.ts +0 -110
  160. package/es/nodes/BaseNode.js +0 -250
  161. package/es/nodes/StartNode.js +0 -25
  162. package/es/nodes/TaskNode.js +0 -25
  163. package/es/util/ID.js +0 -13
  164. package/es/util/global.d.ts +0 -5
  165. package/es/util/global.js +0 -26
  166. package/lib/main.js +0 -1
  167. /package/es/constant/{constant.d.ts → index.d.ts} +0 -0
  168. /package/es/constant/{LogCode.d.ts → logCode.d.ts} +0 -0
  169. /package/es/{util/ID.d.ts → utils/id.d.ts} +0 -0
  170. /package/es/{util → utils}/storage.d.ts +0 -0
@@ -1,54 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- // import { runInNewContext } from './nodeVm';
38
- import { runInBrowserContext } from './browserVm';
39
- import { isInBrowser, globalScope } from '../util/global';
40
- var getExpressionResult = function (code, context) { return __awaiter(void 0, void 0, void 0, function () {
41
- var r;
42
- return __generator(this, function (_a) {
43
- switch (_a.label) {
44
- case 0:
45
- if (!isInBrowser) return [3 /*break*/, 2];
46
- return [4 /*yield*/, runInBrowserContext(code, context)];
47
- case 1:
48
- r = _a.sent();
49
- return [2 /*return*/, r];
50
- case 2: return [2 /*return*/, globalScope.eval(code)]; // eslint-disable-line no-eval
51
- }
52
- });
53
- }); };
54
- export { getExpressionResult, };
@@ -1,110 +0,0 @@
1
- import type { NextActionParam, ActionResult, ExecResumeParams, ExecParams, OutgoingConfig } from '../types.d';
2
- export interface BaseNodeInterface {
3
- outgoing: Record<string, any>[];
4
- incoming: Record<string, any>[];
5
- nodeId: string;
6
- type: string;
7
- readonly baseType: string;
8
- execute(actionParam: any): Promise<NextActionParam>;
9
- }
10
- export declare type NodeConstructor = {
11
- new (config: {
12
- nodeConfig: NodeConfig;
13
- context: Record<string, any>;
14
- globalData: Record<string, any>;
15
- }): BaseNode;
16
- action(params: {
17
- executionId: string;
18
- actionId: string;
19
- nodeId: string;
20
- }): Promise<NextActionParam>;
21
- onResume(params: {
22
- executionId: string;
23
- actionId: string;
24
- nodeId: string;
25
- data?: Record<string, any>;
26
- }): Promise<void>;
27
- };
28
- export declare type IncomingConfig = {
29
- id: string;
30
- properties?: Record<string, any>;
31
- source: string;
32
- };
33
- export declare type NodeConfig = {
34
- id: string;
35
- type: string;
36
- properties?: Record<string, any>;
37
- incoming: IncomingConfig[];
38
- outgoing: OutgoingConfig[];
39
- };
40
- export default class BaseNode implements BaseNodeInterface {
41
- static nodeTypeName: string;
42
- /**
43
- * 节点的出边
44
- */
45
- outgoing: OutgoingConfig[];
46
- /**
47
- * 节点的入边
48
- */
49
- incoming: IncomingConfig[];
50
- /**
51
- * 节点的属性
52
- */
53
- properties?: Record<string, any>;
54
- nodeId: string;
55
- type: string;
56
- /**
57
- * 节点的上下文,是调用流程时传入的上下文
58
- */
59
- context: Record<string, any>;
60
- /**
61
- * 节点的全局数据,是调用流程时传入的全局数据。
62
- * 在计算表达式时,即基于全局数据进行计算。
63
- */
64
- globalData: Record<string, any>;
65
- readonly baseType: string;
66
- constructor({ nodeConfig, context, globalData }: {
67
- nodeConfig: any;
68
- context: any;
69
- globalData: any;
70
- });
71
- /**
72
- * 节点的每一次执行都会生成一个唯一的actionId
73
- */
74
- execute(params: ExecParams): Promise<NextActionParam>;
75
- /**
76
- * 节点在执行中断后,可以通过resume方法恢复执行。
77
- * 自定义节点时不建议重写此方法
78
- */
79
- resume(params: ExecResumeParams): Promise<undefined>;
80
- private getOutgoing;
81
- private isPass;
82
- /**
83
- * 节点的执行逻辑
84
- * @overridable 可以自定义节点重写此方法。
85
- * @param params.executionId 流程执行记录ID
86
- * @param params.actionId 此节点执行记录ID
87
- * @param params.nodeId 节点ID
88
- * @returns 返回下一步的执行参数
89
- * 当不返回时,表示此节点执行成功,流程会继续执行下一步。
90
- * 当返回时,返回格式
91
- */
92
- action(params: {
93
- executionId: string;
94
- actionId: string;
95
- nodeId: string;
96
- }): Promise<ActionResult>;
97
- /**
98
- * 节点的重新恢复执行逻辑
99
- * @overridable 可以自定义节点重写此方法。
100
- * @param params.executionId 流程执行记录ID
101
- * @param params.actionId 此节点执行记录ID
102
- * @param params.nodeId 节点ID
103
- */
104
- onResume(params: {
105
- executionId: string;
106
- actionId: string;
107
- nodeId: string;
108
- data?: Record<string, any>;
109
- }): Promise<void>;
110
- }
@@ -1,250 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- var __values = (this && this.__values) || function(o) {
49
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
50
- if (m) return m.call(o);
51
- if (o && typeof o.length === "number") return {
52
- next: function () {
53
- if (o && i >= o.length) o = void 0;
54
- return { value: o && o[i++], done: !o };
55
- }
56
- };
57
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
58
- };
59
- import { ActionStatus } from '../constant/constant';
60
- import { getExpressionResult } from '../expression';
61
- var BaseNode = /** @class */ (function () {
62
- function BaseNode(_a) {
63
- var nodeConfig = _a.nodeConfig, context = _a.context, globalData = _a.globalData;
64
- this.outgoing = nodeConfig.outgoing;
65
- this.incoming = nodeConfig.incoming;
66
- this.nodeId = nodeConfig.id;
67
- this.type = nodeConfig.type;
68
- this.properties = nodeConfig.properties || {};
69
- this.context = context;
70
- this.globalData = globalData;
71
- this.baseType = 'base';
72
- }
73
- /**
74
- * 节点的每一次执行都会生成一个唯一的actionId
75
- */
76
- BaseNode.prototype.execute = function (params) {
77
- return __awaiter(this, void 0, void 0, function () {
78
- var r, status, outgoing, detail;
79
- return __generator(this, function (_a) {
80
- switch (_a.label) {
81
- case 0: return [4 /*yield*/, this.action({
82
- executionId: params.executionId,
83
- actionId: params.actionId,
84
- nodeId: this.nodeId,
85
- })];
86
- case 1:
87
- r = _a.sent();
88
- status = r ? r.status : 'success';
89
- if (!(status === ActionStatus.SUCCESS)) return [3 /*break*/, 3];
90
- return [4 /*yield*/, this.getOutgoing()];
91
- case 2:
92
- outgoing = _a.sent();
93
- detail = r ? r.detail : {};
94
- params.next({
95
- status: ActionStatus.SUCCESS,
96
- detail: detail,
97
- executionId: params.executionId,
98
- actionId: params.actionId,
99
- nodeId: this.nodeId,
100
- nodeType: this.type,
101
- properties: this.properties,
102
- outgoing: outgoing,
103
- });
104
- _a.label = 3;
105
- case 3: return [2 /*return*/, {
106
- status: status,
107
- detail: r && r.detail,
108
- executionId: params.executionId,
109
- actionId: params.actionId,
110
- nodeId: this.nodeId,
111
- nodeType: this.type,
112
- properties: this.properties,
113
- outgoing: [],
114
- }];
115
- }
116
- });
117
- });
118
- };
119
- /**
120
- * 节点在执行中断后,可以通过resume方法恢复执行。
121
- * 自定义节点时不建议重写此方法
122
- */
123
- BaseNode.prototype.resume = function (params) {
124
- return __awaiter(this, void 0, void 0, function () {
125
- var outgoing;
126
- return __generator(this, function (_a) {
127
- switch (_a.label) {
128
- case 0: return [4 /*yield*/, this.getOutgoing()];
129
- case 1:
130
- outgoing = _a.sent();
131
- return [4 /*yield*/, this.onResume({
132
- executionId: params.executionId,
133
- nodeId: params.nodeId,
134
- actionId: params.actionId,
135
- data: params.data,
136
- })];
137
- case 2:
138
- _a.sent();
139
- params.next({
140
- executionId: params.executionId,
141
- actionId: params.actionId,
142
- nodeId: this.nodeId,
143
- nodeType: this.type,
144
- properties: this.properties,
145
- outgoing: outgoing,
146
- status: ActionStatus.SUCCESS,
147
- });
148
- return [2 /*return*/, undefined];
149
- }
150
- });
151
- });
152
- };
153
- BaseNode.prototype.getOutgoing = function () {
154
- return __awaiter(this, void 0, void 0, function () {
155
- var outgoing, expressions, _a, _b, item, properties, result;
156
- var e_1, _c;
157
- var _this = this;
158
- return __generator(this, function (_d) {
159
- switch (_d.label) {
160
- case 0:
161
- outgoing = [];
162
- expressions = [];
163
- try {
164
- for (_a = __values(this.outgoing), _b = _a.next(); !_b.done; _b = _a.next()) {
165
- item = _b.value;
166
- properties = item.properties;
167
- expressions.push(this.isPass(properties));
168
- }
169
- }
170
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
171
- finally {
172
- try {
173
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
174
- }
175
- finally { if (e_1) throw e_1.error; }
176
- }
177
- return [4 /*yield*/, Promise.all(expressions)];
178
- case 1:
179
- result = _d.sent();
180
- result.forEach(function (item, index) {
181
- var out = _this.outgoing[index];
182
- out.result = item;
183
- outgoing.push(out);
184
- });
185
- return [2 /*return*/, outgoing];
186
- }
187
- });
188
- });
189
- };
190
- BaseNode.prototype.isPass = function (properties) {
191
- return __awaiter(this, void 0, void 0, function () {
192
- var conditionExpression, result, e_2;
193
- return __generator(this, function (_a) {
194
- switch (_a.label) {
195
- case 0:
196
- if (!properties)
197
- return [2 /*return*/, true];
198
- conditionExpression = properties.conditionExpression;
199
- if (!conditionExpression)
200
- return [2 /*return*/, true];
201
- _a.label = 1;
202
- case 1:
203
- _a.trys.push([1, 3, , 4]);
204
- return [4 /*yield*/, getExpressionResult("isPassResult = (" + conditionExpression + ")", __assign({}, this.globalData))];
205
- case 2:
206
- result = _a.sent();
207
- return [2 /*return*/, result.isPassResult];
208
- case 3:
209
- e_2 = _a.sent();
210
- return [2 /*return*/, false];
211
- case 4: return [2 /*return*/];
212
- }
213
- });
214
- });
215
- };
216
- /**
217
- * 节点的执行逻辑
218
- * @overridable 可以自定义节点重写此方法。
219
- * @param params.executionId 流程执行记录ID
220
- * @param params.actionId 此节点执行记录ID
221
- * @param params.nodeId 节点ID
222
- * @returns 返回下一步的执行参数
223
- * 当不返回时,表示此节点执行成功,流程会继续执行下一步。
224
- * 当返回时,返回格式
225
- */
226
- BaseNode.prototype.action = function (params) {
227
- return __awaiter(this, void 0, void 0, function () {
228
- return __generator(this, function (_a) {
229
- return [2 /*return*/, null];
230
- });
231
- });
232
- };
233
- /**
234
- * 节点的重新恢复执行逻辑
235
- * @overridable 可以自定义节点重写此方法。
236
- * @param params.executionId 流程执行记录ID
237
- * @param params.actionId 此节点执行记录ID
238
- * @param params.nodeId 节点ID
239
- */
240
- BaseNode.prototype.onResume = function (params) {
241
- return __awaiter(this, void 0, void 0, function () {
242
- return __generator(this, function (_a) {
243
- return [2 /*return*/, undefined];
244
- });
245
- });
246
- };
247
- BaseNode.nodeTypeName = 'BaseNode';
248
- return BaseNode;
249
- }());
250
- export default BaseNode;
@@ -1,25 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
- import BaseNode from './BaseNode';
15
- var StartNode = /** @class */ (function (_super) {
16
- __extends(StartNode, _super);
17
- function StartNode() {
18
- var _this = _super !== null && _super.apply(this, arguments) || this;
19
- _this.baseType = 'start';
20
- return _this;
21
- }
22
- StartNode.nodeTypeName = 'StartNode';
23
- return StartNode;
24
- }(BaseNode));
25
- export default StartNode;
@@ -1,25 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
- import BaseNode from './BaseNode';
15
- var TaskNode = /** @class */ (function (_super) {
16
- __extends(TaskNode, _super);
17
- function TaskNode() {
18
- var _this = _super !== null && _super.apply(this, arguments) || this;
19
- _this.baseType = 'task';
20
- return _this;
21
- }
22
- TaskNode.nodeTypeName = 'TaskNode';
23
- return TaskNode;
24
- }(BaseNode));
25
- export default TaskNode;
package/es/util/ID.js DELETED
@@ -1,13 +0,0 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
- export var createExecId = function () {
3
- var uuid = uuidv4();
4
- return "exec-" + uuid;
5
- };
6
- export var createActionId = function () {
7
- var uuid = uuidv4();
8
- return "action-" + uuid;
9
- };
10
- export var createEngineId = function () {
11
- var uuid = uuidv4();
12
- return "engine-" + uuid;
13
- };
@@ -1,5 +0,0 @@
1
- declare const isInBrowser: boolean;
2
- declare const isInNodeJS: boolean;
3
- declare const isInWebWorker: Function;
4
- declare const globalScope: Record<string, any>;
5
- export { globalScope, isInBrowser, isInWebWorker, isInNodeJS, };
package/es/util/global.js DELETED
@@ -1,26 +0,0 @@
1
- // The one and only way of getting global scope in all environments
2
- // https://stackoverflow.com/q/3277182/1008999
3
- var isInBrowser = typeof window === 'object' && window.window === window;
4
- var isInNodeJS = typeof global === 'object' && global.global === global;
5
- // eslint-disable-next-line no-restricted-globals
6
- var isInWebWorker = !isInBrowser && typeof self === 'object' && self.constructor;
7
- var globalScope = (function () {
8
- if (isInBrowser) {
9
- return window;
10
- }
11
- // eslint-disable-next-line no-restricted-globals
12
- if (typeof self === 'object' && self.self === self) { // web workers
13
- // eslint-disable-next-line no-restricted-globals
14
- return self;
15
- }
16
- if (isInNodeJS) {
17
- return global;
18
- }
19
- if (typeof globalThis === 'object') {
20
- return globalThis;
21
- }
22
- return {
23
- eval: function () { return undefined; },
24
- };
25
- })();
26
- export { globalScope, isInBrowser, isInWebWorker, isInNodeJS, };