@nocobase/plugin-workflow 0.18.0-alpha.1 → 0.18.0-alpha.8
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/client/index.d.ts +8 -0
- package/dist/client/index.js +30 -30
- package/dist/client/nodes/calculation.d.ts +7 -2
- package/dist/client/nodes/index.d.ts +10 -5
- package/dist/client/triggers/collection.d.ts +0 -1
- package/dist/client/triggers/index.d.ts +2 -3
- package/dist/client/triggers/schedule/index.d.ts +0 -1
- package/dist/client/variable.d.ts +15 -14
- package/dist/externalVersion.js +9 -8
- package/dist/locale/en-US.json +1 -1
- package/dist/locale/es-ES.json +1 -1
- package/dist/locale/fr-FR.json +1 -1
- package/dist/locale/pt-BR.json +1 -1
- package/dist/locale/zh-CN.json +3 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/Plugin.d.ts +9 -11
- package/dist/server/Plugin.js +38 -24
- package/dist/server/Processor.d.ts +9 -5
- package/dist/server/Processor.js +8 -33
- package/dist/server/actions/workflows.js +4 -4
- package/dist/server/collections/executions.js +0 -5
- package/dist/server/collections/workflows.js +0 -5
- package/dist/server/constants.d.ts +17 -22
- package/dist/server/constants.js +0 -7
- package/dist/server/instructions/CalculationInstruction.d.ts +4 -2
- package/dist/server/instructions/CalculationInstruction.js +2 -10
- package/dist/server/instructions/ConditionInstruction.d.ts +10 -2
- package/dist/server/instructions/ConditionInstruction.js +7 -0
- package/dist/server/instructions/CreateInstruction.d.ts +1 -1
- package/dist/server/instructions/CreateInstruction.js +4 -4
- package/dist/server/instructions/DestroyInstruction.d.ts +1 -1
- package/dist/server/instructions/DestroyInstruction.js +2 -2
- package/dist/server/instructions/QueryInstruction.d.ts +4 -1
- package/dist/server/instructions/QueryInstruction.js +2 -2
- package/dist/server/instructions/UpdateInstruction.d.ts +1 -1
- package/dist/server/instructions/UpdateInstruction.js +2 -2
- package/dist/server/instructions/index.d.ts +9 -6
- package/dist/server/instructions/index.js +2 -2
- package/dist/server/triggers/CollectionTrigger.js +3 -3
- package/dist/server/triggers/ScheduleTrigger.d.ts +1 -1
- package/dist/server/triggers/ScheduleTrigger.js +14 -14
- package/dist/server/triggers/index.d.ts +2 -2
- package/dist/server/triggers/index.js +2 -2
- package/dist/server/types/Execution.d.ts +0 -2
- package/dist/server/types/Workflow.d.ts +0 -1
- package/package.json +6 -5
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
export declare const EXECUTION_STATUS: {
|
|
2
|
-
QUEUEING: any;
|
|
3
|
-
STARTED:
|
|
4
|
-
RESOLVED:
|
|
5
|
-
FAILED:
|
|
6
|
-
ERROR:
|
|
7
|
-
ABORTED:
|
|
8
|
-
CANCELED:
|
|
9
|
-
REJECTED:
|
|
10
|
-
RETRY_NEEDED:
|
|
2
|
+
readonly QUEUEING: any;
|
|
3
|
+
readonly STARTED: 0;
|
|
4
|
+
readonly RESOLVED: 1;
|
|
5
|
+
readonly FAILED: -1;
|
|
6
|
+
readonly ERROR: -2;
|
|
7
|
+
readonly ABORTED: -3;
|
|
8
|
+
readonly CANCELED: -4;
|
|
9
|
+
readonly REJECTED: -5;
|
|
10
|
+
readonly RETRY_NEEDED: -6;
|
|
11
11
|
};
|
|
12
12
|
export declare const JOB_STATUS: {
|
|
13
|
-
PENDING:
|
|
14
|
-
RESOLVED:
|
|
15
|
-
FAILED:
|
|
16
|
-
ERROR:
|
|
17
|
-
ABORTED:
|
|
18
|
-
CANCELED:
|
|
19
|
-
REJECTED:
|
|
20
|
-
RETRY_NEEDED:
|
|
21
|
-
};
|
|
22
|
-
export declare const BRANCH_INDEX: {
|
|
23
|
-
DEFAULT: any;
|
|
24
|
-
ON_TRUE: number;
|
|
25
|
-
ON_FALSE: number;
|
|
13
|
+
readonly PENDING: 0;
|
|
14
|
+
readonly RESOLVED: 1;
|
|
15
|
+
readonly FAILED: -1;
|
|
16
|
+
readonly ERROR: -2;
|
|
17
|
+
readonly ABORTED: -3;
|
|
18
|
+
readonly CANCELED: -4;
|
|
19
|
+
readonly REJECTED: -5;
|
|
20
|
+
readonly RETRY_NEEDED: -6;
|
|
26
21
|
};
|
package/dist/server/constants.js
CHANGED
|
@@ -17,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var constants_exports = {};
|
|
19
19
|
__export(constants_exports, {
|
|
20
|
-
BRANCH_INDEX: () => BRANCH_INDEX,
|
|
21
20
|
EXECUTION_STATUS: () => EXECUTION_STATUS,
|
|
22
21
|
JOB_STATUS: () => JOB_STATUS
|
|
23
22
|
});
|
|
@@ -43,14 +42,8 @@ const JOB_STATUS = {
|
|
|
43
42
|
REJECTED: -5,
|
|
44
43
|
RETRY_NEEDED: -6
|
|
45
44
|
};
|
|
46
|
-
const BRANCH_INDEX = {
|
|
47
|
-
DEFAULT: null,
|
|
48
|
-
ON_TRUE: 1,
|
|
49
|
-
ON_FALSE: 0
|
|
50
|
-
};
|
|
51
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
46
|
0 && (module.exports = {
|
|
53
|
-
BRANCH_INDEX,
|
|
54
47
|
EXECUTION_STATUS,
|
|
55
48
|
JOB_STATUS
|
|
56
49
|
});
|
|
@@ -2,14 +2,16 @@ import { Instruction } from '.';
|
|
|
2
2
|
import type Processor from '../Processor';
|
|
3
3
|
import type { FlowNodeModel } from '../types';
|
|
4
4
|
export interface CalculationConfig {
|
|
5
|
-
dynamic?: boolean | string;
|
|
6
5
|
engine?: string;
|
|
7
6
|
expression?: string;
|
|
8
7
|
}
|
|
9
8
|
export declare class CalculationInstruction extends Instruction {
|
|
10
9
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
|
|
11
10
|
result: any;
|
|
12
|
-
status:
|
|
11
|
+
status: 1;
|
|
12
|
+
} | {
|
|
13
|
+
result: any;
|
|
14
|
+
status: -2;
|
|
13
15
|
}>;
|
|
14
16
|
}
|
|
15
17
|
export default CalculationInstruction;
|
|
@@ -22,20 +22,12 @@ __export(CalculationInstruction_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(CalculationInstruction_exports);
|
|
24
24
|
var import_evaluators = require("@nocobase/evaluators");
|
|
25
|
-
var import_utils = require("@nocobase/utils");
|
|
26
25
|
var import__ = require(".");
|
|
27
26
|
var import_constants = require("../constants");
|
|
28
27
|
class CalculationInstruction extends import__.Instruction {
|
|
29
28
|
async run(node, prevJob, processor) {
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
let scope = processor.getScope(node.id);
|
|
33
|
-
if (dynamic) {
|
|
34
|
-
const parsed = (0, import_utils.parse)(dynamic)(scope) ?? {};
|
|
35
|
-
engine = parsed.engine;
|
|
36
|
-
expression = parsed.expression;
|
|
37
|
-
scope = (0, import_utils.parse)(node.config.scope ?? "")(scope) ?? {};
|
|
38
|
-
}
|
|
29
|
+
const { engine = "math.js", expression = "" } = node.config;
|
|
30
|
+
const scope = processor.getScope(node.id);
|
|
39
31
|
const evaluator = import_evaluators.evaluators.get(engine);
|
|
40
32
|
try {
|
|
41
33
|
const result = evaluator && expression ? evaluator(expression, scope) : null;
|
|
@@ -3,16 +3,24 @@ import { Instruction } from '.';
|
|
|
3
3
|
import type Processor from '../Processor';
|
|
4
4
|
import type { FlowNodeModel, JobModel } from '../types';
|
|
5
5
|
type Comparer = (a: any, b: any) => boolean;
|
|
6
|
+
export declare const BRANCH_INDEX: {
|
|
7
|
+
readonly DEFAULT: any;
|
|
8
|
+
readonly ON_TRUE: 1;
|
|
9
|
+
readonly ON_FALSE: 0;
|
|
10
|
+
};
|
|
6
11
|
export declare const calculators: Registry<Comparer>;
|
|
7
12
|
export declare class ConditionInstruction extends Instruction {
|
|
8
13
|
run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
|
|
9
|
-
status:
|
|
14
|
+
status: 1;
|
|
10
15
|
result: boolean;
|
|
11
16
|
nodeId: number;
|
|
12
17
|
upstreamId: any;
|
|
13
18
|
} | {
|
|
14
19
|
result: any;
|
|
15
|
-
status:
|
|
20
|
+
status: -2;
|
|
21
|
+
} | {
|
|
22
|
+
status: -1;
|
|
23
|
+
result: boolean;
|
|
16
24
|
}>;
|
|
17
25
|
resume(node: FlowNodeModel, branchJob: JobModel, processor: Processor): Promise<any>;
|
|
18
26
|
}
|
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var ConditionInstruction_exports = {};
|
|
19
19
|
__export(ConditionInstruction_exports, {
|
|
20
|
+
BRANCH_INDEX: () => BRANCH_INDEX,
|
|
20
21
|
ConditionInstruction: () => ConditionInstruction,
|
|
21
22
|
calculators: () => calculators,
|
|
22
23
|
default: () => ConditionInstruction_default
|
|
@@ -26,6 +27,11 @@ var import_evaluators = require("@nocobase/evaluators");
|
|
|
26
27
|
var import_utils = require("@nocobase/utils");
|
|
27
28
|
var import__ = require(".");
|
|
28
29
|
var import_constants = require("../constants");
|
|
30
|
+
const BRANCH_INDEX = {
|
|
31
|
+
DEFAULT: null,
|
|
32
|
+
ON_TRUE: 1,
|
|
33
|
+
ON_FALSE: 0
|
|
34
|
+
};
|
|
29
35
|
const calculators = new import_utils.Registry();
|
|
30
36
|
function equal(a, b) {
|
|
31
37
|
return a == b;
|
|
@@ -145,6 +151,7 @@ class ConditionInstruction extends import__.Instruction {
|
|
|
145
151
|
var ConditionInstruction_default = ConditionInstruction;
|
|
146
152
|
// Annotate the CommonJS export names for ESM import in node:
|
|
147
153
|
0 && (module.exports = {
|
|
154
|
+
BRANCH_INDEX,
|
|
148
155
|
ConditionInstruction,
|
|
149
156
|
calculators
|
|
150
157
|
});
|
|
@@ -33,8 +33,8 @@ class CreateInstruction extends import__.Instruction {
|
|
|
33
33
|
...options,
|
|
34
34
|
context: {
|
|
35
35
|
executionId: processor.execution.id
|
|
36
|
-
}
|
|
37
|
-
transaction: processor.transaction
|
|
36
|
+
}
|
|
37
|
+
// transaction: processor.transaction,
|
|
38
38
|
});
|
|
39
39
|
let result = created;
|
|
40
40
|
if (created && appends.length) {
|
|
@@ -45,8 +45,8 @@ class CreateInstruction extends import__.Instruction {
|
|
|
45
45
|
}, /* @__PURE__ */ new Set());
|
|
46
46
|
result = await repository.findOne({
|
|
47
47
|
filterByTk: created[model.primaryKeyAttribute],
|
|
48
|
-
appends: Array.from(includeFields)
|
|
49
|
-
transaction: processor.transaction
|
|
48
|
+
appends: Array.from(includeFields)
|
|
49
|
+
// transaction: processor.transaction,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
return {
|
|
@@ -4,7 +4,7 @@ import type { FlowNodeModel } from '../types';
|
|
|
4
4
|
export declare class DestroyInstruction extends Instruction {
|
|
5
5
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
6
6
|
result: any;
|
|
7
|
-
status:
|
|
7
|
+
status: 1;
|
|
8
8
|
}>;
|
|
9
9
|
}
|
|
10
10
|
export default DestroyInstruction;
|
|
@@ -4,7 +4,10 @@ import { Instruction } from '.';
|
|
|
4
4
|
export declare class QueryInstruction extends Instruction {
|
|
5
5
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
6
6
|
result: any;
|
|
7
|
-
status:
|
|
7
|
+
status: -1;
|
|
8
|
+
} | {
|
|
9
|
+
result: object;
|
|
10
|
+
status: 1;
|
|
8
11
|
}>;
|
|
9
12
|
}
|
|
10
13
|
export default QueryInstruction;
|
|
@@ -49,8 +49,8 @@ class QueryInstruction extends import__.Instruction {
|
|
|
49
49
|
var _a;
|
|
50
50
|
return `${((_a = item.direction) == null ? void 0 : _a.toLowerCase()) === "desc" ? "-" : ""}${item.field}`;
|
|
51
51
|
}),
|
|
52
|
-
appends
|
|
53
|
-
transaction: processor.transaction
|
|
52
|
+
appends
|
|
53
|
+
// transaction: processor.transaction,
|
|
54
54
|
});
|
|
55
55
|
if (failOnEmpty && (multiple ? !result.length : !result)) {
|
|
56
56
|
return {
|
|
@@ -32,8 +32,8 @@ class UpdateInstruction extends import__.Instruction {
|
|
|
32
32
|
...options,
|
|
33
33
|
context: {
|
|
34
34
|
executionId: processor.execution.id
|
|
35
|
-
}
|
|
36
|
-
transaction: processor.transaction
|
|
35
|
+
}
|
|
36
|
+
// transaction: processor.transaction,
|
|
37
37
|
});
|
|
38
38
|
return {
|
|
39
39
|
result: result.length ?? result,
|
|
@@ -9,12 +9,15 @@ export interface IJob {
|
|
|
9
9
|
}
|
|
10
10
|
export type InstructionResult = IJob | Promise<IJob> | null;
|
|
11
11
|
export type Runner = (node: FlowNodeModel, input: any, processor: Processor) => InstructionResult;
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export type InstructionInterface = {
|
|
13
|
+
run: Runner;
|
|
14
|
+
resume?: Runner;
|
|
15
|
+
getScope?: (node: FlowNodeModel, data: any, processor: Processor) => any;
|
|
16
|
+
duplicateConfig?: (node: FlowNodeModel, options: Transactionable) => object | Promise<object>;
|
|
17
|
+
};
|
|
18
|
+
export declare abstract class Instruction implements InstructionInterface {
|
|
19
|
+
workflow: Plugin;
|
|
20
|
+
constructor(workflow: Plugin);
|
|
15
21
|
abstract run(node: FlowNodeModel, input: any, processor: Processor): InstructionResult;
|
|
16
|
-
resume?(node: FlowNodeModel, input: any, processor: Processor): InstructionResult;
|
|
17
|
-
getScope?(node: FlowNodeModel, data: any, processor: Processor): any;
|
|
18
|
-
duplicateConfig?(node: FlowNodeModel, options: Transactionable): object | Promise<object>;
|
|
19
22
|
}
|
|
20
23
|
export default Instruction;
|
|
@@ -22,8 +22,8 @@ __export(instructions_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(instructions_exports);
|
|
24
24
|
class Instruction {
|
|
25
|
-
constructor(
|
|
26
|
-
this.
|
|
25
|
+
constructor(workflow) {
|
|
26
|
+
this.workflow = workflow;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
var instructions_default = Instruction;
|
|
@@ -86,7 +86,7 @@ async function handler(workflow, data, options) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
const json = (0, import_utils.toJSON)(result);
|
|
89
|
-
this.
|
|
89
|
+
this.workflow.trigger(
|
|
90
90
|
workflow,
|
|
91
91
|
{ data: json },
|
|
92
92
|
{
|
|
@@ -97,7 +97,7 @@ async function handler(workflow, data, options) {
|
|
|
97
97
|
class CollectionTrigger extends import__.default {
|
|
98
98
|
events = /* @__PURE__ */ new Map();
|
|
99
99
|
on(workflow) {
|
|
100
|
-
const { db } = this.
|
|
100
|
+
const { db } = this.workflow.app;
|
|
101
101
|
const { collection, mode } = workflow.config;
|
|
102
102
|
const Collection2 = db.getCollection(collection);
|
|
103
103
|
if (!Collection2) {
|
|
@@ -122,7 +122,7 @@ class CollectionTrigger extends import__.default {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
off(workflow) {
|
|
125
|
-
const { db } = this.
|
|
125
|
+
const { db } = this.workflow.app;
|
|
126
126
|
const { collection, mode } = workflow.config;
|
|
127
127
|
const Collection2 = db.getCollection(collection);
|
|
128
128
|
if (!Collection2) {
|
|
@@ -94,7 +94,7 @@ ScheduleModes.set(SCHEDULE_MODE.CONSTANT, {
|
|
|
94
94
|
return 0;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
this.
|
|
97
|
+
this.workflow.trigger(workflow, { date: now });
|
|
98
98
|
return 1;
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -178,7 +178,7 @@ ScheduleModes.set(SCHEDULE_MODE.COLLECTION_FIELD, {
|
|
|
178
178
|
this.setCache(workflow);
|
|
179
179
|
};
|
|
180
180
|
this.events.set(name, listener);
|
|
181
|
-
this.
|
|
181
|
+
this.workflow.app.db.on(event, listener);
|
|
182
182
|
},
|
|
183
183
|
off(workflow) {
|
|
184
184
|
const { collection } = workflow.config;
|
|
@@ -187,11 +187,11 @@ ScheduleModes.set(SCHEDULE_MODE.COLLECTION_FIELD, {
|
|
|
187
187
|
if (this.events.has(name)) {
|
|
188
188
|
const listener = this.events.get(name);
|
|
189
189
|
this.events.delete(name);
|
|
190
|
-
this.
|
|
190
|
+
this.workflow.app.db.off(event, listener);
|
|
191
191
|
}
|
|
192
192
|
},
|
|
193
193
|
async shouldCache(workflow, now) {
|
|
194
|
-
const { db } = this.
|
|
194
|
+
const { db } = this.workflow.app;
|
|
195
195
|
const { startsOn, endsOn, repeat, collection } = workflow.config;
|
|
196
196
|
const timestamp = now.getTime();
|
|
197
197
|
const startTimestamp = getOnTimestampWithOffset(startsOn, now);
|
|
@@ -265,7 +265,7 @@ ScheduleModes.set(SCHEDULE_MODE.COLLECTION_FIELD, {
|
|
|
265
265
|
[import_database.Op.lt]: new Date(startTimestamp)
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
|
-
const tsFn = DialectTimestampFnMap[this.
|
|
268
|
+
const tsFn = DialectTimestampFnMap[this.workflow.app.db.options.dialect];
|
|
269
269
|
if (typeof repeat === "number" && tsFn) {
|
|
270
270
|
const modExp = (0, import_database.fn)(
|
|
271
271
|
"MOD",
|
|
@@ -298,7 +298,7 @@ ScheduleModes.set(SCHEDULE_MODE.COLLECTION_FIELD, {
|
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
const repo = this.
|
|
301
|
+
const repo = this.workflow.app.db.getRepository(collection);
|
|
302
302
|
const instances = await repo.find({
|
|
303
303
|
where: {
|
|
304
304
|
[import_database.Op.and]: conditions
|
|
@@ -309,7 +309,7 @@ ScheduleModes.set(SCHEDULE_MODE.COLLECTION_FIELD, {
|
|
|
309
309
|
} : {}
|
|
310
310
|
});
|
|
311
311
|
instances.forEach((item) => {
|
|
312
|
-
this.
|
|
312
|
+
this.workflow.trigger(workflow, {
|
|
313
313
|
date: now,
|
|
314
314
|
data: item.toJSON()
|
|
315
315
|
});
|
|
@@ -358,9 +358,9 @@ class ScheduleTrigger extends import__.default {
|
|
|
358
358
|
interval = 1e3;
|
|
359
359
|
// caching workflows in range, default to 1min
|
|
360
360
|
cacheCycle = 6e4;
|
|
361
|
-
constructor(
|
|
362
|
-
super(
|
|
363
|
-
|
|
361
|
+
constructor(workflow) {
|
|
362
|
+
super(workflow);
|
|
363
|
+
workflow.app.on("beforeStop", () => {
|
|
364
364
|
if (this.timer) {
|
|
365
365
|
clearInterval(this.timer);
|
|
366
366
|
}
|
|
@@ -368,7 +368,7 @@ class ScheduleTrigger extends import__.default {
|
|
|
368
368
|
}
|
|
369
369
|
init() {
|
|
370
370
|
var _a;
|
|
371
|
-
if (((_a = this.
|
|
371
|
+
if (((_a = this.workflow.app.getPlugin("multi-app-share-collection")) == null ? void 0 : _a.enabled) && this.workflow.app.name !== "main") {
|
|
372
372
|
return;
|
|
373
373
|
}
|
|
374
374
|
if (this.timer) {
|
|
@@ -395,7 +395,7 @@ class ScheduleTrigger extends import__.default {
|
|
|
395
395
|
this.timer = setTimeout(this.run, nextInterval);
|
|
396
396
|
};
|
|
397
397
|
async onTick(now) {
|
|
398
|
-
const isSqlite = this.
|
|
398
|
+
const isSqlite = this.workflow.app.db.options.dialect === "sqlite";
|
|
399
399
|
return Array.from(this.cache.values()).reduce(
|
|
400
400
|
(prev, workflow) => {
|
|
401
401
|
if (!this.shouldTrigger(workflow, now)) {
|
|
@@ -411,7 +411,7 @@ class ScheduleTrigger extends import__.default {
|
|
|
411
411
|
);
|
|
412
412
|
}
|
|
413
413
|
async reload() {
|
|
414
|
-
const WorkflowRepo = this.
|
|
414
|
+
const WorkflowRepo = this.workflow.app.db.getRepository("workflows");
|
|
415
415
|
const workflows = await WorkflowRepo.find({
|
|
416
416
|
filter: { enabled: true, type: "schedule" }
|
|
417
417
|
});
|
|
@@ -424,7 +424,7 @@ class ScheduleTrigger extends import__.default {
|
|
|
424
424
|
workflows.forEach(async (workflow) => {
|
|
425
425
|
const should = await this.shouldCache(workflow, now);
|
|
426
426
|
if (should) {
|
|
427
|
-
this.
|
|
427
|
+
this.workflow.getLogger(workflow.id).info("caching scheduled workflow will run in next minute");
|
|
428
428
|
}
|
|
429
429
|
this.setCache(workflow, !should);
|
|
430
430
|
});
|
|
@@ -2,8 +2,8 @@ import { Transactionable } from '@nocobase/database';
|
|
|
2
2
|
import type Plugin from '../Plugin';
|
|
3
3
|
import type { WorkflowModel } from '../types';
|
|
4
4
|
export declare abstract class Trigger {
|
|
5
|
-
readonly
|
|
6
|
-
constructor(
|
|
5
|
+
readonly workflow: Plugin;
|
|
6
|
+
constructor(workflow: Plugin);
|
|
7
7
|
abstract on(workflow: WorkflowModel): void;
|
|
8
8
|
abstract off(workflow: WorkflowModel): void;
|
|
9
9
|
duplicateConfig?(workflow: WorkflowModel, options: Transactionable): object | Promise<object>;
|
|
@@ -22,8 +22,8 @@ __export(triggers_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(triggers_exports);
|
|
24
24
|
class Trigger {
|
|
25
|
-
constructor(
|
|
26
|
-
this.
|
|
25
|
+
constructor(workflow) {
|
|
26
|
+
this.workflow = workflow;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
var triggers_default = Trigger;
|
package/package.json
CHANGED
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful workflow plugin designed to support business process management and automation.",
|
|
6
6
|
"description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
|
|
7
|
-
"version": "0.18.0-alpha.
|
|
7
|
+
"version": "0.18.0-alpha.8",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@nocobase/plugin-workflow-test": "0.18.0-alpha.8"
|
|
12
|
+
},
|
|
10
13
|
"devDependencies": {
|
|
11
14
|
"@ant-design/icons": "5.x",
|
|
12
15
|
"@formily/antd-v5": "1.x",
|
|
@@ -24,8 +27,7 @@
|
|
|
24
27
|
"react-i18next": "^11.15.1",
|
|
25
28
|
"react-js-cron": "^3.1.0",
|
|
26
29
|
"react-router-dom": "^6.11.2",
|
|
27
|
-
"sequelize": "^6.26.0"
|
|
28
|
-
"winston": "^3.8.2"
|
|
30
|
+
"sequelize": "^6.26.0"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
33
|
"@nocobase/actions": "0.x",
|
|
@@ -36,11 +38,10 @@
|
|
|
36
38
|
"@nocobase/plugin-collection-manager": "0.x",
|
|
37
39
|
"@nocobase/plugin-error-handler": "0.x",
|
|
38
40
|
"@nocobase/plugin-users": "0.x",
|
|
39
|
-
"@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
|
|
40
41
|
"@nocobase/resourcer": "0.x",
|
|
41
42
|
"@nocobase/server": "0.x",
|
|
42
43
|
"@nocobase/test": "0.x",
|
|
43
44
|
"@nocobase/utils": "0.x"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "727d42f6f14e5f863831da3dbf3255ba1165b567"
|
|
46
47
|
}
|