anx-esop-engine 1.0.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.
@@ -0,0 +1,233 @@
1
+ import React from 'react';
2
+ import * as zustand from 'zustand';
3
+
4
+ interface DomainNode {
5
+ id: string;
6
+ type: 'start' | 'end' | 'task' | 'userTask' | 'serviceTask' | 'scriptTask' | 'manualTask' | 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'subProcess' | 'eventSubProcess' | 'transaction' | 'adhocSubProcess' | 'boundaryEvent' | 'intermediateCatch' | 'intermediateThrow' | 'textAnnotation' | 'dataStoreReference' | 'dataObjectReference' | 'pool' | 'lane' | 'custom';
7
+ label: string;
8
+ bpmnType: string;
9
+ documentation?: string;
10
+ position: {
11
+ x: number;
12
+ y: number;
13
+ };
14
+ width: number;
15
+ height: number;
16
+ parentId?: string;
17
+ attachedTo?: string;
18
+ eventType?: string;
19
+ isExpanded: boolean;
20
+ properties: Record<string, any>;
21
+ }
22
+ interface DomainEdge {
23
+ id: string;
24
+ source: string;
25
+ target: string;
26
+ sourceHandle?: string;
27
+ targetHandle?: string;
28
+ sourceSide?: 'top' | 'right' | 'bottom' | 'left';
29
+ targetSide?: 'top' | 'right' | 'bottom' | 'left';
30
+ label?: string;
31
+ bpmnType: string;
32
+ conditionExpression?: string;
33
+ semantic: 'control' | 'message' | 'data' | 'annotation';
34
+ isDefault?: boolean;
35
+ isConditional?: boolean;
36
+ associationDirection?: 'none' | 'one' | 'both';
37
+ waypoints?: {
38
+ x: number;
39
+ y: number;
40
+ }[];
41
+ properties?: Record<string, any>;
42
+ }
43
+ interface DomainPool {
44
+ id: string;
45
+ name: string;
46
+ position: {
47
+ x: number;
48
+ y: number;
49
+ };
50
+ width: number;
51
+ height: number;
52
+ lanes: DomainLane[];
53
+ }
54
+ interface DomainLane {
55
+ id: string;
56
+ name: string;
57
+ position: {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ width: number;
62
+ height: number;
63
+ }
64
+ interface DomainWorkflow {
65
+ id: string;
66
+ name: string;
67
+ nodes: DomainNode[];
68
+ edges: DomainEdge[];
69
+ pools?: DomainPool[];
70
+ }
71
+
72
+ declare class BpmnImporter {
73
+ /**
74
+ * Imports a BPMN XML string and converts it to a clean DomainWorkflow model.
75
+ * Leverages bpmn-moddle with automatic fallback to DOMParser.
76
+ */
77
+ static importXml(xml: string): Promise<DomainWorkflow>;
78
+ private static parseWithBpmnModdle;
79
+ private static parseWithDOMParser;
80
+ }
81
+
82
+ declare class BpmnExporter {
83
+ /**
84
+ * Serializes a BPMN DomainWorkflow back to standard BPMN 2.0 XML string.
85
+ */
86
+ static exportToXml(workflow: DomainWorkflow): Promise<string>;
87
+ }
88
+
89
+ declare class BpmnLayout {
90
+ /**
91
+ * Applies an automatic layout to nodes and edges using Dagre if available,
92
+ * otherwise falling back to a structured grid layout.
93
+ */
94
+ static applyAutoLayout(nodes: DomainNode[], edges: DomainEdge[], direction?: 'LR' | 'TB'): Promise<DomainNode[]>;
95
+ /**
96
+ * Simple grid-based fallback layout when Dagre is unavailable
97
+ */
98
+ private static applyGridLayout;
99
+ }
100
+
101
+ interface ValidationError {
102
+ elementId: string;
103
+ severity: 'error' | 'warning';
104
+ message: string;
105
+ }
106
+ declare class BpmnValidator {
107
+ /**
108
+ * Evaluates if a connection is semantically valid under BPMN 2.0 specifications.
109
+ * Checks source/target node types against the connection type.
110
+ */
111
+ static canConnect(source: DomainNode, target: DomainNode, connectionType: 'control' | 'message' | 'data' | 'annotation'): {
112
+ isValid: boolean;
113
+ reason?: string;
114
+ };
115
+ /**
116
+ * Validates the graph structure of a DomainWorkflow and returns warnings/errors.
117
+ */
118
+ static validateWorkflow(nodes: DomainNode[], edges: DomainEdge[]): ValidationError[];
119
+ }
120
+
121
+ interface ReplaceOption {
122
+ label: string;
123
+ actionName: string;
124
+ className: string;
125
+ target: {
126
+ type: DomainNode['type'];
127
+ bpmnType: string;
128
+ isExpanded?: boolean;
129
+ isInterrupting?: boolean;
130
+ triggeredByEvent?: boolean;
131
+ cancelActivity?: boolean;
132
+ eventDefinitionType?: string;
133
+ instantiate?: boolean;
134
+ eventGatewayType?: string;
135
+ };
136
+ }
137
+ declare const REPLACE_OPTIONS: Record<string, ReplaceOption[]>;
138
+
139
+ declare function BpmnModeler({ displayLeftPanel, editMode }: {
140
+ displayLeftPanel: boolean;
141
+ editMode: boolean;
142
+ }): React.JSX.Element;
143
+
144
+ declare const BpmnNode: ({ data, id, selected }: any) => React.JSX.Element;
145
+
146
+ declare const BpmnEdge: ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, data, selected, label, }: any) => React.JSX.Element;
147
+
148
+ declare const BpmnPalette: () => React.JSX.Element;
149
+
150
+ declare const BpmnPropertiesPanel: () => React.JSX.Element;
151
+
152
+ declare const BpmnContextPad: () => null;
153
+
154
+ interface BpmnQuickAppendProps {
155
+ onSelect: (option: ReplaceOption) => void;
156
+ trigger?: React.ReactNode;
157
+ tooltip?: string;
158
+ placement?: 'top' | 'right' | 'bottom' | 'left';
159
+ size?: 'small' | 'medium';
160
+ }
161
+ declare const BpmnQuickAppend: React.FC<BpmnQuickAppendProps>;
162
+
163
+ declare const BPMN_ICON_PATHS: {
164
+ TASK_ICON_COMMERCIAL: string;
165
+ TASK_ICON_CUSTOMER_SERVICE: string;
166
+ TASK_ICON_FINANCE: string;
167
+ TASK_ICON_EQUIPMENT: string;
168
+ TASK_ICON_LOGISTICS: string;
169
+ TASK_ICON_MARINE: string;
170
+ TASK_ICON_DOCUMENT: string;
171
+ DATA_OBJECT: string;
172
+ DATA_STORE: string;
173
+ MARKER_PARALLEL: string;
174
+ MARKER_SEQUENTIAL: string;
175
+ MARKER_LOOP: string;
176
+ TIMER: string;
177
+ MESSAGE: string;
178
+ SIGNAL: string;
179
+ ERROR: string;
180
+ ESCALATION: string;
181
+ CONDITIONAL: string;
182
+ COMPENSATION: string;
183
+ LINK: string;
184
+ TERMINATE: string;
185
+ CANCEL: string;
186
+ GATEWAY_EXCLUSIVE: string;
187
+ GATEWAY_PARALLEL: string;
188
+ GATEWAY_INCLUSIVE: string;
189
+ GATEWAY_COMPLEX: string;
190
+ GATEWAY_EVENT_BASED: string;
191
+ };
192
+
193
+ interface BpmnState {
194
+ workflow: DomainWorkflow;
195
+ past: DomainWorkflow[];
196
+ future: DomainWorkflow[];
197
+ errors: ValidationError[];
198
+ clipboard: {
199
+ nodes: DomainNode[];
200
+ edges: DomainEdge[];
201
+ };
202
+ selectedNodeId: string | null;
203
+ selectedEdgeId: string | null;
204
+ editingNodeId: string | null;
205
+ activeTool: 'hand' | 'lasso' | 'space' | 'connection';
206
+ setWorkflow: (workflow: DomainWorkflow) => void;
207
+ addNode: (node: DomainNode) => void;
208
+ removeNode: (nodeId: string) => void;
209
+ updateNode: (nodeId: string, updates: Partial<DomainNode>) => void;
210
+ updateNodes: (updates: {
211
+ id: string;
212
+ changes: Partial<DomainNode>;
213
+ }[]) => void;
214
+ addEdge: (edge: DomainEdge) => void;
215
+ removeEdge: (edgeId: string) => void;
216
+ updateEdge: (edgeId: string, updates: Partial<DomainEdge>) => void;
217
+ setSelectedNodeId: (id: string | null) => void;
218
+ setSelectedEdgeId: (id: string | null) => void;
219
+ setEditingNodeId: (id: string | null) => void;
220
+ setActiveTool: (tool: 'hand' | 'lasso' | 'space' | 'connection') => void;
221
+ copySelection: (nodeIds: string[]) => void;
222
+ pasteSelection: (positionOffset?: {
223
+ x: number;
224
+ y: number;
225
+ }) => void;
226
+ undo: () => void;
227
+ redo: () => void;
228
+ clearHistory: () => void;
229
+ applyLayout: (direction: 'LR' | 'TB') => Promise<void>;
230
+ }
231
+ declare const useBpmnStore: zustand.UseBoundStore<zustand.StoreApi<BpmnState>>;
232
+
233
+ export { BPMN_ICON_PATHS, BpmnContextPad, BpmnEdge, BpmnExporter, BpmnImporter, BpmnLayout, BpmnModeler, BpmnNode, BpmnPalette, BpmnPropertiesPanel, BpmnQuickAppend, type BpmnQuickAppendProps, type BpmnState, BpmnValidator, type DomainEdge, type DomainLane, type DomainNode, type DomainPool, type DomainWorkflow, REPLACE_OPTIONS, type ReplaceOption, type ValidationError, useBpmnStore };