gbflowengine 0.0.0-stage → 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +271 -3
- package/dist/gbflowengine.css +1 -0
- package/dist/gbflowengine.js +18363 -0
- package/dist/gbflowengine.js.map +1 -0
- package/dist/gbflowengine.umd.cjs +5 -0
- package/dist/gbflowengine.umd.cjs.map +1 -0
- package/package.json +84 -6
- package/src/center/DefinitionInspect.vue +291 -0
- package/src/center/FlowCenter.vue +33 -0
- package/src/center/index.js +29 -0
- package/src/center/storage.js +748 -0
- package/src/core/flow/condition.js +160 -0
- package/src/core/flow/customNode.js +385 -0
- package/src/core/flow/defaults.js +124 -0
- package/src/core/flow/flowConstant.js +265 -0
- package/src/core/flow/flowNodeUtils.js +30 -0
- package/src/core/flow/index.js +47 -0
- package/src/core/flow/node.js +44 -0
- package/src/core/flow/nodeFactory.js +58 -0
- package/src/core/flow/prediction.js +325 -0
- package/src/core/flow/runtime/auto.js +83 -0
- package/src/core/flow/runtime/decide.js +329 -0
- package/src/core/flow/runtime/event.js +28 -0
- package/src/core/flow/runtime/execute.js +357 -0
- package/src/core/flow/runtime/helpers.js +52 -0
- package/src/core/flow/runtime/query.js +146 -0
- package/src/core/flow/runtime/reject.js +137 -0
- package/src/core/flow/runtime/token.js +269 -0
- package/src/core/flow/runtime.js +129 -0
- package/src/core/flow/schema.js +864 -0
- package/src/definition/FlowDefinitionDesigner.vue +338 -0
- package/src/definition/index.js +9 -0
- package/src/index.js +39 -0
- package/src/storage.js +200 -0
- package/src/testing/FlowTestPanel.vue +2502 -0
- package/src/testing/UserConfigDrawer.vue +376 -0
- package/src/testing/diagram/FlowProgressDiagram.vue +318 -0
- package/src/testing/diagramModel.js +517 -0
- package/src/testing/index.js +23 -0
- package/src/testing/mock.js +246 -0
- package/src/testing/oaExecutors.js +51 -0
- package/src/testing/oaSeed.js +467 -0
- package/src/testing/sample.js +412 -0
- package/src/testing/seed.js +122 -0
- package/src/utils/format.js +27 -0
- package/src/visual/FlowCanvas.vue +441 -0
- package/src/visual/NodeProgressDetail.vue +43 -0
- package/src/visual/NodeStatusBadge.vue +17 -0
- package/src/visual/NodeWrap.vue +47 -0
- package/src/visual/ScWorkflow.vue +50 -0
- package/src/visual/SelectDialog.vue +460 -0
- package/src/visual/conditionHelpers.js +117 -0
- package/src/visual/index.js +6 -0
- package/src/visual/nodes/AddNode.vue +223 -0
- package/src/visual/nodes/ApproverNode.vue +348 -0
- package/src/visual/nodes/BranchNode.vue +442 -0
- package/src/visual/nodes/CustomNode.vue +339 -0
- package/src/visual/nodes/EndNode.vue +22 -0
- package/src/visual/nodes/PassNode.vue +101 -0
- package/src/visual/nodes/PromoterNode.vue +135 -0
- package/src/visual/nodes/RejectNode.vue +101 -0
- package/src/visual/nodes/SendNode.vue +152 -0
- package/src/visual/styles.scss +879 -0
- package/src/visual/useScNodeStatus.js +18 -0
- package/src/workbench/OaWorkbench.vue +1341 -0
- package/src/workbench/components/ApprovalWorkspace.vue +2090 -0
- package/src/workbench/components/CategoryIcon.vue +74 -0
- package/src/workbench/components/NotificationIcon.vue +73 -0
- package/src/workbench/components/ProcessSteps.vue +557 -0
- package/src/workbench/components/ResubmitDialog.vue +227 -0
- package/src/workbench/components/SidebarNav.vue +138 -0
- package/src/workbench/components/StartFlowDialog.vue +1058 -0
- package/src/workbench/components/UserAvatar.vue +68 -0
- package/src/workbench/custom-tasks.js +130 -0
- package/src/workbench/model.js +1080 -0
- package/src/workbench/pages/DesignPage.vue +798 -0
- package/src/workbench/pages/HomePage.vue +1050 -0
- package/src/workbench/pages/MonitorPage.vue +1029 -0
- package/src/workbench/pages/NotificationsPage.vue +554 -0
- package/src/workbench/pages/RequestsPage.vue +644 -0
- package/src/workbench/pages/TaskCenterPage.vue +1155 -0
- package/src/workbench/pages/TemplatesPage.vue +680 -0
- package/src/workbench/persistence.js +89 -0
- package/src/workbench/shared.js +18 -0
- package/src/workbench/styles.scss +555 -0
- package/src/workbench/useWorkbench.js +955 -0
- package/types/center.d.ts +5 -0
- package/types/core.d.ts +479 -0
- package/types/definition.d.ts +4 -0
- package/types/index.d.ts +34 -0
- package/types/testing.d.ts +20 -0
- package/types/visual.d.ts +20 -0
package/types/core.d.ts
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
export type NodeId = string | number
|
|
2
|
+
export type FlowNodeTypeValue =
|
|
3
|
+
| 'start'
|
|
4
|
+
| 'approve'
|
|
5
|
+
| 'cc'
|
|
6
|
+
| 'custom'
|
|
7
|
+
| 'branch'
|
|
8
|
+
| 'condition'
|
|
9
|
+
| 'parallel'
|
|
10
|
+
| 'parallel_branch'
|
|
11
|
+
| 'inclusive'
|
|
12
|
+
| 'inclusive_branch'
|
|
13
|
+
| 'pass'
|
|
14
|
+
| 'reject'
|
|
15
|
+
| 'end'
|
|
16
|
+
|
|
17
|
+
export interface FlowCondition {
|
|
18
|
+
variable: string
|
|
19
|
+
variableName?: string
|
|
20
|
+
operator: string
|
|
21
|
+
value?: unknown
|
|
22
|
+
logic?: 'AND' | 'OR'
|
|
23
|
+
fieldType?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CustomNodeConfig {
|
|
27
|
+
executorType?: 'http' | 'method'
|
|
28
|
+
url?: string
|
|
29
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | string
|
|
30
|
+
headers?: Array<{ key: string; value: string }>
|
|
31
|
+
body?: string
|
|
32
|
+
timeoutMs?: number
|
|
33
|
+
methodKey?: string
|
|
34
|
+
resultVariable?: string
|
|
35
|
+
onError?: 'terminate' | 'continue'
|
|
36
|
+
[key: string]: unknown
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface FlowNode {
|
|
40
|
+
nodeId: NodeId
|
|
41
|
+
nodeName: string
|
|
42
|
+
type: FlowNodeTypeValue | string
|
|
43
|
+
childNode?: FlowNode | null
|
|
44
|
+
branchList?: FlowNode[]
|
|
45
|
+
conditions?: FlowCondition[]
|
|
46
|
+
isDefaultCondition?: boolean
|
|
47
|
+
isDefaultBranch?: boolean
|
|
48
|
+
branchIndex?: number
|
|
49
|
+
approverType?: 'user' | 'role' | 'superior_leader' | string
|
|
50
|
+
userList?: Array<NodeId | Record<string, unknown>>
|
|
51
|
+
roleList?: NodeId[]
|
|
52
|
+
userNickNames?: Record<string, string>
|
|
53
|
+
deptNameMap?: Record<string, string>
|
|
54
|
+
roleNameMap?: Record<string, string>
|
|
55
|
+
signMode?: 'and' | 'or'
|
|
56
|
+
superiorLevel?: number
|
|
57
|
+
allowTransfer?: boolean
|
|
58
|
+
allowInitiatorAddUsers?: boolean
|
|
59
|
+
rejectStrategy?: 'terminate' | 'to_previous' | 'to_initiator' | 'to_specified' | string
|
|
60
|
+
rejectTargetNodeId?: NodeId | null
|
|
61
|
+
rejectRetryLimit?: number
|
|
62
|
+
termAuto?: boolean
|
|
63
|
+
term?: number
|
|
64
|
+
termMode?: 0 | 1 | number
|
|
65
|
+
custom?: CustomNodeConfig
|
|
66
|
+
[key: string]: unknown
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface FlowForm {
|
|
70
|
+
components: Array<Record<string, unknown>>
|
|
71
|
+
options: Record<string, unknown>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface FlowDefinitionMeta {
|
|
75
|
+
id: string
|
|
76
|
+
name: string
|
|
77
|
+
description?: string
|
|
78
|
+
tags?: string[]
|
|
79
|
+
groupId?: string | null
|
|
80
|
+
status?: 'draft' | 'published' | 'disabled'
|
|
81
|
+
version?: number
|
|
82
|
+
publishedAt?: string
|
|
83
|
+
createdAt?: string
|
|
84
|
+
updatedAt?: string
|
|
85
|
+
revisions?: DefinitionRevision[]
|
|
86
|
+
[key: string]: unknown
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface DefinitionRevision {
|
|
90
|
+
version: number
|
|
91
|
+
publishedAt: string
|
|
92
|
+
name: string
|
|
93
|
+
description?: string
|
|
94
|
+
tags?: string[]
|
|
95
|
+
workflow: FlowNode
|
|
96
|
+
form: FlowForm
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface FlowDefinition {
|
|
100
|
+
schemaVersion: string
|
|
101
|
+
kind: string
|
|
102
|
+
meta: FlowDefinitionMeta
|
|
103
|
+
workflow: FlowNode
|
|
104
|
+
form: FlowForm
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface ApprovalRecord {
|
|
108
|
+
action: string
|
|
109
|
+
approver: { id: NodeId; name: string; [key: string]: unknown }
|
|
110
|
+
comment?: string
|
|
111
|
+
at: string
|
|
112
|
+
system?: boolean
|
|
113
|
+
limitReached?: boolean
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface FlowTask {
|
|
117
|
+
id: string
|
|
118
|
+
nodeId: NodeId
|
|
119
|
+
nodeName: string
|
|
120
|
+
tokenId: string
|
|
121
|
+
kind?: 'approve' | 'submit' | 'custom'
|
|
122
|
+
signMode: 'and' | 'or' | null
|
|
123
|
+
approvers: Array<Record<string, any>>
|
|
124
|
+
approvedBy: Array<Record<string, any>>
|
|
125
|
+
records: ApprovalRecord[]
|
|
126
|
+
status: 'pending' | 'approved' | 'rejected' | 'completed' | 'failed' | 'cancelled' | string
|
|
127
|
+
cycle: number
|
|
128
|
+
createdAt: string
|
|
129
|
+
finishedAt?: string
|
|
130
|
+
dueAt?: string
|
|
131
|
+
termMode?: 0 | 1
|
|
132
|
+
autoApproved?: boolean
|
|
133
|
+
custom?: CustomNodeConfig
|
|
134
|
+
attempts?: number
|
|
135
|
+
result?: unknown
|
|
136
|
+
lastError?: string
|
|
137
|
+
[key: string]: unknown
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface FlowEvent {
|
|
141
|
+
id: string
|
|
142
|
+
event: string
|
|
143
|
+
at: string
|
|
144
|
+
cycle: number
|
|
145
|
+
[key: string]: unknown
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface FlowToken {
|
|
149
|
+
id: string
|
|
150
|
+
nodeId: NodeId | null
|
|
151
|
+
continuations: NodeId[]
|
|
152
|
+
joins: Array<{
|
|
153
|
+
groupId: string
|
|
154
|
+
targetId: NodeId | null
|
|
155
|
+
expected: number
|
|
156
|
+
createdBy?: NodeId
|
|
157
|
+
continuations?: NodeId[]
|
|
158
|
+
}>
|
|
159
|
+
blockedTaskId: string | null
|
|
160
|
+
blockedJoinGroup: string | null
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface RuntimeState {
|
|
164
|
+
status: 'idle' | 'running' | 'completed' | 'rejected' | 'cancelled' | 'revoked'
|
|
165
|
+
initiator: Record<string, any> | null
|
|
166
|
+
tokens: FlowToken[]
|
|
167
|
+
tasks: FlowTask[]
|
|
168
|
+
ccRecords: Array<Record<string, any>>
|
|
169
|
+
history: FlowEvent[]
|
|
170
|
+
variables: Record<string, any>
|
|
171
|
+
warnings: Array<{ code: string; message: string; at: string }>
|
|
172
|
+
startedAt: string | null
|
|
173
|
+
endedAt: string | null
|
|
174
|
+
cycle: number
|
|
175
|
+
currentNodeIds?: NodeId[]
|
|
176
|
+
pendingTaskCount?: number
|
|
177
|
+
[key: string]: unknown
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface RuntimeContext {
|
|
181
|
+
initiator?: Record<string, any>
|
|
182
|
+
initiatorId?: NodeId
|
|
183
|
+
resolveApprovers?: (
|
|
184
|
+
node: FlowNode,
|
|
185
|
+
variables: Record<string, any>,
|
|
186
|
+
context: RuntimeContext
|
|
187
|
+
) => Array<Record<string, any>> | null | undefined
|
|
188
|
+
resolveRoleUsers?: (roleIds: NodeId[], node: FlowNode) => Array<Record<string, any>>
|
|
189
|
+
getSuperiorLeader?: (level: number, node: FlowNode) => Array<Record<string, any>> | Record<string, any> | null
|
|
190
|
+
resolveUser?: (userId: NodeId) => Record<string, any> | null
|
|
191
|
+
resolveExtraCcUsers?: (
|
|
192
|
+
node: FlowNode,
|
|
193
|
+
variables: Record<string, any>,
|
|
194
|
+
context: RuntimeContext
|
|
195
|
+
) => Array<Record<string, any>>
|
|
196
|
+
[key: string]: any
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export type RuntimeHandlers = Partial<
|
|
200
|
+
Record<
|
|
201
|
+
| 'onStart'
|
|
202
|
+
| 'onTaskCreated'
|
|
203
|
+
| 'onTaskUpdated'
|
|
204
|
+
| 'onTaskApproved'
|
|
205
|
+
| 'onTaskTransferred'
|
|
206
|
+
| 'onCustomTaskCompleted'
|
|
207
|
+
| 'onCustomTaskFailed'
|
|
208
|
+
| 'onNodeEnter'
|
|
209
|
+
| 'onNodeLeave'
|
|
210
|
+
| 'onCc'
|
|
211
|
+
| 'onJoin'
|
|
212
|
+
| 'onReturned'
|
|
213
|
+
| 'onResubmitted'
|
|
214
|
+
| 'onFinished'
|
|
215
|
+
| 'onWarning',
|
|
216
|
+
(payload: any) => void
|
|
217
|
+
>
|
|
218
|
+
>
|
|
219
|
+
|
|
220
|
+
export interface FlowRuntimeOptions {
|
|
221
|
+
workflow: FlowNode
|
|
222
|
+
data?: Record<string, any>
|
|
223
|
+
context?: RuntimeContext
|
|
224
|
+
state?: RuntimeState | null
|
|
225
|
+
handlers?: RuntimeHandlers | null
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export class FlowRuntime {
|
|
229
|
+
constructor(options: FlowRuntimeOptions)
|
|
230
|
+
static restore(options: FlowRuntimeOptions): FlowRuntime
|
|
231
|
+
workflow: FlowNode
|
|
232
|
+
context: RuntimeContext
|
|
233
|
+
handlers: RuntimeHandlers
|
|
234
|
+
state: RuntimeState
|
|
235
|
+
getNode(nodeId: NodeId): FlowNode | null
|
|
236
|
+
getState(): RuntimeState
|
|
237
|
+
getPendingTasks(): FlowTask[]
|
|
238
|
+
getPendingTasksForUser(userId: NodeId): FlowTask[]
|
|
239
|
+
getPendingCustomTasks(): FlowTask[]
|
|
240
|
+
getCcRecordsForUser(userId: NodeId): Array<Record<string, any>>
|
|
241
|
+
getRejectInfo(nodeId: NodeId): Record<string, any>
|
|
242
|
+
setVariables(patch: Record<string, any>): Record<string, any>
|
|
243
|
+
resolveApprovers(node: FlowNode): Array<Record<string, any>>
|
|
244
|
+
resolveCcUsers(node: FlowNode): Array<Record<string, any>>
|
|
245
|
+
start(initialData?: Record<string, any> | null, initiator?: Record<string, any> | null): RuntimeState
|
|
246
|
+
approve(taskId: string, payload?: Record<string, any>): RuntimeState
|
|
247
|
+
reject(taskId: string, payload?: Record<string, any>): RuntimeState
|
|
248
|
+
transfer(taskId: string, payload?: Record<string, any>): RuntimeState
|
|
249
|
+
resubmit(taskId: string, payload?: Record<string, any>): RuntimeState
|
|
250
|
+
completeCustomTask(taskId: string, payload?: Record<string, any>): RuntimeState
|
|
251
|
+
revoke(payload?: Record<string, any>): RuntimeState
|
|
252
|
+
cancel(reason?: string): RuntimeState
|
|
253
|
+
tick(now?: number | Date): RuntimeState
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function createFlowRuntime(options: FlowRuntimeOptions): FlowRuntime
|
|
257
|
+
export function evaluateBranches(workflow: FlowNode, data?: Record<string, any>): Array<Record<string, any>>
|
|
258
|
+
|
|
259
|
+
export interface PredictionNode {
|
|
260
|
+
id: string
|
|
261
|
+
nodeId: NodeId
|
|
262
|
+
nodeName: string
|
|
263
|
+
type: string
|
|
264
|
+
typeLabel?: string
|
|
265
|
+
kind: string
|
|
266
|
+
depth: number
|
|
267
|
+
path: string[]
|
|
268
|
+
group?: Record<string, any> | null
|
|
269
|
+
approvers?: Array<Record<string, any>>
|
|
270
|
+
ccUsers?: Array<Record<string, any>>
|
|
271
|
+
signMode?: string
|
|
272
|
+
signModeLabel?: string
|
|
273
|
+
note?: string
|
|
274
|
+
[key: string]: unknown
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface PredictionResult {
|
|
278
|
+
rootNodeId: NodeId
|
|
279
|
+
definitionName: string | null
|
|
280
|
+
initiator: Record<string, any> | null
|
|
281
|
+
status: 'completed' | 'rejected' | string
|
|
282
|
+
nodeCount: number
|
|
283
|
+
approvalNodeCount: number
|
|
284
|
+
approvalTaskCount: number
|
|
285
|
+
ccNodeCount: number
|
|
286
|
+
ccUserCount: number
|
|
287
|
+
branchCount: number
|
|
288
|
+
decisions: Array<Record<string, any>>
|
|
289
|
+
warnings: Array<{ code: string; message: string; nodeId?: NodeId | null; nodeName?: string }>
|
|
290
|
+
nodes: PredictionNode[]
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function predictWorkflow(options: {
|
|
294
|
+
definition?: FlowDefinition | null
|
|
295
|
+
workflow?: FlowNode | null
|
|
296
|
+
data?: Record<string, any>
|
|
297
|
+
context?: RuntimeContext
|
|
298
|
+
initiator?: Record<string, any> | null
|
|
299
|
+
}): PredictionResult
|
|
300
|
+
export function predictFlow(
|
|
301
|
+
workflow: FlowNode,
|
|
302
|
+
data?: Record<string, any>,
|
|
303
|
+
context?: RuntimeContext,
|
|
304
|
+
initiator?: Record<string, any> | null
|
|
305
|
+
): PredictionResult
|
|
306
|
+
|
|
307
|
+
export const MAX_PREDICTION_NODES: number
|
|
308
|
+
export const MAX_NODE_COUNT: number
|
|
309
|
+
export const SCHEMA_VERSION: string
|
|
310
|
+
export const SCHEMA_KIND: string
|
|
311
|
+
export const WORKFLOW_KIND: string
|
|
312
|
+
export const FORM_KIND: string
|
|
313
|
+
|
|
314
|
+
export const FlowNodeType: {
|
|
315
|
+
readonly START: 'start'
|
|
316
|
+
readonly APPROVE: 'approve'
|
|
317
|
+
readonly CC: 'cc'
|
|
318
|
+
readonly BRANCH: 'branch'
|
|
319
|
+
readonly CONDITION: 'condition'
|
|
320
|
+
readonly PARALLEL: 'parallel'
|
|
321
|
+
readonly PARALLEL_BRANCH: 'parallel_branch'
|
|
322
|
+
readonly INCLUSIVE: 'inclusive'
|
|
323
|
+
readonly INCLUSIVE_BRANCH: 'inclusive_branch'
|
|
324
|
+
readonly PASS: 'pass'
|
|
325
|
+
readonly REJECT: 'reject'
|
|
326
|
+
readonly END: 'end'
|
|
327
|
+
}
|
|
328
|
+
export const NodeTypeLabel: Record<string, string>
|
|
329
|
+
export const ApproverType: Record<string, string>
|
|
330
|
+
export const ApproverTypeLabel: Record<string, string>
|
|
331
|
+
export const ApproverTypeOptions: Array<{ value: string; label: string }>
|
|
332
|
+
export const SignMode: Record<string, string>
|
|
333
|
+
export const SignModeLabel: Record<string, string>
|
|
334
|
+
export const RejectStrategy: Record<string, string>
|
|
335
|
+
export const RejectStrategyLabel: Record<string, string>
|
|
336
|
+
export const TaskAction: Record<string, string>
|
|
337
|
+
export const TaskStatus: Record<string, string>
|
|
338
|
+
export const FlowInstanceStatus: Record<string, string>
|
|
339
|
+
export const FlowEventType: Record<string, string>
|
|
340
|
+
export const BusinessType: Record<string, string>
|
|
341
|
+
|
|
342
|
+
export function normalizeWorkflow(
|
|
343
|
+
workflow: FlowNode,
|
|
344
|
+
options?: { ensureEnd?: boolean }
|
|
345
|
+
): { workflow: FlowNode; repairs: string[] }
|
|
346
|
+
export function createDefinition(input?: {
|
|
347
|
+
workflow?: FlowNode | null
|
|
348
|
+
form?: Array<Record<string, any>> | FlowForm | null
|
|
349
|
+
meta?: Partial<FlowDefinitionMeta>
|
|
350
|
+
}): FlowDefinition
|
|
351
|
+
export function normalizeDefinition(input: FlowDefinition | Record<string, any> | string, options?: Record<string, any>): FlowDefinition
|
|
352
|
+
export function importDefinition(input: string | Record<string, any> | Array<Record<string, any>>): {
|
|
353
|
+
document: FlowDefinition
|
|
354
|
+
repairs: string[]
|
|
355
|
+
validation: ValidationResult
|
|
356
|
+
}
|
|
357
|
+
export function exportDefinition(input: FlowDefinition | Record<string, any>, options?: { raw?: boolean; space?: number; updateTimestamp?: boolean }): string | FlowDefinition
|
|
358
|
+
export function exportWorkflow(workflow: FlowNode, meta?: Partial<FlowDefinitionMeta>, options?: { raw?: boolean; space?: number }): string | Record<string, any>
|
|
359
|
+
|
|
360
|
+
export interface ValidationIssue {
|
|
361
|
+
code: string
|
|
362
|
+
message: string
|
|
363
|
+
nodeId?: NodeId
|
|
364
|
+
componentId?: string
|
|
365
|
+
[key: string]: unknown
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface ValidationResult {
|
|
369
|
+
valid: boolean
|
|
370
|
+
errors: ValidationIssue[]
|
|
371
|
+
warnings: ValidationIssue[]
|
|
372
|
+
nodeCount?: number
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export function validateWorkflow(workflow: FlowNode, options?: { strict?: boolean; formVariables?: any[] }): ValidationResult
|
|
376
|
+
export function validateDefinition(definition: FlowDefinition, options?: { strict?: boolean }): ValidationResult
|
|
377
|
+
|
|
378
|
+
export function evaluateCondition(condition: FlowCondition, data?: Record<string, any>): boolean
|
|
379
|
+
export function evaluateConditionGroup(conditions: FlowCondition[], data?: Record<string, any>): boolean
|
|
380
|
+
export function getVariableValue(data: Record<string, any>, variable: string): unknown
|
|
381
|
+
export function selectBranchNode(branchNode: FlowNode, data?: Record<string, any>): FlowNode | null
|
|
382
|
+
export function selectInclusiveBranches(branchNode: FlowNode, data?: Record<string, any>): FlowNode[]
|
|
383
|
+
export function isEmptyValue(value: unknown): boolean
|
|
384
|
+
export function normalizeComparable(value: unknown): string
|
|
385
|
+
|
|
386
|
+
export function isStructuralNode(node: FlowNode | null): boolean
|
|
387
|
+
export function isTerminalNode(node: FlowNode | null): boolean
|
|
388
|
+
export function isBranchNode(node: FlowNode | null): boolean
|
|
389
|
+
export function getNodeTypeLabel(type: string): string
|
|
390
|
+
export function createNodeDefaults(type: string): Record<string, unknown>
|
|
391
|
+
|
|
392
|
+
export function findNodeById(node: FlowNode | null, targetId: NodeId): FlowNode | null
|
|
393
|
+
export function hasEndNode(node: FlowNode | null): boolean
|
|
394
|
+
export function ensureEndNode(rootNode: FlowNode): FlowNode
|
|
395
|
+
export function createNewNode(type: string, name?: string): FlowNode
|
|
396
|
+
export function createEndNode(): FlowNode
|
|
397
|
+
export function generateNodeId(): number
|
|
398
|
+
export function traverseNodes(root: FlowNode | null, visitor: (node: FlowNode) => void): void
|
|
399
|
+
export function getAllNodes(root: FlowNode | null): FlowNode[]
|
|
400
|
+
export function countNodes(root: FlowNode | null): number
|
|
401
|
+
export function getNodeStatistics(root: FlowNode | null): Record<string, number>
|
|
402
|
+
|
|
403
|
+
export const CUSTOM_EXECUTOR_TYPE: { HTTP: 'http'; METHOD: 'method' }
|
|
404
|
+
export const CUSTOM_ERROR_POLICY: { TERMINATE: 'terminate'; CONTINUE: 'continue' }
|
|
405
|
+
export const CUSTOM_HTTP_METHODS: string[]
|
|
406
|
+
export const CUSTOM_TIMEOUT_DEFAULT: number
|
|
407
|
+
export const CUSTOM_TIMEOUT_MIN: number
|
|
408
|
+
export const CUSTOM_TIMEOUT_MAX: number
|
|
409
|
+
export const CUSTOM_RESULT_LIMIT: number
|
|
410
|
+
|
|
411
|
+
export function createCustomNodeConfig(overrides?: CustomNodeConfig): CustomNodeConfig
|
|
412
|
+
export function normalizeCustomNodeConfig(input?: CustomNodeConfig | null): CustomNodeConfig
|
|
413
|
+
export function validateCustomNodeConfig(input?: CustomNodeConfig | null): {
|
|
414
|
+
errors: ValidationIssue[]
|
|
415
|
+
warnings: ValidationIssue[]
|
|
416
|
+
config: CustomNodeConfig
|
|
417
|
+
}
|
|
418
|
+
export function customNodeSummary(input?: CustomNodeConfig | null): string
|
|
419
|
+
export function isValidCustomResultVariable(value: unknown): boolean
|
|
420
|
+
export function interpolateCustomTemplate(template: unknown, variables?: Record<string, any>): any
|
|
421
|
+
export function resolveCustomRequest(input: CustomNodeConfig, variables?: Record<string, any>): {
|
|
422
|
+
url: string
|
|
423
|
+
method: string
|
|
424
|
+
headers: Record<string, string>
|
|
425
|
+
body?: string
|
|
426
|
+
timeoutMs: number
|
|
427
|
+
}
|
|
428
|
+
export function executeCustomNode(
|
|
429
|
+
input: CustomNodeConfig,
|
|
430
|
+
options?: {
|
|
431
|
+
variables?: Record<string, any>
|
|
432
|
+
executors?: Record<string, (context: Record<string, any>) => unknown>
|
|
433
|
+
fetchImpl?: (...args: any[]) => Promise<any>
|
|
434
|
+
signal?: any
|
|
435
|
+
node?: FlowNode | null
|
|
436
|
+
instance?: Record<string, any> | null
|
|
437
|
+
}
|
|
438
|
+
): Promise<any>
|
|
439
|
+
|
|
440
|
+
export const RUNTIME_RUNNING: 'running'
|
|
441
|
+
export const RUNTIME_COMPLETED: 'completed'
|
|
442
|
+
export const RUNTIME_REJECTED: 'rejected'
|
|
443
|
+
export const RUNTIME_CANCELLED: 'cancelled'
|
|
444
|
+
export const RUNTIME_REVOKED: 'revoked'
|
|
445
|
+
export const RUNTIME_IDLE: 'idle'
|
|
446
|
+
|
|
447
|
+
// Re-exported headless form helpers.
|
|
448
|
+
export interface FormVariable {
|
|
449
|
+
variableName: string
|
|
450
|
+
label: string
|
|
451
|
+
dataType: string
|
|
452
|
+
componentType: string
|
|
453
|
+
metadata: Record<string, any>
|
|
454
|
+
getOptions(): Array<Record<string, any>>
|
|
455
|
+
getDateFormat?(): string
|
|
456
|
+
[key: string]: any
|
|
457
|
+
}
|
|
458
|
+
export const ConditionOperator: Record<string, string>
|
|
459
|
+
export const OPERATOR_LABEL_MAP: Record<string, string>
|
|
460
|
+
export function computeDataType(component: Record<string, any>): string
|
|
461
|
+
export function enrichFormVariables(components: Array<Record<string, any>>): FormVariable[]
|
|
462
|
+
export function findFormVariable(formVariables: FormVariable[], variableName: string): FormVariable | null
|
|
463
|
+
export function normalizeForm(form: unknown): { components: Array<Record<string, any>>; options: Record<string, any>; repairs: string[] }
|
|
464
|
+
export function validateForm(form: unknown): { valid: boolean; errors: ValidationIssue[]; warnings: ValidationIssue[] }
|
|
465
|
+
export function importForm(input: unknown): { form: FlowForm; repairs: string[] }
|
|
466
|
+
export function exportForm(input: unknown, meta?: Record<string, any>, options?: Record<string, any>): string | Record<string, any>
|
|
467
|
+
export function downloadJSON(data: unknown, fileName?: string, space?: number): void
|
|
468
|
+
export function downloadText(content: string, fileName: string, mime?: string): void
|
|
469
|
+
export function readTextFile(file: File): Promise<string>
|
|
470
|
+
export function pickJSONFile(): Promise<{ file: File; text: string } | null>
|
|
471
|
+
export function sanitizeFileName(name: string, fallback?: string): string
|
|
472
|
+
export const COMPONENT_TYPES: Record<string, string>
|
|
473
|
+
export const COMPONENT_TYPE_LABELS: Record<string, string>
|
|
474
|
+
export const OPTION_COMPONENT_TYPES: string[]
|
|
475
|
+
export function generateComponentId(): string
|
|
476
|
+
export function ensureComponentId(component: Record<string, any>): Record<string, any>
|
|
477
|
+
export function getFieldName(component: Record<string, any>): string
|
|
478
|
+
export const BaseDataType: Record<string, string>
|
|
479
|
+
export const ComponentType: Record<string, string>
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue'
|
|
2
|
+
import type { FlowDefinition, FlowNode, PredictionResult, RuntimeState } from './core'
|
|
3
|
+
|
|
4
|
+
export * from './core'
|
|
5
|
+
|
|
6
|
+
export const FlowCenter: DefineComponent<any, any, any>
|
|
7
|
+
export const FlowTestPanel: DefineComponent<any, any, any>
|
|
8
|
+
export const UserConfigDrawer: DefineComponent<any, any, any>
|
|
9
|
+
export const FlowProgressDiagram: DefineComponent<any, any, any>
|
|
10
|
+
export const FlowDefinitionDesigner: DefineComponent<any, any, any>
|
|
11
|
+
export const ScWorkflow: DefineComponent<any, any, any>
|
|
12
|
+
export const NodeStatusBadge: DefineComponent<any, any, any>
|
|
13
|
+
export const NodeProgressDetail: DefineComponent<any, any, any>
|
|
14
|
+
|
|
15
|
+
export function createOaDemoInstances(): any[]
|
|
16
|
+
export function createDemoCustomExecutors(): Record<string, (context: any) => Promise<unknown> | unknown>
|
|
17
|
+
|
|
18
|
+
export function buildDiagramModel(options: {
|
|
19
|
+
workflow: FlowNode
|
|
20
|
+
state?: RuntimeState | null
|
|
21
|
+
prediction?: PredictionResult | null
|
|
22
|
+
}): Record<string, any>
|
|
23
|
+
export function pruneUnselectedBranches(
|
|
24
|
+
workflow: FlowNode | null,
|
|
25
|
+
statusMap?: Record<string, any>
|
|
26
|
+
): FlowNode | null
|
|
27
|
+
|
|
28
|
+
export const version: string
|
|
29
|
+
|
|
30
|
+
declare const plugin: {
|
|
31
|
+
version: string
|
|
32
|
+
install(app: { component: (name: string, component: any) => void }): void
|
|
33
|
+
}
|
|
34
|
+
export default plugin
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const FlowTestPanel: DefineComponent<any, any, any>
|
|
4
|
+
export const UserConfigDrawer: DefineComponent<any, any, any>
|
|
5
|
+
export const FlowProgressDiagram: DefineComponent<any, any, any>
|
|
6
|
+
export const mockUsers: Array<Record<string, any>>
|
|
7
|
+
export const mockDepartments: Array<Record<string, any>>
|
|
8
|
+
export const mockRoles: Array<Record<string, any>>
|
|
9
|
+
export function createMockAdapters(options?: Record<string, any>): Record<string, any>
|
|
10
|
+
export function createMockRuntimeContext(options?: Record<string, any>): Record<string, any>
|
|
11
|
+
export function createTestRuntime(options?: Record<string, any>): {
|
|
12
|
+
runtime: import('./core').FlowRuntime
|
|
13
|
+
context: Record<string, any>
|
|
14
|
+
initiator: Record<string, any> | null
|
|
15
|
+
}
|
|
16
|
+
export function createOaDemoInstances(): Array<Record<string, any>>
|
|
17
|
+
export function createDemoCustomExecutors(): Record<string, (context: Record<string, any>) => Promise<unknown> | unknown>
|
|
18
|
+
export function createSampleDefinition(): import('./core').FlowDefinition
|
|
19
|
+
export function createSampleWorkflow(): import('./core').FlowNode
|
|
20
|
+
export function createSampleForm(): Array<Record<string, any>>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const ScWorkflow: DefineComponent<any, any, any>
|
|
4
|
+
export const NodeStatusBadge: DefineComponent<any, any, any>
|
|
5
|
+
export const NodeProgressDetail: DefineComponent<any, any, any>
|
|
6
|
+
export function useScNodeStatus(nodeConfig: any): {
|
|
7
|
+
statusInfo: import('vue').ComputedRef<Record<string, any> | null>
|
|
8
|
+
statusClass: import('vue').ComputedRef<string>
|
|
9
|
+
}
|
|
10
|
+
export function getVariable(formVariables: any[], variableName: string): any
|
|
11
|
+
export function getValueControl(formVariables: any[], variableName: string): string
|
|
12
|
+
export function getVariableOptions(formVariables: any[], variableName: string): any[]
|
|
13
|
+
export function getVariableDateFormat(formVariables: any[], variableName: string): string
|
|
14
|
+
export function isIntegerVariable(formVariables: any[], variableName: string): boolean
|
|
15
|
+
export function operatorLabel(operator: string): string
|
|
16
|
+
export function operatorsForVariable(formVariables: any[], variableName: string): Array<{ value: string; label: string }>
|
|
17
|
+
export function needsValue(operator: string): boolean
|
|
18
|
+
export function summarizeConditions(formVariables: any[], conditions: any[]): string
|
|
19
|
+
export function groupsFromConditions(conditions: any[]): any[][]
|
|
20
|
+
export function conditionsFromGroups(groups: any[][]): any[]
|