@tachybase/module-event-source 0.23.20 → 0.23.35

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.
@@ -1,16 +1,16 @@
1
1
  module.exports = {
2
- "@tachybase/client": "0.23.20",
3
- "@tachybase/server": "0.23.20",
2
+ "@tachybase/client": "0.23.35",
3
+ "@tachybase/server": "0.23.35",
4
4
  "react": "18.3.1",
5
- "@tachybase/module-workflow": "0.23.20",
6
- "@tachybase/schema": "0.23.20",
7
- "@tachybase/components": "0.23.20",
5
+ "@tachybase/module-workflow": "0.23.35",
6
+ "@tachybase/schema": "0.23.35",
7
+ "@tachybase/components": "0.23.35",
8
8
  "antd": "5.22.5",
9
- "@tachybase/actions": "0.23.20",
10
- "@tachybase/utils": "0.23.20",
9
+ "@tachybase/actions": "0.23.35",
10
+ "@tachybase/utils": "0.23.35",
11
11
  "sequelize": "6.37.5",
12
- "@tachybase/database": "0.23.20",
13
- "@tachybase/data-source": "0.23.20",
14
- "@tachybase/resourcer": "0.23.20",
12
+ "@tachybase/database": "0.23.35",
13
+ "@tachybase/data-source": "0.23.35",
14
+ "@tachybase/resourcer": "0.23.35",
15
15
  "lodash": "4.17.21"
16
16
  };
@@ -66,6 +66,7 @@ __export(BeforeResourceService_exports, {
66
66
  BeforeAfterResourceService: () => BeforeAfterResourceService
67
67
  });
68
68
  module.exports = __toCommonJS(BeforeResourceService_exports);
69
+ var import_module_workflow = require("@tachybase/module-workflow");
69
70
  var import_utils = require("@tachybase/utils");
70
71
  var import_webhooks = require("../webhooks/webhooks");
71
72
  var _logger_dec, _app_dec, _BeforeAfterResourceService_decorators, _init;
@@ -97,7 +98,10 @@ class BeforeAfterResourceService {
97
98
  }
98
99
  if (prefix === "before") {
99
100
  const body = await new import_webhooks.WebhookController().action(ctx, resourceDef);
100
- await new import_webhooks.WebhookController().triggerWorkflow(ctx, resourceDef, body);
101
+ const result = await new import_webhooks.WebhookController().triggerWorkflow(ctx, resourceDef, body);
102
+ if (result && result.lastSavedJob.status === import_module_workflow.JOB_STATUS.ERROR) {
103
+ ctx.throw(400, result.lastSavedJob.result);
104
+ }
101
105
  await next();
102
106
  } else {
103
107
  await next();
@@ -1,4 +1,5 @@
1
1
  import { Context } from '@tachybase/actions';
2
+ import { Processor } from '@tachybase/module-workflow';
2
3
  /** 获得真正变动的数据库字段 */
3
4
  export declare function getChanged(ctx: Context): () => Promise<{
4
5
  changed?: string[];
@@ -11,5 +12,5 @@ export declare class WebhookController {
11
12
  action(ctx: Context, action: {
12
13
  code: string;
13
14
  }): Promise<string>;
14
- triggerWorkflow(ctx: any, action: any, body: any): Promise<void>;
15
+ triggerWorkflow(ctx: any, action: any, body: any): Promise<Processor | void>;
15
16
  }
@@ -262,7 +262,7 @@ class WebhookController {
262
262
  const pluginWorkflow = ctx.app.getPlugin(import_module_workflow.PluginWorkflow);
263
263
  const wfRepo = ctx.db.getRepository("workflows");
264
264
  const wf = await wfRepo.findOne({ filter: { key: action.workflowKey, enabled: true } });
265
- await pluginWorkflow.trigger(wf, { data: body, ...userInfo }, { httpContext: ctx });
265
+ return await pluginWorkflow.trigger(wf, { data: body, ...userInfo }, { httpContext: ctx });
266
266
  }
267
267
  }
268
268
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/module-event-source",
3
- "version": "0.23.20",
3
+ "version": "0.23.35",
4
4
  "main": "dist/server/index.js",
5
5
  "dependencies": {},
6
6
  "devDependencies": {
@@ -10,17 +10,17 @@
10
10
  "sequelize": "6.37.5"
11
11
  },
12
12
  "peerDependencies": {
13
- "@tachybase/actions": "0.23.20",
14
- "@tachybase/components": "0.23.20",
15
- "@tachybase/database": "0.23.20",
16
- "@tachybase/client": "0.23.20",
17
- "@tachybase/data-source": "0.23.20",
18
- "@tachybase/module-workflow": "0.23.20",
19
- "@tachybase/resourcer": "0.23.20",
20
- "@tachybase/schema": "0.23.20",
21
- "@tachybase/server": "0.23.20",
22
- "@tachybase/test": "0.23.20",
23
- "@tachybase/utils": "0.23.20"
13
+ "@tachybase/actions": "0.23.35",
14
+ "@tachybase/client": "0.23.35",
15
+ "@tachybase/components": "0.23.35",
16
+ "@tachybase/module-workflow": "0.23.35",
17
+ "@tachybase/database": "0.23.35",
18
+ "@tachybase/resourcer": "0.23.35",
19
+ "@tachybase/server": "0.23.35",
20
+ "@tachybase/schema": "0.23.35",
21
+ "@tachybase/test": "0.23.35",
22
+ "@tachybase/utils": "0.23.35",
23
+ "@tachybase/data-source": "0.23.35"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tachybase-build --no-dts @tachybase/module-event-source"