@onlineapps/cookbook-core 2.1.4 → 2.1.7

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/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "@onlineapps/cookbook-core",
3
- "version": "2.1.4",
3
+ "version": "2.1.7",
4
4
  "description": "Core cookbook parsing and validation - lightweight foundation for workflow definitions",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
- "prepublishOnly": "../../../scripts/pre-publish-compatibility-check.sh",
8
- "postpublish": "../../../scripts/update-manifest-from-npm.sh && ../../../scripts/update-all-services.sh",
9
7
  "test": "jest",
10
8
  "test:watch": "jest --watch",
11
9
  "test:coverage": "jest --coverage",
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$comment": "COOKBOOK V2 FORMAT - V1 IS BANNED! steps MUST be object keyed by step_id, NOT array!",
4
3
  "type": "object",
5
4
  "required": ["steps", "version"],
6
5
  "additionalProperties": true,
@@ -11,8 +10,8 @@
11
10
  },
12
11
  "version": {
13
12
  "type": "string",
14
- "pattern": "^2\\.\\d+\\.\\d+$",
15
- "description": "Semantic version - MUST be 2.x.x (V1 is banned)"
13
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
14
+ "description": "Semantic version of the cookbook schema"
16
15
  },
17
16
  "description": {
18
17
  "type": "string"
@@ -35,25 +34,50 @@
35
34
  },
36
35
  "metadata": {
37
36
  "type": "object",
37
+ "properties": {
38
+ "tags": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "string"
42
+ }
43
+ },
44
+ "priority": {
45
+ "type": "integer",
46
+ "minimum": 0,
47
+ "maximum": 10
48
+ },
49
+ "deprecated": {
50
+ "type": "boolean"
51
+ },
52
+ "deprecationMessage": {
53
+ "type": "string"
54
+ },
55
+ "author": {
56
+ "type": "string"
57
+ },
58
+ "created": {
59
+ "type": "string",
60
+ "format": "date-time"
61
+ },
62
+ "modified": {
63
+ "type": "string",
64
+ "format": "date-time"
65
+ }
66
+ },
38
67
  "additionalProperties": true
39
68
  },
40
69
  "steps": {
41
- "type": "object",
42
- "minProperties": 1,
43
- "additionalProperties": {
70
+ "type": "array",
71
+ "minItems": 1,
72
+ "items": {
44
73
  "$ref": "#/definitions/Step"
45
- },
46
- "description": "V2: Object keyed by step_id (NOT array!)"
47
- },
48
- "delivery": {
49
- "type": "object",
50
- "description": "Delivery configuration for workflow results"
74
+ }
51
75
  }
52
76
  },
53
77
  "definitions": {
54
78
  "Step": {
55
79
  "type": "object",
56
- "required": ["step_id", "type"],
80
+ "required": ["id", "type"],
57
81
  "oneOf": [
58
82
  { "$ref": "#/definitions/TaskStep" },
59
83
  { "$ref": "#/definitions/ForeachStep" },
@@ -66,14 +90,12 @@
66
90
  },
67
91
  "TaskStep": {
68
92
  "type": "object",
69
- "required": ["step_id", "type", "service"],
93
+ "required": ["id", "type", "service"],
70
94
  "additionalProperties": true,
71
95
  "properties": {
72
- "step_id": {
96
+ "id": {
73
97
  "type": "string",
74
- "minLength": 1,
75
- "pattern": "^[a-zA-Z0-9_]+$",
76
- "description": "V2: step_id (snake_case, must match object key)"
98
+ "minLength": 1
77
99
  },
78
100
  "type": {
79
101
  "type": "string",
@@ -87,6 +109,14 @@
87
109
  "type": "string",
88
110
  "minLength": 1
89
111
  },
112
+ "action": {
113
+ "type": "string",
114
+ "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"]
115
+ },
116
+ "endpoint": {
117
+ "type": "string",
118
+ "minLength": 1
119
+ },
90
120
  "operation": {
91
121
  "type": "string",
92
122
  "minLength": 1,
@@ -94,15 +124,20 @@
94
124
  },
95
125
  "input": {
96
126
  "type": "object",
97
- "additionalProperties": true
127
+ "additionalProperties": true,
128
+ "description": "Optional input mapping - supports all JSON types"
98
129
  },
99
130
  "output": {
100
131
  "type": "object",
101
- "additionalProperties": true
132
+ "additionalProperties": true,
133
+ "description": "Optional output mapping - supports all JSON types"
102
134
  },
103
135
  "depends_on": {
104
136
  "type": "array",
105
- "items": { "type": "string" }
137
+ "items": {
138
+ "type": "string",
139
+ "minLength": 1
140
+ }
106
141
  },
107
142
  "retry": {
108
143
  "$ref": "#/definitions/Retry"
@@ -115,91 +150,130 @@
115
150
  "$ref": "#/definitions/ErrorHandler"
116
151
  },
117
152
  "condition": {
118
- "type": "string"
119
- },
120
- "expect": {
121
- "type": "object",
122
- "description": "Expected output for testing"
153
+ "type": "string",
154
+ "description": "JSONPath expression that must evaluate to true for step to execute"
123
155
  }
156
+ },
157
+ "condition": {
158
+ "type": "string",
159
+ "description": "JSONPath expression for conditional execution"
160
+ },
161
+ "timeoutMs": {
162
+ "type": "integer",
163
+ "minimum": 1,
164
+ "description": "Timeout for entire foreach loop"
165
+ },
166
+ "on_error": {
167
+ "$ref": "#/definitions/ErrorHandler"
124
168
  }
125
169
  },
126
170
  "ForeachStep": {
127
171
  "type": "object",
128
- "required": ["step_id", "type", "iterator", "body"],
172
+ "required": ["id", "type", "iterator", "body"],
129
173
  "additionalProperties": true,
130
174
  "properties": {
131
- "step_id": {
175
+ "id": {
132
176
  "type": "string",
133
- "minLength": 1,
134
- "pattern": "^[a-zA-Z0-9_]+$"
177
+ "minLength": 1
135
178
  },
136
179
  "type": {
137
180
  "type": "string",
138
181
  "const": "foreach"
139
182
  },
183
+ "name": {
184
+ "type": "string",
185
+ "minLength": 1
186
+ },
140
187
  "iterator": {
141
188
  "type": "string",
142
189
  "minLength": 1
143
190
  },
144
191
  "body": {
145
- "type": "object",
146
- "minProperties": 1,
147
- "additionalProperties": {
192
+ "type": "array",
193
+ "minItems": 1,
194
+ "items": {
148
195
  "$ref": "#/definitions/Step"
149
196
  }
197
+ },
198
+ "output": {
199
+ "type": "object",
200
+ "additionalProperties": true,
201
+ "description": "Optional output collection mapping"
150
202
  }
151
203
  }
152
204
  },
153
205
  "ForkJoinStep": {
154
206
  "type": "object",
155
- "required": ["step_id", "type", "branches", "join"],
207
+ "required": ["id", "type", "branches", "join"],
156
208
  "additionalProperties": true,
157
209
  "properties": {
158
- "step_id": {
210
+ "id": {
159
211
  "type": "string",
160
- "minLength": 1,
161
- "pattern": "^[a-zA-Z0-9_]+$"
212
+ "minLength": 1
162
213
  },
163
214
  "type": {
164
215
  "type": "string",
165
216
  "const": "fork_join"
166
217
  },
218
+ "name": {
219
+ "type": "string",
220
+ "minLength": 1
221
+ },
167
222
  "branches": {
168
- "type": "object",
169
- "minProperties": 1,
170
- "additionalProperties": {
223
+ "type": "array",
224
+ "minItems": 1,
225
+ "items": {
171
226
  "$ref": "#/definitions/Step"
172
227
  }
173
228
  },
174
229
  "join": {
175
230
  "type": "object",
176
231
  "required": ["strategy"],
232
+ "additionalProperties": false,
177
233
  "properties": {
178
234
  "strategy": {
179
235
  "type": "string",
180
- "enum": ["merge", "first", "last", "all", "custom"]
236
+ "enum": ["merge", "first", "last", "all", "custom"],
237
+ "description": "How to combine branch results"
181
238
  },
182
239
  "output": {
183
- "type": "object"
240
+ "type": "object",
241
+ "additionalProperties": true,
242
+ "description": "Optional output mapping for joined results"
184
243
  }
185
244
  }
186
245
  }
246
+ },
247
+ "condition": {
248
+ "type": "string",
249
+ "description": "JSONPath expression for conditional execution"
250
+ },
251
+ "timeoutMs": {
252
+ "type": "integer",
253
+ "minimum": 1,
254
+ "description": "Timeout for all branches"
255
+ },
256
+ "on_error": {
257
+ "$ref": "#/definitions/ErrorHandler"
187
258
  }
188
259
  },
189
260
  "SwitchStep": {
190
261
  "type": "object",
191
- "required": ["step_id", "type", "expression", "cases"],
262
+ "required": ["id", "type", "expression", "cases", "default"],
192
263
  "additionalProperties": true,
193
264
  "properties": {
194
- "step_id": {
265
+ "id": {
195
266
  "type": "string",
196
- "minLength": 1,
197
- "pattern": "^[a-zA-Z0-9_]+$"
267
+ "minLength": 1
198
268
  },
199
269
  "type": {
200
270
  "type": "string",
201
271
  "const": "switch"
202
272
  },
273
+ "name": {
274
+ "type": "string",
275
+ "minLength": 1
276
+ },
203
277
  "expression": {
204
278
  "type": "string",
205
279
  "minLength": 1
@@ -213,82 +287,138 @@
213
287
  },
214
288
  "default": {
215
289
  "$ref": "#/definitions/Step"
290
+ },
291
+ "depends_on": {
292
+ "type": "array",
293
+ "items": {
294
+ "type": "string",
295
+ "minLength": 1
296
+ }
297
+ },
298
+ "condition": {
299
+ "type": "string",
300
+ "description": "JSONPath expression for conditional execution"
301
+ },
302
+ "on_error": {
303
+ "$ref": "#/definitions/ErrorHandler"
216
304
  }
217
305
  }
218
306
  },
219
307
  "SubWorkflowStep": {
220
308
  "type": "object",
221
- "required": ["step_id", "type", "steps"],
309
+ "required": ["id", "type", "steps"],
222
310
  "additionalProperties": true,
223
311
  "properties": {
224
- "step_id": {
312
+ "id": {
225
313
  "type": "string",
226
- "minLength": 1,
227
- "pattern": "^[a-zA-Z0-9_]+$"
314
+ "minLength": 1
228
315
  },
229
316
  "type": {
230
317
  "type": "string",
231
318
  "const": "sub_workflow"
232
319
  },
320
+ "name": {
321
+ "type": "string",
322
+ "minLength": 1
323
+ },
233
324
  "input": {
234
- "type": "object"
325
+ "type": "object",
326
+ "additionalProperties": true,
327
+ "description": "Optional input for sub-workflow - supports all JSON types"
235
328
  },
236
329
  "steps": {
237
- "type": "object",
238
- "minProperties": 1,
239
- "additionalProperties": {
330
+ "type": "array",
331
+ "minItems": 1,
332
+ "items": {
240
333
  "$ref": "#/definitions/Step"
241
334
  }
335
+ },
336
+ "condition": {
337
+ "type": "string",
338
+ "description": "JSONPath expression for conditional execution"
339
+ },
340
+ "timeoutMs": {
341
+ "type": "integer",
342
+ "minimum": 1,
343
+ "description": "Timeout for entire sub-workflow"
344
+ },
345
+ "on_error": {
346
+ "$ref": "#/definitions/ErrorHandler"
242
347
  }
243
348
  }
244
349
  },
245
350
  "WaitStep": {
246
351
  "type": "object",
247
- "required": ["step_id", "type", "durationMs"],
352
+ "required": ["id", "type", "durationMs"],
248
353
  "additionalProperties": true,
249
354
  "properties": {
250
- "step_id": {
355
+ "id": {
251
356
  "type": "string",
252
- "minLength": 1,
253
- "pattern": "^[a-zA-Z0-9_]+$"
357
+ "minLength": 1
254
358
  },
255
359
  "type": {
256
360
  "type": "string",
257
361
  "const": "wait"
258
362
  },
363
+ "name": {
364
+ "type": "string",
365
+ "minLength": 1
366
+ },
259
367
  "durationMs": {
260
368
  "type": "integer",
261
369
  "minimum": 0
370
+ },
371
+ "condition": {
372
+ "type": "string",
373
+ "description": "JSONPath expression for conditional execution"
262
374
  }
263
375
  }
264
376
  },
265
377
  "DispatchStep": {
266
378
  "type": "object",
267
- "required": ["step_id", "type", "method", "target"],
379
+ "required": ["id", "type", "method", "target"],
268
380
  "additionalProperties": true,
269
381
  "properties": {
270
- "step_id": {
382
+ "id": {
271
383
  "type": "string",
272
- "minLength": 1,
273
- "pattern": "^[a-zA-Z0-9_]+$"
384
+ "minLength": 1
274
385
  },
275
386
  "type": {
276
387
  "type": "string",
277
388
  "const": "dispatch"
278
389
  },
390
+ "name": {
391
+ "type": "string",
392
+ "minLength": 1
393
+ },
279
394
  "method": {
280
395
  "type": "string",
281
- "enum": ["webhook", "http", "grpc", "kafka", "sqs", "custom"]
396
+ "enum": ["webhook", "http", "grpc", "kafka", "sqs", "custom"],
397
+ "description": "Dispatch method to use"
282
398
  },
283
399
  "target": {
284
400
  "type": "string",
285
401
  "format": "uri"
286
402
  },
287
403
  "input": {
288
- "type": "object"
404
+ "type": "object",
405
+ "additionalProperties": true,
406
+ "description": "Optional dispatch payload - supports all JSON types"
289
407
  },
290
408
  "retry": {
291
409
  "$ref": "#/definitions/Retry"
410
+ },
411
+ "condition": {
412
+ "type": "string",
413
+ "description": "JSONPath expression for conditional execution"
414
+ },
415
+ "timeoutMs": {
416
+ "type": "integer",
417
+ "minimum": 1,
418
+ "description": "Timeout for dispatch operation"
419
+ },
420
+ "on_error": {
421
+ "$ref": "#/definitions/ErrorHandler"
292
422
  }
293
423
  }
294
424
  },
@@ -308,38 +438,45 @@
308
438
  "backoffMultiplier": {
309
439
  "type": "number",
310
440
  "minimum": 1.0,
311
- "maximum": 5.0
441
+ "maximum": 5.0,
442
+ "description": "Exponential backoff multiplier"
312
443
  }
313
444
  }
314
445
  },
315
446
  "ErrorHandler": {
316
447
  "type": "object",
317
- "required": ["strategy"],
318
448
  "additionalProperties": false,
319
449
  "properties": {
320
450
  "strategy": {
321
451
  "type": "string",
322
- "enum": ["retry", "fail", "continue", "compensate", "fallback"]
452
+ "enum": ["retry", "fail", "continue", "compensate", "fallback"],
453
+ "description": "How to handle errors"
323
454
  },
324
455
  "retries": {
325
456
  "type": "integer",
326
457
  "minimum": 0,
327
- "maximum": 10
458
+ "maximum": 10,
459
+ "description": "Number of retries before applying strategy"
328
460
  },
329
461
  "retryDelayMs": {
330
462
  "type": "integer",
331
- "minimum": 0
463
+ "minimum": 0,
464
+ "description": "Delay between retries"
332
465
  },
333
466
  "fallbackStep": {
334
- "type": "string"
467
+ "type": "string",
468
+ "description": "Step ID to execute as fallback"
335
469
  },
336
470
  "compensationStep": {
337
- "type": "string"
471
+ "type": "string",
472
+ "description": "Step ID to execute for compensation/rollback"
338
473
  },
339
474
  "errorOutput": {
340
- "type": "string"
475
+ "type": "string",
476
+ "description": "JSONPath to store error details"
341
477
  }
342
- }
478
+ },
479
+ "required": ["strategy"]
343
480
  }
344
481
  }
345
- }
482
+ }