@gadmin2n/schematics 0.0.135 → 0.0.137

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 (95) hide show
  1. package/dist/lib/application/files/gadmin2-game-angle-demo/Dockerfile.server +2 -2
  2. package/dist/lib/application/files/gadmin2-game-angle-demo/compose-ctl.sh +1 -1
  3. package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/canvas.prisma +1 -0
  4. package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/workflow.prisma +14 -3
  5. package/dist/lib/application/files/gadmin2-game-angle-demo/config/ui/User.ts +4 -4
  6. package/dist/lib/application/files/gadmin2-game-angle-demo/docker-compose.md +2 -2
  7. package/dist/lib/application/files/gadmin2-game-angle-demo/docker-compose.yml +13 -92
  8. package/dist/lib/application/files/gadmin2-game-angle-demo/readme.md +105 -7
  9. package/dist/lib/application/files/gadmin2-game-angle-demo/server/ensure-database.js +1 -1
  10. package/dist/lib/application/files/gadmin2-game-angle-demo/server/package.json +7 -6
  11. package/dist/lib/application/files/gadmin2-game-angle-demo/server/prisma.config.ts +9 -1
  12. package/dist/lib/application/files/gadmin2-game-angle-demo/server/scripts/gen-jwt.ts +85 -0
  13. package/dist/lib/application/files/gadmin2-game-angle-demo/server/scripts/notify-dev-servers.js +9 -8
  14. package/dist/lib/application/files/gadmin2-game-angle-demo/server/scripts/wait-for-nest-ready.js +5 -5
  15. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflow-node-types.ts +43 -2
  16. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflow.seed.ts +9 -1
  17. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflows.ts +24 -0
  18. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas-export.dto.ts +27 -0
  19. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas-export.service.spec.ts +430 -0
  20. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas-export.service.ts +203 -0
  21. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.controller.ts +36 -3
  22. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/canvas/canvas.module.ts +2 -1
  23. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.controller.spec.ts +54 -0
  24. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.controller.ts +245 -0
  25. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.module.ts +10 -0
  26. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.service.spec.ts +366 -0
  27. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.service.ts +110 -0
  28. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-execution.dto.ts +19 -1
  29. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.controller.ts +15 -0
  30. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.service.spec.ts +79 -0
  31. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.service.ts +41 -19
  32. package/dist/lib/application/files/gadmin2-game-angle-demo/server/start-prod.sh +5 -5
  33. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/README.md +37 -573
  34. package/dist/lib/application/files/gadmin2-game-angle-demo/web/ecosystem.dev.config.cjs +12 -1
  35. package/dist/lib/application/files/gadmin2-game-angle-demo/web/package.json +1 -0
  36. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/header.tsx +3 -2
  37. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/config/routeRegistry.tsx +39 -26
  38. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/i18n.ts +3 -1
  39. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/locales/en/common.json +3 -0
  40. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/locales/zh_CN/common.json +3 -0
  41. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasEditPage.tsx +23 -5
  42. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasListPage.tsx +66 -10
  43. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasPage.tsx +16 -7
  44. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/CanvasToolbar.tsx +21 -0
  45. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/canvasApi.ts +30 -0
  46. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/ExportModal.tsx +84 -0
  47. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/components/ImportModal.tsx +166 -0
  48. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/canvas/hooks/useCanvasHistory.ts +52 -13
  49. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/DslView.tsx +6 -0
  50. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodePropertyPanel.tsx +6 -1
  51. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/editor.tsx +17 -0
  52. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/instance-detail.tsx +18 -6
  53. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/temporal-tenant/index.tsx +225 -0
  54. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/utilities/lazy-with-reload.ts +31 -0
  55. package/package.json +1 -1
  56. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-dsl-validate.spec.ts +0 -220
  57. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-dsl-validate.ts +0 -132
  58. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/TODO.md +0 -152
  59. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/config/development-sql.yaml +0 -5
  60. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/docker-compose.yml +0 -25
  61. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/package.json +0 -13
  62. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/.dockerignore +0 -12
  63. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/.env +0 -7
  64. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/Dockerfile +0 -79
  65. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/GRACEFUL-DEPLOYMENT.md +0 -270
  66. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/SANDBOX.md +0 -122
  67. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/package-lock.json +0 -4285
  68. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/package.json +0 -28
  69. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/code-execute.ts +0 -51
  70. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/db-execute.ts +0 -85
  71. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/db-query.ts +0 -35
  72. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/http-request.ts +0 -54
  73. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/index.ts +0 -6
  74. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/reporting.ts +0 -85
  75. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/activities/send-notification.ts +0 -47
  76. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/config.ts +0 -13
  77. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/condition.ts +0 -101
  78. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/context.ts +0 -58
  79. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/graph.ts +0 -184
  80. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/helpers.ts +0 -133
  81. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/node-types.ts +0 -96
  82. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/types.ts +0 -77
  83. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/dsl/validate.ts +0 -109
  84. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/index.ts +0 -101
  85. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/outbox-poller.ts +0 -382
  86. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/tests/activities/code-execute.test.ts +0 -44
  87. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/tests/activities/http-request.test.ts +0 -87
  88. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/tests/cron-trigger-workflow.test.ts +0 -20
  89. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/tests/helpers.test.ts +0 -225
  90. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/tests/node-type-consistency.test.ts +0 -101
  91. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/tests/validate.test.ts +0 -205
  92. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/src/workflows/dsl-workflow.ts +0 -499
  93. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/tsconfig.json +0 -19
  94. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/vitest.config.ts +0 -8
  95. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/worker/yarn.lock +0 -1905
@@ -24,8 +24,8 @@ const DEFAULTS = {
24
24
  pollMs: 250,
25
25
  initialStableMs: 3000,
26
26
  maxStableMs: 15000,
27
- observeDownTimeoutMs: 15000,
28
- totalTimeoutMs: 60000,
27
+ observeDownTimeoutMs: 5000,
28
+ totalTimeoutMs: 15000,
29
29
  };
30
30
 
31
31
  /**
@@ -56,7 +56,7 @@ async function waitForNestReady({ ping, sleep, now, log, opts = {} }) {
56
56
  const started = now();
57
57
  log(
58
58
  `waiting for nest restart (poll=${pollMs}ms, stable=${initialStableMs}ms, ` +
59
- `maxStable=${maxStableMs}ms, totalTimeout=${totalTimeoutMs}ms) ...`,
59
+ `maxStable=${maxStableMs}ms, totalTimeout=${totalTimeoutMs}ms) ...`,
60
60
  );
61
61
 
62
62
  // Phase 1:等第一次 down。若长时间不 down,视作"未在 --watch 模式"或"文件全 unchanged",跳过。
@@ -86,7 +86,7 @@ async function waitForNestReady({ ping, sleep, now, log, opts = {} }) {
86
86
  if (now() - started >= totalTimeoutMs) {
87
87
  log(
88
88
  `nest not stable within ${totalTimeoutMs}ms ` +
89
- `(restarts=${restarts}, stableRequired=${stableRequiredMs}ms); continue anyway.`,
89
+ `(restarts=${restarts}, stableRequired=${stableRequiredMs}ms); continue anyway.`,
90
90
  );
91
91
  return {
92
92
  skipped: false,
@@ -111,7 +111,7 @@ async function waitForNestReady({ ping, sleep, now, log, opts = {} }) {
111
111
  if (newStable !== stableRequiredMs) {
112
112
  log(
113
113
  `observed rebuild cycle ${cycleLength}ms; ` +
114
- `expanding stable window ${stableRequiredMs}→${newStable}ms.`,
114
+ `expanding stable window ${stableRequiredMs}→${newStable}ms.`,
115
115
  );
116
116
  stableRequiredMs = newStable;
117
117
  }
@@ -1,3 +1,4 @@
1
+ import { ALL_NODE_TYPES } from '@gadmin2n/nest-common/workflow-dsl';
1
2
  import { Prisma, PrismaClient } from '@prisma/client';
2
3
 
3
4
  export const NODE_TYPES = [
@@ -631,8 +632,16 @@ export const NODE_TYPES = [
631
632
  properties: {
632
633
  approvers: {
633
634
  type: 'array',
634
- items: { type: 'string' },
635
- description: 'Approver user IDs or emails',
635
+ items: {
636
+ type: 'object',
637
+ properties: {
638
+ type: { type: 'string', enum: ['user', 'group'] },
639
+ id: { type: 'string' },
640
+ },
641
+ required: ['type', 'id'],
642
+ },
643
+ description:
644
+ 'Approvers — mix of individual users (type=user, id=userid) and reusable groups (type=group, id=UserGroup.code)',
636
645
  },
637
646
  approvalMode: {
638
647
  type: 'string',
@@ -720,6 +729,38 @@ export const NODE_TYPES = [
720
729
  },
721
730
  ];
722
731
 
732
+ // ─── Seed / nest-common consistency check ──────────────────────────────────
733
+ //
734
+ // Every entry in ALL_NODE_TYPES (the canonical registry in nest-common) MUST
735
+ // have a corresponding seed row here. If a new node type is added upstream
736
+ // but never seeded, the frontend canvas won't know how to render it — this
737
+ // throws at seed time so the gap is caught in dev / CI, not in production.
738
+ {
739
+ const seededTypes = new Set(NODE_TYPES.map((n) => n.type));
740
+ const missing = ALL_NODE_TYPES.filter((t) => !seededTypes.has(t));
741
+ if (missing.length > 0) {
742
+ throw new Error(
743
+ `[workflow-node-types seed] Missing seed rows for node types: ${missing.join(
744
+ ', ',
745
+ )}. ` +
746
+ `Add them to NODE_TYPES above, or (if the type was removed upstream, which nest-common ` +
747
+ `disallows — see workflow-dsl/README.md) coordinate a major bump.`,
748
+ );
749
+ }
750
+ const extra = [...seededTypes].filter(
751
+ (t) => !(ALL_NODE_TYPES as readonly string[]).includes(t),
752
+ );
753
+ if (extra.length > 0) {
754
+ // Extras are NOT an error — a downstream project may seed additional
755
+ // types locally. Log for visibility.
756
+ console.warn(
757
+ `[workflow-node-types seed] Extra local-only node types: ${extra.join(
758
+ ', ',
759
+ )}`,
760
+ );
761
+ }
762
+ }
763
+
723
764
  export async function seedNodeTypes(prisma: PrismaClient) {
724
765
  console.log('Seeding workflow node types...');
725
766
  for (const nodeType of NODE_TYPES) {
@@ -60,12 +60,20 @@ export async function seedWorkflowModule(prisma: PrismaClient): Promise<void> {
60
60
  },
61
61
  {
62
62
  code: 'workflow_node_instance',
63
- zhName: 'Node模版',
63
+ zhName: 'Node 实例',
64
64
  enName: 'Node Instance',
65
65
  sortOrder: 2,
66
66
  resourceCode: 'workflowNodeInstance',
67
67
  resourceDescription: 'Workflow node instance management',
68
68
  },
69
+ {
70
+ code: 'workflow_temporal_tenant',
71
+ zhName: '服务注册',
72
+ enName: 'Service Registration',
73
+ sortOrder: 3,
74
+ resourceCode: 'temporalTenantConfig',
75
+ resourceDescription: 'Temporal tenant config management',
76
+ },
69
77
  ];
70
78
 
71
79
  const allPages = [{ id: workflowPage.id, code: workflowPage.code }];
@@ -24,24 +24,28 @@ const WORKFLOWS = [
24
24
  type: 'http_request',
25
25
  label: '拉取外部数据',
26
26
  position: { x: 350, y: 200 },
27
+ config: {},
27
28
  },
28
29
  {
29
30
  id: 'action_2',
30
31
  type: 'code',
31
32
  label: '数据转换',
32
33
  position: { x: 600, y: 200 },
34
+ config: {},
33
35
  },
34
36
  {
35
37
  id: 'action_3',
36
38
  type: 'db_execute',
37
39
  label: '写入数据库',
38
40
  position: { x: 850, y: 200 },
41
+ config: {},
39
42
  },
40
43
  {
41
44
  id: 'action_4',
42
45
  type: 'send_notification',
43
46
  label: '发送通知',
44
47
  position: { x: 1100, y: 200 },
48
+ config: {},
45
49
  },
46
50
  ],
47
51
  edges: [
@@ -72,36 +76,42 @@ const WORKFLOWS = [
72
76
  type: 'set_variable',
73
77
  label: '提取用户信息',
74
78
  position: { x: 350, y: 200 },
79
+ config: {},
75
80
  },
76
81
  {
77
82
  id: 'approval_1',
78
83
  type: 'approval',
79
84
  label: '管理员审批',
80
85
  position: { x: 600, y: 200 },
86
+ config: {},
81
87
  },
82
88
  {
83
89
  id: 'condition_1',
84
90
  type: 'if_else',
85
91
  label: '审批结果判断',
86
92
  position: { x: 850, y: 200 },
93
+ config: {},
87
94
  },
88
95
  {
89
96
  id: 'action_2',
90
97
  type: 'db_execute',
91
98
  label: '激活用户',
92
99
  position: { x: 1100, y: 100 },
100
+ config: {},
93
101
  },
94
102
  {
95
103
  id: 'action_3',
96
104
  type: 'send_notification',
97
105
  label: '发送欢迎邮件',
98
106
  position: { x: 1350, y: 100 },
107
+ config: {},
99
108
  },
100
109
  {
101
110
  id: 'action_4',
102
111
  type: 'send_notification',
103
112
  label: '发送拒绝通知',
104
113
  position: { x: 1100, y: 300 },
114
+ config: {},
105
115
  },
106
116
  ],
107
117
  edges: [
@@ -146,30 +156,35 @@ const WORKFLOWS = [
146
156
  type: 'event_trigger',
147
157
  label: '监听错误事件',
148
158
  position: { x: 100, y: 200 },
159
+ config: {},
149
160
  },
150
161
  {
151
162
  id: 'action_1',
152
163
  type: 'db_query',
153
164
  label: '查询近5分钟错误数',
154
165
  position: { x: 350, y: 200 },
166
+ config: {},
155
167
  },
156
168
  {
157
169
  id: 'condition_1',
158
170
  type: 'if_else',
159
171
  label: '错误率 > 5%?',
160
172
  position: { x: 600, y: 200 },
173
+ config: {},
161
174
  },
162
175
  {
163
176
  id: 'action_2',
164
177
  type: 'send_notification',
165
178
  label: '发送告警',
166
179
  position: { x: 850, y: 100 },
180
+ config: {},
167
181
  },
168
182
  {
169
183
  id: 'action_3',
170
184
  type: 'code',
171
185
  label: '记录日志',
172
186
  position: { x: 850, y: 300 },
187
+ config: {},
173
188
  },
174
189
  ],
175
190
  edges: [
@@ -214,24 +229,28 @@ const WORKFLOWS = [
214
229
  type: 'db_query',
215
230
  label: '查询数据',
216
231
  position: { x: 350, y: 200 },
232
+ config: {},
217
233
  },
218
234
  {
219
235
  id: 'loop_1',
220
236
  type: 'for_each',
221
237
  label: '遍历分页',
222
238
  position: { x: 600, y: 200 },
239
+ config: {},
223
240
  },
224
241
  {
225
242
  id: 'action_2',
226
243
  type: 'code',
227
244
  label: '转换为CSV',
228
245
  position: { x: 850, y: 200 },
246
+ config: {},
229
247
  },
230
248
  {
231
249
  id: 'action_3',
232
250
  type: 'send_notification',
233
251
  label: '发送邮件',
234
252
  position: { x: 1100, y: 200 },
253
+ config: {},
235
254
  },
236
255
  ],
237
256
  edges: [
@@ -262,30 +281,35 @@ const WORKFLOWS = [
262
281
  type: 'parallel',
263
282
  label: '并行部署',
264
283
  position: { x: 350, y: 200 },
284
+ config: {},
265
285
  },
266
286
  {
267
287
  id: 'action_1',
268
288
  type: 'http_request',
269
289
  label: '部署 Staging',
270
290
  position: { x: 600, y: 100 },
291
+ config: {},
271
292
  },
272
293
  {
273
294
  id: 'approval_1',
274
295
  type: 'approval',
275
296
  label: 'Production 审批',
276
297
  position: { x: 600, y: 300 },
298
+ config: {},
277
299
  },
278
300
  {
279
301
  id: 'action_2',
280
302
  type: 'http_request',
281
303
  label: '部署 Production',
282
304
  position: { x: 850, y: 300 },
305
+ config: {},
283
306
  },
284
307
  {
285
308
  id: 'action_3',
286
309
  type: 'send_notification',
287
310
  label: '部署完成通知',
288
311
  position: { x: 1100, y: 200 },
312
+ config: {},
289
313
  },
290
314
  ],
291
315
  edges: [
@@ -0,0 +1,27 @@
1
+ import { IsObject } from 'class-validator';
2
+
3
+ export class ImportPayloadDto {
4
+ @IsObject()
5
+ payload: ExportPayload;
6
+ }
7
+
8
+ export interface ExportPayload {
9
+ version: number;
10
+ exportedAt: string;
11
+ canvas: {
12
+ code: string;
13
+ name: string;
14
+ items: any[];
15
+ layout: any[];
16
+ };
17
+ savedQueries: Array<{
18
+ sourceId: string;
19
+ sql: string;
20
+ description: string;
21
+ }>;
22
+ }
23
+
24
+ export interface ImportPreviewResponse {
25
+ current: Partial<ExportPayload> | null;
26
+ incoming: ExportPayload;
27
+ }