@jarenjs/flow 0.72.3 → 0.73.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/README.md +60 -3
- package/dist/types/dag.d.ts +6 -4
- package/dist/types/errors.d.ts +10 -0
- package/dist/types/fsm.d.ts +24 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/statechart.d.ts +82 -0
- package/dist/types/workflow.d.ts +97 -0
- package/docs/APP-INTEGRATION.md +8 -0
- package/docs/FLOW-FORMAT.md +67 -11
- package/docs/STATECHART-FORMAT.md +186 -0
- package/docs/WORKFLOW-FORMAT.md +260 -0
- package/package.json +4 -4
- package/schemas/jaren-statechart-state.draft-07.schema.json +72 -0
- package/schemas/jaren-statechart-state.schema.json +72 -0
- package/schemas/jaren-statechart.authoring.schema.json +216 -0
- package/schemas/jaren-statechart.draft-07.schema.json +216 -0
- package/schemas/jaren-statechart.schema.json +216 -0
- package/schemas/jaren-workflow.authoring.schema.json +282 -0
- package/schemas/jaren-workflow.draft-07.schema.json +288 -0
- package/schemas/jaren-workflow.schema.json +288 -0
- package/src/dag.js +52 -24
- package/src/errors.js +10 -0
- package/src/fsm.js +2 -2
- package/src/index.js +11 -0
- package/src/statechart.js +420 -0
- package/src/workflow.js +461 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://jarenjs.dev/schemas/jaren-workflow/0.2/authoring",
|
|
4
|
+
"title": "Jaren composed workflow 0.2 (authoring profile)",
|
|
5
|
+
"description": "Authoring profile of the canonical grammar: the document SHAPE only, with queryDocument, dagDocument left open. Constrains decoding on small models, where the full grammar does not decode at all. It is deliberately WEAKER than the canonical schema - a document valid here may be nonsense - so the engine compiler is the gate that makes it safe, and generated documents must be compiled before use.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"$workflow": {
|
|
9
|
+
"const": "0.2"
|
|
10
|
+
},
|
|
11
|
+
"revision": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
},
|
|
15
|
+
"initial": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"states": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"minProperties": 1,
|
|
22
|
+
"additionalProperties": {
|
|
23
|
+
"$ref": "#/$defs/state"
|
|
24
|
+
},
|
|
25
|
+
"description": "(LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": [
|
|
29
|
+
"$workflow",
|
|
30
|
+
"revision",
|
|
31
|
+
"initial",
|
|
32
|
+
"states"
|
|
33
|
+
],
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"$defs": {
|
|
36
|
+
"queryDocument": {
|
|
37
|
+
"description": "A Jaren query expression; validate against the full grammar and compile locally."
|
|
38
|
+
},
|
|
39
|
+
"dagDocument": {
|
|
40
|
+
"description": "A Jaren DAG document; validate and compile with versioned tasks locally."
|
|
41
|
+
},
|
|
42
|
+
"body": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"properties": {
|
|
45
|
+
"initial": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"minLength": 1
|
|
48
|
+
},
|
|
49
|
+
"states": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"minProperties": 1,
|
|
52
|
+
"additionalProperties": {
|
|
53
|
+
"$ref": "#/$defs/state"
|
|
54
|
+
},
|
|
55
|
+
"description": "(LLM profile: a member-name constraint is relaxed here; the canonical schema enforces it)"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": [
|
|
59
|
+
"initial",
|
|
60
|
+
"states"
|
|
61
|
+
],
|
|
62
|
+
"additionalProperties": false
|
|
63
|
+
},
|
|
64
|
+
"state": {
|
|
65
|
+
"anyOf": [
|
|
66
|
+
{
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"work": {
|
|
70
|
+
"anyOf": [
|
|
71
|
+
{
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"task": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"minLength": 1
|
|
77
|
+
},
|
|
78
|
+
"version": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"minLength": 1
|
|
81
|
+
},
|
|
82
|
+
"with": {
|
|
83
|
+
"$ref": "#/$defs/queryDocument"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": [
|
|
87
|
+
"task",
|
|
88
|
+
"version"
|
|
89
|
+
],
|
|
90
|
+
"additionalProperties": false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"dag": {
|
|
96
|
+
"$ref": "#/$defs/dagDocument"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"required": [
|
|
100
|
+
"dag"
|
|
101
|
+
],
|
|
102
|
+
"additionalProperties": false
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"input": {
|
|
107
|
+
"$ref": "#/$defs/queryDocument"
|
|
108
|
+
},
|
|
109
|
+
"then": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"minLength": 1
|
|
112
|
+
},
|
|
113
|
+
"catch": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"minLength": 1
|
|
116
|
+
},
|
|
117
|
+
"limit": {
|
|
118
|
+
"type": "integer",
|
|
119
|
+
"minimum": 1,
|
|
120
|
+
"maximum": 9007199254740991
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"required": [
|
|
124
|
+
"work",
|
|
125
|
+
"then"
|
|
126
|
+
],
|
|
127
|
+
"additionalProperties": false
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "object",
|
|
131
|
+
"properties": {
|
|
132
|
+
"choose": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"items": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"properties": {
|
|
137
|
+
"guard": {
|
|
138
|
+
"$ref": "#/$defs/queryDocument"
|
|
139
|
+
},
|
|
140
|
+
"to": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"minLength": 1
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"required": [
|
|
146
|
+
"guard",
|
|
147
|
+
"to"
|
|
148
|
+
],
|
|
149
|
+
"additionalProperties": false
|
|
150
|
+
},
|
|
151
|
+
"minItems": 1
|
|
152
|
+
},
|
|
153
|
+
"otherwise": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"minLength": 1
|
|
156
|
+
},
|
|
157
|
+
"limit": {
|
|
158
|
+
"type": "integer",
|
|
159
|
+
"minimum": 1,
|
|
160
|
+
"maximum": 9007199254740991
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"required": [
|
|
164
|
+
"choose",
|
|
165
|
+
"otherwise"
|
|
166
|
+
],
|
|
167
|
+
"additionalProperties": false
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "object",
|
|
171
|
+
"properties": {
|
|
172
|
+
"on": {
|
|
173
|
+
"type": "array",
|
|
174
|
+
"items": {
|
|
175
|
+
"type": "object",
|
|
176
|
+
"properties": {
|
|
177
|
+
"event": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"minLength": 1
|
|
180
|
+
},
|
|
181
|
+
"to": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"minLength": 1
|
|
184
|
+
},
|
|
185
|
+
"guard": {
|
|
186
|
+
"$ref": "#/$defs/queryDocument"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": [
|
|
190
|
+
"event",
|
|
191
|
+
"to"
|
|
192
|
+
],
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
},
|
|
195
|
+
"minItems": 0
|
|
196
|
+
},
|
|
197
|
+
"after": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"properties": {
|
|
200
|
+
"ms": {
|
|
201
|
+
"type": "number",
|
|
202
|
+
"minimum": 0
|
|
203
|
+
},
|
|
204
|
+
"to": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"minLength": 1
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"required": [
|
|
210
|
+
"ms",
|
|
211
|
+
"to"
|
|
212
|
+
],
|
|
213
|
+
"additionalProperties": false
|
|
214
|
+
},
|
|
215
|
+
"limit": {
|
|
216
|
+
"type": "integer",
|
|
217
|
+
"minimum": 1,
|
|
218
|
+
"maximum": 9007199254740991
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"required": [
|
|
222
|
+
"on"
|
|
223
|
+
],
|
|
224
|
+
"additionalProperties": false,
|
|
225
|
+
"anyOf": [
|
|
226
|
+
{
|
|
227
|
+
"properties": {
|
|
228
|
+
"on": {
|
|
229
|
+
"minItems": 1
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"required": [
|
|
235
|
+
"after"
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"type": "object",
|
|
242
|
+
"properties": {
|
|
243
|
+
"flow": {
|
|
244
|
+
"$ref": "#/$defs/body"
|
|
245
|
+
},
|
|
246
|
+
"then": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"minLength": 1
|
|
249
|
+
},
|
|
250
|
+
"limit": {
|
|
251
|
+
"type": "integer",
|
|
252
|
+
"minimum": 1,
|
|
253
|
+
"maximum": 9007199254740991
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"required": [
|
|
257
|
+
"flow",
|
|
258
|
+
"then"
|
|
259
|
+
],
|
|
260
|
+
"additionalProperties": false
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"type": "object",
|
|
264
|
+
"properties": {
|
|
265
|
+
"final": {
|
|
266
|
+
"const": true
|
|
267
|
+
},
|
|
268
|
+
"limit": {
|
|
269
|
+
"type": "integer",
|
|
270
|
+
"minimum": 1,
|
|
271
|
+
"maximum": 9007199254740991
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"required": [
|
|
275
|
+
"final"
|
|
276
|
+
],
|
|
277
|
+
"additionalProperties": false
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://jarenjs.dev/schemas/jaren-workflow/0.2/draft-07",
|
|
4
|
+
"title": "Jaren composed workflow 0.2",
|
|
5
|
+
"description": "Nested work, choices, waits and bounded control lower onto jaren-fsm 0.2 and jaren-dag 0.1. Distinct from the historical Mermaid jaren-workflow 0.1 projection. Every automatic cycle must cross a declared visit limit; every task needs an implementation version.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"$workflow": {
|
|
9
|
+
"const": "0.2"
|
|
10
|
+
},
|
|
11
|
+
"revision": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
},
|
|
15
|
+
"initial": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"states": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"minProperties": 1,
|
|
22
|
+
"propertyNames": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"minLength": 1
|
|
25
|
+
},
|
|
26
|
+
"additionalProperties": {
|
|
27
|
+
"$ref": "#/definitions/state"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": [
|
|
32
|
+
"$workflow",
|
|
33
|
+
"revision",
|
|
34
|
+
"initial",
|
|
35
|
+
"states"
|
|
36
|
+
],
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"definitions": {
|
|
39
|
+
"queryDocument": {
|
|
40
|
+
"$ref": "https://jarenjs.dev/schemas/jaren-query/0.1/draft-07"
|
|
41
|
+
},
|
|
42
|
+
"dagDocument": {
|
|
43
|
+
"$ref": "https://jarenjs.dev/schemas/jaren-dag/0.1/draft-07"
|
|
44
|
+
},
|
|
45
|
+
"body": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"initial": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
},
|
|
52
|
+
"states": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"minProperties": 1,
|
|
55
|
+
"propertyNames": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"minLength": 1
|
|
58
|
+
},
|
|
59
|
+
"additionalProperties": {
|
|
60
|
+
"$ref": "#/definitions/state"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": [
|
|
65
|
+
"initial",
|
|
66
|
+
"states"
|
|
67
|
+
],
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
"state": {
|
|
71
|
+
"anyOf": [
|
|
72
|
+
{
|
|
73
|
+
"type": "object",
|
|
74
|
+
"properties": {
|
|
75
|
+
"work": {
|
|
76
|
+
"anyOf": [
|
|
77
|
+
{
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"task": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"minLength": 1
|
|
83
|
+
},
|
|
84
|
+
"version": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"minLength": 1
|
|
87
|
+
},
|
|
88
|
+
"with": {
|
|
89
|
+
"$ref": "#/definitions/queryDocument"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"required": [
|
|
93
|
+
"task",
|
|
94
|
+
"version"
|
|
95
|
+
],
|
|
96
|
+
"additionalProperties": false
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": {
|
|
101
|
+
"dag": {
|
|
102
|
+
"$ref": "#/definitions/dagDocument"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"required": [
|
|
106
|
+
"dag"
|
|
107
|
+
],
|
|
108
|
+
"additionalProperties": false
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"input": {
|
|
113
|
+
"$ref": "#/definitions/queryDocument"
|
|
114
|
+
},
|
|
115
|
+
"then": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"minLength": 1
|
|
118
|
+
},
|
|
119
|
+
"catch": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"minLength": 1
|
|
122
|
+
},
|
|
123
|
+
"limit": {
|
|
124
|
+
"type": "integer",
|
|
125
|
+
"minimum": 1,
|
|
126
|
+
"maximum": 9007199254740991
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": [
|
|
130
|
+
"work",
|
|
131
|
+
"then"
|
|
132
|
+
],
|
|
133
|
+
"additionalProperties": false
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"choose": {
|
|
139
|
+
"type": "array",
|
|
140
|
+
"items": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"guard": {
|
|
144
|
+
"$ref": "#/definitions/queryDocument"
|
|
145
|
+
},
|
|
146
|
+
"to": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"minLength": 1
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"required": [
|
|
152
|
+
"guard",
|
|
153
|
+
"to"
|
|
154
|
+
],
|
|
155
|
+
"additionalProperties": false
|
|
156
|
+
},
|
|
157
|
+
"minItems": 1
|
|
158
|
+
},
|
|
159
|
+
"otherwise": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"minLength": 1
|
|
162
|
+
},
|
|
163
|
+
"limit": {
|
|
164
|
+
"type": "integer",
|
|
165
|
+
"minimum": 1,
|
|
166
|
+
"maximum": 9007199254740991
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"choose",
|
|
171
|
+
"otherwise"
|
|
172
|
+
],
|
|
173
|
+
"additionalProperties": false
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"on": {
|
|
179
|
+
"type": "array",
|
|
180
|
+
"items": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"properties": {
|
|
183
|
+
"event": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"minLength": 1
|
|
186
|
+
},
|
|
187
|
+
"to": {
|
|
188
|
+
"type": "string",
|
|
189
|
+
"minLength": 1
|
|
190
|
+
},
|
|
191
|
+
"guard": {
|
|
192
|
+
"$ref": "#/definitions/queryDocument"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"required": [
|
|
196
|
+
"event",
|
|
197
|
+
"to"
|
|
198
|
+
],
|
|
199
|
+
"additionalProperties": false
|
|
200
|
+
},
|
|
201
|
+
"minItems": 0
|
|
202
|
+
},
|
|
203
|
+
"after": {
|
|
204
|
+
"type": "object",
|
|
205
|
+
"properties": {
|
|
206
|
+
"ms": {
|
|
207
|
+
"type": "number",
|
|
208
|
+
"minimum": 0
|
|
209
|
+
},
|
|
210
|
+
"to": {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"minLength": 1
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"required": [
|
|
216
|
+
"ms",
|
|
217
|
+
"to"
|
|
218
|
+
],
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
},
|
|
221
|
+
"limit": {
|
|
222
|
+
"type": "integer",
|
|
223
|
+
"minimum": 1,
|
|
224
|
+
"maximum": 9007199254740991
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"required": [
|
|
228
|
+
"on"
|
|
229
|
+
],
|
|
230
|
+
"additionalProperties": false,
|
|
231
|
+
"anyOf": [
|
|
232
|
+
{
|
|
233
|
+
"properties": {
|
|
234
|
+
"on": {
|
|
235
|
+
"minItems": 1
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"required": [
|
|
241
|
+
"after"
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"type": "object",
|
|
248
|
+
"properties": {
|
|
249
|
+
"flow": {
|
|
250
|
+
"$ref": "#/definitions/body"
|
|
251
|
+
},
|
|
252
|
+
"then": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"minLength": 1
|
|
255
|
+
},
|
|
256
|
+
"limit": {
|
|
257
|
+
"type": "integer",
|
|
258
|
+
"minimum": 1,
|
|
259
|
+
"maximum": 9007199254740991
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"required": [
|
|
263
|
+
"flow",
|
|
264
|
+
"then"
|
|
265
|
+
],
|
|
266
|
+
"additionalProperties": false
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"type": "object",
|
|
270
|
+
"properties": {
|
|
271
|
+
"final": {
|
|
272
|
+
"const": true
|
|
273
|
+
},
|
|
274
|
+
"limit": {
|
|
275
|
+
"type": "integer",
|
|
276
|
+
"minimum": 1,
|
|
277
|
+
"maximum": 9007199254740991
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"required": [
|
|
281
|
+
"final"
|
|
282
|
+
],
|
|
283
|
+
"additionalProperties": false
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|