@nocobase/plugin-workflow-request-interceptor 2.0.6 → 2.0.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.
@@ -8,13 +8,13 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.0.6",
12
- "@nocobase/plugin-workflow": "2.0.6",
11
+ "@nocobase/client": "2.0.8",
12
+ "@nocobase/plugin-workflow": "2.0.8",
13
13
  "@formily/react": "2.3.7",
14
14
  "react": "18.2.0",
15
- "@nocobase/flow-engine": "2.0.6",
16
- "@nocobase/server": "2.0.6",
15
+ "@nocobase/flow-engine": "2.0.8",
16
+ "@nocobase/server": "2.0.8",
17
17
  "lodash": "4.17.21",
18
- "@nocobase/plugin-error-handler": "2.0.6",
19
- "@nocobase/data-source-manager": "2.0.6"
18
+ "@nocobase/plugin-error-handler": "2.0.8",
19
+ "@nocobase/data-source-manager": "2.0.8"
20
20
  };
@@ -195,14 +195,21 @@ class RequestInterceptionTrigger extends import_plugin_workflow.Trigger {
195
195
  });
196
196
  }
197
197
  const params = values.action === import_constants.INTERCEPTABLE_ACTIONS.DESTROY ? { filterByTk } : { values: target };
198
+ const { userId } = values;
199
+ if (userId == null) {
200
+ throw new Error("user is not provided");
201
+ }
198
202
  const UserRepo = this.workflow.app.db.getRepository("users");
199
203
  const actor = await UserRepo.findOne({
200
- filterByTk: values.userId,
204
+ filterByTk: typeof userId === "object" ? userId["id"] : userId,
201
205
  appends: ["roles"]
202
206
  });
203
207
  if (!actor) {
204
208
  throw new Error("user not found");
205
209
  }
210
+ if (!actor) {
211
+ throw new Error("user not found");
212
+ }
206
213
  const { roles, ...user } = actor.desensitize().get();
207
214
  const roleName = values.roleName || ((_a = roles == null ? void 0 : roles[0]) == null ? void 0 : _a.name);
208
215
  return this.workflow.trigger(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow-request-interceptor",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "displayName": "Workflow: Pre-action event",
5
5
  "displayName.zh-CN": "工作流:操作前事件",
6
6
  "description": "Triggered before the execution of a request initiated through an action button or API, such as before adding, updating, or deleting data. Suitable for data validation and logic judgment before action, and the request could be rejected by using the \"End process\" node.",
@@ -27,6 +27,6 @@
27
27
  "keywords": [
28
28
  "Workflow"
29
29
  ],
30
- "gitHead": "8364210afd350869f33619e892fc82c8176f647a",
30
+ "gitHead": "af89ac2350fded2a0a915a119b8f0e83d50711cc",
31
31
  "license": "Apache-2.0"
32
32
  }