@steedos-labs/plugin-workflow 3.0.43 → 3.0.44

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.
@@ -25,7 +25,7 @@ amis_schema: |-
25
25
  "isMobile": "${window:innerWidth <= 768}"
26
26
  },
27
27
  "schemaApi": {
28
- "url": "${isMobile ? '/api/v6/functions/pages/schema?pageId=flow_selector_mobile' : '/api/v6/functions/pages/schema?pageId=flow_selector'}",
28
+ "url": "${isMobile ? '/api/workflow/pages/schema?pageId=flow_selector_mobile' : '/api/workflow/pages/schema?pageId=flow_selector'}",
29
29
  "method": "get"
30
30
  },
31
31
  "initFetchSchema": true,
@@ -25,7 +25,7 @@ amis_schema: |-
25
25
  "isMobile": "${window:innerWidth <= 768}"
26
26
  },
27
27
  "schemaApi": {
28
- "url": "${isMobile ? '/api/v6/functions/pages/schema?pageId=flow_selector_mobile' : '/api/v6/functions/pages/schema?pageId=flow_selector'}",
28
+ "url": "${isMobile ? '/api/workflow/pages/schema?pageId=flow_selector_mobile' : '/api/workflow/pages/schema?pageId=flow_selector'}",
29
29
  "method": "get"
30
30
  },
31
31
  "initFetchSchema": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.43",
3
+ "version": "3.0.44",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -0,0 +1,58 @@
1
+ const objectql = require('@steedos/objectql');
2
+
3
+ module.exports = {
4
+ rest: {
5
+ method: 'GET',
6
+ fullPath: '/api/workflow/pages/schema'
7
+ },
8
+ params: {
9
+ pageId: { type: 'string' }
10
+ },
11
+ async handler(ctx) {
12
+ const { pageId } = ctx.params;
13
+ const userSession = ctx.meta.user;
14
+
15
+ if (!pageId) {
16
+ return {};
17
+ }
18
+
19
+ // 直接 broker.call page.getMeSchema,完全绕过 vm2 沙箱
20
+ // 参考 steedos-platform/services/service-pages/main/default/routes/page_schema.router.js
21
+ // flow_selector 这个 page 的 type 固定为 'page'
22
+ const result = await objectql.getSteedosSchema().broker.call('page.getMeSchema', {
23
+ type: 'page',
24
+ pageId: pageId
25
+ }, {
26
+ meta: { user: userSession }
27
+ });
28
+
29
+ if (!result || !result.schema) {
30
+ return {};
31
+ }
32
+
33
+ // result.schema 可能是字符串(JSON)或对象,统一处理
34
+ let schema = result.schema;
35
+ if (typeof schema === 'string') {
36
+ try {
37
+ schema = JSON.parse(schema);
38
+ } catch (e) {
39
+ return {};
40
+ }
41
+ }
42
+
43
+ // 返回与旧接口一致的结构,包含 inject + assets(tailwind CSS)+ body
44
+ // 参考 steedos-platform/services/service-pages/main/default/functions/pages_schema.function.yml
45
+ return {
46
+ type: 'inject',
47
+ assets: [
48
+ {
49
+ type: 'css',
50
+ id: 'page-css',
51
+ src: `/api/v6/pages/${pageId}/current/tailwind.css`,
52
+ location: 'start'
53
+ }
54
+ ],
55
+ body: [schema]
56
+ };
57
+ }
58
+ };
@@ -16,4 +16,5 @@ module.exports = {
16
16
  rollbackApprovalCommentsField: require('./rollbackApprovalCommentsField'),
17
17
  integrationTestApprovalComments: require('./integrationTestApprovalComments'),
18
18
  approvalCommentsConsole: require('./approvalCommentsConsole'),
19
+ getPageSchema: require('./getPageSchema'),
19
20
  }