@gadmin2n/schematics 0.0.142 → 0.0.144

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 (140) hide show
  1. package/dist/lib/application/files/gadmin2-game-angle-demo/config/prisma/workflow.prisma +5 -23
  2. package/dist/lib/application/files/gadmin2-game-angle-demo/server/scripts/lib/page-helpers.ts +4 -2
  3. package/dist/lib/application/files/gadmin2-game-angle-demo/server/scripts/page-manage.ts +36 -1
  4. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/agenda.seed.ts +14 -14
  5. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/bootstrap.ts +18 -13
  6. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/canvas.seed.ts +14 -14
  7. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/index.ts +1 -1
  8. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflow-node-types.ts +67 -404
  9. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflow.seed.ts +16 -40
  10. package/dist/lib/application/files/gadmin2-game-angle-demo/server/seed/workflows.ts +12 -124
  11. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/app.module.ts +3 -0
  12. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/config/index.ts +0 -21
  13. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/codeRuntime/code-runtime.controller.ts +3 -10
  14. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/codeRuntime/codeRuntime.module.ts +1 -2
  15. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-callback.controller.spec.ts +48 -0
  16. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-callback.controller.ts +96 -0
  17. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-interaction-runtime.controller.spec.ts +1 -59
  18. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-interaction-runtime.controller.ts +8 -43
  19. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-interaction-runtime.dto.ts +0 -23
  20. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-interaction.service.ts +2 -0
  21. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/external-wait.handler.ts +2 -0
  22. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/externalInteraction.module.ts +7 -3
  23. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/workflow-callback-url.controller.ts +2 -2
  24. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/workflow-callback-url.service.spec.ts +18 -123
  25. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/externalInteraction/workflow-callback-url.service.ts +4 -0
  26. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/httpRequest/http-request-runtime.controller.ts +3 -10
  27. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/httpRequest/httpRequest.module.ts +1 -2
  28. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/human-approval.controller.ts +0 -10
  29. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/human-approval.dto.ts +12 -4
  30. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/human-approval.errors.ts +1 -1
  31. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/human-approval.external-decision.spec.ts +42 -209
  32. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/human-approval.service.ts +108 -225
  33. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/humanApproval.module.ts +0 -2
  34. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/runtime/human-approval-runtime.controller.ts +27 -22
  35. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/runtime/human-approval-runtime.dto.ts +9 -1
  36. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/runtime/runtime-token.guard.spec.ts +30 -0
  37. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/humanApproval/runtime/runtime-token.guard.ts +8 -15
  38. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/index.ts +0 -2
  39. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/runtime-connectivity-probe.service.spec.ts +14 -0
  40. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/runtime-connectivity-probe.service.ts +37 -0
  41. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.controller.spec.ts +41 -0
  42. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.controller.ts +53 -0
  43. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/temporalTenantConfig.module.ts +7 -2
  44. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/temporalTenantConfig/workflow-runtime-health.controller.ts +21 -0
  45. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/dsl-validate.util.spec.ts +2 -2
  46. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-callable.spec.ts +16 -88
  47. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-callable.ts +23 -59
  48. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-compiler.service.spec.ts +125 -39
  49. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-compiler.service.ts +95 -28
  50. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-handle-validator.ts +0 -20
  51. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-http-response.spec.ts +23 -26
  52. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow-http-response.ts +6 -52
  53. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.controller.ts +2 -2
  54. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.service.spec.ts +24 -0
  55. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflow/workflow.service.ts +26 -21
  56. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowConfig/widget-catalog.service.spec.ts +0 -1
  57. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowConfig/widget-catalog.service.ts +0 -1
  58. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowRuntimeConfig/workflow-runtime-config.service.spec.ts +32 -0
  59. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowRuntimeConfig/workflow-runtime-config.service.ts +41 -0
  60. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/workflowRuntimeConfig/workflowRuntimeConfig.module.ts +10 -0
  61. package/dist/lib/application/files/gadmin2-game-angle-demo/server/tsconfig.build.json +10 -1
  62. package/dist/lib/application/files/gadmin2-game-angle-demo/temporal/README.md +16 -12
  63. package/dist/lib/application/files/gadmin2-game-angle-demo/web/package.json +1 -1
  64. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/PageHeader.tsx +1 -1
  65. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/agentPanel/inspectorActions.ts +19 -19
  66. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/contexts/color-mode/index.tsx +1 -1
  67. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/components/layout/header.tsx +15 -11
  68. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/config/routeRegistry.tsx +0 -6
  69. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/AddDataModal.tsx +3 -3
  70. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/AddPageModal.tsx +1 -1
  71. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/DeleteDataConfirm.tsx +1 -1
  72. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/dev-shell/EditDataModal.tsx +1 -1
  73. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useDynamicResources.tsx +1 -0
  74. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/locales/en/workflow.json +85 -95
  75. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/locales/zh_CN/workflow.json +85 -95
  76. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agenda/index.tsx +2 -2
  77. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agendaJob/list.tsx +21 -2
  78. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/game/list.tsx +21 -2
  79. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/human-approval/inbox.tsx +14 -66
  80. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/list.tsx +4 -4
  81. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/list.tsx +3 -3
  82. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/list.tsx +3 -3
  83. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/CustomNode.test.tsx +29 -0
  84. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/CustomNode.tsx +4 -2
  85. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/EnhancedFlowRenderer.tsx +4 -6
  86. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/ExecutionStatusNode.test.tsx +3 -0
  87. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/ExecutionStatusNode.tsx +3 -1
  88. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/FlowRenderer.tsx +4 -6
  89. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NewNodeDefaults.test.tsx +23 -92
  90. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodeOutputSummary.tsx +200 -0
  91. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodePropertyPanel.test.tsx +61 -136
  92. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodePropertyPanel.tsx +96 -195
  93. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/components/NodeTypeBadge.tsx +36 -0
  94. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/components/CreateNodeInstanceModal.tsx +5 -10
  95. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/components/NodeInstanceForm.tsx +47 -22
  96. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/create.tsx +7 -5
  97. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/edit.tsx +8 -6
  98. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/node-config.css +35 -0
  99. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/schema-form/default-widgets.tsx +1 -6
  100. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/ApproverSourceEditor.tsx +1 -4
  101. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/CodeConfigEditor.tsx +1 -1
  102. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/ExternalRequestConfigEditor.tsx +1 -1
  103. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/ExternalWaitConfigEditor.tsx +82 -259
  104. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/HttpRequestConfigEditor.tsx +1 -2
  105. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/HumanApprovalConfigEditor.test.tsx +7 -6
  106. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/HumanApprovalConfigEditor.tsx +77 -71
  107. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/ReturnResultConfigEditor.test.tsx +10 -57
  108. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/ReturnResultConfigEditor.tsx +8 -273
  109. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/temporal-tenant/index.test.tsx +54 -0
  110. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/temporal-tenant/index.tsx +110 -20
  111. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/utils/newNodeConfig.ts +4 -34
  112. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/utils/resolveOutputs.test.ts +3 -10
  113. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/utils/resolveOutputs.ts +2 -37
  114. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflowEventOutbox/list.tsx +26 -2
  115. package/package.json +1 -1
  116. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/approvalChannel/approval-channel.controller.ts +0 -89
  117. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/approvalChannel/approval-channel.dto.ts +0 -68
  118. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/approvalChannel/approval-channel.service.spec.ts +0 -177
  119. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/approvalChannel/approval-channel.service.ts +0 -283
  120. package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/modules/approvalChannel/approvalChannel.module.ts +0 -10
  121. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/approval-channels/ApprovalChannelModal.test.tsx +0 -84
  122. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/approval-channels/ApprovalChannelModal.tsx +0 -141
  123. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/approval-channels/approval-channel.types.ts +0 -16
  124. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/approval-channels/index.tsx +0 -210
  125. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/ApprovalRequestTriggerConfigEditor.tsx +0 -39
  126. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/SubmitApprovalResultConfigEditor.tsx +0 -104
  127. package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/widgets/SubmitExternalResultConfigEditor.tsx +0 -98
  128. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/{Components → components}/AssignRolesModal.tsx +0 -0
  129. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/{Components → components}/CreatePageModal.tsx +0 -0
  130. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/{Components → components}/EditPageModal.tsx +0 -0
  131. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/{Components → components}/PageDetailDrawer.tsx +0 -0
  132. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/page/{Components → components}/PageFormModal.tsx +0 -0
  133. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/{Components → components}/CreateModal.tsx +0 -0
  134. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/{Components → components}/EditModal.tsx +0 -0
  135. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/{Components → components}/ResourceDetailDrawer.tsx +0 -0
  136. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/resource/{Components → components}/modal.tsx +0 -0
  137. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/{Components → components}/CreateModal.tsx +0 -0
  138. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/{Components → components}/EditModal.tsx +0 -0
  139. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/{Components → components}/RoleDetailDrawer.tsx +0 -0
  140. /package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/role/{Components → components}/modal.tsx +0 -0
@@ -1,4 +1,3 @@
1
- import { ALL_NODE_TYPES } from '@gadmin2n/nest-common/workflow-dsl';
2
1
  import { Prisma, PrismaClient } from '@prisma/client';
3
2
 
4
3
  type BaseNodeTypeSeed = {
@@ -87,15 +86,14 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
87
86
  },
88
87
  inputSchema: { type: 'object', properties: {} },
89
88
  outputSchema: {
90
- type: 'object',
91
- properties: { triggeredAt: { type: 'string' } },
89
+ description: 'Workflow start data supplied by the schedule trigger',
92
90
  },
93
91
  outputs: [],
94
92
  },
95
93
  {
96
94
  type: 'webhook_trigger',
97
95
  category: 'TRIGGER',
98
- label: '接收外部请求',
96
+ label: '接收外部调用',
99
97
  icon: 'ApiOutlined',
100
98
  description: '通过外部 HTTP POST 请求启动 Workflow',
101
99
  configSchema: {
@@ -162,7 +160,14 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
162
160
  query: { type: 'object' },
163
161
  },
164
162
  },
165
- outputSchema: { type: 'object', properties: { body: { type: 'object' } } },
163
+ outputSchema: {
164
+ type: 'object',
165
+ properties: {
166
+ body: { type: 'object', description: 'Unmodified request body' },
167
+ headers: { type: 'object', description: 'Request headers' },
168
+ query: { type: 'object', description: 'Query parameters' },
169
+ },
170
+ },
166
171
  outputs: [],
167
172
  },
168
173
  {
@@ -170,7 +175,7 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
170
175
  category: 'TRIGGER',
171
176
  label: 'Event Trigger',
172
177
  icon: 'ThunderboltOutlined',
173
- description: 'Trigger workflow on an internal event (Temporal Signal)',
178
+ description: '收到内部业务事件(Outbox)后启动 Workflow',
174
179
  configSchema: {
175
180
  type: 'object',
176
181
  properties: {
@@ -212,7 +217,9 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
212
217
  required: [],
213
218
  },
214
219
  inputSchema: { type: 'object', properties: { data: { type: 'object' } } },
215
- outputSchema: { type: 'object', properties: { data: { type: 'object' } } },
220
+ outputSchema: {
221
+ description: 'Workflow start data supplied for the manual run',
222
+ },
216
223
  outputs: [],
217
224
  },
218
225
 
@@ -299,12 +306,6 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
299
306
  configSchema: {
300
307
  type: 'object',
301
308
  properties: {
302
- operation: {
303
- type: 'string',
304
- enum: ['query', 'execute'],
305
- description:
306
- 'query = read (SELECT), execute = write (INSERT/UPDATE/DELETE)',
307
- },
308
309
  query: { type: 'string', description: 'SQL statement' },
309
310
  params: {
310
311
  type: 'array',
@@ -379,48 +380,6 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
379
380
  },
380
381
  outputs: [],
381
382
  },
382
- {
383
- type: 'send_notification',
384
- category: 'ACTION',
385
- label: 'Send Notification',
386
- icon: 'BellOutlined',
387
- description: 'Send a notification via email, Slack, or webhook',
388
- configSchema: {
389
- type: 'object',
390
- properties: {
391
- channel: {
392
- type: 'string',
393
- enum: ['email', 'slack', 'webhook', 'dingtalk', 'wecom'],
394
- description: 'Notification channel',
395
- },
396
- recipients: {
397
- type: 'array',
398
- items: { type: 'string' },
399
- description: 'Recipient list (emails, user IDs, or webhook URLs)',
400
- },
401
- subject: {
402
- type: 'string',
403
- description: 'Message subject (for email channel)',
404
- },
405
- message: {
406
- type: 'string',
407
- description:
408
- 'Notification message body (supports template variables)',
409
- },
410
- templateId: {
411
- type: 'string',
412
- description: 'Message template ID (optional, overrides message)',
413
- },
414
- },
415
- required: ['channel', 'recipients', 'message'],
416
- },
417
- inputSchema: { type: 'object', properties: { data: { type: 'object' } } },
418
- outputSchema: {
419
- type: 'object',
420
- properties: { sent: { type: 'boolean' }, messageId: { type: 'string' } },
421
- },
422
- outputs: [],
423
- },
424
383
  {
425
384
  type: 'code',
426
385
  category: 'ACTION',
@@ -454,39 +413,6 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
454
413
  outputs: [],
455
414
  },
456
415
 
457
- // ─── DATA PROCESSING ───────────────────────────────────────────────────────
458
- {
459
- type: 'set_variable',
460
- category: 'ACTION',
461
- label: 'Set Variable',
462
- icon: 'FormOutlined',
463
- description: 'Set, transform, or rename values from the previous node',
464
- configSchema: {
465
- type: 'object',
466
- properties: {
467
- assignments: {
468
- type: 'array',
469
- items: {
470
- type: 'object',
471
- properties: {
472
- name: { type: 'string' },
473
- value: { type: 'string' },
474
- },
475
- },
476
- description: 'Variable assignments (name → expression)',
477
- },
478
- keepOnlySet: {
479
- type: 'boolean',
480
- description: 'Remove all other fields, keep only assigned',
481
- },
482
- },
483
- required: ['assignments'],
484
- },
485
- inputSchema: { type: 'object', properties: { data: { type: 'object' } } },
486
- outputSchema: { type: 'object', properties: { data: { type: 'object' } } },
487
- outputs: [],
488
- },
489
-
490
416
  // ─── CONDITION ─────────────────────────────────────────────────────────────
491
417
  {
492
418
  type: 'if_else',
@@ -514,11 +440,6 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
514
440
  enum: ['AND', 'OR'],
515
441
  description: 'How to combine multiple conditions',
516
442
  },
517
- fallbackExpression: {
518
- type: 'string',
519
- description:
520
- 'Fallback: raw expression (if conditions array is empty)',
521
- },
522
443
  },
523
444
  required: [],
524
445
  },
@@ -568,7 +489,7 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
568
489
  // ─── FLOW CONTROL ──────────────────────────────────────────────────────────
569
490
  {
570
491
  type: 'for_each',
571
- category: 'LOOP',
492
+ category: 'FLOW_CONTROL',
572
493
  label: 'For Each',
573
494
  icon: 'RetweetOutlined',
574
495
  description: 'Iterate over an array field',
@@ -583,10 +504,6 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
583
504
  type: 'number',
584
505
  description: 'Parallel concurrency (1 = sequential)',
585
506
  },
586
- batchSize: {
587
- type: 'number',
588
- description: 'Process items in batches of this size',
589
- },
590
507
  errorPolicy: {
591
508
  type: 'string',
592
509
  enum: ['stop', 'continue', 'collect'],
@@ -600,9 +517,10 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
600
517
  outputSchema: {
601
518
  type: 'object',
602
519
  properties: {
603
- currentItem: { type: 'object' },
604
- index: { type: 'number' },
605
520
  results: { type: 'array' },
521
+ errors: { type: 'array' },
522
+ totalProcessed: { type: 'number' },
523
+ error: { type: 'string' },
606
524
  },
607
525
  },
608
526
  outputs: [],
@@ -610,7 +528,7 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
610
528
  {
611
529
  type: 'delay',
612
530
  category: 'FLOW_CONTROL',
613
- label: 'Delay/Wait',
531
+ label: '定时等待',
614
532
  icon: 'HourglassOutlined',
615
533
  description:
616
534
  'Pause workflow execution for a specified duration (Temporal Timer)',
@@ -619,7 +537,7 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
619
537
  properties: {
620
538
  delayType: {
621
539
  type: 'string',
622
- enum: ['fixedDuration', 'untilTime', 'untilSignal'],
540
+ enum: ['fixedDuration', 'untilTime'],
623
541
  description: 'Type of delay',
624
542
  },
625
543
  duration: {
@@ -630,10 +548,6 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
630
548
  type: 'string',
631
549
  description: 'Resume at ISO datetime (for untilTime)',
632
550
  },
633
- signalName: {
634
- type: 'string',
635
- description: 'Signal name to wait for (for untilSignal)',
636
- },
637
551
  },
638
552
  required: ['delayType'],
639
553
  },
@@ -669,12 +583,8 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
669
583
  },
670
584
  waitMode: {
671
585
  type: 'string',
672
- enum: ['all', 'any', 'count'],
673
- description: 'Wait for all, any one, or N branches to complete',
674
- },
675
- waitCount: {
676
- type: 'number',
677
- description: 'Number of branches to wait for (when waitMode=count)',
586
+ enum: ['all', 'any'],
587
+ description: 'Wait for all branches or any one branch to complete',
678
588
  },
679
589
  },
680
590
  required: ['branches'],
@@ -682,51 +592,7 @@ const INLINE_NODE_DEFINITIONS: BaseNodeTypeSeed[] = [
682
592
  inputSchema: { type: 'object', properties: { data: { type: 'object' } } },
683
593
  outputSchema: {
684
594
  type: 'object',
685
- properties: { results: { type: 'array' } },
686
- },
687
- outputs: [],
688
- },
689
- {
690
- type: 'error_handler',
691
- category: 'FLOW_CONTROL',
692
- label: 'Error Handler',
693
- icon: 'WarningOutlined',
694
- description: 'Catch errors from upstream nodes and execute fallback logic',
695
- configSchema: {
696
- type: 'object',
697
- properties: {
698
- errorTypes: {
699
- type: 'array',
700
- items: { type: 'string' },
701
- description: 'Error types to catch (empty = catch all)',
702
- },
703
- retryPolicy: {
704
- type: 'string',
705
- enum: ['none', 'fixed', 'exponential'],
706
- description: 'Retry strategy before triggering error handler',
707
- },
708
- maxRetries: { type: 'number', description: 'Maximum retry attempts' },
709
- retryInterval: {
710
- type: 'number',
711
- description: 'Initial retry interval in seconds',
712
- },
713
- fallbackAction: {
714
- type: 'string',
715
- enum: ['continue', 'stop', 'goto'],
716
- description:
717
- 'Action after catching: continue downstream, stop workflow, or goto a specific node',
718
- },
719
- gotoNodeId: {
720
- type: 'string',
721
- description: 'Target node ID (when fallbackAction=goto)',
722
- },
723
- },
724
- required: [],
725
- },
726
- inputSchema: { type: 'object', properties: { error: { type: 'object' } } },
727
- outputSchema: {
728
- type: 'object',
729
- properties: { error: { type: 'object' }, handled: { type: 'boolean' } },
595
+ properties: { completedBranches: { type: 'number' } },
730
596
  },
731
597
  outputs: [],
732
598
  },
@@ -793,9 +659,12 @@ const approvalDefinition: BaseNodeTypeSeed = {
793
659
  outputSchema: {
794
660
  type: 'object',
795
661
  properties: {
662
+ requestId: { type: 'string' },
663
+ nodeId: { type: 'string' },
664
+ result: { type: 'string', enum: ['APPROVED', 'REJECTED'] },
665
+ reason: { type: 'string' },
666
+ decidedAt: { type: 'string' },
796
667
  approved: { type: 'boolean' },
797
- approvedBy: { type: 'string' },
798
- comment: { type: 'string' },
799
668
  },
800
669
  },
801
670
  outputs: [],
@@ -805,10 +674,9 @@ const approvalDefinition: BaseNodeTypeSeed = {
805
674
  const subWorkflowDefinition: BaseNodeTypeSeed = {
806
675
  type: 'sub_workflow',
807
676
  category: 'SUB_WORKFLOW',
808
- label: 'Sub Workflow',
677
+ label: '调用 Workflow',
809
678
  icon: 'SubnodeOutlined',
810
- description:
811
- 'Call another workflow as a sub-process (Temporal Child Workflow)',
679
+ description: '调用另一个 Workflow,并等待其返回结果',
812
680
  configSchema: {
813
681
  type: 'object',
814
682
  properties: {
@@ -821,21 +689,12 @@ const subWorkflowDefinition: BaseNodeTypeSeed = {
821
689
  description:
822
690
  'Bind child inputs to the previous node, Workflow data, or fixed values',
823
691
  },
824
- waitForCompletion: {
825
- type: 'boolean',
826
- description: 'Wait for child workflow to finish (sync vs async)',
827
- },
828
- timeout: {
829
- type: 'number',
830
- description: 'Child workflow timeout in seconds',
831
- },
832
692
  },
833
693
  required: ['workflowId'],
834
694
  },
835
695
  inputSchema: { type: 'object', properties: { data: { type: 'object' } } },
836
696
  outputSchema: {
837
- type: 'object',
838
- properties: { result: { type: 'object' }, status: { type: 'string' } },
697
+ description: 'Unmodified result returned by the called Workflow',
839
698
  },
840
699
  outputs: [],
841
700
  };
@@ -843,17 +702,17 @@ const subWorkflowDefinition: BaseNodeTypeSeed = {
843
702
  const HUMAN_APPROVAL_CONFIG_SCHEMA: NodeTypeSeed['configSchema'] = {
844
703
  type: 'object',
845
704
  properties: {
846
- channelRef: {
705
+ approvalWorkflowId: {
847
706
  type: 'string',
848
- title: 'Approval channel',
707
+ title: 'Approval Workflow',
849
708
  description:
850
- 'Optional reusable channel for dispatching to and receiving decisions from an external approval provider.',
709
+ 'Optional callable Workflow that dispatches the request, waits for the external result, and returns the decision.',
851
710
  },
852
- channelInputBindings: {
711
+ approvalWorkflowInputBindings: {
853
712
  ...PARAMETER_BINDINGS_SCHEMA,
854
713
  title: 'Approval document fields',
855
714
  description:
856
- 'Bind the selected approval channel inputs to input, Workflow data, or fixed values.',
715
+ 'Bind the selected approval Workflow inputs to input, Workflow data, or fixed values.',
857
716
  },
858
717
  approverSources: {
859
718
  type: 'array',
@@ -947,15 +806,15 @@ const humanApprovalNode: NodeTypeSeed = {
947
806
  configSchema: HUMAN_APPROVAL_CONFIG_SCHEMA,
948
807
  outputs: ['true', 'false'],
949
808
  runtimeKey: 'human_approval',
950
- schemaVersion: 6,
809
+ schemaVersion: 7,
951
810
  instancePolicy: 'REQUIRED',
952
811
  uiSchema: HUMAN_APPROVAL_UI_SCHEMA,
953
812
  };
954
813
 
955
814
  const callableTriggerNode: NodeTypeSeed = {
956
815
  type: 'callable_trigger',
957
- category: 'TRIGGER',
958
- label: '接收调用',
816
+ category: 'SUB_WORKFLOW',
817
+ label: '接收内部调用',
959
818
  icon: 'ImportOutlined',
960
819
  description: '接收其他地方传入的 Workflow 启动数据',
961
820
  configSchema: {
@@ -977,7 +836,9 @@ const callableTriggerNode: NodeTypeSeed = {
977
836
  },
978
837
  },
979
838
  inputSchema: { type: 'object' },
980
- outputSchema: { type: 'object' },
839
+ outputSchema: {
840
+ description: 'Workflow start data supplied by the caller',
841
+ },
981
842
  outputs: [],
982
843
  runtimeKey: 'callable_trigger',
983
844
  schemaVersion: 2,
@@ -989,233 +850,73 @@ const callableTriggerNode: NodeTypeSeed = {
989
850
  },
990
851
  };
991
852
 
992
- const approvalRequestTriggerNode: NodeTypeSeed = {
993
- type: 'approval_request_trigger',
994
- category: 'TRIGGER',
995
- label: '接收调用',
996
- icon: 'AuditOutlined',
997
- description: '旧版审批调用入口,仅用于兼容已有 Workflow',
998
- configSchema: {
999
- type: 'object',
1000
- properties: {},
1001
- },
1002
- inputSchema: { type: 'object' },
1003
- outputSchema: { type: 'object' },
1004
- outputs: [],
1005
- runtimeKey: 'approval_request_trigger',
1006
- schemaVersion: 1,
1007
- instancePolicy: 'INLINE_ONLY',
1008
- uiSchema: {
1009
- widget: 'approval-request-trigger-config',
1010
- },
1011
- };
1012
-
1013
853
  const returnResultNode: NodeTypeSeed = {
1014
854
  type: 'return_result',
1015
- category: 'ACTION',
1016
- label: '返回结果',
855
+ category: 'SUB_WORKFLOW',
856
+ label: '返回调用',
1017
857
  icon: 'ExportOutlined',
1018
- description: '把上一个节点或 Workflow 数据返回给调用方',
858
+ description: '结束当前 Workflow,并把上一个节点的结果返回给调用方',
1019
859
  configSchema: {
1020
860
  type: 'object',
1021
- properties: {
1022
- resultType: {
1023
- type: 'string',
1024
- title: '结果类型',
1025
- enum: ['JSON', 'APPROVAL_SUBJECTS'],
1026
- default: 'JSON',
1027
- },
1028
- sourceMode: {
1029
- type: 'string',
1030
- title: '结果来源',
1031
- enum: ['INPUT', 'WORKFLOW'],
1032
- default: 'INPUT',
1033
- },
1034
- path: {
1035
- type: 'string',
1036
- title: 'Workflow 数据字段',
1037
- description: '例如 approvers',
1038
- },
1039
- httpStatusCode: {
1040
- type: 'integer',
1041
- title: 'HTTP 状态码',
1042
- minimum: 100,
1043
- maximum: 599,
1044
- default: 200,
1045
- },
1046
- httpHeaders: {
1047
- type: 'object',
1048
- title: 'HTTP 响应头',
1049
- additionalProperties: { type: 'string' },
1050
- default: {},
1051
- },
1052
- },
1053
- required: ['resultType', 'sourceMode'],
861
+ properties: {},
862
+ additionalProperties: false,
1054
863
  },
1055
864
  inputSchema: { type: 'object' },
1056
865
  outputSchema: { type: 'object' },
1057
866
  outputs: [],
1058
867
  runtimeKey: 'return_result',
1059
- schemaVersion: 4,
868
+ schemaVersion: 5,
1060
869
  instancePolicy: 'INLINE_ONLY',
1061
870
  uiSchema: { widget: 'return-result-config' },
1062
871
  };
1063
872
 
1064
- const submitApprovalResultNode: NodeTypeSeed = {
1065
- type: 'submit_approval_result',
1066
- category: 'ACTION',
1067
- label: '提交审批结果',
1068
- icon: 'CheckCircleOutlined',
1069
- description: '把外部系统的审批决定提交给正在等待的人工审核节点',
1070
- configSchema: {
1071
- type: 'object',
1072
- properties: {
1073
- inputBindings: {
1074
- type: 'object',
1075
- properties: Object.fromEntries(
1076
- [
1077
- 'requestId',
1078
- 'channelRef',
1079
- 'eventId',
1080
- 'approverId',
1081
- 'decision',
1082
- 'comment',
1083
- 'payload',
1084
- ].map((key) => [key, PARAMETER_BINDING_SCHEMA]),
1085
- ),
1086
- required: [
1087
- 'requestId',
1088
- 'channelRef',
1089
- 'eventId',
1090
- 'approverId',
1091
- 'decision',
1092
- ],
1093
- additionalProperties: false,
1094
- },
1095
- },
1096
- required: ['inputBindings'],
1097
- additionalProperties: false,
1098
- },
1099
- inputSchema: { description: 'Normalized approval result' },
1100
- outputSchema: {
1101
- type: 'object',
1102
- properties: {
1103
- accepted: { type: 'boolean' },
1104
- requestId: { type: 'string' },
1105
- },
1106
- },
1107
- outputs: [],
1108
- runtimeKey: 'submit_approval_result',
1109
- schemaVersion: 1,
1110
- instancePolicy: 'INLINE_ONLY',
1111
- uiSchema: { widget: 'submit-approval-result-config' },
1112
- };
1113
-
1114
- const submitExternalResultNode: NodeTypeSeed = {
1115
- type: 'submit_external_result',
1116
- category: 'ACTION',
1117
- label: '提交外部处理结果',
1118
- icon: 'ApiOutlined',
1119
- description: '把外部系统的处理结果提交给正在等待的 Workflow',
1120
- configSchema: {
1121
- type: 'object',
1122
- properties: {
1123
- inputBindings: {
1124
- type: 'object',
1125
- properties: Object.fromEntries(
1126
- ['callbackToken', 'eventId', 'outcome', 'operatorId', 'data'].map(
1127
- (key) => [key, PARAMETER_BINDING_SCHEMA],
1128
- ),
1129
- ),
1130
- required: ['callbackToken', 'eventId', 'outcome'],
1131
- additionalProperties: false,
1132
- },
1133
- },
1134
- required: ['inputBindings'],
1135
- additionalProperties: false,
1136
- },
1137
- inputSchema: { description: 'External callback payload' },
1138
- outputSchema: {
1139
- type: 'object',
1140
- properties: {
1141
- accepted: { type: 'boolean' },
1142
- duplicate: { type: 'boolean' },
1143
- resolved: { type: 'boolean' },
1144
- },
1145
- },
1146
- outputs: [],
1147
- runtimeKey: 'submit_external_result',
1148
- schemaVersion: 1,
1149
- instancePolicy: 'INLINE_ONLY',
1150
- uiSchema: { widget: 'submit-external-result-config' },
1151
- };
1152
-
1153
873
  const externalWaitNode: NodeTypeSeed = {
1154
874
  type: 'external_wait',
1155
875
  category: 'FLOW_CONTROL',
1156
- label: '等待外部处理',
876
+ label: '等待外部结果',
1157
877
  icon: 'HourglassOutlined',
1158
- description: '发起外部处理,并在收到结果后从对应出口继续',
878
+ description: '阻塞当前 Workflow,直到收到 callbackToken 对应的外部回调',
1159
879
  configSchema: {
1160
880
  type: 'object',
1161
881
  properties: {
1162
- dispatchWorkflowId: {
1163
- type: 'string',
1164
- title: '发送 Workflow',
1165
- pattern: '^[1-9][0-9]*$',
1166
- },
1167
- callbackWorkflowId: {
1168
- type: 'string',
1169
- title: '回调 Workflow',
1170
- pattern: '^[1-9][0-9]*$',
1171
- },
1172
- businessDataBinding: PARAMETER_BINDING_SCHEMA,
1173
- participantsBinding: PARAMETER_BINDING_SCHEMA,
1174
- outcomes: {
1175
- type: 'array',
1176
- minItems: 1,
1177
- items: {
1178
- type: 'object',
1179
- properties: {
1180
- code: {
1181
- type: 'string',
1182
- pattern: '^[A-Z][A-Z0-9_]{0,63}$',
1183
- },
1184
- label: { type: 'string', minLength: 1, maxLength: 64 },
1185
- },
1186
- required: ['code', 'label'],
1187
- additionalProperties: false,
1188
- },
1189
- },
882
+ callbackTokenBinding: PARAMETER_BINDING_SCHEMA,
1190
883
  timeout: {
1191
884
  type: 'object',
1192
885
  properties: {
886
+ mode: {
887
+ type: 'string',
888
+ enum: ['DEADLINE', 'DURATION', 'NONE'],
889
+ },
1193
890
  durationSeconds: { type: 'integer', minimum: 1 },
1194
- outcome: { type: 'string', const: 'TIMEOUT' },
891
+ deadlineBinding: PARAMETER_BINDING_SCHEMA,
1195
892
  },
1196
- required: ['durationSeconds', 'outcome'],
893
+ required: ['mode'],
1197
894
  additionalProperties: false,
1198
895
  },
1199
896
  },
1200
- required: ['dispatchWorkflowId', 'outcomes', 'timeout'],
897
+ required: ['callbackTokenBinding', 'timeout'],
1201
898
  additionalProperties: false,
1202
899
  },
1203
900
  inputSchema: {
1204
- description: '上一个节点的结果;默认作为发送给外部系统的业务数据',
901
+ description: '等待外部回调所需的 callbackToken 和截止时间',
1205
902
  },
1206
903
  outputSchema: {
1207
904
  type: 'object',
1208
905
  properties: {
906
+ callbackToken: { type: 'string' },
907
+ nodeId: { type: 'string' },
908
+ eventId: { type: 'string' },
1209
909
  outcome: { type: 'string' },
1210
910
  operatorId: { type: 'string' },
1211
911
  data: { type: 'object' },
1212
912
  completedAt: { type: 'string' },
913
+ reason: { type: 'string' },
1213
914
  },
1214
- required: ['outcome'],
915
+ required: ['callbackToken'],
1215
916
  },
1216
- outputs: null,
917
+ outputs: ['RECEIVED', 'TIMEOUT'],
1217
918
  runtimeKey: 'external_wait',
1218
- schemaVersion: 1,
919
+ schemaVersion: 2,
1219
920
  instancePolicy: 'INLINE_ONLY',
1220
921
  uiSchema: { widget: 'external-wait-config' },
1221
922
  };
@@ -1274,10 +975,7 @@ const codeNode: NodeTypeSeed = {
1274
975
  },
1275
976
  inputSchema: { description: 'Any JSON value from the previous node' },
1276
977
  outputSchema: {
1277
- type: 'object',
1278
- properties: {
1279
- result: { description: 'Any JSON value returned by the script' },
1280
- },
978
+ description: 'Any JSON value returned by the script',
1281
979
  },
1282
980
  runtimeKey: 'code',
1283
981
  schemaVersion: 4,
@@ -1302,46 +1000,11 @@ export const NODE_TYPES: NodeTypeSeed[] = [
1302
1000
  codeNode,
1303
1001
  humanApprovalNode,
1304
1002
  callableTriggerNode,
1305
- approvalRequestTriggerNode,
1306
1003
  returnResultNode,
1307
- submitApprovalResultNode,
1308
- submitExternalResultNode,
1309
1004
  externalWaitNode,
1310
1005
  subWorkflowNode,
1311
1006
  ];
1312
1007
 
1313
- // ─── Seed / nest-common consistency check ──────────────────────────────────
1314
- //
1315
- // Every entry in ALL_NODE_TYPES (the canonical registry in nest-common) MUST
1316
- // have a corresponding seed row here. If a new node type is added upstream
1317
- // but never seeded, the frontend canvas won't know how to render it — this
1318
- // throws at seed time so the gap is caught in dev / CI, not in production.
1319
- {
1320
- const seededTypes = new Set(NODE_TYPES.map((n) => n.type));
1321
- const missing = ALL_NODE_TYPES.filter((t) => !seededTypes.has(t));
1322
- if (missing.length > 0) {
1323
- throw new Error(
1324
- `[workflow-node-types seed] Missing seed rows for node types: ${missing.join(
1325
- ', ',
1326
- )}. ` +
1327
- `Add them to NODE_TYPES above, or (if the type was removed upstream, which nest-common ` +
1328
- `disallows — see workflow-dsl/README.md) coordinate a major bump.`,
1329
- );
1330
- }
1331
- const extra = [...seededTypes].filter(
1332
- (t) => !(ALL_NODE_TYPES as readonly string[]).includes(t),
1333
- );
1334
- if (extra.length > 0) {
1335
- // Extras are NOT an error — a downstream project may seed additional
1336
- // types locally. Log for visibility.
1337
- console.warn(
1338
- `[workflow-node-types seed] Extra local-only node types: ${extra.join(
1339
- ', ',
1340
- )}`,
1341
- );
1342
- }
1343
- }
1344
-
1345
1008
  export async function seedNodeTypes(prisma: PrismaClient) {
1346
1009
  console.log('Seeding workflow node types...');
1347
1010
  for (const nodeType of NODE_TYPES) {