@tachybase/module-workflow 1.3.21 → 1.3.23

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 (137) hide show
  1. package/dist/client/Plugin.d.ts +3 -3
  2. package/dist/client/features/dynamic-calculation/expression.d.ts +1 -0
  3. package/dist/client/features/interceptor/WorkflowTriggerInterceptor.d.ts +1 -1
  4. package/dist/client/features/js-parse/JSParse.instruction.d.ts +3 -3
  5. package/dist/client/features/json-parse/JSONParse.instruction.d.ts +3 -3
  6. package/dist/client/features/manual/instruction/SchemaConfig.d.ts +1 -1
  7. package/dist/client/features/manual/instruction/createManualFormBlockUISchema.d.ts +11 -11
  8. package/dist/client/features/notice/configuration/Notice.instruction.d.ts +2 -2
  9. package/dist/client/features/request/RequestInstruction.d.ts +2 -2
  10. package/dist/client/features/script/Script.instruction.d.ts +3 -3
  11. package/dist/client/index.js +52 -53
  12. package/dist/client/nodes/calculation.d.ts +2 -1
  13. package/dist/client/nodes/condition.d.ts +2 -2
  14. package/dist/client/nodes/create.d.ts +1 -1
  15. package/dist/client/nodes/query.d.ts +1 -1
  16. package/dist/client/triggers/collection.d.ts +1 -1
  17. package/dist/externalVersion.js +10 -16
  18. package/dist/node_modules/@babel/core/node_modules/.bin/json5 +2 -2
  19. package/dist/node_modules/@babel/core/node_modules/.bin/parser +2 -2
  20. package/dist/node_modules/@babel/core/node_modules/.bin/semver +2 -2
  21. package/dist/node_modules/@babel/core/package.json +1 -1
  22. package/dist/node_modules/@babel/preset-env/node_modules/.bin/semver +2 -2
  23. package/dist/node_modules/@babel/preset-env/package.json +1 -1
  24. package/dist/node_modules/@babel/preset-react/package.json +1 -1
  25. package/dist/node_modules/@babel/preset-typescript/package.json +1 -1
  26. package/dist/node_modules/cron-parser/package.json +1 -1
  27. package/dist/node_modules/form-data/package.json +1 -1
  28. package/dist/node_modules/jsonata/package.json +1 -1
  29. package/dist/node_modules/lru-cache/package.json +1 -1
  30. package/dist/node_modules/mime-types/index.js +3 -3
  31. package/dist/node_modules/mime-types/mimeScore.js +52 -0
  32. package/dist/node_modules/mime-types/package.json +1 -1
  33. package/dist/node_modules/qrcode/package.json +1 -1
  34. package/dist/server/Plugin.d.ts +1 -4
  35. package/dist/server/Plugin.js +8 -10
  36. package/dist/server/Processor.d.ts +1 -2
  37. package/dist/server/Processor.js +5 -7
  38. package/dist/server/actions/executions.d.ts +1 -1
  39. package/dist/server/actions/executions.js +4 -5
  40. package/dist/server/actions/nodes.d.ts +1 -1
  41. package/dist/server/actions/nodes.js +33 -25
  42. package/dist/server/actions/workflows.d.ts +1 -1
  43. package/dist/server/actions/workflows.js +11 -12
  44. package/dist/server/collections/1-users_jobs.d.ts +1 -1
  45. package/dist/server/collections/1-users_jobs.js +2 -2
  46. package/dist/server/collections/2-jobs.d.ts +1 -1
  47. package/dist/server/collections/2-jobs.js +2 -2
  48. package/dist/server/collections/3-users.d.ts +1 -1
  49. package/dist/server/collections/3-users.js +2 -2
  50. package/dist/server/collections/executions.d.ts +1 -1
  51. package/dist/server/collections/flow_nodes.d.ts +1 -1
  52. package/dist/server/collections/jobs.d.ts +1 -1
  53. package/dist/server/collections/workflowCategories.d.ts +1 -1
  54. package/dist/server/collections/workflows.d.ts +1 -1
  55. package/dist/server/features/_deprecated-js-parse/plugin.d.ts +1 -1
  56. package/dist/server/features/_deprecated-js-parse/plugin.js +1 -1
  57. package/dist/server/features/_deprecated-json-parse/plugin.d.ts +1 -1
  58. package/dist/server/features/_deprecated-json-parse/plugin.js +1 -1
  59. package/dist/server/features/aggregate/AggregateInstruction.js +4 -5
  60. package/dist/server/features/aggregate/Plugin.d.ts +1 -1
  61. package/dist/server/features/aggregate/Plugin.js +1 -1
  62. package/dist/server/features/delay/Plugin.d.ts +1 -1
  63. package/dist/server/features/delay/Plugin.js +1 -1
  64. package/dist/server/features/dynamic-calculation/DynamicCalculation.js +4 -15
  65. package/dist/server/features/dynamic-calculation/Plugin.d.ts +1 -1
  66. package/dist/server/features/dynamic-calculation/Plugin.js +1 -1
  67. package/dist/server/features/dynamic-calculation/expression-field.d.ts +1 -1
  68. package/dist/server/features/dynamic-calculation/expression-field.js +3 -3
  69. package/dist/server/features/interception/RequestInterceptionTrigger.d.ts +1 -1
  70. package/dist/server/features/interception/RequestInterceptionTrigger.js +2 -2
  71. package/dist/server/features/interception/index.d.ts +1 -1
  72. package/dist/server/features/interception/index.js +1 -1
  73. package/dist/server/features/loop/Plugin.d.ts +1 -1
  74. package/dist/server/features/loop/Plugin.js +1 -1
  75. package/dist/server/features/manual/ManualInstruction.d.ts +1 -1
  76. package/dist/server/features/manual/ManualInstruction.js +2 -2
  77. package/dist/server/features/manual/Plugin.d.ts +1 -1
  78. package/dist/server/features/manual/Plugin.js +4 -5
  79. package/dist/server/features/manual/actions.d.ts +1 -1
  80. package/dist/server/features/manual/actions.js +2 -2
  81. package/dist/server/features/notice/NoticeInstruction.js +2 -2
  82. package/dist/server/features/notice/actions.js +4 -14
  83. package/dist/server/features/notice/collections/workflowNotice.d.ts +1 -1
  84. package/dist/server/features/notice/collections/workflowNotice.js +2 -2
  85. package/dist/server/features/notice/plugin.d.ts +1 -1
  86. package/dist/server/features/notice/plugin.js +4 -4
  87. package/dist/server/features/omni-trigger/CustomActionTrigger.d.ts +1 -1
  88. package/dist/server/features/omni-trigger/CustomActionTrigger.js +6 -7
  89. package/dist/server/features/omni-trigger/Plugin.d.ts +1 -1
  90. package/dist/server/features/omni-trigger/Plugin.js +1 -1
  91. package/dist/server/features/parallel/Plugin.d.ts +1 -1
  92. package/dist/server/features/parallel/Plugin.js +1 -1
  93. package/dist/server/features/request/Plugin.d.ts +1 -1
  94. package/dist/server/features/request/Plugin.js +1 -1
  95. package/dist/server/features/request/RequestInstruction.js +10 -11
  96. package/dist/server/features/response/Plugin.d.ts +1 -1
  97. package/dist/server/features/response/Plugin.js +1 -1
  98. package/dist/server/features/script/plugin.d.ts +1 -1
  99. package/dist/server/features/script/plugin.js +1 -1
  100. package/dist/server/features/script/script.instruction.js +2 -2
  101. package/dist/server/features/sql/Plugin.d.ts +1 -1
  102. package/dist/server/features/sql/Plugin.js +1 -1
  103. package/dist/server/features/trigger-instruction/flownode-check.d.ts +1 -1
  104. package/dist/server/features/trigger-instruction/plugin.d.ts +1 -1
  105. package/dist/server/features/trigger-instruction/plugin.js +1 -1
  106. package/dist/server/features/variables/Plugin.d.ts +1 -1
  107. package/dist/server/features/variables/Plugin.js +1 -1
  108. package/dist/server/instructions/CalculationInstruction.js +3 -3
  109. package/dist/server/instructions/ConditionInstruction.d.ts +1 -1
  110. package/dist/server/instructions/ConditionInstruction.js +3 -4
  111. package/dist/server/instructions/CreateInstruction.js +7 -9
  112. package/dist/server/instructions/DestroyInstruction.js +2 -2
  113. package/dist/server/instructions/QueryInstruction.js +3 -4
  114. package/dist/server/instructions/UpdateInstruction.js +5 -7
  115. package/dist/server/instructions/UpdateOrCreateInstruction.js +7 -9
  116. package/dist/server/instructions/index.d.ts +1 -1
  117. package/dist/server/migrations/20241118104303-add-initAt.d.ts +1 -1
  118. package/dist/server/migrations/20241118104303-add-initAt.js +1 -1
  119. package/dist/server/migrations/20241206122842-add-createdBy.d.ts +1 -1
  120. package/dist/server/migrations/20241206122842-add-createdBy.js +1 -1
  121. package/dist/server/migrations/20241220001154-bigInt.d.ts +1 -1
  122. package/dist/server/migrations/20241220001154-bigInt.js +1 -1
  123. package/dist/server/triggers/CollectionTrigger.d.ts +1 -1
  124. package/dist/server/triggers/CollectionTrigger.js +4 -4
  125. package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.d.ts +2 -2
  126. package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +12 -13
  127. package/dist/server/triggers/index.d.ts +1 -1
  128. package/dist/server/types/Execution.d.ts +1 -1
  129. package/dist/server/types/Execution.js +2 -2
  130. package/dist/server/types/FlowNode.d.ts +1 -1
  131. package/dist/server/types/FlowNode.js +2 -2
  132. package/dist/server/types/Job.d.ts +1 -1
  133. package/dist/server/types/Job.js +2 -2
  134. package/dist/server/types/Workflow.d.ts +1 -1
  135. package/dist/server/types/Workflow.js +2 -2
  136. package/dist/server/utils.js +2 -2
  137. package/package.json +17 -27
@@ -21,7 +21,7 @@ __export(CalculationInstruction_exports, {
21
21
  default: () => CalculationInstruction_default
22
22
  });
23
23
  module.exports = __toCommonJS(CalculationInstruction_exports);
24
- var import_evaluators = require("@tachybase/evaluators");
24
+ var import_server = require("@tego/server");
25
25
  var import_lodash = require("lodash");
26
26
  var import__ = require(".");
27
27
  var import_constants = require("../constants");
@@ -29,7 +29,7 @@ class CalculationInstruction extends import__.Instruction {
29
29
  async run(node, prevJob, processor) {
30
30
  const { engine = "math.js", expression = "", transString = false } = node.config;
31
31
  const scope = processor.getScope(node.id);
32
- const evaluator = import_evaluators.evaluators.get(engine);
32
+ const evaluator = import_server.evaluators.get(engine);
33
33
  try {
34
34
  let result = evaluator && expression ? evaluator(expression, scope) : null;
35
35
  if (transString && engine === "formula.js") {
@@ -38,7 +38,7 @@ class CalculationInstruction extends import__.Instruction {
38
38
  const item = (0, import_lodash.get)(context, v) ?? null;
39
39
  return item;
40
40
  });
41
- result = import_evaluators.evaluators.get(engine)(targetVal);
41
+ result = import_server.evaluators.get(engine)(targetVal);
42
42
  }
43
43
  return {
44
44
  result,
@@ -1,4 +1,4 @@
1
- import { Registry } from '@tachybase/utils';
1
+ import { Registry } from '@tego/server';
2
2
  import { Instruction } from '.';
3
3
  import type Processor from '../Processor';
4
4
  import type { FlowNodeModel, JobModel } from '../types';
@@ -23,8 +23,7 @@ __export(ConditionInstruction_exports, {
23
23
  default: () => ConditionInstruction_default
24
24
  });
25
25
  module.exports = __toCommonJS(ConditionInstruction_exports);
26
- var import_evaluators = require("@tachybase/evaluators");
27
- var import_utils = require("@tachybase/utils");
26
+ var import_server = require("@tego/server");
28
27
  var import__ = require(".");
29
28
  var import_constants = require("../constants");
30
29
  const BRANCH_INDEX = {
@@ -32,7 +31,7 @@ const BRANCH_INDEX = {
32
31
  ON_TRUE: 1,
33
32
  ON_FALSE: 0
34
33
  };
35
- const calculators = new import_utils.Registry();
34
+ const calculators = new import_server.Registry();
36
35
  function equal(a, b) {
37
36
  return a === b;
38
37
  }
@@ -124,7 +123,7 @@ class ConditionInstruction extends import__.Instruction {
124
123
  async run(node, prevJob, processor) {
125
124
  const start = prevJob.createdAt || Date.now();
126
125
  const { engine, calculation, expression, rejectOnFalse } = node.config || {};
127
- const evaluator = import_evaluators.evaluators.get(engine);
126
+ const evaluator = import_server.evaluators.get(engine);
128
127
  let result = true;
129
128
  try {
130
129
  result = evaluator ? evaluator(expression, processor.getScope(node.id)) : logicCalculate(processor.getParsedValue(calculation, node.id));
@@ -31,21 +31,19 @@ __export(CreateInstruction_exports, {
31
31
  default: () => CreateInstruction_default
32
32
  });
33
33
  module.exports = __toCommonJS(CreateInstruction_exports);
34
- var import_data_source = require("@tachybase/data-source");
35
- var import_server = require("@tachybase/server");
36
- var import_utils = require("@tachybase/utils");
34
+ var import_server = require("@tego/server");
37
35
  var import_axios = __toESM(require("axios"));
38
36
  var import_form_data = __toESM(require("form-data"));
39
37
  var import_lodash = __toESM(require("lodash"));
40
38
  var import_mime_types = __toESM(require("mime-types"));
41
39
  var import__ = require(".");
42
40
  var import_constants = require("../constants");
43
- var import_utils2 = require("../utils");
41
+ var import_utils = require("../utils");
44
42
  class CreateInstruction extends import__.Instruction {
45
43
  async run(node, input, processor) {
46
44
  var _a, _b;
47
45
  const { collection, params: { appends = [], ...params } = {} } = node.config;
48
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
46
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
49
47
  const { repository, filterTargetKey } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
50
48
  const options = processor.getParsedValue(params, node.id);
51
49
  const transaction = this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction);
@@ -111,7 +109,7 @@ class CreateInstruction extends import__.Instruction {
111
109
  const base64Data = matches[2];
112
110
  const buffer = Buffer.from(base64Data, "base64");
113
111
  const ext = import_mime_types.default.extension(contentType);
114
- const filename = `${(0, import_utils.uid)()}.${ext}`;
112
+ const filename = `${(0, import_server.uid)()}.${ext}`;
115
113
  form.append("file", buffer, {
116
114
  filename,
117
115
  contentType
@@ -142,7 +140,7 @@ class CreateInstruction extends import__.Instruction {
142
140
  const response = await (0, import_axios.default)(config);
143
141
  const contentType = response.headers["content-type"];
144
142
  const ext = import_mime_types.default.extension(contentType);
145
- const fullFilename = `${filename ?? (0, import_utils.uid)()}.${ext}`;
143
+ const fullFilename = `${filename ?? (0, import_server.uid)()}.${ext}`;
146
144
  form.append("file", response.data, {
147
145
  filename: fullFilename,
148
146
  contentType: response.headers["content-type"]
@@ -151,7 +149,7 @@ class CreateInstruction extends import__.Instruction {
151
149
  const response = await (0, import_axios.default)(config);
152
150
  const contentType = response.headers["content-type"];
153
151
  const ext = import_mime_types.default.extension(contentType);
154
- const filename = `${(0, import_utils.uid)()}.${ext}`;
152
+ const filename = `${(0, import_server.uid)()}.${ext}`;
155
153
  form.append("file", response.data, {
156
154
  filename,
157
155
  contentType: response.headers["content-type"]
@@ -204,7 +202,7 @@ class CreateInstruction extends import__.Instruction {
204
202
  }
205
203
  return {
206
204
  // NOTE: get() for non-proxied instance (#380)
207
- result: (0, import_utils2.toJSON)(result),
205
+ result: (0, import_utils.toJSON)(result),
208
206
  status: import_constants.JOB_STATUS.RESOLVED
209
207
  };
210
208
  }
@@ -21,14 +21,14 @@ __export(DestroyInstruction_exports, {
21
21
  default: () => DestroyInstruction_default
22
22
  });
23
23
  module.exports = __toCommonJS(DestroyInstruction_exports);
24
- var import_data_source = require("@tachybase/data-source");
24
+ var import_server = require("@tego/server");
25
25
  var import__ = require(".");
26
26
  var import_constants = require("../constants");
27
27
  class DestroyInstruction extends import__.Instruction {
28
28
  async run(node, input, processor) {
29
29
  var _a, _b;
30
30
  const { collection, params = {} } = node.config;
31
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
31
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
32
32
  const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
33
33
  const options = processor.getParsedValue(params, node.id);
34
34
  const result = await repository.destroy({
@@ -21,8 +21,7 @@ __export(QueryInstruction_exports, {
21
21
  default: () => QueryInstruction_default
22
22
  });
23
23
  module.exports = __toCommonJS(QueryInstruction_exports);
24
- var import_actions = require("@tachybase/actions");
25
- var import_data_source = require("@tachybase/data-source");
24
+ var import_server = require("@tego/server");
26
25
  var import__ = require(".");
27
26
  var import_constants = require("../constants");
28
27
  var import_utils = require("../utils");
@@ -33,7 +32,7 @@ class QueryInstruction extends import__.Instruction {
33
32
  if (isTree) {
34
33
  otherOptions.tree = true;
35
34
  }
36
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
35
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
37
36
  const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
38
37
  const { page, pageSize, sort = [], paginate = true, ...options } = processor.getParsedValue(params, node.id);
39
38
  const appends = options.appends ? Array.from(
@@ -43,7 +42,7 @@ class QueryInstruction extends import__.Instruction {
43
42
  return set;
44
43
  }, /* @__PURE__ */ new Set())
45
44
  ) : options.appends;
46
- let pageArgs = paginate ? import_actions.utils.pageArgsToLimitArgs(page, pageSize) : {};
45
+ let pageArgs = paginate ? import_server.utils.pageArgsToLimitArgs(page, pageSize) : {};
47
46
  const result = await (multiple ? repository.find : repository.findOne).call(repository, {
48
47
  ...options,
49
48
  ...otherOptions,
@@ -31,9 +31,7 @@ __export(UpdateInstruction_exports, {
31
31
  default: () => UpdateInstruction_default
32
32
  });
33
33
  module.exports = __toCommonJS(UpdateInstruction_exports);
34
- var import_data_source = require("@tachybase/data-source");
35
- var import_server = require("@tachybase/server");
36
- var import_utils = require("@tachybase/utils");
34
+ var import_server = require("@tego/server");
37
35
  var import_axios = __toESM(require("axios"));
38
36
  var import_form_data = __toESM(require("form-data"));
39
37
  var import_lodash = __toESM(require("lodash"));
@@ -44,7 +42,7 @@ class UpdateInstruction extends import__.Instruction {
44
42
  async run(node, input, processor) {
45
43
  var _a, _b;
46
44
  const { collection, params = {} } = node.config;
47
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
45
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
48
46
  const { repository } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
49
47
  const options = processor.getParsedValue(params, node.id);
50
48
  const c = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
@@ -109,7 +107,7 @@ class UpdateInstruction extends import__.Instruction {
109
107
  const base64Data = matches[2];
110
108
  const buffer = Buffer.from(base64Data, "base64");
111
109
  const ext = import_mime_types.default.extension(contentType);
112
- const filename = `${(0, import_utils.uid)()}.${ext}`;
110
+ const filename = `${(0, import_server.uid)()}.${ext}`;
113
111
  form.append("file", buffer, {
114
112
  filename,
115
113
  contentType
@@ -140,7 +138,7 @@ class UpdateInstruction extends import__.Instruction {
140
138
  const response = await (0, import_axios.default)(config);
141
139
  const contentType = response.headers["content-type"];
142
140
  const ext = import_mime_types.default.extension(contentType);
143
- const fullFilename = `${filename || (0, import_utils.uid)()}.${ext}`;
141
+ const fullFilename = `${filename || (0, import_server.uid)()}.${ext}`;
144
142
  form.append("file", response.data, {
145
143
  filename: fullFilename,
146
144
  contentType: response.headers["content-type"]
@@ -149,7 +147,7 @@ class UpdateInstruction extends import__.Instruction {
149
147
  const response = await (0, import_axios.default)(config);
150
148
  const contentType = response.headers["content-type"];
151
149
  const ext = import_mime_types.default.extension(contentType);
152
- const filename = `${(0, import_utils.uid)()}.${ext}`;
150
+ const filename = `${(0, import_server.uid)()}.${ext}`;
153
151
  form.append("file", response.data, {
154
152
  filename,
155
153
  contentType: response.headers["content-type"]
@@ -31,21 +31,19 @@ __export(UpdateOrCreateInstruction_exports, {
31
31
  default: () => UpdateOrCreateInstruction_default
32
32
  });
33
33
  module.exports = __toCommonJS(UpdateOrCreateInstruction_exports);
34
- var import_data_source = require("@tachybase/data-source");
35
- var import_server = require("@tachybase/server");
36
- var import_utils = require("@tachybase/utils");
34
+ var import_server = require("@tego/server");
37
35
  var import_axios = __toESM(require("axios"));
38
36
  var import_form_data = __toESM(require("form-data"));
39
37
  var import_lodash = __toESM(require("lodash"));
40
38
  var import_mime_types = __toESM(require("mime-types"));
41
39
  var import__ = require(".");
42
40
  var import_constants = require("../constants");
43
- var import_utils2 = require("../utils");
41
+ var import_utils = require("../utils");
44
42
  class UpdateOrCreateInstruction extends import__.Instruction {
45
43
  async run(node, input, processor) {
46
44
  var _a, _b, _c, _d;
47
45
  const { collection, params: { appends = [], ...params } = {} } = node.config;
48
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
46
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
49
47
  const { repository, filterTargetKey } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
50
48
  const options = processor.getParsedValue(params, node.id);
51
49
  const transaction = this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction);
@@ -111,7 +109,7 @@ class UpdateOrCreateInstruction extends import__.Instruction {
111
109
  const base64Data = matches[2];
112
110
  const buffer = Buffer.from(base64Data, "base64");
113
111
  const ext = import_mime_types.default.extension(contentType);
114
- const filename = `${(0, import_utils.uid)()}.${ext}`;
112
+ const filename = `${(0, import_server.uid)()}.${ext}`;
115
113
  form.append("file", buffer, {
116
114
  filename,
117
115
  contentType
@@ -142,7 +140,7 @@ class UpdateOrCreateInstruction extends import__.Instruction {
142
140
  const response = await (0, import_axios.default)(config);
143
141
  const contentType = response.headers["content-type"];
144
142
  const ext = import_mime_types.default.extension(contentType);
145
- const fullFilename = `${filename || (0, import_utils.uid)()}.${ext}`;
143
+ const fullFilename = `${filename || (0, import_server.uid)()}.${ext}`;
146
144
  form.append("file", response.data, {
147
145
  filename: fullFilename,
148
146
  contentType: response.headers["content-type"]
@@ -151,7 +149,7 @@ class UpdateOrCreateInstruction extends import__.Instruction {
151
149
  const response = await (0, import_axios.default)(config);
152
150
  const contentType = response.headers["content-type"];
153
151
  const ext = import_mime_types.default.extension(contentType);
154
- const filename = `${(0, import_utils.uid)()}.${ext}`;
152
+ const filename = `${(0, import_server.uid)()}.${ext}`;
155
153
  form.append("file", response.data, {
156
154
  filename,
157
155
  contentType: response.headers["content-type"]
@@ -219,7 +217,7 @@ class UpdateOrCreateInstruction extends import__.Instruction {
219
217
  }
220
218
  return {
221
219
  // NOTE: get() for non-proxied instance (#380)
222
- result: (0, import_utils2.toJSON)(result),
220
+ result: (0, import_utils.toJSON)(result),
223
221
  status: import_constants.JOB_STATUS.RESOLVED
224
222
  };
225
223
  }
@@ -1,4 +1,4 @@
1
- import { Transactionable } from '@tachybase/database';
1
+ import { Transactionable } from '@tego/server';
2
2
  import type Plugin from '../Plugin';
3
3
  import type Processor from '../Processor';
4
4
  import type { FlowNodeModel } from '../types';
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class extends Migration {
3
3
  on: string;
4
4
  appVersion: string;
@@ -20,7 +20,7 @@ __export(add_initAt_exports, {
20
20
  default: () => add_initAt_default
21
21
  });
22
22
  module.exports = __toCommonJS(add_initAt_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  var import_sequelize = require("sequelize");
25
25
  var import_constants = require("../constants");
26
26
  class add_initAt_default extends import_server.Migration {
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class extends Migration {
3
3
  on: string;
4
4
  appVersion: string;
@@ -20,7 +20,7 @@ __export(add_createdBy_exports, {
20
20
  default: () => add_createdBy_default
21
21
  });
22
22
  module.exports = __toCommonJS(add_createdBy_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  class add_createdBy_default extends import_server.Migration {
25
25
  constructor() {
26
26
  super(...arguments);
@@ -1,4 +1,4 @@
1
- import { Migration } from '@tachybase/server';
1
+ import { Migration } from '@tego/server';
2
2
  export default class extends Migration {
3
3
  on: string;
4
4
  appVersion: string;
@@ -20,7 +20,7 @@ __export(bigInt_exports, {
20
20
  default: () => bigInt_default
21
21
  });
22
22
  module.exports = __toCommonJS(bigInt_exports);
23
- var import_server = require("@tachybase/server");
23
+ var import_server = require("@tego/server");
24
24
  var import_sequelize = require("sequelize");
25
25
  class bigInt_default extends import_server.Migration {
26
26
  constructor() {
@@ -1,4 +1,4 @@
1
- import { Transactionable } from '@tachybase/database';
1
+ import { Transactionable } from '@tego/server';
2
2
  import Trigger from '.';
3
3
  import type { WorkflowModel } from '../types';
4
4
  export interface CollectionChangeTriggerConfig {
@@ -30,7 +30,7 @@ __export(CollectionTrigger_exports, {
30
30
  default: () => CollectionTrigger
31
31
  });
32
32
  module.exports = __toCommonJS(CollectionTrigger_exports);
33
- var import_data_source = require("@tachybase/data-source");
33
+ var import_server = require("@tego/server");
34
34
  var import__ = __toESM(require("."));
35
35
  var import_utils = require("../utils");
36
36
  const MODE_BITMAP = {
@@ -55,7 +55,7 @@ function getFieldRawName(collection, name) {
55
55
  async function handler(workflow, data, options) {
56
56
  var _a, _b;
57
57
  const { condition, changed, mode, appends, blacklist } = workflow.config;
58
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(workflow.config.collection);
58
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(workflow.config.collection);
59
59
  const collection = (_a = this.workflow.app.dataSourceManager) == null ? void 0 : _a.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
60
60
  const { transaction, context } = options;
61
61
  const { repository, filterTargetKey } = collection;
@@ -126,7 +126,7 @@ class CollectionTrigger extends import__.default {
126
126
  if (!collection) {
127
127
  return;
128
128
  }
129
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
129
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
130
130
  const { db } = ((_b = (_a = this.workflow.app.dataSourceManager) == null ? void 0 : _a.dataSources.get(dataSourceName)) == null ? void 0 : _b.collectionManager) ?? {};
131
131
  if (!db || !db.getCollection(collectionName)) {
132
132
  return;
@@ -155,7 +155,7 @@ class CollectionTrigger extends import__.default {
155
155
  if (!collection) {
156
156
  return;
157
157
  }
158
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
158
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
159
159
  const { db } = ((_a = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName)) == null ? void 0 : _a.collectionManager) ?? {};
160
160
  if (!db || !db.getCollection(collectionName)) {
161
161
  return;
@@ -1,4 +1,4 @@
1
- import { Transactionable } from '@tachybase/database';
1
+ import { Transactionable } from '@tego/server';
2
2
  import type Plugin from '../../Plugin';
3
3
  import type { WorkflowModel } from '../../types';
4
4
  export type ScheduleOnField = {
@@ -22,7 +22,7 @@ export default class ScheduleTrigger {
22
22
  constructor(workflow: Plugin);
23
23
  reload(): Promise<void>;
24
24
  inspect(workflows: WorkflowModel[]): void;
25
- loadRecordsToSchedule({ config: { collection, limit, startsOn, repeat, endsOn }, allExecuted }: WorkflowModel, currentDate: Date): Promise<import("@tachybase/database").Model<any, any>[]>;
25
+ loadRecordsToSchedule({ config: { collection, limit, startsOn, repeat, endsOn }, allExecuted }: WorkflowModel, currentDate: Date): Promise<import("@tego/server").Model<any, any>[]>;
26
26
  getRecordNextTime(workflow: WorkflowModel, record: any, nextSecond?: boolean): any;
27
27
  schedule(workflow: WorkflowModel, record: any, nextTime: any, toggle?: boolean, options?: {}): Promise<void>;
28
28
  trigger(workflow: WorkflowModel, record: any, nextTime: any, { transaction }?: Transactionable): Promise<void>;
@@ -30,8 +30,7 @@ __export(DateFieldScheduleTrigger_exports, {
30
30
  default: () => ScheduleTrigger
31
31
  });
32
32
  module.exports = __toCommonJS(DateFieldScheduleTrigger_exports);
33
- var import_data_source = require("@tachybase/data-source");
34
- var import_database = require("@tachybase/database");
33
+ var import_server = require("@tego/server");
35
34
  var import_cron_parser = __toESM(require("cron-parser"));
36
35
  var import_utils = require("./utils");
37
36
  function getOnTimestampWithOffset({ field, offset = 0, unit = 1e3 }, now) {
@@ -154,7 +153,7 @@ class ScheduleTrigger {
154
153
  {
155
154
  [startsOn.field]: {
156
155
  // cache next 2 cycles
157
- [import_database.Op.lt]: new Date(startTimestamp + range)
156
+ [import_server.Op.lt]: new Date(startTimestamp + range)
158
157
  }
159
158
  }
160
159
  ];
@@ -162,12 +161,12 @@ class ScheduleTrigger {
162
161
  if (typeof repeat === "number") {
163
162
  const tsFn = DialectTimestampFnMap[db.options.dialect];
164
163
  if (repeat > range && tsFn) {
165
- const modExp = (0, import_database.fn)(
164
+ const modExp = (0, import_server.fn)(
166
165
  "MOD",
167
- (0, import_database.literal)(`${Math.round(timestamp / 1e3)} - ${tsFn(startsOn.field)}`),
166
+ (0, import_server.literal)(`${Math.round(timestamp / 1e3)} - ${tsFn(startsOn.field)}`),
168
167
  Math.round(repeat / 1e3)
169
168
  );
170
- conditions.push((0, import_database.where)(modExp, { [import_database.Op.lt]: Math.round(range / 1e3) }));
169
+ conditions.push((0, import_server.where)(modExp, { [import_server.Op.lt]: Math.round(range / 1e3) }));
171
170
  }
172
171
  } else if (typeof repeat === "string") {
173
172
  if (!matchCronNextTime(repeat, currentDate, range)) {
@@ -187,7 +186,7 @@ class ScheduleTrigger {
187
186
  } else {
188
187
  conditions.push({
189
188
  [endsOn.field]: {
190
- [import_database.Op.gte]: new Date(endTimestamp)
189
+ [import_server.Op.gte]: new Date(endTimestamp)
191
190
  }
192
191
  });
193
192
  }
@@ -195,14 +194,14 @@ class ScheduleTrigger {
195
194
  } else {
196
195
  conditions.push({
197
196
  [startsOn.field]: {
198
- [import_database.Op.gte]: new Date(startTimestamp)
197
+ [import_server.Op.gte]: new Date(startTimestamp)
199
198
  }
200
199
  });
201
200
  }
202
201
  const { model } = db.getCollection(collection);
203
202
  return model.findAll({
204
203
  where: {
205
- [import_database.Op.and]: conditions
204
+ [import_server.Op.and]: conditions
206
205
  }
207
206
  });
208
207
  }
@@ -258,7 +257,7 @@ class ScheduleTrigger {
258
257
  return nextTime;
259
258
  }
260
259
  schedule(workflow, record, nextTime, toggle = true, options = {}) {
261
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(workflow.config.collection);
260
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(workflow.config.collection);
262
261
  const { filterTargetKey } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
263
262
  const recordPk = record.get(filterTargetKey);
264
263
  if (toggle) {
@@ -281,7 +280,7 @@ class ScheduleTrigger {
281
280
  }
282
281
  }
283
282
  async trigger(workflow, record, nextTime, { transaction } = {}) {
284
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(workflow.config.collection);
283
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(workflow.config.collection);
285
284
  const { repository, filterTargetKey } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
286
285
  const recordPk = record.get(filterTargetKey);
287
286
  const data = await repository.findOne({
@@ -306,7 +305,7 @@ class ScheduleTrigger {
306
305
  on(workflow) {
307
306
  this.inspect([workflow]);
308
307
  const { collection } = workflow.config;
309
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
308
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
310
309
  const event = `${collectionName}.afterSaveWithAssociations`;
311
310
  const eventKey = `${collection}.afterSaveWithAssociations`;
312
311
  const name = getHookId(workflow, event);
@@ -328,7 +327,7 @@ class ScheduleTrigger {
328
327
  }
329
328
  }
330
329
  const { collection } = workflow.config;
331
- const [dataSourceName, collectionName] = (0, import_data_source.parseCollectionName)(collection);
330
+ const [dataSourceName, collectionName] = (0, import_server.parseCollectionName)(collection);
332
331
  const event = `${collectionName}.afterSaveWithAssociations`;
333
332
  const eventKey = `${collection}.afterSaveWithAssociations`;
334
333
  const name = getHookId(workflow, event);
@@ -1,4 +1,4 @@
1
- import { Transactionable } from '@tachybase/database';
1
+ import { Transactionable } from '@tego/server';
2
2
  import type Plugin from '../Plugin';
3
3
  import type { WorkflowModel } from '../types';
4
4
  export declare abstract class Trigger {
@@ -1,4 +1,4 @@
1
- import { BelongsToGetAssociationMixin, Database, HasManyGetAssociationsMixin, Model } from '@tachybase/database';
1
+ import { BelongsToGetAssociationMixin, Database, HasManyGetAssociationsMixin, Model } from '@tego/server';
2
2
  import JobModel from './Job';
3
3
  import WorkflowModel from './Workflow';
4
4
  export default class ExecutionModel extends Model {
@@ -20,6 +20,6 @@ __export(Execution_exports, {
20
20
  default: () => ExecutionModel
21
21
  });
22
22
  module.exports = __toCommonJS(Execution_exports);
23
- var import_database = require("@tachybase/database");
24
- class ExecutionModel extends import_database.Model {
23
+ var import_server = require("@tego/server");
24
+ class ExecutionModel extends import_server.Model {
25
25
  }
@@ -1,4 +1,4 @@
1
- import { BelongsToGetAssociationMixin, Database, Model } from '@tachybase/database';
1
+ import { BelongsToGetAssociationMixin, Database, Model } from '@tego/server';
2
2
  import WorkflowModel from './Workflow';
3
3
  export default class FlowNodeModel extends Model {
4
4
  static readonly database: Database;
@@ -20,6 +20,6 @@ __export(FlowNode_exports, {
20
20
  default: () => FlowNodeModel
21
21
  });
22
22
  module.exports = __toCommonJS(FlowNode_exports);
23
- var import_database = require("@tachybase/database");
24
- class FlowNodeModel extends import_database.Model {
23
+ var import_server = require("@tego/server");
24
+ class FlowNodeModel extends import_server.Model {
25
25
  }
@@ -1,4 +1,4 @@
1
- import { BelongsToGetAssociationMixin, Model } from '@tachybase/database';
1
+ import { BelongsToGetAssociationMixin, Model } from '@tego/server';
2
2
  import FlowNodeModel from './FlowNode';
3
3
  export default class JobModel extends Model {
4
4
  id: number;
@@ -20,6 +20,6 @@ __export(Job_exports, {
20
20
  default: () => JobModel
21
21
  });
22
22
  module.exports = __toCommonJS(Job_exports);
23
- var import_database = require("@tachybase/database");
24
- class JobModel extends import_database.Model {
23
+ var import_server = require("@tego/server");
24
+ class JobModel extends import_server.Model {
25
25
  }
@@ -1,4 +1,4 @@
1
- import { Database, HasManyCountAssociationsMixin, HasManyCreateAssociationMixin, HasManyGetAssociationsMixin, Model } from '@tachybase/database';
1
+ import { Database, HasManyCountAssociationsMixin, HasManyCreateAssociationMixin, HasManyGetAssociationsMixin, Model } from '@tego/server';
2
2
  import ExecutionModel from './Execution';
3
3
  import FlowNodeModel from './FlowNode';
4
4
  export default class WorkflowModel extends Model {
@@ -20,6 +20,6 @@ __export(Workflow_exports, {
20
20
  default: () => WorkflowModel
21
21
  });
22
22
  module.exports = __toCommonJS(Workflow_exports);
23
- var import_database = require("@tachybase/database");
24
- class WorkflowModel extends import_database.Model {
23
+ var import_server = require("@tego/server");
24
+ class WorkflowModel extends import_server.Model {
25
25
  }
@@ -20,12 +20,12 @@ __export(utils_exports, {
20
20
  toJSON: () => toJSON
21
21
  });
22
22
  module.exports = __toCommonJS(utils_exports);
23
- var import_database = require("@tachybase/database");
23
+ var import_server = require("@tego/server");
24
24
  function toJSON(data) {
25
25
  if (Array.isArray(data)) {
26
26
  return data.map(toJSON);
27
27
  }
28
- if (!(data instanceof import_database.Model) || !data) {
28
+ if (!(data instanceof import_server.Model) || !data) {
29
29
  return data;
30
30
  }
31
31
  const result = data.get();