@nocobase/plugin-workflow 0.17.0-alpha.3 → 0.17.0-alpha.4

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 (118) hide show
  1. package/dist/client/WorkflowPane.d.ts +2 -0
  2. package/dist/client/components/index.d.ts +5 -0
  3. package/dist/client/hooks/useTriggerWorkflowActionProps.d.ts +3 -0
  4. package/dist/client/index.d.ts +14 -6
  5. package/dist/client/index.js +136 -186
  6. package/dist/client/nodes/calculation.d.ts +8 -62
  7. package/dist/client/nodes/condition.d.ts +9 -9
  8. package/dist/client/nodes/create.d.ts +3 -5
  9. package/dist/client/nodes/destroy.d.ts +3 -4
  10. package/dist/client/nodes/index.d.ts +2 -6
  11. package/dist/client/nodes/query.d.ts +3 -5
  12. package/dist/client/nodes/update.d.ts +4 -4
  13. package/dist/client/triggers/collection.d.ts +3 -4
  14. package/dist/client/triggers/index.d.ts +2 -11
  15. package/dist/client/triggers/schedule/index.d.ts +3 -4
  16. package/dist/client/utils.d.ts +1 -0
  17. package/dist/externalVersion.js +11 -13
  18. package/dist/locale/en-US.json +1 -32
  19. package/dist/locale/es-ES.json +1 -32
  20. package/dist/locale/fr-FR.json +1 -32
  21. package/dist/locale/ja-JP.json +0 -5
  22. package/dist/locale/pt-BR.json +1 -32
  23. package/dist/locale/ru-RU.json +0 -5
  24. package/dist/locale/tr-TR.json +0 -5
  25. package/dist/locale/zh-CN.json +42 -114
  26. package/dist/node_modules/cron-parser/package.json +1 -1
  27. package/dist/node_modules/lru-cache/package.json +1 -1
  28. package/dist/server/Plugin.d.ts +12 -2
  29. package/dist/server/Plugin.js +31 -7
  30. package/dist/server/Processor.d.ts +1 -1
  31. package/dist/server/index.d.ts +1 -1
  32. package/dist/server/index.js +2 -0
  33. package/dist/server/instructions/CalculationInstruction.d.ts +15 -0
  34. package/dist/server/instructions/{calculation.js → CalculationInstruction.js} +13 -6
  35. package/dist/server/instructions/ConditionInstruction.d.ts +19 -0
  36. package/dist/server/instructions/{condition.js → ConditionInstruction.js} +11 -7
  37. package/dist/server/instructions/CreateInstruction.d.ts +10 -0
  38. package/dist/server/instructions/{create.js → CreateInstruction.js} +13 -6
  39. package/dist/server/instructions/DestroyInstruction.d.ts +10 -0
  40. package/dist/server/instructions/{destroy.js → DestroyInstruction.js} +13 -6
  41. package/dist/server/instructions/{update.d.ts → QueryInstruction.d.ts} +5 -4
  42. package/dist/server/instructions/{query.js → QueryInstruction.js} +13 -6
  43. package/dist/server/instructions/{aggregate.d.ts → UpdateInstruction.d.ts} +5 -4
  44. package/dist/server/instructions/{update.js → UpdateInstruction.js} +13 -6
  45. package/dist/server/instructions/index.d.ts +10 -14
  46. package/dist/server/instructions/index.js +9 -39
  47. package/dist/server/migrations/20231122143143-split-to-plugins.d.ts +4 -0
  48. package/dist/server/migrations/20231122143143-split-to-plugins.js +87 -0
  49. package/dist/server/triggers/{collection.d.ts → CollectionTrigger.d.ts} +1 -1
  50. package/dist/server/triggers/{collection.js → CollectionTrigger.js} +15 -5
  51. package/dist/server/triggers/{schedule.d.ts → ScheduleTrigger.d.ts} +2 -1
  52. package/dist/server/triggers/{schedule.js → ScheduleTrigger.js} +5 -5
  53. package/dist/server/triggers/index.d.ts +2 -6
  54. package/dist/server/triggers/index.js +1 -21
  55. package/package.json +3 -2
  56. package/dist/client/WorkflowProvider.d.ts +0 -5
  57. package/dist/client/components/Duration.d.ts +0 -5
  58. package/dist/client/components/DynamicExpression.d.ts +0 -6
  59. package/dist/client/components/NullRender.d.ts +0 -1
  60. package/dist/client/interfaces/expression.d.ts +0 -3
  61. package/dist/client/nodes/aggregate.d.ts +0 -196
  62. package/dist/client/nodes/delay.d.ts +0 -35
  63. package/dist/client/nodes/loop.d.ts +0 -33
  64. package/dist/client/nodes/manual/AssigneesSelect.d.ts +0 -6
  65. package/dist/client/nodes/manual/DetailsBlockProvider.d.ts +0 -2
  66. package/dist/client/nodes/manual/FormBlockInitializer.d.ts +0 -2
  67. package/dist/client/nodes/manual/FormBlockProvider.d.ts +0 -2
  68. package/dist/client/nodes/manual/ModeConfig.d.ts +0 -5
  69. package/dist/client/nodes/manual/SchemaConfig.d.ts +0 -49
  70. package/dist/client/nodes/manual/WorkflowTodo.d.ts +0 -5
  71. package/dist/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +0 -2
  72. package/dist/client/nodes/manual/forms/create.d.ts +0 -3
  73. package/dist/client/nodes/manual/forms/custom.d.ts +0 -5
  74. package/dist/client/nodes/manual/forms/update.d.ts +0 -3
  75. package/dist/client/nodes/manual/index.d.ts +0 -86
  76. package/dist/client/nodes/manual/utils.d.ts +0 -2
  77. package/dist/client/nodes/parallel.d.ts +0 -32
  78. package/dist/client/nodes/request.d.ts +0 -183
  79. package/dist/client/nodes/sql.d.ts +0 -35
  80. package/dist/client/triggers/form.d.ts +0 -52
  81. package/dist/server/fields/expression-field.d.ts +0 -7
  82. package/dist/server/fields/expression-field.js +0 -32
  83. package/dist/server/fields/index.d.ts +0 -1
  84. package/dist/server/fields/index.js +0 -28
  85. package/dist/server/instructions/aggregate.js +0 -54
  86. package/dist/server/instructions/calculation.d.ts +0 -3
  87. package/dist/server/instructions/condition.d.ts +0 -6
  88. package/dist/server/instructions/create.d.ts +0 -8
  89. package/dist/server/instructions/delay.d.ts +0 -15
  90. package/dist/server/instructions/delay.js +0 -104
  91. package/dist/server/instructions/destroy.d.ts +0 -8
  92. package/dist/server/instructions/loop.d.ts +0 -15
  93. package/dist/server/instructions/loop.js +0 -94
  94. package/dist/server/instructions/manual/actions.d.ts +0 -2
  95. package/dist/server/instructions/manual/actions.js +0 -94
  96. package/dist/server/instructions/manual/collecions/jobs.d.ts +0 -19
  97. package/dist/server/instructions/manual/collecions/jobs.js +0 -39
  98. package/dist/server/instructions/manual/collecions/users.d.ts +0 -15
  99. package/dist/server/instructions/manual/collecions/users.js +0 -37
  100. package/dist/server/instructions/manual/collecions/users_jobs.d.ts +0 -3
  101. package/dist/server/instructions/manual/collecions/users_jobs.js +0 -70
  102. package/dist/server/instructions/manual/forms/create.d.ts +0 -5
  103. package/dist/server/instructions/manual/forms/create.js +0 -41
  104. package/dist/server/instructions/manual/forms/index.d.ts +0 -6
  105. package/dist/server/instructions/manual/forms/index.js +0 -38
  106. package/dist/server/instructions/manual/forms/update.d.ts +0 -6
  107. package/dist/server/instructions/manual/forms/update.js +0 -41
  108. package/dist/server/instructions/manual/index.d.ts +0 -29
  109. package/dist/server/instructions/manual/index.js +0 -179
  110. package/dist/server/instructions/parallel.d.ts +0 -12
  111. package/dist/server/instructions/parallel.js +0 -124
  112. package/dist/server/instructions/query.d.ts +0 -9
  113. package/dist/server/instructions/request.d.ts +0 -18
  114. package/dist/server/instructions/request.js +0 -92
  115. package/dist/server/instructions/sql.d.ts +0 -12
  116. package/dist/server/instructions/sql.js +0 -43
  117. package/dist/server/triggers/form.d.ts +0 -11
  118. package/dist/server/triggers/form.js +0 -116
@@ -1,9 +1,10 @@
1
- import Processor from '../Processor';
1
+ import type Processor from '../Processor';
2
2
  import type { FlowNodeModel } from '../types';
3
- declare const _default: {
3
+ import { Instruction } from '.';
4
+ export declare class QueryInstruction extends Instruction {
4
5
  run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
5
6
  result: any;
6
7
  status: number;
7
8
  }>;
8
- };
9
- export default _default;
9
+ }
10
+ export default QueryInstruction;
@@ -15,15 +15,17 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var query_exports = {};
19
- __export(query_exports, {
20
- default: () => query_default
18
+ var QueryInstruction_exports = {};
19
+ __export(QueryInstruction_exports, {
20
+ QueryInstruction: () => QueryInstruction,
21
+ default: () => QueryInstruction_default
21
22
  });
22
- module.exports = __toCommonJS(query_exports);
23
+ module.exports = __toCommonJS(QueryInstruction_exports);
23
24
  var import_actions = require("@nocobase/actions");
24
25
  var import_constants = require("../constants");
25
26
  var import_utils = require("../utils");
26
- var query_default = {
27
+ var import__ = require(".");
28
+ class QueryInstruction extends import__.Instruction {
27
29
  async run(node, input, processor) {
28
30
  const { collection, multiple, params = {}, failOnEmpty = false } = node.config;
29
31
  const repo = node.constructor.database.getRepository(collection);
@@ -61,4 +63,9 @@ var query_default = {
61
63
  status: import_constants.JOB_STATUS.RESOLVED
62
64
  };
63
65
  }
64
- };
66
+ }
67
+ var QueryInstruction_default = QueryInstruction;
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ QueryInstruction
71
+ });
@@ -1,9 +1,10 @@
1
- import Processor from '../Processor';
1
+ import type Processor from '../Processor';
2
2
  import type { FlowNodeModel } from '../types';
3
- declare const _default: {
3
+ import { Instruction } from '.';
4
+ export declare class UpdateInstruction extends Instruction {
4
5
  run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
5
6
  result: any;
6
7
  status: number;
7
8
  }>;
8
- };
9
- export default _default;
9
+ }
10
+ export default UpdateInstruction;
@@ -15,13 +15,15 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var update_exports = {};
19
- __export(update_exports, {
20
- default: () => update_default
18
+ var UpdateInstruction_exports = {};
19
+ __export(UpdateInstruction_exports, {
20
+ UpdateInstruction: () => UpdateInstruction,
21
+ default: () => UpdateInstruction_default
21
22
  });
22
- module.exports = __toCommonJS(update_exports);
23
+ module.exports = __toCommonJS(UpdateInstruction_exports);
23
24
  var import_constants = require("../constants");
24
- var update_default = {
25
+ var import__ = require(".");
26
+ class UpdateInstruction extends import__.Instruction {
25
27
  async run(node, input, processor) {
26
28
  const { collection, params = {} } = node.config;
27
29
  const repo = node.constructor.database.getRepository(collection);
@@ -38,4 +40,9 @@ var update_default = {
38
40
  status: import_constants.JOB_STATUS.RESOLVED
39
41
  };
40
42
  }
41
- };
43
+ }
44
+ var UpdateInstruction_default = UpdateInstruction;
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ UpdateInstruction
48
+ });
@@ -1,6 +1,6 @@
1
1
  import { Transactionable } from '@nocobase/database';
2
- import Plugin from '..';
3
- import Processor from '../Processor';
2
+ import type Plugin from '../Plugin';
3
+ import type Processor from '../Processor';
4
4
  import type { FlowNodeModel } from '../types';
5
5
  export interface IJob {
6
6
  status: number;
@@ -9,16 +9,12 @@ 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 interface Instruction {
13
- run: Runner;
14
- resume?: Runner;
15
- getScope?: (node: FlowNodeModel, data: any, processor: Processor) => any;
16
- duplicateConfig?: (node: FlowNodeModel, options: Transactionable) => object | Promise<object>;
12
+ export declare abstract class Instruction {
13
+ plugin: Plugin;
14
+ constructor(plugin: Plugin);
15
+ 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>;
17
19
  }
18
- type InstructionConstructor<T> = {
19
- new (p: Plugin): T;
20
- };
21
- export default function <T extends Instruction>(plugin: any, more?: {
22
- [key: string]: T | InstructionConstructor<T>;
23
- }): void;
24
- export {};
20
+ export default Instruction;
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,48 +14,20 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
  var instructions_exports = {};
29
19
  __export(instructions_exports, {
20
+ Instruction: () => Instruction,
30
21
  default: () => instructions_default
31
22
  });
32
23
  module.exports = __toCommonJS(instructions_exports);
33
- var import_path = __toESM(require("path"));
34
- var import_utils = require("@nocobase/utils");
35
- function instructions_default(plugin, more = {}) {
36
- const { instructions } = plugin;
37
- const natives = [
38
- "calculation",
39
- "condition",
40
- "parallel",
41
- "loop",
42
- "delay",
43
- "manual",
44
- "query",
45
- "create",
46
- "update",
47
- "destroy",
48
- "aggregate",
49
- "request",
50
- "sql"
51
- ].reduce(
52
- (result, key) => Object.assign(result, {
53
- [key]: (0, import_utils.requireModule)(import_path.default.isAbsolute(key) ? key : import_path.default.join(__dirname, key))
54
- }),
55
- {}
56
- );
57
- for (const [name, instruction] of Object.entries({ ...more, ...natives })) {
58
- instructions.register(
59
- name,
60
- typeof instruction === "function" ? new instruction(plugin) : instruction
61
- );
24
+ class Instruction {
25
+ constructor(plugin) {
26
+ this.plugin = plugin;
62
27
  }
63
28
  }
29
+ var instructions_default = Instruction;
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ Instruction
33
+ });
@@ -0,0 +1,4 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class extends Migration {
3
+ up(): Promise<void>;
4
+ }
@@ -0,0 +1,87 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var split_to_plugins_exports = {};
19
+ __export(split_to_plugins_exports, {
20
+ default: () => split_to_plugins_default
21
+ });
22
+ module.exports = __toCommonJS(split_to_plugins_exports);
23
+ var import_server = require("@nocobase/server");
24
+ class split_to_plugins_default extends import_server.Migration {
25
+ async up() {
26
+ const match = await this.app.version.satisfies("<0.17.0-alpha.4");
27
+ if (!match) {
28
+ return;
29
+ }
30
+ const { db } = this.context;
31
+ const PluginModel = db.getModel("applicationPlugins");
32
+ const NodeRepo = db.getRepository("flow_nodes");
33
+ await db.sequelize.transaction(async (transaction) => {
34
+ await [
35
+ "@nocobase/plugin-workflow-aggregate",
36
+ "@nocobase/plugin-workflow-delay",
37
+ "@nocobase/plugin-workflow-dynamic-calculation",
38
+ "@nocobase/plugin-workflow-loop",
39
+ "@nocobase/plugin-workflow-manual",
40
+ "@nocobase/plugin-workflow-parallel",
41
+ "@nocobase/plugin-workflow-request",
42
+ "@nocobase/plugin-workflow-sql",
43
+ "@nocobase/plugin-workflow-form-trigger"
44
+ ].reduce(
45
+ (promise, packageName) => promise.then(async () => {
46
+ const existed = await PluginModel.findOne({ where: { packageName }, transaction });
47
+ if (!existed) {
48
+ await PluginModel.create(
49
+ {
50
+ name: packageName,
51
+ packageName,
52
+ version: "0.17.0-alpha.1",
53
+ enabled: true,
54
+ installed: true,
55
+ builtin: true
56
+ },
57
+ { transaction }
58
+ );
59
+ }
60
+ }),
61
+ Promise.resolve()
62
+ );
63
+ const nodes = await NodeRepo.find({
64
+ transaction
65
+ });
66
+ await nodes.reduce(
67
+ (promise, node) => promise.then(() => {
68
+ if (node.type === "calculation" && node.config.dynamic) {
69
+ node.set({
70
+ type: "dynamic-calculation",
71
+ config: {
72
+ expression: node.config.dynamic,
73
+ scope: node.config.scope
74
+ }
75
+ });
76
+ node.changed("config", true);
77
+ }
78
+ return node.save({
79
+ silent: true,
80
+ transaction
81
+ });
82
+ }),
83
+ Promise.resolve()
84
+ );
85
+ });
86
+ }
87
+ }
@@ -1,4 +1,4 @@
1
- import { Trigger } from '..';
1
+ import Trigger from '.';
2
2
  import type { WorkflowModel } from '../types';
3
3
  export interface CollectionChangeTriggerConfig {
4
4
  collection: string;
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,13 +16,21 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var collection_exports = {};
19
- __export(collection_exports, {
28
+ var CollectionTrigger_exports = {};
29
+ __export(CollectionTrigger_exports, {
20
30
  default: () => CollectionTrigger
21
31
  });
22
- module.exports = __toCommonJS(collection_exports);
23
- var import__ = require("..");
32
+ module.exports = __toCommonJS(CollectionTrigger_exports);
33
+ var import__ = __toESM(require("."));
24
34
  var import_utils = require("../utils");
25
35
  const MODE_BITMAP = {
26
36
  CREATE: 1,
@@ -84,7 +94,7 @@ async function handler(workflow, data, options) {
84
94
  }
85
95
  );
86
96
  }
87
- class CollectionTrigger extends import__.Trigger {
97
+ class CollectionTrigger extends import__.default {
88
98
  events = /* @__PURE__ */ new Map();
89
99
  on(workflow) {
90
100
  const { db } = this.plugin.app;
@@ -1,4 +1,5 @@
1
- import Plugin, { Trigger } from '..';
1
+ import type Plugin from '../Plugin';
2
+ import Trigger from '.';
2
3
  export type ScheduleOnField = string | {
3
4
  field: string;
4
5
  offset?: number;
@@ -25,15 +25,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var schedule_exports = {};
29
- __export(schedule_exports, {
28
+ var ScheduleTrigger_exports = {};
29
+ __export(ScheduleTrigger_exports, {
30
30
  SCHEDULE_MODE: () => SCHEDULE_MODE,
31
31
  default: () => ScheduleTrigger
32
32
  });
33
- module.exports = __toCommonJS(schedule_exports);
33
+ module.exports = __toCommonJS(ScheduleTrigger_exports);
34
34
  var import_database = require("@nocobase/database");
35
35
  var import_cron_parser = __toESM(require("cron-parser"));
36
- var import__ = require("..");
36
+ var import__ = __toESM(require("."));
37
37
  const SCHEDULE_MODE = {
38
38
  CONSTANT: 0,
39
39
  COLLECTION_FIELD: 1
@@ -332,7 +332,7 @@ function matchNext(workflow, now, range = this.cacheCycle) {
332
332
  }
333
333
  return false;
334
334
  }
335
- class ScheduleTrigger extends import__.Trigger {
335
+ class ScheduleTrigger extends import__.default {
336
336
  static CacheRules = [
337
337
  ({ config, allExecuted }) => (config.limit ? allExecuted < config.limit : true) && config.startsOn,
338
338
  matchNext,
@@ -1,5 +1,5 @@
1
1
  import { Transactionable } from '@nocobase/database';
2
- import Plugin from '..';
2
+ import type Plugin from '../Plugin';
3
3
  import type { WorkflowModel } from '../types';
4
4
  export declare abstract class Trigger {
5
5
  readonly plugin: Plugin;
@@ -8,8 +8,4 @@ export declare abstract class Trigger {
8
8
  abstract off(workflow: WorkflowModel): void;
9
9
  duplicateConfig?(workflow: WorkflowModel, options: Transactionable): object | Promise<object>;
10
10
  }
11
- export default function <T extends Trigger>(plugin: any, more?: {
12
- [key: string]: {
13
- new (p: Plugin): T;
14
- };
15
- }): void;
11
+ export default Trigger;
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
  var triggers_exports = {};
29
19
  __export(triggers_exports, {
@@ -31,22 +21,12 @@ __export(triggers_exports, {
31
21
  default: () => triggers_default
32
22
  });
33
23
  module.exports = __toCommonJS(triggers_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_utils = require("@nocobase/utils");
36
24
  class Trigger {
37
25
  constructor(plugin) {
38
26
  this.plugin = plugin;
39
27
  }
40
28
  }
41
- function triggers_default(plugin, more = {}) {
42
- const { triggers } = plugin;
43
- triggers.register("collection", new ((0, import_utils.requireModule)(import_path.default.join(__dirname, "collection")))(plugin));
44
- triggers.register("form", new ((0, import_utils.requireModule)(import_path.default.join(__dirname, "form")))(plugin));
45
- triggers.register("schedule", new ((0, import_utils.requireModule)(import_path.default.join(__dirname, "schedule")))(plugin));
46
- for (const [name, TClass] of Object.entries(more)) {
47
- triggers.register(name, new TClass(plugin));
48
- }
49
- }
29
+ var triggers_default = Trigger;
50
30
  // Annotate the CommonJS export names for ESM import in node:
51
31
  0 && (module.exports = {
52
32
  Trigger
package/package.json CHANGED
@@ -4,7 +4,7 @@
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.17.0-alpha.3",
7
+ "version": "0.17.0-alpha.4",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "devDependencies": {
@@ -36,10 +36,11 @@
36
36
  "@nocobase/plugin-collection-manager": "0.x",
37
37
  "@nocobase/plugin-error-handler": "0.x",
38
38
  "@nocobase/plugin-users": "0.x",
39
+ "@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
39
40
  "@nocobase/resourcer": "0.x",
40
41
  "@nocobase/server": "0.x",
41
42
  "@nocobase/test": "0.x",
42
43
  "@nocobase/utils": "0.x"
43
44
  },
44
- "gitHead": "8fb3aace819722ceb845ea63ec3009f324a897a9"
45
+ "gitHead": "663b03a3799a70ba1a2bc6a0d686e679331a50ad"
45
46
  }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const WorkflowContext: React.Context<{}>;
3
- export declare function useWorkflowContext(): {};
4
- export declare function WorkflowPane(): React.JSX.Element;
5
- export declare const WorkflowProvider: (props: any) => React.JSX.Element;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export default function ({ value, onChange }: {
3
- value?: number;
4
- onChange: any;
5
- }): React.JSX.Element;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export declare const DynamicExpression: React.ForwardRefExoticComponent<Omit<Partial<Omit<{
3
- children?: React.ReactNode;
4
- }, string | number | symbol> & Omit<any, "ref"> & {
5
- children?: React.ReactNode;
6
- }>, "ref"> & React.RefAttributes<unknown>>;
@@ -1 +0,0 @@
1
- export declare function NullRender(): any;
@@ -1,3 +0,0 @@
1
- import { IField } from '@nocobase/client';
2
- declare const _default: IField;
3
- export default _default;