@haneinfo/state-machine 0.1.1 → 0.2.1

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 (48) hide show
  1. package/agent-guide.md +31 -3
  2. package/dist/kind.js +1 -1
  3. package/dist/kind.js.map +1 -1
  4. package/dist/mcp-tools.d.ts +8 -1
  5. package/dist/mcp-tools.d.ts.map +1 -1
  6. package/dist/mcp-tools.js +6 -2
  7. package/dist/mcp-tools.js.map +1 -1
  8. package/dist/plugin.d.ts +9 -4
  9. package/dist/plugin.d.ts.map +1 -1
  10. package/dist/plugin.js +27 -4
  11. package/dist/plugin.js.map +1 -1
  12. package/dist/prisma-store.d.ts.map +1 -1
  13. package/dist/prisma-store.js +3 -1
  14. package/dist/prisma-store.js.map +1 -1
  15. package/dist/runtime.service.d.ts +12 -2
  16. package/dist/runtime.service.d.ts.map +1 -1
  17. package/dist/runtime.service.js +266 -40
  18. package/dist/runtime.service.js.map +1 -1
  19. package/dist/semantics.d.ts +2 -2
  20. package/dist/semantics.d.ts.map +1 -1
  21. package/dist/semantics.js +33 -1
  22. package/dist/semantics.js.map +1 -1
  23. package/dist/simulate.d.ts +10 -4
  24. package/dist/simulate.d.ts.map +1 -1
  25. package/dist/simulate.js +99 -31
  26. package/dist/simulate.js.map +1 -1
  27. package/dist/state-machine.controller.d.ts +3 -0
  28. package/dist/state-machine.controller.d.ts.map +1 -1
  29. package/dist/state-machine.controller.js +11 -0
  30. package/dist/state-machine.controller.js.map +1 -1
  31. package/dist/state-machine.module.d.ts +3 -1
  32. package/dist/state-machine.module.d.ts.map +1 -1
  33. package/dist/state-machine.module.js +10 -2
  34. package/dist/state-machine.module.js.map +1 -1
  35. package/dist/store.d.ts +3 -1
  36. package/dist/store.d.ts.map +1 -1
  37. package/dist/store.js.map +1 -1
  38. package/dist/testing.d.ts +4 -1
  39. package/dist/testing.d.ts.map +1 -1
  40. package/dist/testing.js +1 -1
  41. package/dist/testing.js.map +1 -1
  42. package/dist/types.d.ts +9 -1
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js.map +1 -1
  45. package/haneinfo.plugin.json +5 -2
  46. package/package.json +6 -6
  47. package/prisma/state-machine.prisma +3 -1
  48. package/schemas/state-machine.spec.json +154 -11
@@ -12,8 +12,13 @@
12
12
  "additionalProperties": false,
13
13
  "required": ["kind", "code"],
14
14
  "properties": {
15
- "kind": { "const": "Form" },
16
- "code": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" }
15
+ "kind": {
16
+ "const": "Form"
17
+ },
18
+ "code": {
19
+ "type": "string",
20
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
21
+ }
17
22
  }
18
23
  },
19
24
  "states": {
@@ -25,10 +30,23 @@
25
30
  "additionalProperties": false,
26
31
  "required": ["key", "label", "type"],
27
32
  "properties": {
28
- "key": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_]*$", "maxLength": 64 },
29
- "label": { "type": "string", "minLength": 1, "maxLength": 200 },
30
- "description": { "type": "string", "maxLength": 2000 },
31
- "type": { "enum": ["INITIAL", "NORMAL", "FINAL"] },
33
+ "key": {
34
+ "type": "string",
35
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
36
+ "maxLength": 64
37
+ },
38
+ "label": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "maxLength": 200
42
+ },
43
+ "description": {
44
+ "type": "string",
45
+ "maxLength": 2000
46
+ },
47
+ "type": {
48
+ "enum": ["INITIAL", "NORMAL", "FINAL", "CHOICE"]
49
+ },
32
50
  "frozen": {
33
51
  "type": "boolean",
34
52
  "description": "While the instance is in this state its data cannot be changed."
@@ -44,23 +62,148 @@
44
62
  "additionalProperties": false,
45
63
  "required": ["key", "from", "to", "label"],
46
64
  "properties": {
47
- "key": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_]*$", "maxLength": 64 },
48
- "label": { "type": "string", "minLength": 1, "maxLength": 200 },
49
- "description": { "type": "string", "maxLength": 2000 },
65
+ "key": {
66
+ "type": "string",
67
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
68
+ "maxLength": 64
69
+ },
70
+ "label": {
71
+ "type": "string",
72
+ "minLength": 1,
73
+ "maxLength": 200
74
+ },
75
+ "description": {
76
+ "type": "string",
77
+ "maxLength": 2000
78
+ },
50
79
  "from": {
51
80
  "type": "array",
52
81
  "minItems": 1,
53
82
  "uniqueItems": true,
54
- "items": { "type": "string", "minLength": 1 }
83
+ "items": {
84
+ "type": "string",
85
+ "minLength": 1
86
+ }
87
+ },
88
+ "to": {
89
+ "type": "string",
90
+ "minLength": 1
55
91
  },
56
- "to": { "type": "string", "minLength": 1 },
57
92
  "permission": {
58
93
  "description": "RBAC permission a person needs to take this transition in the App. Absent: any signed-in person who can read the instance. Assignment and Timer actions do not check it.",
59
94
  "type": "string",
60
95
  "pattern": "^[a-z][a-z0-9-]*(:[a-z][a-z0-9-]*)+$"
96
+ },
97
+ "when": {
98
+ "$ref": "#/$defs/predicate"
99
+ },
100
+ "automatic": {
101
+ "type": "boolean"
61
102
  }
62
103
  }
63
104
  }
64
105
  }
106
+ },
107
+ "$defs": {
108
+ "predicate": {
109
+ "oneOf": [
110
+ {
111
+ "type": "object",
112
+ "additionalProperties": false,
113
+ "required": ["kind", "operator", "left"],
114
+ "properties": {
115
+ "kind": {
116
+ "const": "PREDICATE"
117
+ },
118
+ "operator": {
119
+ "enum": ["EQ", "NEQ", "GT", "GTE", "LT", "LTE", "IN", "NOT_EMPTY"]
120
+ },
121
+ "left": {
122
+ "$ref": "#/$defs/valueExpression"
123
+ },
124
+ "right": {
125
+ "oneOf": [
126
+ {
127
+ "$ref": "#/$defs/valueExpression"
128
+ },
129
+ {
130
+ "type": "array",
131
+ "minItems": 1,
132
+ "items": {
133
+ "$ref": "#/$defs/valueExpression"
134
+ }
135
+ }
136
+ ]
137
+ }
138
+ }
139
+ },
140
+ {
141
+ "type": "object",
142
+ "additionalProperties": false,
143
+ "required": ["kind", "operator", "expressions"],
144
+ "properties": {
145
+ "kind": {
146
+ "const": "GROUP"
147
+ },
148
+ "operator": {
149
+ "enum": ["AND", "OR"]
150
+ },
151
+ "expressions": {
152
+ "type": "array",
153
+ "minItems": 1,
154
+ "items": {
155
+ "$ref": "#/$defs/predicate"
156
+ }
157
+ }
158
+ }
159
+ }
160
+ ]
161
+ },
162
+ "valueExpression": {
163
+ "oneOf": [
164
+ {
165
+ "type": "object",
166
+ "additionalProperties": false,
167
+ "required": ["kind", "value"],
168
+ "properties": {
169
+ "kind": {
170
+ "const": "LITERAL"
171
+ },
172
+ "value": {
173
+ "type": ["string", "number", "boolean", "null"]
174
+ }
175
+ }
176
+ },
177
+ {
178
+ "type": "object",
179
+ "additionalProperties": false,
180
+ "required": ["kind", "fieldId"],
181
+ "properties": {
182
+ "kind": {
183
+ "const": "FIELD"
184
+ },
185
+ "fieldId": {
186
+ "type": "string",
187
+ "minLength": 1,
188
+ "maxLength": 64
189
+ }
190
+ }
191
+ },
192
+ {
193
+ "type": "object",
194
+ "additionalProperties": false,
195
+ "required": ["kind", "key"],
196
+ "properties": {
197
+ "kind": {
198
+ "const": "CONTEXT"
199
+ },
200
+ "key": {
201
+ "type": "string",
202
+ "minLength": 1
203
+ }
204
+ }
205
+ }
206
+ ]
207
+ }
65
208
  }
66
209
  }