@allternit/workflow-engine 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.
Files changed (49) hide show
  1. package/README.md +227 -0
  2. package/dist/engine/workflow-engine.d.ts +39 -0
  3. package/dist/engine/workflow-engine.d.ts.bak +39 -0
  4. package/dist/engine/workflow-engine.d.ts.map +1 -0
  5. package/dist/engine/workflow-engine.js +532 -0
  6. package/dist/engine/workflow-engine.js.bak +532 -0
  7. package/dist/engine/workflow-engine.js.map +1 -0
  8. package/dist/index.d.ts +38 -0
  9. package/dist/index.d.ts.bak +38 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +41 -0
  12. package/dist/index.js.bak +41 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/scheduler/index.d.ts +53 -0
  15. package/dist/scheduler/index.d.ts.bak +53 -0
  16. package/dist/scheduler/index.d.ts.map +1 -0
  17. package/dist/scheduler/index.js +135 -0
  18. package/dist/scheduler/index.js.bak +135 -0
  19. package/dist/scheduler/index.js.map +1 -0
  20. package/dist/types.d.ts +402 -0
  21. package/dist/types.d.ts.bak +402 -0
  22. package/dist/types.d.ts.map +1 -0
  23. package/dist/types.js +7 -0
  24. package/dist/types.js.bak +7 -0
  25. package/dist/types.js.map +1 -0
  26. package/dist/visualizer/index.d.ts +81 -0
  27. package/dist/visualizer/index.d.ts.bak +81 -0
  28. package/dist/visualizer/index.d.ts.map +1 -0
  29. package/dist/visualizer/index.js +277 -0
  30. package/dist/visualizer/index.js.bak +277 -0
  31. package/dist/visualizer/index.js.map +1 -0
  32. package/package.json +57 -0
  33. package/src/__tests__/visualizer.test.ts.bak +110 -0
  34. package/src/__tests__/workflow-engine.test.ts.bak +239 -0
  35. package/src/engine/workflow-engine.test.ts.bak +852 -0
  36. package/src/engine/workflow-engine.ts +651 -0
  37. package/src/engine/workflow-engine.ts.bak +651 -0
  38. package/src/index.ts +89 -0
  39. package/src/index.ts.bak +89 -0
  40. package/src/scheduler/index.ts +204 -0
  41. package/src/scheduler/index.ts.bak +204 -0
  42. package/src/scheduler/scheduler.test.ts.bak +521 -0
  43. package/src/types.ts +449 -0
  44. package/src/types.ts.bak +449 -0
  45. package/src/visualizer/index.ts +409 -0
  46. package/src/visualizer/index.ts.bak +409 -0
  47. package/src/visualizer/visualizer.test.ts.bak +844 -0
  48. package/tsconfig.json +22 -0
  49. package/vitest.config.ts.bak +9 -0
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Workflow Visualizer
3
+ *
4
+ * Generates visual representations of workflows.
5
+ */
6
+ /**
7
+ * Create workflow visualizer
8
+ */
9
+ export function createVisualizer(config = {}) {
10
+ const { width = 1200, height = 800, nodeWidth = 180, nodeHeight = 60, hSpacing = 100, vSpacing = 80, autoLayout: enableAutoLayout = true, } = config;
11
+ /**
12
+ * Generate visual layout
13
+ */
14
+ function layout(workflow) {
15
+ let nodePositions;
16
+ if (enableAutoLayout) {
17
+ nodePositions = autoLayoutNodes(workflow.nodes, workflow.connections);
18
+ }
19
+ else {
20
+ // Use existing positions or default
21
+ nodePositions = {};
22
+ workflow.nodes.forEach(node => {
23
+ nodePositions[node.id] = node.position || { x: 0, y: 0 };
24
+ });
25
+ }
26
+ // Create visual nodes
27
+ const visualNodes = workflow.nodes.map(node => {
28
+ const pos = nodePositions[node.id];
29
+ return {
30
+ id: node.id,
31
+ x: pos.x,
32
+ y: pos.y,
33
+ width: nodeWidth,
34
+ height: nodeHeight,
35
+ label: node.name || node.type,
36
+ color: getNodeColor(node.type),
37
+ icon: getNodeIcon(node.type),
38
+ };
39
+ });
40
+ // Create visual connections
41
+ const visualConnections = workflow.connections.map(conn => {
42
+ const sourcePos = nodePositions[conn.source];
43
+ const targetPos = nodePositions[conn.target];
44
+ const source = {
45
+ x: sourcePos.x + nodeWidth / 2,
46
+ y: sourcePos.y + nodeHeight,
47
+ };
48
+ const target = {
49
+ x: targetPos.x + nodeWidth / 2,
50
+ y: targetPos.y,
51
+ };
52
+ return {
53
+ id: conn.id,
54
+ source,
55
+ target,
56
+ path: generatePath(source, target),
57
+ };
58
+ });
59
+ // Calculate bounds
60
+ const bounds = calculateBounds(visualNodes);
61
+ return {
62
+ nodes: visualNodes,
63
+ connections: visualConnections,
64
+ bounds,
65
+ };
66
+ }
67
+ /**
68
+ * Auto-layout nodes using layered graph layout
69
+ */
70
+ function autoLayout(nodes, connections) {
71
+ return autoLayoutNodes(nodes, connections);
72
+ }
73
+ /**
74
+ * Auto-layout nodes
75
+ */
76
+ function autoLayoutNodes(nodes, connections) {
77
+ const positions = {};
78
+ // Build adjacency list
79
+ const incoming = new Map();
80
+ const outgoing = new Map();
81
+ nodes.forEach(node => {
82
+ incoming.set(node.id, []);
83
+ outgoing.set(node.id, []);
84
+ });
85
+ connections.forEach(conn => {
86
+ outgoing.get(conn.source)?.push(conn.target);
87
+ incoming.get(conn.target)?.push(conn.source);
88
+ });
89
+ // Topological sort with layering
90
+ const layers = [];
91
+ const visited = new Set();
92
+ const inDegree = new Map();
93
+ nodes.forEach(node => {
94
+ inDegree.set(node.id, incoming.get(node.id)?.length || 0);
95
+ });
96
+ while (visited.size < nodes.length) {
97
+ const layer = [];
98
+ nodes.forEach(node => {
99
+ if (!visited.has(node.id) && (inDegree.get(node.id) || 0) === 0) {
100
+ layer.push(node.id);
101
+ }
102
+ });
103
+ if (layer.length === 0) {
104
+ // Cycle detected, add remaining nodes
105
+ nodes.forEach(node => {
106
+ if (!visited.has(node.id)) {
107
+ layer.push(node.id);
108
+ }
109
+ });
110
+ }
111
+ layers.push(layer);
112
+ layer.forEach(nodeId => {
113
+ visited.add(nodeId);
114
+ outgoing.get(nodeId)?.forEach(targetId => {
115
+ const degree = inDegree.get(targetId) || 0;
116
+ inDegree.set(targetId, degree - 1);
117
+ });
118
+ });
119
+ }
120
+ // Position nodes in layers
121
+ layers.forEach((layer, layerIndex) => {
122
+ const layerWidth = layer.length * (nodeWidth + hSpacing) - hSpacing;
123
+ const startX = (width - layerWidth) / 2;
124
+ layer.forEach((nodeId, index) => {
125
+ positions[nodeId] = {
126
+ x: startX + index * (nodeWidth + hSpacing),
127
+ y: 100 + layerIndex * (nodeHeight + vSpacing),
128
+ };
129
+ });
130
+ });
131
+ return positions;
132
+ }
133
+ /**
134
+ * Generate SVG path between two points
135
+ */
136
+ function generatePath(source, target) {
137
+ const midY = (source.y + target.y) / 2;
138
+ return `M ${source.x} ${source.y} C ${source.x} ${midY}, ${target.x} ${midY}, ${target.x} ${target.y}`;
139
+ }
140
+ /**
141
+ * Calculate bounds
142
+ */
143
+ function calculateBounds(nodes) {
144
+ if (nodes.length === 0) {
145
+ return { minX: 0, minY: 0, maxX: width, maxY: height, width, height };
146
+ }
147
+ const xs = nodes.map(n => n.x);
148
+ const ys = nodes.map(n => n.y);
149
+ const minX = Math.min(...xs) - 50;
150
+ const minY = Math.min(...ys) - 50;
151
+ const maxX = Math.max(...xs) + nodeWidth + 50;
152
+ const maxY = Math.max(...ys) + nodeHeight + 50;
153
+ return {
154
+ minX,
155
+ minY,
156
+ maxX,
157
+ maxY,
158
+ width: maxX - minX,
159
+ height: maxY - minY,
160
+ };
161
+ }
162
+ /**
163
+ * Get node color by type
164
+ */
165
+ function getNodeColor(type) {
166
+ const colors = {
167
+ 'trigger:manual': '#3b82f6',
168
+ 'trigger:schedule': '#3b82f6',
169
+ 'trigger:webhook': '#3b82f6',
170
+ 'transform:map': '#10b981',
171
+ 'transform:filter': '#10b981',
172
+ 'condition:if': '#f59e0b',
173
+ 'loop:for-each': '#8b5cf6',
174
+ 'delay:wait': '#6b7280',
175
+ 'http:request': '#ec4899',
176
+ 'output:result': '#ef4444',
177
+ 'output:log': '#6b7280',
178
+ };
179
+ return colors[type] || '#6b7280';
180
+ }
181
+ /**
182
+ * Get node icon by type
183
+ */
184
+ function getNodeIcon(type) {
185
+ const icons = {
186
+ 'trigger:manual': 'play',
187
+ 'trigger:schedule': 'clock',
188
+ 'trigger:webhook': 'webhook',
189
+ 'transform:map': 'transform',
190
+ 'transform:filter': 'filter',
191
+ 'condition:if': 'git-branch',
192
+ 'loop:for-each': 'repeat',
193
+ 'delay:wait': 'timer',
194
+ 'http:request': 'globe',
195
+ 'output:result': 'check-circle',
196
+ 'output:log': 'file-text',
197
+ };
198
+ return icons[type] || 'box';
199
+ }
200
+ /**
201
+ * Export to SVG
202
+ */
203
+ function toSVG(workflow) {
204
+ const { nodes, connections, bounds } = layout(workflow);
205
+ const svgWidth = bounds.width;
206
+ const svgHeight = bounds.height;
207
+ let svg = `<svg width="${svgWidth}" height="${svgHeight}" viewBox="${bounds.minX} ${bounds.minY} ${svgWidth} ${svgHeight}" xmlns="http://www.w3.org/2000/svg">\n`;
208
+ // Definitions
209
+ svg += ` <defs>\n`;
210
+ svg += ` <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">\n`;
211
+ svg += ` <polygon points="0 0, 10 3.5, 0 7" fill="#6b7280" />\n`;
212
+ svg += ` </marker>\n`;
213
+ svg += ` </defs>\n`;
214
+ // Connections
215
+ connections.forEach(conn => {
216
+ svg += ` <path d="${conn.path}" fill="none" stroke="#6b7280" stroke-width="2" marker-end="url(#arrowhead)" />\n`;
217
+ });
218
+ // Nodes
219
+ nodes.forEach(node => {
220
+ const rx = 8;
221
+ svg += ` <g transform="translate(${node.x}, ${node.y})">\n`;
222
+ svg += ` <rect width="${node.width}" height="${node.height}" rx="${rx}" fill="${node.color}" stroke="none" />\n`;
223
+ svg += ` <text x="${node.width / 2}" y="${node.height / 2}" text-anchor="middle" dominant-baseline="middle" fill="white" font-family="sans-serif" font-size="14">${node.label}</text>\n`;
224
+ svg += ` </g>\n`;
225
+ });
226
+ svg += `</svg>`;
227
+ return svg;
228
+ }
229
+ /**
230
+ * Export to Mermaid diagram
231
+ */
232
+ function toMermaid(workflow) {
233
+ let mermaid = 'graph TD\n';
234
+ // Node definitions
235
+ workflow.nodes.forEach(node => {
236
+ const label = node.name || node.type;
237
+ mermaid += ` ${node.id}["${label}"]\n`;
238
+ });
239
+ // Connections
240
+ workflow.connections.forEach(conn => {
241
+ mermaid += ` ${conn.source} --> ${conn.target}\n`;
242
+ });
243
+ return mermaid;
244
+ }
245
+ /**
246
+ * Export to DOT (Graphviz)
247
+ */
248
+ function toDOT(workflow) {
249
+ let dot = 'digraph Workflow {\n';
250
+ dot += ' rankdir=TB;\n';
251
+ dot += ' node [shape=box, style=filled, fontname="sans-serif"];\n';
252
+ // Node definitions
253
+ workflow.nodes.forEach(node => {
254
+ const label = node.name || node.type;
255
+ const color = getNodeColor(node.type);
256
+ dot += ` "${node.id}" [label="${label}", fillcolor="${color}", fontcolor=white];\n`;
257
+ });
258
+ // Connections
259
+ workflow.connections.forEach(conn => {
260
+ dot += ` "${conn.source}" -> "${conn.target}";\n`;
261
+ });
262
+ dot += '}';
263
+ return dot;
264
+ }
265
+ return {
266
+ layout,
267
+ autoLayout,
268
+ toSVG,
269
+ toMermaid,
270
+ toDOT,
271
+ };
272
+ }
273
+ /**
274
+ * Global visualizer instance
275
+ */
276
+ export const globalVisualizer = createVisualizer();
277
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Workflow Visualizer
3
+ *
4
+ * Generates visual representations of workflows.
5
+ */
6
+ /**
7
+ * Create workflow visualizer
8
+ */
9
+ export function createVisualizer(config = {}) {
10
+ const { width = 1200, height = 800, nodeWidth = 180, nodeHeight = 60, hSpacing = 100, vSpacing = 80, autoLayout: enableAutoLayout = true, } = config;
11
+ /**
12
+ * Generate visual layout
13
+ */
14
+ function layout(workflow) {
15
+ let nodePositions;
16
+ if (enableAutoLayout) {
17
+ nodePositions = autoLayoutNodes(workflow.nodes, workflow.connections);
18
+ }
19
+ else {
20
+ // Use existing positions or default
21
+ nodePositions = {};
22
+ workflow.nodes.forEach(node => {
23
+ nodePositions[node.id] = node.position || { x: 0, y: 0 };
24
+ });
25
+ }
26
+ // Create visual nodes
27
+ const visualNodes = workflow.nodes.map(node => {
28
+ const pos = nodePositions[node.id];
29
+ return {
30
+ id: node.id,
31
+ x: pos.x,
32
+ y: pos.y,
33
+ width: nodeWidth,
34
+ height: nodeHeight,
35
+ label: node.name || node.type,
36
+ color: getNodeColor(node.type),
37
+ icon: getNodeIcon(node.type),
38
+ };
39
+ });
40
+ // Create visual connections
41
+ const visualConnections = workflow.connections.map(conn => {
42
+ const sourcePos = nodePositions[conn.source];
43
+ const targetPos = nodePositions[conn.target];
44
+ const source = {
45
+ x: sourcePos.x + nodeWidth / 2,
46
+ y: sourcePos.y + nodeHeight,
47
+ };
48
+ const target = {
49
+ x: targetPos.x + nodeWidth / 2,
50
+ y: targetPos.y,
51
+ };
52
+ return {
53
+ id: conn.id,
54
+ source,
55
+ target,
56
+ path: generatePath(source, target),
57
+ };
58
+ });
59
+ // Calculate bounds
60
+ const bounds = calculateBounds(visualNodes);
61
+ return {
62
+ nodes: visualNodes,
63
+ connections: visualConnections,
64
+ bounds,
65
+ };
66
+ }
67
+ /**
68
+ * Auto-layout nodes using layered graph layout
69
+ */
70
+ function autoLayout(nodes, connections) {
71
+ return autoLayoutNodes(nodes, connections);
72
+ }
73
+ /**
74
+ * Auto-layout nodes
75
+ */
76
+ function autoLayoutNodes(nodes, connections) {
77
+ const positions = {};
78
+ // Build adjacency list
79
+ const incoming = new Map();
80
+ const outgoing = new Map();
81
+ nodes.forEach(node => {
82
+ incoming.set(node.id, []);
83
+ outgoing.set(node.id, []);
84
+ });
85
+ connections.forEach(conn => {
86
+ outgoing.get(conn.source)?.push(conn.target);
87
+ incoming.get(conn.target)?.push(conn.source);
88
+ });
89
+ // Topological sort with layering
90
+ const layers = [];
91
+ const visited = new Set();
92
+ const inDegree = new Map();
93
+ nodes.forEach(node => {
94
+ inDegree.set(node.id, incoming.get(node.id)?.length || 0);
95
+ });
96
+ while (visited.size < nodes.length) {
97
+ const layer = [];
98
+ nodes.forEach(node => {
99
+ if (!visited.has(node.id) && (inDegree.get(node.id) || 0) === 0) {
100
+ layer.push(node.id);
101
+ }
102
+ });
103
+ if (layer.length === 0) {
104
+ // Cycle detected, add remaining nodes
105
+ nodes.forEach(node => {
106
+ if (!visited.has(node.id)) {
107
+ layer.push(node.id);
108
+ }
109
+ });
110
+ }
111
+ layers.push(layer);
112
+ layer.forEach(nodeId => {
113
+ visited.add(nodeId);
114
+ outgoing.get(nodeId)?.forEach(targetId => {
115
+ const degree = inDegree.get(targetId) || 0;
116
+ inDegree.set(targetId, degree - 1);
117
+ });
118
+ });
119
+ }
120
+ // Position nodes in layers
121
+ layers.forEach((layer, layerIndex) => {
122
+ const layerWidth = layer.length * (nodeWidth + hSpacing) - hSpacing;
123
+ const startX = (width - layerWidth) / 2;
124
+ layer.forEach((nodeId, index) => {
125
+ positions[nodeId] = {
126
+ x: startX + index * (nodeWidth + hSpacing),
127
+ y: 100 + layerIndex * (nodeHeight + vSpacing),
128
+ };
129
+ });
130
+ });
131
+ return positions;
132
+ }
133
+ /**
134
+ * Generate SVG path between two points
135
+ */
136
+ function generatePath(source, target) {
137
+ const midY = (source.y + target.y) / 2;
138
+ return `M ${source.x} ${source.y} C ${source.x} ${midY}, ${target.x} ${midY}, ${target.x} ${target.y}`;
139
+ }
140
+ /**
141
+ * Calculate bounds
142
+ */
143
+ function calculateBounds(nodes) {
144
+ if (nodes.length === 0) {
145
+ return { minX: 0, minY: 0, maxX: width, maxY: height, width, height };
146
+ }
147
+ const xs = nodes.map(n => n.x);
148
+ const ys = nodes.map(n => n.y);
149
+ const minX = Math.min(...xs) - 50;
150
+ const minY = Math.min(...ys) - 50;
151
+ const maxX = Math.max(...xs) + nodeWidth + 50;
152
+ const maxY = Math.max(...ys) + nodeHeight + 50;
153
+ return {
154
+ minX,
155
+ minY,
156
+ maxX,
157
+ maxY,
158
+ width: maxX - minX,
159
+ height: maxY - minY,
160
+ };
161
+ }
162
+ /**
163
+ * Get node color by type
164
+ */
165
+ function getNodeColor(type) {
166
+ const colors = {
167
+ 'trigger:manual': '#3b82f6',
168
+ 'trigger:schedule': '#3b82f6',
169
+ 'trigger:webhook': '#3b82f6',
170
+ 'transform:map': '#10b981',
171
+ 'transform:filter': '#10b981',
172
+ 'condition:if': '#f59e0b',
173
+ 'loop:for-each': '#8b5cf6',
174
+ 'delay:wait': '#6b7280',
175
+ 'http:request': '#ec4899',
176
+ 'output:result': '#ef4444',
177
+ 'output:log': '#6b7280',
178
+ };
179
+ return colors[type] || '#6b7280';
180
+ }
181
+ /**
182
+ * Get node icon by type
183
+ */
184
+ function getNodeIcon(type) {
185
+ const icons = {
186
+ 'trigger:manual': 'play',
187
+ 'trigger:schedule': 'clock',
188
+ 'trigger:webhook': 'webhook',
189
+ 'transform:map': 'transform',
190
+ 'transform:filter': 'filter',
191
+ 'condition:if': 'git-branch',
192
+ 'loop:for-each': 'repeat',
193
+ 'delay:wait': 'timer',
194
+ 'http:request': 'globe',
195
+ 'output:result': 'check-circle',
196
+ 'output:log': 'file-text',
197
+ };
198
+ return icons[type] || 'box';
199
+ }
200
+ /**
201
+ * Export to SVG
202
+ */
203
+ function toSVG(workflow) {
204
+ const { nodes, connections, bounds } = layout(workflow);
205
+ const svgWidth = bounds.width;
206
+ const svgHeight = bounds.height;
207
+ let svg = `<svg width="${svgWidth}" height="${svgHeight}" viewBox="${bounds.minX} ${bounds.minY} ${svgWidth} ${svgHeight}" xmlns="http://www.w3.org/2000/svg">\n`;
208
+ // Definitions
209
+ svg += ` <defs>\n`;
210
+ svg += ` <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">\n`;
211
+ svg += ` <polygon points="0 0, 10 3.5, 0 7" fill="#6b7280" />\n`;
212
+ svg += ` </marker>\n`;
213
+ svg += ` </defs>\n`;
214
+ // Connections
215
+ connections.forEach(conn => {
216
+ svg += ` <path d="${conn.path}" fill="none" stroke="#6b7280" stroke-width="2" marker-end="url(#arrowhead)" />\n`;
217
+ });
218
+ // Nodes
219
+ nodes.forEach(node => {
220
+ const rx = 8;
221
+ svg += ` <g transform="translate(${node.x}, ${node.y})">\n`;
222
+ svg += ` <rect width="${node.width}" height="${node.height}" rx="${rx}" fill="${node.color}" stroke="none" />\n`;
223
+ svg += ` <text x="${node.width / 2}" y="${node.height / 2}" text-anchor="middle" dominant-baseline="middle" fill="white" font-family="sans-serif" font-size="14">${node.label}</text>\n`;
224
+ svg += ` </g>\n`;
225
+ });
226
+ svg += `</svg>`;
227
+ return svg;
228
+ }
229
+ /**
230
+ * Export to Mermaid diagram
231
+ */
232
+ function toMermaid(workflow) {
233
+ let mermaid = 'graph TD\n';
234
+ // Node definitions
235
+ workflow.nodes.forEach(node => {
236
+ const label = node.name || node.type;
237
+ mermaid += ` ${node.id}["${label}"]\n`;
238
+ });
239
+ // Connections
240
+ workflow.connections.forEach(conn => {
241
+ mermaid += ` ${conn.source} --> ${conn.target}\n`;
242
+ });
243
+ return mermaid;
244
+ }
245
+ /**
246
+ * Export to DOT (Graphviz)
247
+ */
248
+ function toDOT(workflow) {
249
+ let dot = 'digraph Workflow {\n';
250
+ dot += ' rankdir=TB;\n';
251
+ dot += ' node [shape=box, style=filled, fontname="sans-serif"];\n';
252
+ // Node definitions
253
+ workflow.nodes.forEach(node => {
254
+ const label = node.name || node.type;
255
+ const color = getNodeColor(node.type);
256
+ dot += ` "${node.id}" [label="${label}", fillcolor="${color}", fontcolor=white];\n`;
257
+ });
258
+ // Connections
259
+ workflow.connections.forEach(conn => {
260
+ dot += ` "${conn.source}" -> "${conn.target}";\n`;
261
+ });
262
+ dot += '}';
263
+ return dot;
264
+ }
265
+ return {
266
+ layout,
267
+ autoLayout,
268
+ toSVG,
269
+ toMermaid,
270
+ toDOT,
271
+ };
272
+ }
273
+ /**
274
+ * Global visualizer instance
275
+ */
276
+ export const globalVisualizer = createVisualizer();
277
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visualizer/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsEH;;GAEG;AACH,MAAM,UAAU,gBAA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ED;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@allternit/workflow-engine",
3
+ "version": "0.1.0",
4
+ "description": "A2R Workflow Engine - Visual workflow orchestration with DAG support",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./engine": {
14
+ "import": "./dist/engine/index.js",
15
+ "types": "./dist/engine/index.d.ts"
16
+ },
17
+ "./nodes": {
18
+ "import": "./dist/nodes/index.js",
19
+ "types": "./dist/nodes/index.d.ts"
20
+ },
21
+ "./executor": {
22
+ "import": "./dist/executor/index.js",
23
+ "types": "./dist/executor/index.d.ts"
24
+ },
25
+ "./scheduler": {
26
+ "import": "./dist/scheduler/index.js",
27
+ "types": "./dist/scheduler/index.d.ts"
28
+ },
29
+ "./visualizer": {
30
+ "import": "./dist/visualizer/index.js",
31
+ "types": "./dist/visualizer/index.d.ts"
32
+ }
33
+ },
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest",
38
+ "typecheck": "tsc --noEmit"
39
+ },
40
+ "dependencies": {
41
+ "uuid": "^9.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^20.0.0",
45
+ "@types/uuid": "^9.0.0",
46
+ "typescript": "^5.3.0",
47
+ "vitest": "^1.0.0"
48
+ },
49
+ "keywords": [
50
+ "a2r",
51
+ "workflow",
52
+ "dag",
53
+ "orchestration",
54
+ "automation"
55
+ ],
56
+ "license": "MIT"
57
+ }