@nocobase/plugin-workflow 0.7.1-alpha.5 → 0.7.2-alpha.1
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/client.d.ts +4 -0
- package/client.js +30 -0
- package/lib/client/ExecutionResourceProvider.d.ts +4 -0
- package/lib/client/ExecutionResourceProvider.js +64 -0
- package/lib/client/WorkflowCanvas.d.ts +15 -0
- package/lib/client/WorkflowCanvas.js +393 -0
- package/lib/client/WorkflowLink.d.ts +1 -0
- package/lib/client/WorkflowLink.js +66 -0
- package/lib/client/WorkflowPage.d.ts +1 -0
- package/lib/client/WorkflowPage.js +92 -0
- package/lib/client/WorkflowProvider.d.ts +1 -0
- package/lib/client/WorkflowProvider.js +78 -0
- package/lib/client/WorkflowShortcut.d.ts +1 -0
- package/lib/client/WorkflowShortcut.js +123 -0
- package/lib/client/calculators.d.ts +101 -0
- package/lib/client/calculators.js +739 -0
- package/lib/client/components/Duration.d.ts +5 -0
- package/lib/client/components/Duration.js +96 -0
- package/lib/client/index.d.ts +3 -0
- package/lib/client/index.js +38 -0
- package/lib/client/nodes/calculation.d.ts +25 -0
- package/lib/client/nodes/calculation.js +85 -0
- package/lib/client/nodes/condition.d.ts +46 -0
- package/lib/client/nodes/condition.js +346 -0
- package/lib/client/nodes/create.d.ts +46 -0
- package/lib/client/nodes/create.js +133 -0
- package/lib/client/nodes/delay.d.ts +36 -0
- package/lib/client/nodes/delay.js +49 -0
- package/lib/client/nodes/destroy.d.ts +55 -0
- package/lib/client/nodes/destroy.js +46 -0
- package/lib/client/nodes/index.d.ts +33 -0
- package/lib/client/nodes/index.js +390 -0
- package/lib/client/nodes/parallel.d.ts +24 -0
- package/lib/client/nodes/parallel.js +216 -0
- package/lib/client/nodes/query.d.ts +70 -0
- package/lib/client/nodes/query.js +143 -0
- package/lib/client/nodes/update.d.ts +60 -0
- package/lib/client/nodes/update.js +48 -0
- package/lib/client/schemas/collection.d.ts +42 -0
- package/lib/client/schemas/collection.js +98 -0
- package/lib/client/schemas/executions.d.ts +209 -0
- package/lib/client/schemas/executions.js +164 -0
- package/lib/client/schemas/workflows.d.ts +2 -0
- package/lib/client/schemas/workflows.js +328 -0
- package/lib/client/style.d.ts +12 -0
- package/lib/client/style.js +216 -0
- package/lib/client/triggers/collection.d.ts +92 -0
- package/lib/client/triggers/collection.js +253 -0
- package/lib/client/triggers/index.d.ts +26 -0
- package/lib/client/triggers/index.js +238 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
- package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
- package/lib/client/triggers/schedule/EndsByField.js +102 -0
- package/lib/client/triggers/schedule/OnField.d.ts +5 -0
- package/lib/client/triggers/schedule/OnField.js +128 -0
- package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
- package/lib/client/triggers/schedule/RepeatField.js +191 -0
- package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
- package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
- package/lib/client/triggers/schedule/index.d.ts +25 -0
- package/lib/client/triggers/schedule/index.js +124 -0
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
- package/lib/index.d.ts +1 -6
- package/lib/index.js +2 -73
- package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
- package/lib/{Plugin.js → server/Plugin.js} +0 -0
- package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
- package/lib/{Processor.js → server/Processor.js} +40 -24
- package/lib/{actions → server/actions}/index.d.ts +0 -0
- package/lib/{actions → server/actions}/index.js +0 -0
- package/lib/{actions → server/actions}/nodes.d.ts +0 -0
- package/lib/{actions → server/actions}/nodes.js +1 -0
- package/lib/{actions → server/actions}/workflows.d.ts +0 -0
- package/lib/{actions → server/actions}/workflows.js +0 -0
- package/lib/{calculators → server/calculators}/index.d.ts +0 -0
- package/lib/{calculators → server/calculators}/index.js +0 -0
- package/lib/{collections → server/collections}/executions.d.ts +0 -0
- package/lib/{collections → server/collections}/executions.js +0 -0
- package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
- package/lib/{collections → server/collections}/flow_nodes.js +0 -0
- package/lib/{collections → server/collections}/jobs.d.ts +0 -0
- package/lib/{collections → server/collections}/jobs.js +0 -0
- package/lib/{collections → server/collections}/workflows.d.ts +0 -0
- package/lib/{collections → server/collections}/workflows.js +0 -0
- package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
- package/lib/{constants.js → server/constants.js} +0 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +86 -0
- package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
- package/lib/{instructions → server/instructions}/calculation.js +0 -0
- package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
- package/lib/{instructions → server/instructions}/condition.js +0 -0
- package/lib/{instructions → server/instructions}/create.d.ts +0 -0
- package/lib/{instructions → server/instructions}/create.js +0 -0
- package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
- package/lib/{instructions → server/instructions}/delay.js +12 -5
- package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
- package/lib/{instructions → server/instructions}/destroy.js +0 -0
- package/lib/{instructions → server/instructions}/index.d.ts +0 -0
- package/lib/{instructions → server/instructions}/index.js +0 -0
- package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
- package/lib/{instructions → server/instructions}/parallel.js +62 -20
- package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
- package/lib/{instructions → server/instructions}/prompt.js +0 -0
- package/lib/{instructions → server/instructions}/query.d.ts +0 -0
- package/lib/{instructions → server/instructions}/query.js +0 -0
- package/lib/{instructions → server/instructions}/update.d.ts +0 -0
- package/lib/{instructions → server/instructions}/update.js +0 -0
- package/lib/{models → server/models}/Execution.d.ts +0 -0
- package/lib/{models → server/models}/Execution.js +0 -0
- package/lib/{models → server/models}/FlowNode.d.ts +0 -0
- package/lib/{models → server/models}/FlowNode.js +0 -0
- package/lib/{models → server/models}/Job.d.ts +0 -0
- package/lib/{models → server/models}/Job.js +0 -0
- package/lib/{models → server/models}/Workflow.d.ts +0 -0
- package/lib/{models → server/models}/Workflow.js +0 -0
- package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
- package/lib/{triggers → server/triggers}/collection.js +0 -0
- package/lib/{triggers → server/triggers}/index.d.ts +0 -0
- package/lib/{triggers → server/triggers}/index.js +0 -0
- package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
- package/lib/{triggers → server/triggers}/schedule.js +2 -2
- package/package.json +10 -8
- package/server.d.ts +4 -0
- package/server.js +30 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
everyText: '每',
|
|
9
|
+
emptyMonths: '每月',
|
|
10
|
+
emptyMonthDays: '每日(月)',
|
|
11
|
+
emptyMonthDaysShort: '每日',
|
|
12
|
+
emptyWeekDays: '每天(周)',
|
|
13
|
+
emptyWeekDaysShort: '每天(周)',
|
|
14
|
+
emptyHours: '每小时',
|
|
15
|
+
emptyMinutes: '每分钟',
|
|
16
|
+
emptyMinutesForHourPeriod: '每',
|
|
17
|
+
yearOption: '年',
|
|
18
|
+
monthOption: '月',
|
|
19
|
+
weekOption: '周',
|
|
20
|
+
dayOption: '天',
|
|
21
|
+
hourOption: '小时',
|
|
22
|
+
minuteOption: '分钟',
|
|
23
|
+
rebootOption: '重启',
|
|
24
|
+
prefixPeriod: '每',
|
|
25
|
+
prefixMonths: '的',
|
|
26
|
+
prefixMonthDays: '的',
|
|
27
|
+
prefixWeekDays: '的',
|
|
28
|
+
prefixWeekDaysForMonthAndYearPeriod: '并且',
|
|
29
|
+
prefixHours: '的',
|
|
30
|
+
prefixMinutes: ':',
|
|
31
|
+
prefixMinutesForHourPeriod: '的',
|
|
32
|
+
suffixMinutesForHourPeriod: '分钟',
|
|
33
|
+
errorInvalidCron: '不符合 cron 规则的表达式',
|
|
34
|
+
clearButtonText: '清空',
|
|
35
|
+
weekDays: [// Order is important, the index will be used as value
|
|
36
|
+
'周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
|
37
|
+
months: [// Order is important, the index will be used as value
|
|
38
|
+
'一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
|
39
|
+
altWeekDays: [// Order is important, the index will be used as value
|
|
40
|
+
'周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
|
41
|
+
altMonths: [// Order is important, the index will be used as value
|
|
42
|
+
'一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
|
|
43
|
+
};
|
|
44
|
+
exports.default = _default;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,84 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {};
|
|
7
6
|
Object.defineProperty(exports, "default", {
|
|
8
7
|
enumerable: true,
|
|
9
8
|
get: function get() {
|
|
10
|
-
return
|
|
9
|
+
return _server.default;
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
12
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
Object.keys(_calculators).forEach(function (key) {
|
|
17
|
-
if (key === "default" || key === "__esModule") return;
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
-
if (key in exports && exports[key] === _calculators[key]) return;
|
|
20
|
-
Object.defineProperty(exports, key, {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function get() {
|
|
23
|
-
return _calculators[key];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
var _constants = require("./constants");
|
|
29
|
-
|
|
30
|
-
Object.keys(_constants).forEach(function (key) {
|
|
31
|
-
if (key === "default" || key === "__esModule") return;
|
|
32
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
33
|
-
if (key in exports && exports[key] === _constants[key]) return;
|
|
34
|
-
Object.defineProperty(exports, key, {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function get() {
|
|
37
|
-
return _constants[key];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
var _instructions = require("./instructions");
|
|
43
|
-
|
|
44
|
-
Object.keys(_instructions).forEach(function (key) {
|
|
45
|
-
if (key === "default" || key === "__esModule") return;
|
|
46
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
47
|
-
if (key in exports && exports[key] === _instructions[key]) return;
|
|
48
|
-
Object.defineProperty(exports, key, {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _instructions[key];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
var _triggers = require("./triggers");
|
|
57
|
-
|
|
58
|
-
Object.keys(_triggers).forEach(function (key) {
|
|
59
|
-
if (key === "default" || key === "__esModule") return;
|
|
60
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
61
|
-
if (key in exports && exports[key] === _triggers[key]) return;
|
|
62
|
-
Object.defineProperty(exports, key, {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function get() {
|
|
65
|
-
return _triggers[key];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
var _Processor = require("./Processor");
|
|
71
|
-
|
|
72
|
-
Object.keys(_Processor).forEach(function (key) {
|
|
73
|
-
if (key === "default" || key === "__esModule") return;
|
|
74
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
75
|
-
if (key in exports && exports[key] === _Processor[key]) return;
|
|
76
|
-
Object.defineProperty(exports, key, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function get() {
|
|
79
|
-
return _Processor[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
var _Plugin = _interopRequireDefault(require("./Plugin"));
|
|
13
|
+
var _server = _interopRequireDefault(require("./server"));
|
|
85
14
|
|
|
86
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
File without changes
|
|
File without changes
|
|
@@ -29,11 +29,12 @@ export default class Processor {
|
|
|
29
29
|
private commit;
|
|
30
30
|
private exec;
|
|
31
31
|
run(node: any, input?: any): any;
|
|
32
|
-
end(node: any, job: any): any
|
|
33
|
-
recall(node: any, job: any): any
|
|
32
|
+
end(node: any, job: any): Promise<any>;
|
|
33
|
+
recall(node: any, job: any): Promise<any>;
|
|
34
34
|
exit(job: JobModel | null): Promise<any>;
|
|
35
35
|
saveJob(payload: any): Promise<any>;
|
|
36
|
-
|
|
36
|
+
getBranches(node: FlowNodeModel): FlowNodeModel[];
|
|
37
|
+
findBranchStartNode(node: FlowNodeModel, parent?: FlowNodeModel): FlowNodeModel | null;
|
|
37
38
|
findBranchParentNode(node: FlowNodeModel): FlowNodeModel | null;
|
|
38
39
|
findBranchParentJob(job: JobModel, node: FlowNodeModel): JobModel | null;
|
|
39
40
|
getParsedValue(value: any, node?: any): any;
|
|
@@ -281,22 +281,28 @@ class Processor {
|
|
|
281
281
|
|
|
282
282
|
|
|
283
283
|
end(node, job) {
|
|
284
|
-
|
|
284
|
+
var _this8 = this;
|
|
285
|
+
|
|
286
|
+
return _asyncToGenerator(function* () {
|
|
287
|
+
const parentNode = _this8.findBranchParentNode(node); // no parent, means on main flow
|
|
288
|
+
|
|
285
289
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
if (parentNode) {
|
|
291
|
+
yield _this8.recall(parentNode, job);
|
|
292
|
+
return job;
|
|
293
|
+
} // really done for all nodes
|
|
294
|
+
// * should mark execution as done with last job status
|
|
290
295
|
|
|
291
296
|
|
|
292
|
-
|
|
297
|
+
return _this8.exit(job);
|
|
298
|
+
})();
|
|
293
299
|
}
|
|
294
300
|
|
|
295
301
|
recall(node, job) {
|
|
296
|
-
var
|
|
302
|
+
var _this9 = this;
|
|
297
303
|
|
|
298
304
|
return _asyncToGenerator(function* () {
|
|
299
|
-
const instructions =
|
|
305
|
+
const instructions = _this9.options.plugin.instructions;
|
|
300
306
|
|
|
301
307
|
const _instructions$get2 = instructions.get(node.type),
|
|
302
308
|
resume = _instructions$get2.resume;
|
|
@@ -305,19 +311,19 @@ class Processor {
|
|
|
305
311
|
return Promise.reject(new Error('`resume` should be implemented'));
|
|
306
312
|
}
|
|
307
313
|
|
|
308
|
-
return
|
|
314
|
+
return _this9.exec(resume, node, job);
|
|
309
315
|
})();
|
|
310
316
|
}
|
|
311
317
|
|
|
312
318
|
exit(job) {
|
|
313
|
-
var
|
|
319
|
+
var _this10 = this;
|
|
314
320
|
|
|
315
321
|
return _asyncToGenerator(function* () {
|
|
316
|
-
const status = job ?
|
|
317
|
-
yield
|
|
322
|
+
const status = job ? _this10.constructor.StatusMap[job.status] : _constants.EXECUTION_STATUS.RESOLVED;
|
|
323
|
+
yield _this10.execution.update({
|
|
318
324
|
status
|
|
319
325
|
}, {
|
|
320
|
-
transaction:
|
|
326
|
+
transaction: _this10.transaction
|
|
321
327
|
});
|
|
322
328
|
return null;
|
|
323
329
|
})();
|
|
@@ -325,10 +331,10 @@ class Processor {
|
|
|
325
331
|
|
|
326
332
|
|
|
327
333
|
saveJob(payload) {
|
|
328
|
-
var
|
|
334
|
+
var _this11 = this;
|
|
329
335
|
|
|
330
336
|
return _asyncToGenerator(function* () {
|
|
331
|
-
const database =
|
|
337
|
+
const database = _this11.execution.constructor.database;
|
|
332
338
|
|
|
333
339
|
const _database$getCollecti = database.getCollection('jobs'),
|
|
334
340
|
model = _database$getCollecti.model;
|
|
@@ -337,7 +343,7 @@ class Processor {
|
|
|
337
343
|
|
|
338
344
|
if (payload instanceof model) {
|
|
339
345
|
job = yield payload.save({
|
|
340
|
-
transaction:
|
|
346
|
+
transaction: _this11.transaction
|
|
341
347
|
});
|
|
342
348
|
} else if (payload.id) {
|
|
343
349
|
var _yield$model$update = yield model.update(payload, {
|
|
@@ -345,7 +351,7 @@ class Processor {
|
|
|
345
351
|
id: payload.id
|
|
346
352
|
},
|
|
347
353
|
returning: true,
|
|
348
|
-
transaction:
|
|
354
|
+
transaction: _this11.transaction
|
|
349
355
|
});
|
|
350
356
|
|
|
351
357
|
var _yield$model$update2 = _slicedToArray(_yield$model$update, 1);
|
|
@@ -353,24 +359,34 @@ class Processor {
|
|
|
353
359
|
job = _yield$model$update2[0];
|
|
354
360
|
} else {
|
|
355
361
|
job = yield model.create(_objectSpread(_objectSpread({}, payload), {}, {
|
|
356
|
-
executionId:
|
|
362
|
+
executionId: _this11.execution.id
|
|
357
363
|
}), {
|
|
358
|
-
transaction:
|
|
364
|
+
transaction: _this11.transaction
|
|
359
365
|
});
|
|
360
366
|
}
|
|
361
367
|
|
|
362
|
-
|
|
368
|
+
_this11.jobsMap.set(job.id, job);
|
|
363
369
|
|
|
364
|
-
|
|
370
|
+
_this11.jobsMapByNodeId[job.nodeId] = job.result;
|
|
365
371
|
return job;
|
|
366
372
|
})();
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
getBranches(node) {
|
|
376
|
+
return this.nodes.filter(item => item.upstream === node && item.branchIndex !== null).sort((a, b) => a.branchIndex - b.branchIndex);
|
|
367
377
|
} // find the first node in current branch
|
|
368
378
|
|
|
369
379
|
|
|
370
|
-
findBranchStartNode(node) {
|
|
380
|
+
findBranchStartNode(node, parent) {
|
|
371
381
|
for (let n = node; n; n = n.upstream) {
|
|
372
|
-
if (
|
|
373
|
-
|
|
382
|
+
if (!parent) {
|
|
383
|
+
if (n.branchIndex !== null) {
|
|
384
|
+
return n;
|
|
385
|
+
}
|
|
386
|
+
} else {
|
|
387
|
+
if (n.upstream === parent) {
|
|
388
|
+
return n;
|
|
389
|
+
}
|
|
374
390
|
}
|
|
375
391
|
}
|
|
376
392
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _Plugin.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
var _calculators = require("./calculators");
|
|
15
|
+
|
|
16
|
+
Object.keys(_calculators).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
+
if (key in exports && exports[key] === _calculators[key]) return;
|
|
20
|
+
Object.defineProperty(exports, key, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _calculators[key];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
var _constants = require("./constants");
|
|
29
|
+
|
|
30
|
+
Object.keys(_constants).forEach(function (key) {
|
|
31
|
+
if (key === "default" || key === "__esModule") return;
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
33
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
|
34
|
+
Object.defineProperty(exports, key, {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function get() {
|
|
37
|
+
return _constants[key];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var _instructions = require("./instructions");
|
|
43
|
+
|
|
44
|
+
Object.keys(_instructions).forEach(function (key) {
|
|
45
|
+
if (key === "default" || key === "__esModule") return;
|
|
46
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
47
|
+
if (key in exports && exports[key] === _instructions[key]) return;
|
|
48
|
+
Object.defineProperty(exports, key, {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _instructions[key];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var _triggers = require("./triggers");
|
|
57
|
+
|
|
58
|
+
Object.keys(_triggers).forEach(function (key) {
|
|
59
|
+
if (key === "default" || key === "__esModule") return;
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
61
|
+
if (key in exports && exports[key] === _triggers[key]) return;
|
|
62
|
+
Object.defineProperty(exports, key, {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function get() {
|
|
65
|
+
return _triggers[key];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
var _Processor = require("./Processor");
|
|
71
|
+
|
|
72
|
+
Object.keys(_Processor).forEach(function (key) {
|
|
73
|
+
if (key === "default" || key === "__esModule") return;
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
75
|
+
if (key in exports && exports[key] === _Processor[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function get() {
|
|
79
|
+
return _Processor[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var _Plugin = _interopRequireDefault(require("./Plugin"));
|
|
85
|
+
|
|
86
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -75,9 +75,15 @@ class _default {
|
|
|
75
75
|
status: _constants.JOB_STATUS.PENDING
|
|
76
76
|
},
|
|
77
77
|
include: [{
|
|
78
|
-
association: 'execution'
|
|
78
|
+
association: 'execution',
|
|
79
|
+
attributes: [],
|
|
80
|
+
where: {
|
|
81
|
+
status: _constants.EXECUTION_STATUS.STARTED
|
|
82
|
+
},
|
|
83
|
+
required: true
|
|
79
84
|
}, {
|
|
80
85
|
association: 'node',
|
|
86
|
+
attributes: ['config'],
|
|
81
87
|
where: {
|
|
82
88
|
type: 'delay'
|
|
83
89
|
},
|
|
@@ -120,12 +126,13 @@ class _default {
|
|
|
120
126
|
var _this3 = this;
|
|
121
127
|
|
|
122
128
|
return _asyncToGenerator(function* () {
|
|
123
|
-
const
|
|
124
|
-
execution = _job$execution === void 0 ? yield job.getExecution() : _job$execution;
|
|
129
|
+
const execution = yield job.getExecution();
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
if (execution.status === _constants.EXECUTION_STATUS.STARTED) {
|
|
132
|
+
const processor = _this3.plugin.createProcessor(execution);
|
|
127
133
|
|
|
128
|
-
|
|
134
|
+
yield processor.resume(job);
|
|
135
|
+
}
|
|
129
136
|
|
|
130
137
|
if (_this3.timers.get(job.id)) {
|
|
131
138
|
_this3.timers.delete(job.id);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -17,34 +17,68 @@ const PARALLEL_MODE = {
|
|
|
17
17
|
RACE: 'race'
|
|
18
18
|
};
|
|
19
19
|
exports.PARALLEL_MODE = PARALLEL_MODE;
|
|
20
|
-
const
|
|
21
|
-
[PARALLEL_MODE.ALL]
|
|
22
|
-
|
|
23
|
-
return _constants.JOB_STATUS.REJECTED;
|
|
24
|
-
}
|
|
20
|
+
const Modes = {
|
|
21
|
+
[PARALLEL_MODE.ALL]: {
|
|
22
|
+
next(previous) {
|
|
23
|
+
return previous.status !== _constants.JOB_STATUS.REJECTED;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
getStatus(result) {
|
|
27
|
+
if (result.some(status => status != null && status === _constants.JOB_STATUS.REJECTED)) {
|
|
28
|
+
return _constants.JOB_STATUS.REJECTED;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (result.every(status => status != null && status === _constants.JOB_STATUS.RESOLVED)) {
|
|
32
|
+
return _constants.JOB_STATUS.RESOLVED;
|
|
33
|
+
}
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
return _constants.JOB_STATUS.RESOLVED;
|
|
35
|
+
return _constants.JOB_STATUS.PENDING;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
|
-
return _constants.JOB_STATUS.PENDING;
|
|
31
38
|
},
|
|
39
|
+
[PARALLEL_MODE.ANY]: {
|
|
40
|
+
next(previous) {
|
|
41
|
+
return previous.status !== _constants.JOB_STATUS.RESOLVED;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
getStatus(result) {
|
|
45
|
+
if (result.some(status => status != null && status === _constants.JOB_STATUS.RESOLVED)) {
|
|
46
|
+
return _constants.JOB_STATUS.RESOLVED;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (result.some(status => status != null ? status === _constants.JOB_STATUS.PENDING : true)) {
|
|
50
|
+
return _constants.JOB_STATUS.PENDING;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return _constants.JOB_STATUS.REJECTED;
|
|
54
|
+
}
|
|
32
55
|
|
|
33
|
-
[PARALLEL_MODE.ANY](result) {
|
|
34
|
-
return result.some(j => j && j.status === _constants.JOB_STATUS.RESOLVED) ? _constants.JOB_STATUS.RESOLVED : result.some(j => j && j.status === _constants.JOB_STATUS.PENDING) ? _constants.JOB_STATUS.PENDING : _constants.JOB_STATUS.REJECTED;
|
|
35
56
|
},
|
|
57
|
+
[PARALLEL_MODE.RACE]: {
|
|
58
|
+
next(previous) {
|
|
59
|
+
return previous.status === _constants.JOB_STATUS.PENDING;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
getStatus(result) {
|
|
63
|
+
if (result.some(status => status != null && status === _constants.JOB_STATUS.RESOLVED)) {
|
|
64
|
+
return _constants.JOB_STATUS.RESOLVED;
|
|
65
|
+
}
|
|
36
66
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
67
|
+
if (result.some(status => status != null && status === _constants.JOB_STATUS.REJECTED)) {
|
|
68
|
+
return _constants.JOB_STATUS.REJECTED;
|
|
69
|
+
}
|
|
40
70
|
|
|
71
|
+
return _constants.JOB_STATUS.PENDING;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
41
75
|
};
|
|
42
76
|
var _default = {
|
|
43
77
|
run(node, prevJob, processor) {
|
|
44
78
|
return _asyncToGenerator(function* () {
|
|
45
79
|
var _prevJob$id;
|
|
46
80
|
|
|
47
|
-
const branches = processor.
|
|
81
|
+
const branches = processor.getBranches(node);
|
|
48
82
|
const job = yield processor.saveJob({
|
|
49
83
|
status: _constants.JOB_STATUS.PENDING,
|
|
50
84
|
result: Array(branches.length).fill(null),
|
|
@@ -56,7 +90,15 @@ var _default = {
|
|
|
56
90
|
// because of the delay is not significant sensible.
|
|
57
91
|
// another benifit of this is, it could handle sequenced branches in future.
|
|
58
92
|
|
|
59
|
-
|
|
93
|
+
const _node$config$mode = node.config.mode,
|
|
94
|
+
mode = _node$config$mode === void 0 ? PARALLEL_MODE.ALL : _node$config$mode;
|
|
95
|
+
yield branches.reduce((promise, branch, i) => promise.then(previous => {
|
|
96
|
+
if (i && !Modes[mode].next(previous)) {
|
|
97
|
+
return Promise.resolve(previous);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return processor.run(branch, job);
|
|
101
|
+
}), Promise.resolve());
|
|
60
102
|
return processor.end(node, job);
|
|
61
103
|
})();
|
|
62
104
|
},
|
|
@@ -73,18 +115,18 @@ var _default = {
|
|
|
73
115
|
|
|
74
116
|
|
|
75
117
|
const jobNode = processor.nodesMap.get(branchJob.nodeId);
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
118
|
+
const branchStartNode = processor.findBranchStartNode(jobNode, node);
|
|
119
|
+
const branches = processor.getBranches(node);
|
|
120
|
+
const branchIndex = branches.indexOf(branchStartNode);
|
|
79
121
|
|
|
80
122
|
const _ref = node.config || {},
|
|
81
123
|
_ref$mode = _ref.mode,
|
|
82
124
|
mode = _ref$mode === void 0 ? PARALLEL_MODE.ALL : _ref$mode;
|
|
83
125
|
|
|
84
|
-
const newResult = [...result.slice(0, branchIndex), branchJob.
|
|
126
|
+
const newResult = [...result.slice(0, branchIndex), branchJob.status, ...result.slice(branchIndex + 1)];
|
|
85
127
|
job.set({
|
|
86
128
|
result: newResult,
|
|
87
|
-
status:
|
|
129
|
+
status: Modes[mode].getStatus(newResult)
|
|
88
130
|
});
|
|
89
131
|
|
|
90
132
|
if (job.status === _constants.JOB_STATUS.PENDING) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|