@steedos-labs/plugin-workflow 3.0.33 → 3.0.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.
@@ -4,8 +4,10 @@ const router = express.Router();
4
4
  const { requireAuthentication } = require("@steedos/auth");
5
5
  const path = require('path');
6
6
 
7
+ // Resolve package root via require.resolve, more reliable than __dirname in Docker/symlink scenarios
7
8
  const packageRoot = path.dirname(require.resolve('@steedos-labs/plugin-workflow/package.json'));
8
9
  const designerDistPath = path.join(packageRoot, 'designer', 'dist');
10
+ const amisRendererDistPath = path.join(designerDistPath, 'amis-renderer');
9
11
 
10
12
  /**
11
13
  * New React-based workflow designer
@@ -19,8 +21,7 @@ router.get('/api/workflow/designer-v2', requireAuthentication, async (req, res)
19
21
  }
20
22
 
21
23
  // In production, serve built React app
22
- const designerPath = path.join(designerDistPath, 'index.html');
23
- res.sendFile(designerPath, { dotfiles: 'allow' });
24
+ res.sendFile(path.join(designerDistPath, 'index.html'), { dotfiles: 'allow' });
24
25
  } catch (e) {
25
26
  res.status(500).send({
26
27
  errors: [{ errorMessage: e.message }]
@@ -61,4 +62,39 @@ router.get('/api/designer-v2/startup', requireAuthentication, async (req, res) =
61
62
  */
62
63
  router.use('/api/workflow/designer-v2', express.static(designerDistPath));
63
64
 
65
+ /**
66
+ * SPA fallback: serve index.html for any sub-path under /api/workflow/designer-v2/
67
+ * that didn't match a static file (e.g. /form-designer, /form-designer?flowId=xxx).
68
+ * Uses router.use to avoid path-to-regexp pattern syntax issues.
69
+ */
70
+ router.use('/api/workflow/designer-v2', (req, res, next) => {
71
+ // Only handle GET requests for HTML pages (skip API calls, static assets, etc.)
72
+ if (req.method !== 'GET') return next();
73
+ // Skip requests for static files (have a file extension)
74
+ if (path.extname(req.path)) return next();
75
+ // Must be a sub-path (not the root which is already handled)
76
+ if (req.path === '/' || req.path === '') return next();
77
+
78
+ requireAuthentication(req, res, () => {
79
+ try {
80
+ if (process.env.NODE_ENV === 'development') {
81
+ return res.redirect('http://localhost:5173');
82
+ }
83
+ const designerIndex = path.join(designerDistPath, 'index.html');
84
+ res.sendFile(designerIndex, { dotfiles: 'allow' });
85
+ } catch (e) {
86
+ res.status(500).send({
87
+ errors: [{ errorMessage: e.message }]
88
+ });
89
+ }
90
+ });
91
+ });
92
+
93
+ /**
94
+ * Serve the amis renderer bundle (js + css).
95
+ * URL: /api/workflow/amis-form-v2/amis-renderer.js
96
+ * /api/workflow/amis-form-v2/amis-renderer.css
97
+ */
98
+ router.use('/api/workflow/amis-form-v2', express.static(amisRendererDistPath));
99
+
64
100
  exports.default = router;
@@ -541,6 +541,12 @@ module.exports = {
541
541
 
542
542
  // 先通过id得到forms对象存下来
543
543
  const form = await objectql.getObject('forms').findOne(this.id);
544
+
545
+ if(form.current.version === 'v2'){
546
+ return ;
547
+ }
548
+
549
+
544
550
  delete form.historys;
545
551
 
546
552
  // 数据库更新操作:将forms表current的fields字段更新为最终数组
@@ -263,6 +263,10 @@ async function updateForm(formId, form, forms, flows, currentUserId) {
263
263
  current.wizard_mode = form["current"]["wizard_mode"];
264
264
  current.amis_schema = form["current"]["amis_schema"]
265
265
 
266
+ current.version = form["current"]["version"];
267
+ current.viewMode = form["current"]["viewMode"];
268
+ current.tableColumns = form["current"]["tableColumns"];
269
+
266
270
  formUpdateObj.$set = {
267
271
  'current': current,
268
272
  'name': form["name"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.33",
3
+ "version": "3.0.35",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,7 +17,8 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "build:watch": "tsc --watch",
20
- "release": "cd designer && npm run build && cd .. && npm publish --registry https://registry.npmjs.org && npx cnpm sync @steedos-labs/plugin-workflow",
20
+ "build:designer": "cd designer && npm run build:all",
21
+ "release": "npm run build:designer && npm publish --registry https://registry.npmjs.org && npx cnpm sync @steedos-labs/plugin-workflow",
21
22
  "export-templates": "node run.js export",
22
23
  "convert-templates": "node convert-templates.js",
23
24
  "test:formula-compat": "node main/default/test/test_formula_compat.js"