@zola_do/workflow-engine 0.1.19 → 0.1.21

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 (2) hide show
  1. package/README.md +74 -74
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,74 +1,74 @@
1
- # @zola_do/workflow-engine
2
-
3
- State machine workflow converter for NestJS. Converts UI JSON (node/edge graph) to XState-compatible state machine definitions.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- # Install individually
9
- npm install @zola_do/workflow-engine
10
-
11
- # Or via meta package
12
- npm install @zola_do/nestjs-shared
13
- ```
14
-
15
- ## Usage
16
-
17
- ### Module Setup
18
-
19
- Register `WorkflowEngineService` in your module:
20
-
21
- ```typescript
22
- import { Module } from '@nestjs/common';
23
- import { WorkflowEngineService } from '@zola_do/workflow-engine';
24
-
25
- @Module({
26
- providers: [WorkflowEngineService],
27
- exports: [WorkflowEngineService],
28
- })
29
- export class WorkflowModule {}
30
- ```
31
-
32
- ### Converting UI JSON to State Machine
33
-
34
- The service converts a React Flow / node-editor style JSON (nodes and edges) into a state machine definition:
35
-
36
- ```typescript
37
- import { Injectable } from '@nestjs/common';
38
- import { WorkflowEngineService } from '@zola_do/workflow-engine';
39
-
40
- @Injectable()
41
- export class WorkflowController {
42
- constructor(private readonly workflowEngine: WorkflowEngineService) {}
43
-
44
- async convertWorkflow(uiJson: {
45
- nodes: Array<{ id: string; type: string; data: { label: string } }>;
46
- edges: Array<{ source: string; target: string; label?: string }>;
47
- }) {
48
- const machine = await this.workflowEngine.convertToStateMachine(uiJson);
49
- return machine;
50
- // Returns { id, initial, states } suitable for XState or similar
51
- }
52
- }
53
- ```
54
-
55
- ### Input Format
56
-
57
- - **nodes:** Array of `{ id, type, data: { label } }`. `type: 'start'` denotes the initial node.
58
- - **edges:** Array of `{ source, target, label? }`. Defines transitions between states.
59
-
60
- ### Output Format
61
-
62
- Returns an object with:
63
-
64
- - `id` — UUID
65
- - `initial` — Initial state label
66
- - `states` — Map of state labels to `{ on: { EVENT: targetState }, meta: { type } }`
67
-
68
- ## Exports
69
-
70
- - `WorkflowEngineService` — `convertToStateMachine(uiJson)`
71
-
72
- ## Related Packages
73
-
74
- - [@zola_do/core](../core) — Shared types
1
+ # @zola_do/workflow-engine
2
+
3
+ State machine workflow converter for NestJS. Converts UI JSON (node/edge graph) to XState-compatible state machine definitions.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Install individually
9
+ npm install @zola_do/workflow-engine
10
+
11
+ # Or via meta package
12
+ npm install @zola_do/nestjs-shared
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Module Setup
18
+
19
+ Register `WorkflowEngineService` in your module:
20
+
21
+ ```typescript
22
+ import { Module } from '@nestjs/common';
23
+ import { WorkflowEngineService } from '@zola_do/workflow-engine';
24
+
25
+ @Module({
26
+ providers: [WorkflowEngineService],
27
+ exports: [WorkflowEngineService],
28
+ })
29
+ export class WorkflowModule {}
30
+ ```
31
+
32
+ ### Converting UI JSON to State Machine
33
+
34
+ The service converts a React Flow / node-editor style JSON (nodes and edges) into a state machine definition:
35
+
36
+ ```typescript
37
+ import { Injectable } from '@nestjs/common';
38
+ import { WorkflowEngineService } from '@zola_do/workflow-engine';
39
+
40
+ @Injectable()
41
+ export class WorkflowController {
42
+ constructor(private readonly workflowEngine: WorkflowEngineService) {}
43
+
44
+ async convertWorkflow(uiJson: {
45
+ nodes: Array<{ id: string; type: string; data: { label: string } }>;
46
+ edges: Array<{ source: string; target: string; label?: string }>;
47
+ }) {
48
+ const machine = await this.workflowEngine.convertToStateMachine(uiJson);
49
+ return machine;
50
+ // Returns { id, initial, states } suitable for XState or similar
51
+ }
52
+ }
53
+ ```
54
+
55
+ ### Input Format
56
+
57
+ - **nodes:** Array of `{ id, type, data: { label } }`. `type: 'start'` denotes the initial node.
58
+ - **edges:** Array of `{ source, target, label? }`. Defines transitions between states.
59
+
60
+ ### Output Format
61
+
62
+ Returns an object with:
63
+
64
+ - `id` — UUID
65
+ - `initial` — Initial state label
66
+ - `states` — Map of state labels to `{ on: { EVENT: targetState }, meta: { type } }`
67
+
68
+ ## Exports
69
+
70
+ - `WorkflowEngineService` — `convertToStateMachine(uiJson)`
71
+
72
+ ## Related Packages
73
+
74
+ - [@zola_do/core](../core) — Shared types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zola_do/workflow-engine",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "State machine workflow converter for NestJS",
5
5
  "author": "zolaDO",
6
6
  "license": "ISC",