@nocobase/plugin-workflow 0.7.0-alpha.83 → 0.7.1-alpha.5
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/lib/Plugin.d.ts +18 -0
- package/lib/Plugin.js +285 -0
- package/lib/Processor.d.ts +40 -0
- package/lib/Processor.js +440 -0
- package/lib/actions/workflows.d.ts +1 -2
- package/lib/actions/workflows.js +13 -87
- package/lib/calculators/index.d.ts +2 -2
- package/lib/calculators/index.js +4 -4
- package/lib/collections/executions.js +7 -15
- package/lib/collections/jobs.js +7 -26
- package/lib/collections/workflows.d.ts +1 -2
- package/lib/collections/workflows.js +67 -67
- package/lib/index.d.ts +4 -3
- package/lib/index.js +24 -10
- package/lib/instructions/calculation.d.ts +1 -1
- package/lib/instructions/calculation.js +4 -6
- package/lib/instructions/condition.d.ts +2 -2
- package/lib/instructions/condition.js +15 -19
- package/lib/instructions/create.d.ts +1 -1
- package/lib/instructions/create.js +8 -12
- package/lib/instructions/delay.d.ts +14 -0
- package/lib/instructions/delay.js +138 -0
- package/lib/instructions/destroy.d.ts +1 -1
- package/lib/instructions/destroy.js +8 -12
- package/lib/instructions/index.d.ts +11 -8
- package/lib/instructions/index.js +43 -13
- package/lib/instructions/parallel.d.ts +3 -3
- package/lib/instructions/parallel.js +15 -19
- package/lib/instructions/prompt.d.ts +2 -2
- package/lib/instructions/prompt.js +2 -2
- package/lib/instructions/query.d.ts +2 -1
- package/lib/instructions/query.js +9 -13
- package/lib/instructions/update.d.ts +2 -2
- package/lib/instructions/update.js +10 -14
- package/lib/models/Execution.d.ts +2 -33
- package/lib/models/Execution.js +2 -397
- package/lib/models/Workflow.d.ts +2 -2
- package/lib/models/Workflow.js +1 -81
- package/lib/triggers/collection.d.ts +2 -6
- package/lib/triggers/collection.js +62 -27
- package/lib/triggers/index.d.ts +11 -4
- package/lib/triggers/index.js +52 -5
- package/lib/triggers/schedule.d.ts +4 -7
- package/lib/triggers/schedule.js +205 -135
- package/package.json +8 -9
- package/lib/server.d.ts +0 -10
- package/lib/server.js +0 -124
package/lib/triggers/index.js
CHANGED
|
@@ -3,16 +3,63 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.Trigger = void 0;
|
|
6
7
|
exports.default = _default;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
function _path() {
|
|
10
|
+
const data = _interopRequireDefault(require("path"));
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
_path = function _path() {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _utils() {
|
|
20
|
+
const data = require("@nocobase/utils");
|
|
21
|
+
|
|
22
|
+
_utils = function _utils() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
11
28
|
|
|
12
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
30
|
|
|
14
|
-
function
|
|
31
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
32
|
+
|
|
33
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
34
|
+
|
|
35
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
36
|
+
|
|
37
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
38
|
+
|
|
39
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
40
|
+
|
|
41
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
42
|
+
|
|
43
|
+
class Trigger {
|
|
44
|
+
constructor(plugin) {
|
|
45
|
+
this.plugin = void 0;
|
|
46
|
+
this.plugin = plugin;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.Trigger = Trigger;
|
|
52
|
+
|
|
53
|
+
function _default(plugin, more = {}) {
|
|
15
54
|
const triggers = plugin.triggers;
|
|
16
|
-
triggers.register('collection', new
|
|
17
|
-
triggers.register('schedule', new
|
|
55
|
+
triggers.register('collection', new ((0, _utils().requireModule)(_path().default.join(__dirname, 'collection')))(plugin));
|
|
56
|
+
triggers.register('schedule', new ((0, _utils().requireModule)(_path().default.join(__dirname, 'schedule')))(plugin));
|
|
57
|
+
|
|
58
|
+
for (var _i = 0, _Object$entries = Object.entries(more); _i < _Object$entries.length; _i++) {
|
|
59
|
+
const _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
60
|
+
name = _Object$entries$_i[0],
|
|
61
|
+
TClass = _Object$entries$_i[1];
|
|
62
|
+
|
|
63
|
+
triggers.register(name, new TClass(plugin));
|
|
64
|
+
}
|
|
18
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Trigger } from '
|
|
1
|
+
import Plugin, { Trigger } from '..';
|
|
2
2
|
export declare type ScheduleOnField = string | {
|
|
3
3
|
field: string;
|
|
4
4
|
offset?: number;
|
|
@@ -6,7 +6,7 @@ export declare type ScheduleOnField = string | {
|
|
|
6
6
|
};
|
|
7
7
|
export interface ScheduleTriggerConfig {
|
|
8
8
|
mode: number;
|
|
9
|
-
|
|
9
|
+
repeat?: string | number | null;
|
|
10
10
|
limit?: number;
|
|
11
11
|
startsOn?: ScheduleOnField;
|
|
12
12
|
endsOn?: ScheduleOnField;
|
|
@@ -15,18 +15,15 @@ export declare const SCHEDULE_MODE: {
|
|
|
15
15
|
readonly CONSTANT: 0;
|
|
16
16
|
readonly COLLECTION_FIELD: 1;
|
|
17
17
|
};
|
|
18
|
-
export default class ScheduleTrigger
|
|
18
|
+
export default class ScheduleTrigger extends Trigger {
|
|
19
19
|
static CacheRules: ((workflow: any, now: any) => any)[];
|
|
20
20
|
static TriggerRules: ((workflow: any, now: any) => boolean)[];
|
|
21
|
-
readonly db: any;
|
|
22
21
|
events: Map<any, any>;
|
|
23
22
|
private timer;
|
|
24
23
|
private cache;
|
|
25
24
|
interval: number;
|
|
26
25
|
cacheCycle: number;
|
|
27
|
-
constructor(
|
|
28
|
-
app: any;
|
|
29
|
-
});
|
|
26
|
+
constructor(plugin: Plugin);
|
|
30
27
|
init(): void;
|
|
31
28
|
run: () => void;
|
|
32
29
|
onTick(now: any): Promise<any>;
|