@rytass/bpm-core-shared 0.1.9 → 0.2.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/CHANGELOG.md +9 -0
- package/package.json +24 -3
- package/src/index.d.ts +3 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/lib/workflow-command.d.ts +156 -0
- package/src/lib/workflow-command.js +292 -0
- package/src/lib/workflow-command.js.map +1 -0
- package/src/lib/workflow-graph.d.ts +96 -0
- package/src/lib/workflow-graph.js +605 -0
- package/src/lib/workflow-graph.js.map +1 -0
- package/src/lib/workflow-toolset.d.ts +105 -0
- package/src/lib/workflow-toolset.js +702 -0
- package/src/lib/workflow-toolset.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
Releases are managed by [`nx release`](https://nx.dev/recipes/nx-release) with
|
|
9
9
|
Conventional Commits — see `nx.json` for the release config.
|
|
10
10
|
|
|
11
|
+
## 0.2.0 — 2026-06-04
|
|
12
|
+
|
|
13
|
+
No source change. Lockstep bump with `@rytass/bpm-core-nestjs-module`
|
|
14
|
+
and `@rytass/bpm-core-client` 0.2.0.
|
|
15
|
+
|
|
16
|
+
## 0.1.10 — 2026-05-28
|
|
17
|
+
|
|
18
|
+
No source change. Lockstep bump.
|
|
19
|
+
|
|
11
20
|
## 0.1.9 — 2026-05-28
|
|
12
21
|
|
|
13
22
|
No source change. Lockstep bump alongside
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/bpm-core-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared TypeScript contracts for the Rytass BPM approval workflow stack (workflow, form, condition, identity, organization, status types).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bpm",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=20.0.0"
|
|
32
32
|
},
|
|
33
|
-
"type": "commonjs",
|
|
34
33
|
"main": "./src/index.js",
|
|
35
34
|
"types": "./src/index.d.ts",
|
|
36
35
|
"typesVersions": {
|
|
@@ -46,6 +45,15 @@
|
|
|
46
45
|
],
|
|
47
46
|
"workflow": [
|
|
48
47
|
"./src/lib/workflow.d.ts"
|
|
48
|
+
],
|
|
49
|
+
"workflow-graph": [
|
|
50
|
+
"./src/lib/workflow-graph.d.ts"
|
|
51
|
+
],
|
|
52
|
+
"workflow-command": [
|
|
53
|
+
"./src/lib/workflow-command.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"workflow-toolset": [
|
|
56
|
+
"./src/lib/workflow-toolset.d.ts"
|
|
49
57
|
]
|
|
50
58
|
}
|
|
51
59
|
},
|
|
@@ -70,9 +78,22 @@
|
|
|
70
78
|
"./workflow": {
|
|
71
79
|
"types": "./src/lib/workflow.d.ts",
|
|
72
80
|
"default": "./src/lib/workflow.js"
|
|
81
|
+
},
|
|
82
|
+
"./workflow-graph": {
|
|
83
|
+
"types": "./src/lib/workflow-graph.d.ts",
|
|
84
|
+
"default": "./src/lib/workflow-graph.js"
|
|
85
|
+
},
|
|
86
|
+
"./workflow-command": {
|
|
87
|
+
"types": "./src/lib/workflow-command.d.ts",
|
|
88
|
+
"default": "./src/lib/workflow-command.js"
|
|
89
|
+
},
|
|
90
|
+
"./workflow-toolset": {
|
|
91
|
+
"types": "./src/lib/workflow-toolset.d.ts",
|
|
92
|
+
"default": "./src/lib/workflow-toolset.js"
|
|
73
93
|
}
|
|
74
94
|
},
|
|
75
95
|
"dependencies": {
|
|
76
96
|
"tslib": "^2.3.0"
|
|
77
|
-
}
|
|
97
|
+
},
|
|
98
|
+
"type": "commonjs"
|
|
78
99
|
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -7,4 +7,7 @@ tslib_1.__exportStar(require("./lib/identity"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./lib/organization"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./lib/status"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./lib/workflow"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/workflow-graph"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/workflow-command"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib/workflow-toolset"), exports);
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/shared/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,qDAA2B;AAC3B,yDAA+B;AAC/B,6DAAmC;AACnC,uDAA6B;AAC7B,yDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/shared/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,qDAA2B;AAC3B,yDAA+B;AAC/B,6DAAmC;AACnC,uDAA6B;AAC7B,yDAA+B;AAC/B,+DAAqC;AACrC,iEAAuC;AACvC,iEAAuC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { FormDefinitionSchema } from './form';
|
|
2
|
+
import { ApproverResolver, ReturnResubmitStrategy, ServiceAction, WorkflowDefinition, WorkflowEdgeConditionOperator, WorkflowNodeTriggerMode } from './workflow';
|
|
3
|
+
import { NodePaletteType, WorkflowEdgeIdFactory } from './workflow-graph';
|
|
4
|
+
/**
|
|
5
|
+
* The serialisable command layer that the template designer — and the LLM
|
|
6
|
+
* assistant — drive the workflow through. Every mutation a user can perform on
|
|
7
|
+
* the canvas, node palette, or property form is expressed as one of these
|
|
8
|
+
* commands, and {@link applyWorkflowCommand} is the single pure reducer that
|
|
9
|
+
* applies them. The React controller and the LLM tool runtime both dispatch the
|
|
10
|
+
* exact same commands, guaranteeing the assistant can do anything a user can.
|
|
11
|
+
*/
|
|
12
|
+
/** Everything the reducer needs as the single source of truth. */
|
|
13
|
+
export interface WorkflowDesignerState {
|
|
14
|
+
/** Form schema bound to the template; needed to compile edge conditions. */
|
|
15
|
+
readonly formSchema: FormDefinitionSchema | null;
|
|
16
|
+
readonly definition: WorkflowDefinition;
|
|
17
|
+
readonly editingEdgeId: string | null;
|
|
18
|
+
readonly formDefinitionVersionId: string | null;
|
|
19
|
+
readonly initiatorPolicyCel: string | null;
|
|
20
|
+
readonly selectedEdgeIds: readonly string[];
|
|
21
|
+
readonly selectedNodeId: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** Where a newly added node should be wired in. */
|
|
24
|
+
export interface WorkflowNodeAnchor {
|
|
25
|
+
/** Insert the node onto this edge, splitting it. */
|
|
26
|
+
readonly edgeId?: string | null;
|
|
27
|
+
/** Insert the node after this node. */
|
|
28
|
+
readonly afterNodeId?: string | null;
|
|
29
|
+
}
|
|
30
|
+
export type WorkflowCommand = {
|
|
31
|
+
readonly type: 'addNode';
|
|
32
|
+
readonly nodeType: NodePaletteType;
|
|
33
|
+
readonly anchor?: WorkflowNodeAnchor;
|
|
34
|
+
} | {
|
|
35
|
+
readonly type: 'renameNode';
|
|
36
|
+
readonly nodeId: string;
|
|
37
|
+
readonly label: string;
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: 'deleteNode';
|
|
40
|
+
readonly nodeId: string;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: 'setNodeTriggerMode';
|
|
43
|
+
readonly nodeId: string;
|
|
44
|
+
readonly triggerMode: WorkflowNodeTriggerMode;
|
|
45
|
+
} | {
|
|
46
|
+
readonly type: 'setUserTaskApprover';
|
|
47
|
+
readonly nodeId: string;
|
|
48
|
+
readonly approverResolver: ApproverResolver;
|
|
49
|
+
} | {
|
|
50
|
+
readonly type: 'setUserTaskReturnResubmitStrategy';
|
|
51
|
+
readonly nodeId: string;
|
|
52
|
+
readonly resubmitStrategy: ReturnResubmitStrategy;
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: 'setUserTaskOptions';
|
|
55
|
+
readonly nodeId: string;
|
|
56
|
+
readonly allowAddSigner?: boolean;
|
|
57
|
+
readonly allowReject?: boolean;
|
|
58
|
+
readonly allowTransfer?: boolean;
|
|
59
|
+
readonly description?: string;
|
|
60
|
+
} | {
|
|
61
|
+
readonly type: 'setServiceAction';
|
|
62
|
+
readonly nodeId: string;
|
|
63
|
+
readonly action: ServiceAction;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: 'setEndState';
|
|
66
|
+
readonly nodeId: string;
|
|
67
|
+
readonly endState: 'APPROVED' | 'REJECTED';
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: 'connectEdge';
|
|
70
|
+
readonly source: string;
|
|
71
|
+
readonly target: string;
|
|
72
|
+
} | {
|
|
73
|
+
readonly type: 'deleteEdge';
|
|
74
|
+
readonly edgeId: string;
|
|
75
|
+
} | {
|
|
76
|
+
readonly type: 'setEdgeCondition';
|
|
77
|
+
readonly edgeId: string;
|
|
78
|
+
readonly fieldKey?: string | null;
|
|
79
|
+
readonly operator?: WorkflowEdgeConditionOperator | null;
|
|
80
|
+
readonly value?: string | null;
|
|
81
|
+
} | {
|
|
82
|
+
readonly type: 'setEdgeDefault';
|
|
83
|
+
readonly edgeId: string;
|
|
84
|
+
readonly isDefault: boolean;
|
|
85
|
+
} | {
|
|
86
|
+
readonly type: 'bindForm';
|
|
87
|
+
readonly formDefinitionVersionId: string | null;
|
|
88
|
+
readonly formSchema: FormDefinitionSchema | null;
|
|
89
|
+
} | {
|
|
90
|
+
readonly type: 'setInitiatorPolicyCel';
|
|
91
|
+
readonly cel: string | null;
|
|
92
|
+
} | {
|
|
93
|
+
readonly type: 'selectNode';
|
|
94
|
+
readonly nodeId: string | null;
|
|
95
|
+
} | {
|
|
96
|
+
readonly type: 'selectEdges';
|
|
97
|
+
readonly edgeIds: readonly string[];
|
|
98
|
+
} | {
|
|
99
|
+
readonly type: 'autoLayout';
|
|
100
|
+
};
|
|
101
|
+
/** High-level intents that fold into a sequence of primitive commands. */
|
|
102
|
+
export type WorkflowMacroCommand = {
|
|
103
|
+
readonly type: 'insertApprovalStep';
|
|
104
|
+
readonly approverResolver: ApproverResolver;
|
|
105
|
+
readonly label?: string;
|
|
106
|
+
readonly anchor?: WorkflowNodeAnchor;
|
|
107
|
+
} | {
|
|
108
|
+
readonly type: 'insertNotification';
|
|
109
|
+
readonly action: ServiceAction;
|
|
110
|
+
readonly label?: string;
|
|
111
|
+
readonly anchor?: WorkflowNodeAnchor;
|
|
112
|
+
} | {
|
|
113
|
+
readonly type: 'insertConditionalBranch';
|
|
114
|
+
readonly label?: string;
|
|
115
|
+
readonly anchor?: WorkflowNodeAnchor;
|
|
116
|
+
};
|
|
117
|
+
export type AnyWorkflowCommand = WorkflowCommand | WorkflowMacroCommand;
|
|
118
|
+
/** Side-effect hints for the React controller (pixel layout/viewport). */
|
|
119
|
+
export interface WorkflowCommandEffects {
|
|
120
|
+
/** Topology changed — controller should re-run dagre layout + viewport. */
|
|
121
|
+
readonly layout: boolean;
|
|
122
|
+
}
|
|
123
|
+
export interface WorkflowCommandResult {
|
|
124
|
+
readonly state: WorkflowDesignerState;
|
|
125
|
+
/** Whether the command actually changed state. */
|
|
126
|
+
readonly changed: boolean;
|
|
127
|
+
/** Human-facing reason the command was a no-op / rejected, else null. */
|
|
128
|
+
readonly error: string | null;
|
|
129
|
+
/** Post-apply validation issue (same text the Save button uses), else null. */
|
|
130
|
+
readonly issue: string | null;
|
|
131
|
+
readonly effects: WorkflowCommandEffects;
|
|
132
|
+
}
|
|
133
|
+
export interface WorkflowCommandOptions {
|
|
134
|
+
/** Injectable edge id factory for deterministic runs (tests, replay). */
|
|
135
|
+
readonly createEdgeId?: WorkflowEdgeIdFactory;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Apply a single primitive command. Pure: same input → same output (given a
|
|
139
|
+
* deterministic edge id factory). Topology-changing commands set
|
|
140
|
+
* `effects.layout` so the controller can run dagre afterwards.
|
|
141
|
+
*/
|
|
142
|
+
export declare function applyWorkflowCommand(state: WorkflowDesignerState, command: WorkflowCommand, options?: WorkflowCommandOptions): WorkflowCommandResult;
|
|
143
|
+
/**
|
|
144
|
+
* Apply a high-level macro by expanding it into primitive commands. The added
|
|
145
|
+
* node's id is deterministic (`<nodeType>_<nextIndex>`), so follow-up commands
|
|
146
|
+
* can target it without depending on the post-insert selection.
|
|
147
|
+
*/
|
|
148
|
+
export declare function applyWorkflowMacroCommand(state: WorkflowDesignerState, command: WorkflowMacroCommand, options?: WorkflowCommandOptions): WorkflowCommandResult;
|
|
149
|
+
/** Apply a batch of primitive commands in order, threading state. */
|
|
150
|
+
export declare function applyWorkflowCommands(state: WorkflowDesignerState, commands: readonly WorkflowCommand[], options?: WorkflowCommandOptions): WorkflowCommandResult;
|
|
151
|
+
/**
|
|
152
|
+
* Expand a high-level macro into the primitive command sequence that realises
|
|
153
|
+
* it. The next node id is derived from the same deterministic rule
|
|
154
|
+
* {@link applyAddNode} uses, so post-add commands can target it directly.
|
|
155
|
+
*/
|
|
156
|
+
export declare function expandMacroCommand(state: WorkflowDesignerState, command: WorkflowMacroCommand): readonly WorkflowCommand[];
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyWorkflowCommand = applyWorkflowCommand;
|
|
4
|
+
exports.applyWorkflowMacroCommand = applyWorkflowMacroCommand;
|
|
5
|
+
exports.applyWorkflowCommands = applyWorkflowCommands;
|
|
6
|
+
exports.expandMacroCommand = expandMacroCommand;
|
|
7
|
+
const workflow_graph_1 = require("./workflow-graph");
|
|
8
|
+
const NO_EFFECTS = { layout: false };
|
|
9
|
+
const LAYOUT_EFFECTS = { layout: true };
|
|
10
|
+
function finalize(state, changed, effects, error = null) {
|
|
11
|
+
return {
|
|
12
|
+
changed,
|
|
13
|
+
effects,
|
|
14
|
+
error,
|
|
15
|
+
issue: (0, workflow_graph_1.readWorkflowDefinitionIssue)(state.definition),
|
|
16
|
+
state,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function reject(state, error) {
|
|
20
|
+
return finalize(state, false, NO_EFFECTS, error);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Apply a single primitive command. Pure: same input → same output (given a
|
|
24
|
+
* deterministic edge id factory). Topology-changing commands set
|
|
25
|
+
* `effects.layout` so the controller can run dagre afterwards.
|
|
26
|
+
*/
|
|
27
|
+
function applyWorkflowCommand(state, command, options = {}) {
|
|
28
|
+
var _a;
|
|
29
|
+
const createEdgeId = (_a = options.createEdgeId) !== null && _a !== void 0 ? _a : workflow_graph_1.defaultWorkflowEdgeId;
|
|
30
|
+
switch (command.type) {
|
|
31
|
+
case 'addNode':
|
|
32
|
+
return applyAddNode(state, command, createEdgeId);
|
|
33
|
+
case 'renameNode':
|
|
34
|
+
return applyRenameNode(state, command);
|
|
35
|
+
case 'deleteNode':
|
|
36
|
+
return applyDeleteNode(state, command);
|
|
37
|
+
case 'setNodeTriggerMode':
|
|
38
|
+
return applySetNodeTriggerMode(state, command);
|
|
39
|
+
case 'setUserTaskApprover':
|
|
40
|
+
return applySetUserTaskApprover(state, command);
|
|
41
|
+
case 'setUserTaskReturnResubmitStrategy':
|
|
42
|
+
return applySetUserTaskReturnResubmitStrategy(state, command);
|
|
43
|
+
case 'setUserTaskOptions':
|
|
44
|
+
return applySetUserTaskOptions(state, command);
|
|
45
|
+
case 'setServiceAction':
|
|
46
|
+
return applySetServiceAction(state, command);
|
|
47
|
+
case 'setEndState':
|
|
48
|
+
return applySetEndState(state, command);
|
|
49
|
+
case 'connectEdge':
|
|
50
|
+
return applyConnectEdge(state, command, createEdgeId);
|
|
51
|
+
case 'deleteEdge':
|
|
52
|
+
return applyDeleteEdge(state, command);
|
|
53
|
+
case 'setEdgeCondition':
|
|
54
|
+
return applySetEdgeCondition(state, command);
|
|
55
|
+
case 'setEdgeDefault':
|
|
56
|
+
return applySetEdgeDefault(state, command);
|
|
57
|
+
case 'bindForm':
|
|
58
|
+
return applyBindForm(state, command);
|
|
59
|
+
case 'setInitiatorPolicyCel':
|
|
60
|
+
return applySetInitiatorPolicyCel(state, command);
|
|
61
|
+
case 'selectNode':
|
|
62
|
+
return finalize(Object.assign(Object.assign({}, state), { selectedNodeId: command.nodeId, selectedEdgeIds: [] }), true, NO_EFFECTS);
|
|
63
|
+
case 'selectEdges':
|
|
64
|
+
return finalize(Object.assign(Object.assign({}, state), { selectedEdgeIds: command.edgeIds, selectedNodeId: null }), true, NO_EFFECTS);
|
|
65
|
+
case 'autoLayout':
|
|
66
|
+
return finalize(state, true, LAYOUT_EFFECTS);
|
|
67
|
+
default:
|
|
68
|
+
return assertNever(command);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Apply a high-level macro by expanding it into primitive commands. The added
|
|
73
|
+
* node's id is deterministic (`<nodeType>_<nextIndex>`), so follow-up commands
|
|
74
|
+
* can target it without depending on the post-insert selection.
|
|
75
|
+
*/
|
|
76
|
+
function applyWorkflowMacroCommand(state, command, options = {}) {
|
|
77
|
+
return applyWorkflowCommands(state, expandMacroCommand(state, command), options);
|
|
78
|
+
}
|
|
79
|
+
/** Apply a batch of primitive commands in order, threading state. */
|
|
80
|
+
function applyWorkflowCommands(state, commands, options = {}) {
|
|
81
|
+
return commands.reduce((accumulator, command) => {
|
|
82
|
+
var _a;
|
|
83
|
+
const next = applyWorkflowCommand(accumulator.state, command, options);
|
|
84
|
+
return Object.assign(Object.assign({}, next), { changed: accumulator.changed || next.changed, effects: {
|
|
85
|
+
layout: accumulator.effects.layout || next.effects.layout,
|
|
86
|
+
},
|
|
87
|
+
// Keep the first hard error encountered.
|
|
88
|
+
error: (_a = accumulator.error) !== null && _a !== void 0 ? _a : next.error });
|
|
89
|
+
}, finalize(state, false, NO_EFFECTS));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Expand a high-level macro into the primitive command sequence that realises
|
|
93
|
+
* it. The next node id is derived from the same deterministic rule
|
|
94
|
+
* {@link applyAddNode} uses, so post-add commands can target it directly.
|
|
95
|
+
*/
|
|
96
|
+
function expandMacroCommand(state, command) {
|
|
97
|
+
if (command.type === 'insertApprovalStep') {
|
|
98
|
+
const nodeId = readNextWorkflowNodeId(state, 'userTask');
|
|
99
|
+
return [
|
|
100
|
+
{ type: 'addNode', nodeType: 'userTask', anchor: command.anchor },
|
|
101
|
+
{
|
|
102
|
+
type: 'setUserTaskApprover',
|
|
103
|
+
nodeId,
|
|
104
|
+
approverResolver: command.approverResolver,
|
|
105
|
+
},
|
|
106
|
+
...(command.label === undefined
|
|
107
|
+
? []
|
|
108
|
+
: [{ type: 'renameNode', nodeId, label: command.label }]),
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
if (command.type === 'insertNotification') {
|
|
112
|
+
const nodeId = readNextWorkflowNodeId(state, 'serviceTask');
|
|
113
|
+
return [
|
|
114
|
+
{ type: 'addNode', nodeType: 'serviceTask', anchor: command.anchor },
|
|
115
|
+
{ type: 'setServiceAction', nodeId, action: command.action },
|
|
116
|
+
...(command.label === undefined
|
|
117
|
+
? []
|
|
118
|
+
: [{ type: 'renameNode', nodeId, label: command.label }]),
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
const nodeId = readNextWorkflowNodeId(state, 'exclusiveGateway');
|
|
122
|
+
return [
|
|
123
|
+
{ type: 'addNode', nodeType: 'exclusiveGateway', anchor: command.anchor },
|
|
124
|
+
...(command.label === undefined
|
|
125
|
+
? []
|
|
126
|
+
: [{ type: 'renameNode', nodeId, label: command.label }]),
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
/** The id {@link applyAddNode} will assign to the next node of this type. */
|
|
130
|
+
function readNextWorkflowNodeId(state, nodeType) {
|
|
131
|
+
return `${nodeType}_${(0, workflow_graph_1.readNextWorkflowNodeIndex)(state.definition.nodes, nodeType)}`;
|
|
132
|
+
}
|
|
133
|
+
// ── Node command handlers ──────────────────────────────────────────────────
|
|
134
|
+
function applyAddNode(state, command, createEdgeId) {
|
|
135
|
+
var _a, _b, _c, _d, _e;
|
|
136
|
+
const nodeIndex = (0, workflow_graph_1.readNextWorkflowNodeIndex)(state.definition.nodes, command.nodeType);
|
|
137
|
+
const node = (0, workflow_graph_1.createWorkflowNode)(command.nodeType, nodeIndex);
|
|
138
|
+
const selectedEdgeId = (_b = (_a = command.anchor) === null || _a === void 0 ? void 0 : _a.edgeId) !== null && _b !== void 0 ? _b : (state.selectedEdgeIds.length === 1 ? state.selectedEdgeIds[0] : null);
|
|
139
|
+
const selectedNodeId = (_d = (_c = command.anchor) === null || _c === void 0 ? void 0 : _c.afterNodeId) !== null && _d !== void 0 ? _d : (((_e = command.anchor) === null || _e === void 0 ? void 0 : _e.edgeId) ? null : state.selectedNodeId);
|
|
140
|
+
const inserted = (0, workflow_graph_1.insertWorkflowNodeIntoDefinition)({
|
|
141
|
+
createId: createEdgeId,
|
|
142
|
+
definition: state.definition,
|
|
143
|
+
node,
|
|
144
|
+
selectedEdgeId,
|
|
145
|
+
selectedNodeId,
|
|
146
|
+
});
|
|
147
|
+
return finalize(Object.assign(Object.assign({}, state), { definition: (0, workflow_graph_1.normalizeDesignerWorkflowDefinition)(inserted.definition), editingEdgeId: inserted.editingEdgeId, selectedEdgeIds: inserted.selectedEdgeIds, selectedNodeId: inserted.selectedNodeId }), true, LAYOUT_EFFECTS);
|
|
148
|
+
}
|
|
149
|
+
function applyRenameNode(state, command) {
|
|
150
|
+
return mapNode(state, command.nodeId, (node) => (0, workflow_graph_1.renameWorkflowNode)(node, command.label));
|
|
151
|
+
}
|
|
152
|
+
function applyDeleteNode(state, command) {
|
|
153
|
+
const node = state.definition.nodes.find((candidate) => candidate.id === command.nodeId);
|
|
154
|
+
if (!node) {
|
|
155
|
+
return reject(state, `找不到節點:${command.nodeId}`);
|
|
156
|
+
}
|
|
157
|
+
if (!(0, workflow_graph_1.isWorkflowNodeRemovable)(node)) {
|
|
158
|
+
return reject(state, '開始與結束節點無法刪除。');
|
|
159
|
+
}
|
|
160
|
+
const definition = (0, workflow_graph_1.normalizeDesignerWorkflowDefinition)(Object.assign(Object.assign({}, state.definition), { edges: state.definition.edges.filter((edge) => edge.source !== node.id && edge.target !== node.id), nodes: state.definition.nodes.filter((candidate) => candidate.id !== node.id) }));
|
|
161
|
+
// Deleting preserves the remaining nodes' manual positions (matches the
|
|
162
|
+
// original designer); tidying is an explicit `autoLayout` step.
|
|
163
|
+
return finalize(Object.assign(Object.assign({}, state), { definition, editingEdgeId: null, selectedEdgeIds: [], selectedNodeId: 'start' }), true, NO_EFFECTS);
|
|
164
|
+
}
|
|
165
|
+
function applySetNodeTriggerMode(state, command) {
|
|
166
|
+
const node = state.definition.nodes.find((n) => n.id === command.nodeId);
|
|
167
|
+
if ((node === null || node === void 0 ? void 0 : node.type) === 'startEvent') {
|
|
168
|
+
return reject(state, '開始節點沒有觸發模式。');
|
|
169
|
+
}
|
|
170
|
+
return mapNode(state, command.nodeId, (target) => (0, workflow_graph_1.applyWorkflowNodeTriggerMode)(target, command.triggerMode));
|
|
171
|
+
}
|
|
172
|
+
function applySetUserTaskApprover(state, command) {
|
|
173
|
+
return mapNode(state, command.nodeId, (node) => node.type === 'userTask'
|
|
174
|
+
? Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { approverResolver: command.approverResolver, decisionPolicy: { type: 'SINGLE' } }) }) : node, 'userTask');
|
|
175
|
+
}
|
|
176
|
+
function applySetUserTaskReturnResubmitStrategy(state, command) {
|
|
177
|
+
return mapNode(state, command.nodeId, (node) => node.type === 'userTask'
|
|
178
|
+
? Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { returnBehavior: Object.assign(Object.assign({}, node.data.returnBehavior), { resubmitStrategy: command.resubmitStrategy }) }) }) : node, 'userTask');
|
|
179
|
+
}
|
|
180
|
+
function applySetUserTaskOptions(state, command) {
|
|
181
|
+
return mapNode(state, command.nodeId, (node) => node.type === 'userTask'
|
|
182
|
+
? Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, node.data), (command.allowAddSigner === undefined
|
|
183
|
+
? {}
|
|
184
|
+
: { allowAddSigner: command.allowAddSigner })), (command.allowReject === undefined
|
|
185
|
+
? {}
|
|
186
|
+
: { allowReject: command.allowReject })), (command.allowTransfer === undefined
|
|
187
|
+
? {}
|
|
188
|
+
: { allowTransfer: command.allowTransfer })), (command.description === undefined
|
|
189
|
+
? {}
|
|
190
|
+
: { description: command.description })) }) : node, 'userTask');
|
|
191
|
+
}
|
|
192
|
+
function applySetServiceAction(state, command) {
|
|
193
|
+
const result = mapNode(state, command.nodeId, (node) => node.type === 'serviceTask'
|
|
194
|
+
? Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { action: command.action }) }) : node, 'serviceTask');
|
|
195
|
+
if (!result.changed) {
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
// Switching a service task to async NOTIFY drops its outgoing edges
|
|
199
|
+
// (normalizeDesignerWorkflowDefinition). The original designer did not
|
|
200
|
+
// relayout here, so neither do we — positions are preserved.
|
|
201
|
+
return finalize(Object.assign(Object.assign({}, result.state), { definition: (0, workflow_graph_1.normalizeDesignerWorkflowDefinition)(result.state.definition) }), true, NO_EFFECTS);
|
|
202
|
+
}
|
|
203
|
+
function applySetEndState(state, command) {
|
|
204
|
+
return mapNode(state, command.nodeId, (node) => node.type === 'endEvent'
|
|
205
|
+
? Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { endState: command.endState }) }) : node, 'endEvent');
|
|
206
|
+
}
|
|
207
|
+
// ── Edge command handlers ──────────────────────────────────────────────────
|
|
208
|
+
function applyConnectEdge(state, command, createEdgeId) {
|
|
209
|
+
const connection = {
|
|
210
|
+
source: command.source,
|
|
211
|
+
sourceHandle: workflow_graph_1.WORKFLOW_OUTPUT_HANDLE_ID,
|
|
212
|
+
target: command.target,
|
|
213
|
+
targetHandle: workflow_graph_1.WORKFLOW_INPUT_HANDLE_ID,
|
|
214
|
+
};
|
|
215
|
+
if (!(0, workflow_graph_1.isWorkflowConnectionValid)(connection, state.definition.nodes)) {
|
|
216
|
+
return reject(state, `無法連線:${command.source} → ${command.target}(來源/目標不可連接或不存在)。`);
|
|
217
|
+
}
|
|
218
|
+
const shouldOpenConditionSettings = state.definition.nodes.some((node) => node.id === command.source && node.type === 'exclusiveGateway');
|
|
219
|
+
const nextEdge = (0, workflow_graph_1.createWorkflowEdge)(command.source, command.target, {}, createEdgeId);
|
|
220
|
+
const definition = (0, workflow_graph_1.normalizeDesignerWorkflowDefinition)(Object.assign(Object.assign({}, state.definition), { edges: [...state.definition.edges, nextEdge] }));
|
|
221
|
+
// Connecting two already-positioned nodes preserves their manual layout
|
|
222
|
+
// (matches the original designer); the LLM/user can call `autoLayout` to tidy.
|
|
223
|
+
return finalize(Object.assign(Object.assign({}, state), { definition, editingEdgeId: shouldOpenConditionSettings ? nextEdge.id : null, selectedEdgeIds: [nextEdge.id], selectedNodeId: null }), true, NO_EFFECTS);
|
|
224
|
+
}
|
|
225
|
+
function applyDeleteEdge(state, command) {
|
|
226
|
+
if (!state.definition.edges.some((edge) => edge.id === command.edgeId)) {
|
|
227
|
+
return reject(state, `找不到連線:${command.edgeId}`);
|
|
228
|
+
}
|
|
229
|
+
const definition = (0, workflow_graph_1.normalizeDesignerWorkflowDefinition)(Object.assign(Object.assign({}, state.definition), { edges: state.definition.edges.filter((edge) => edge.id !== command.edgeId) }));
|
|
230
|
+
return finalize(Object.assign(Object.assign({}, state), { definition, editingEdgeId: state.editingEdgeId === command.edgeId ? null : state.editingEdgeId, selectedEdgeIds: state.selectedEdgeIds.filter((edgeId) => edgeId !== command.edgeId) }), true, NO_EFFECTS);
|
|
231
|
+
}
|
|
232
|
+
function applySetEdgeCondition(state, command) {
|
|
233
|
+
var _a, _b, _c, _d, _e, _f;
|
|
234
|
+
const targetEdge = state.definition.edges.find((edge) => edge.id === command.edgeId);
|
|
235
|
+
if (!targetEdge) {
|
|
236
|
+
return reject(state, `找不到連線:${command.edgeId}`);
|
|
237
|
+
}
|
|
238
|
+
const schema = state.formSchema;
|
|
239
|
+
const nextFieldKey = (_b = (_a = command.fieldKey) !== null && _a !== void 0 ? _a : targetEdge.data.conditionFieldKey) !== null && _b !== void 0 ? _b : null;
|
|
240
|
+
const field = (0, workflow_graph_1.readConditionField)(schema, nextFieldKey);
|
|
241
|
+
const nextOperator = (0, workflow_graph_1.readNextConditionOperator)(field, (_d = (_c = command.operator) !== null && _c !== void 0 ? _c : targetEdge.data.conditionOperator) !== null && _d !== void 0 ? _d : null);
|
|
242
|
+
const nextValue = (0, workflow_graph_1.readNextConditionValue)(field, nextOperator, (_f = (_e = command.value) !== null && _e !== void 0 ? _e : targetEdge.data.conditionValue) !== null && _f !== void 0 ? _f : null);
|
|
243
|
+
const nextLabel = (0, workflow_graph_1.readConditionLabel)(field, nextOperator, nextValue);
|
|
244
|
+
const definition = Object.assign(Object.assign({}, state.definition), { edges: state.definition.edges.map((edge) => edge.id === command.edgeId
|
|
245
|
+
? Object.assign(Object.assign({}, edge), { data: Object.assign(Object.assign({}, edge.data), { condition: (0, workflow_graph_1.readConditionExpression)(field, nextOperator, nextValue), conditionFieldKey: field === null || field === void 0 ? void 0 : field.fieldKey, conditionOperator: nextOperator, conditionValue: nextValue, isDefault: false, label: nextLabel }) }) : edge) });
|
|
246
|
+
return finalize(Object.assign(Object.assign({}, state), { definition }), true, NO_EFFECTS);
|
|
247
|
+
}
|
|
248
|
+
function applySetEdgeDefault(state, command) {
|
|
249
|
+
const targetEdge = state.definition.edges.find((edge) => edge.id === command.edgeId);
|
|
250
|
+
if (!targetEdge) {
|
|
251
|
+
return reject(state, `找不到連線:${command.edgeId}`);
|
|
252
|
+
}
|
|
253
|
+
const definition = Object.assign(Object.assign({}, state.definition), { edges: state.definition.edges.map((edge) => {
|
|
254
|
+
if (command.isDefault &&
|
|
255
|
+
edge.source === targetEdge.source &&
|
|
256
|
+
edge.id !== targetEdge.id &&
|
|
257
|
+
(0, workflow_graph_1.isExclusiveGatewaySourceEdge)(edge, state.definition.nodes)) {
|
|
258
|
+
return Object.assign(Object.assign({}, edge), { data: Object.assign(Object.assign({}, edge.data), { isDefault: false }) });
|
|
259
|
+
}
|
|
260
|
+
if (edge.id !== targetEdge.id) {
|
|
261
|
+
return edge;
|
|
262
|
+
}
|
|
263
|
+
// Becoming the default ("其他情況") means it carries no condition; clear
|
|
264
|
+
// any stale condition so the edge reads cleanly as the else path.
|
|
265
|
+
return command.isDefault
|
|
266
|
+
? Object.assign(Object.assign({}, edge), { data: Object.assign(Object.assign({}, edge.data), { condition: undefined, conditionFieldKey: undefined, conditionOperator: undefined, conditionValue: undefined, isDefault: true, label: undefined }) }) : Object.assign(Object.assign({}, edge), { data: Object.assign(Object.assign({}, edge.data), { isDefault: false }) });
|
|
267
|
+
}) });
|
|
268
|
+
return finalize(Object.assign(Object.assign({}, state), { definition }), true, NO_EFFECTS);
|
|
269
|
+
}
|
|
270
|
+
// ── Form / policy handlers ─────────────────────────────────────────────────
|
|
271
|
+
function applyBindForm(state, command) {
|
|
272
|
+
return finalize(Object.assign(Object.assign({}, state), { formDefinitionVersionId: command.formDefinitionVersionId, formSchema: command.formSchema }), true, NO_EFFECTS);
|
|
273
|
+
}
|
|
274
|
+
function applySetInitiatorPolicyCel(state, command) {
|
|
275
|
+
return finalize(Object.assign(Object.assign({}, state), { initiatorPolicyCel: command.cel }), true, NO_EFFECTS);
|
|
276
|
+
}
|
|
277
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
278
|
+
function mapNode(state, nodeId, updater, expectedType) {
|
|
279
|
+
const node = state.definition.nodes.find((candidate) => candidate.id === nodeId);
|
|
280
|
+
if (!node) {
|
|
281
|
+
return reject(state, `找不到節點:${nodeId}`);
|
|
282
|
+
}
|
|
283
|
+
if (expectedType && node.type !== expectedType) {
|
|
284
|
+
return reject(state, `節點 ${nodeId} 的型別為 ${node.type},預期為 ${expectedType}。`);
|
|
285
|
+
}
|
|
286
|
+
const definition = Object.assign(Object.assign({}, state.definition), { nodes: state.definition.nodes.map((candidate) => candidate.id === nodeId ? updater(candidate) : candidate) });
|
|
287
|
+
return finalize(Object.assign(Object.assign({}, state), { definition }), true, NO_EFFECTS);
|
|
288
|
+
}
|
|
289
|
+
function assertNever(command) {
|
|
290
|
+
throw new Error(`未支援的 workflow command:${JSON.stringify(command)}`);
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=workflow-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-command.js","sourceRoot":"","sources":["../../../../../libs/shared/src/lib/workflow-command.ts"],"names":[],"mappings":";;AAqNA,oDAuDC;AAOD,8DAUC;AAGD,sDAqBC;AAOD,gDAwCC;AA3VD,qDAsB0B;AAwJ1B,MAAM,UAAU,GAA2B,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC7D,MAAM,cAAc,GAA2B,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAEhE,SAAS,QAAQ,CACf,KAA4B,EAC5B,OAAgB,EAChB,OAA+B,EAC/B,QAAuB,IAAI;IAE3B,OAAO;QACL,OAAO;QACP,OAAO;QACP,KAAK;QACL,KAAK,EAAE,IAAA,4CAA2B,EAAC,KAAK,CAAC,UAAU,CAAC;QACpD,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CACb,KAA4B,EAC5B,KAAa;IAEb,OAAO,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,KAA4B,EAC5B,OAAwB,EACxB,UAAkC,EAAE;;IAEpC,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,sCAAqB,CAAC;IAEnE,QAAQ,OAAO,CAAC,I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