@hotmeshio/hotmesh 0.0.52 → 0.0.54

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 (134) hide show
  1. package/README.md +22 -18
  2. package/build/index.d.ts +1 -2
  3. package/build/index.js +1 -3
  4. package/build/modules/enums.d.ts +8 -3
  5. package/build/modules/enums.js +16 -8
  6. package/build/modules/errors.d.ts +58 -20
  7. package/build/modules/errors.js +90 -33
  8. package/build/package.json +7 -2
  9. package/build/services/activities/activity.d.ts +8 -0
  10. package/build/services/activities/activity.js +63 -14
  11. package/build/services/activities/await.js +6 -6
  12. package/build/services/activities/cycle.d.ts +2 -2
  13. package/build/services/activities/cycle.js +5 -5
  14. package/build/services/activities/hook.js +9 -5
  15. package/build/services/activities/interrupt.d.ts +3 -3
  16. package/build/services/activities/interrupt.js +15 -6
  17. package/build/services/activities/signal.d.ts +2 -2
  18. package/build/services/activities/signal.js +4 -4
  19. package/build/services/activities/trigger.d.ts +5 -2
  20. package/build/services/activities/trigger.js +34 -4
  21. package/build/services/activities/worker.js +6 -6
  22. package/build/services/compiler/deployer.js +33 -5
  23. package/build/services/compiler/validator.d.ts +2 -0
  24. package/build/services/compiler/validator.js +5 -1
  25. package/build/services/durable/client.d.ts +7 -1
  26. package/build/services/durable/client.js +57 -38
  27. package/build/services/durable/exporter.d.ts +27 -81
  28. package/build/services/durable/exporter.js +153 -325
  29. package/build/services/durable/handle.d.ts +13 -8
  30. package/build/services/durable/handle.js +61 -48
  31. package/build/services/durable/index.d.ts +0 -2
  32. package/build/services/durable/index.js +0 -2
  33. package/build/services/durable/schemas/factory.d.ts +33 -0
  34. package/build/services/durable/schemas/factory.js +2356 -0
  35. package/build/services/durable/search.js +8 -8
  36. package/build/services/durable/worker.js +117 -25
  37. package/build/services/durable/workflow.d.ts +67 -52
  38. package/build/services/durable/workflow.js +322 -306
  39. package/build/services/engine/index.d.ts +2 -2
  40. package/build/services/engine/index.js +5 -2
  41. package/build/services/exporter/index.d.ts +2 -4
  42. package/build/services/exporter/index.js +4 -5
  43. package/build/services/hotmesh/index.d.ts +2 -2
  44. package/build/services/hotmesh/index.js +2 -2
  45. package/build/services/mapper/index.d.ts +6 -2
  46. package/build/services/mapper/index.js +6 -2
  47. package/build/services/pipe/functions/array.d.ts +2 -10
  48. package/build/services/pipe/functions/array.js +30 -28
  49. package/build/services/pipe/functions/conditional.d.ts +1 -0
  50. package/build/services/pipe/functions/conditional.js +3 -0
  51. package/build/services/pipe/functions/date.d.ts +1 -0
  52. package/build/services/pipe/functions/date.js +4 -0
  53. package/build/services/pipe/functions/index.d.ts +2 -0
  54. package/build/services/pipe/functions/index.js +2 -0
  55. package/build/services/pipe/functions/logical.d.ts +5 -0
  56. package/build/services/pipe/functions/logical.js +12 -0
  57. package/build/services/pipe/functions/object.d.ts +3 -0
  58. package/build/services/pipe/functions/object.js +25 -7
  59. package/build/services/pipe/index.d.ts +20 -3
  60. package/build/services/pipe/index.js +82 -16
  61. package/build/services/router/index.js +14 -3
  62. package/build/services/serializer/index.d.ts +3 -2
  63. package/build/services/serializer/index.js +11 -4
  64. package/build/services/store/clients/ioredis.js +6 -6
  65. package/build/services/store/clients/redis.js +7 -7
  66. package/build/services/store/index.d.ts +2 -0
  67. package/build/services/store/index.js +4 -1
  68. package/build/services/stream/clients/ioredis.js +8 -8
  69. package/build/services/stream/clients/redis.js +1 -1
  70. package/build/types/activity.d.ts +60 -5
  71. package/build/types/durable.d.ts +183 -36
  72. package/build/types/error.d.ts +48 -0
  73. package/build/types/error.js +2 -0
  74. package/build/types/exporter.d.ts +35 -7
  75. package/build/types/index.d.ts +4 -3
  76. package/build/types/job.d.ts +93 -6
  77. package/build/types/pipe.d.ts +81 -3
  78. package/build/types/stream.d.ts +61 -1
  79. package/build/types/stream.js +4 -0
  80. package/index.ts +1 -2
  81. package/modules/enums.ts +16 -8
  82. package/modules/errors.ts +139 -34
  83. package/package.json +7 -2
  84. package/services/activities/activity.ts +63 -14
  85. package/services/activities/await.ts +6 -6
  86. package/services/activities/cycle.ts +7 -6
  87. package/services/activities/hook.ts +12 -5
  88. package/services/activities/interrupt.ts +19 -9
  89. package/services/activities/signal.ts +6 -5
  90. package/services/activities/trigger.ts +43 -6
  91. package/services/activities/worker.ts +7 -7
  92. package/services/compiler/deployer.ts +33 -6
  93. package/services/compiler/validator.ts +7 -3
  94. package/services/durable/client.ts +49 -22
  95. package/services/durable/exporter.ts +162 -349
  96. package/services/durable/handle.ts +66 -53
  97. package/services/durable/index.ts +0 -2
  98. package/services/durable/schemas/factory.ts +2358 -0
  99. package/services/durable/search.ts +8 -8
  100. package/services/durable/worker.ts +128 -29
  101. package/services/durable/workflow.ts +371 -322
  102. package/services/engine/index.ts +8 -3
  103. package/services/exporter/index.ts +10 -12
  104. package/services/hotmesh/index.ts +4 -3
  105. package/services/mapper/index.ts +6 -2
  106. package/services/pipe/functions/array.ts +24 -37
  107. package/services/pipe/functions/conditional.ts +4 -0
  108. package/services/pipe/functions/date.ts +6 -0
  109. package/services/pipe/functions/index.ts +7 -5
  110. package/services/pipe/functions/logical.ts +11 -0
  111. package/services/pipe/functions/object.ts +26 -7
  112. package/services/pipe/index.ts +99 -21
  113. package/services/quorum/index.ts +1 -3
  114. package/services/router/index.ts +14 -3
  115. package/services/serializer/index.ts +12 -5
  116. package/services/store/clients/ioredis.ts +6 -6
  117. package/services/store/clients/redis.ts +7 -7
  118. package/services/store/index.ts +4 -1
  119. package/services/stream/clients/ioredis.ts +8 -8
  120. package/services/stream/clients/redis.ts +1 -1
  121. package/types/activity.ts +87 -15
  122. package/types/durable.ts +263 -75
  123. package/types/error.ts +52 -0
  124. package/types/exporter.ts +43 -9
  125. package/types/index.ts +14 -8
  126. package/types/job.ts +157 -36
  127. package/types/pipe.ts +84 -3
  128. package/types/stream.ts +82 -23
  129. package/build/services/durable/factory.d.ts +0 -17
  130. package/build/services/durable/factory.js +0 -817
  131. package/build/services/durable/meshos.d.ts +0 -127
  132. package/build/services/durable/meshos.js +0 -380
  133. package/services/durable/factory.ts +0 -818
  134. package/services/durable/meshos.ts +0 -441
@@ -0,0 +1,2356 @@
1
+ "use strict";
2
+ /**
3
+ *********** HOTMESH 'DURABLE' MODULE APPLICATION GRAPH **********
4
+ *
5
+ * This HotMesh application spec uses 50 activities and 25 transitions
6
+ * to model and emulate the Temporal Application & Query servers using
7
+ * Redis as the backend.
8
+ *
9
+ * It's particularly useful for organizations with high-speed, high-volume
10
+ * use cases as it uses in-memory Redis Streams for transactional,
11
+ * workflow processing, while adhering to Temporal's developer-friendly syntax.
12
+ *
13
+ * This YAML file can also serve as a useful starting point for building
14
+ * Integration/BPM/Workflow servers in general (MuleSoft, etc) without the need
15
+ * for a physical application server.
16
+ *
17
+ * Possible use cases include:
18
+ * * Orchestration servers
19
+ * * Integration servers
20
+ * * BPMN engines
21
+ * * Reentrant process servers
22
+ * * Service Meshes
23
+ * * Master Data Management systems
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.APP_ID = exports.APP_VERSION = exports.getWorkflowYAML = void 0;
27
+ const APP_VERSION = '1';
28
+ exports.APP_VERSION = APP_VERSION;
29
+ const APP_ID = 'durable';
30
+ exports.APP_ID = APP_ID;
31
+ /**
32
+ * returns a new durable workflow schema
33
+ * @param {string} app - app name (e.g., 'durable')
34
+ * @param {string} version - number as string (e.g., '1')
35
+ * @returns {string} HotMesh App YAML
36
+ */
37
+ const getWorkflowYAML = (app, version) => {
38
+ return `app:
39
+ id: ${app}
40
+ version: '${version}'
41
+ graphs:
42
+
43
+ ###################################################
44
+ # THE DURABLE-REENTRANT-WORKFLOW #
45
+ # #
46
+ - subscribes: ${app}.execute
47
+ publishes: ${app}.executed
48
+
49
+ expire:
50
+ '@pipe':
51
+ - ['{trigger.output.data.originJobId}', 0, '{trigger.output.data.expire}']
52
+ - ['{@conditional.ternary}']
53
+
54
+ input:
55
+ schema:
56
+ type: object
57
+ properties:
58
+ originJobId:
59
+ description: the entry point from the outside world; subflows will inherit this value
60
+ type: string
61
+ workflowId:
62
+ description: the id for this workflow (see \`trigger.stats.id\`)
63
+ type: string
64
+ parentWorkflowId:
65
+ type: string
66
+ arguments:
67
+ description: the arguments to pass to the flow
68
+ type: array
69
+ workflowTopic:
70
+ description: the Redis stream topic the worker is listening on
71
+ type: string
72
+ backoffCoefficient:
73
+ description: the time multiple in seconds to backoff before retrying
74
+ type: number
75
+ maximumAttempts:
76
+ description: the maximum number of retries to attempt before failing the workflow
77
+ type: number
78
+ maximumInterval:
79
+ description: the maximum time in seconds to wait between retries; provides a fixed limit to exponential backoff growth
80
+ type: number
81
+ expire:
82
+ description: the time in seconds to expire the workflow in Redis once it completes
83
+ type: number
84
+
85
+ output:
86
+ schema:
87
+ type: object
88
+ properties:
89
+ response:
90
+ description: the final response from the workflow if any
91
+ type: any
92
+ done:
93
+ description: true if the workflow is complete (whether successful or not)
94
+ type: boolean
95
+ $error:
96
+ description: only present if a structured error ocurred (598, 597, etc)
97
+ type: object
98
+ properties:
99
+ code:
100
+ type: number
101
+ message:
102
+ type: string
103
+ stack:
104
+ type: string
105
+ workflowId:
106
+ type: string
107
+ jc:
108
+ type: string
109
+ ju:
110
+ type: string
111
+
112
+ activities:
113
+
114
+ ######## MAIN ACTIVITIES (RESPONSIBLE FOR FLOW ENTRY/STARTUP) ########
115
+ trigger:
116
+ title: Main Flow Trigger
117
+ type: trigger
118
+ job:
119
+ maps:
120
+ done: false
121
+ stats:
122
+ id: '{$self.input.data.workflowId}'
123
+ key: '{$self.input.data.parentWorkflowId}'
124
+ parent: '{$self.input.data.originJobId}'
125
+ adjacent: '{$self.input.data.parentWorkflowId}'
126
+
127
+ cycle_hook:
128
+ title: Main Cycle Pivot - Cycling Descendants send execution back to this point
129
+ type: hook
130
+ cycle: true
131
+ output:
132
+ schema:
133
+ type: object
134
+ properties:
135
+ retryCount:
136
+ type: number
137
+ maps:
138
+ retryCount: 0
139
+ throttleSeconds: 0
140
+
141
+ throttler:
142
+ title: Pauses for an exponentially-throttled amount of time after a retryable error or passes through immediately
143
+ type: hook
144
+ sleep: '{cycle_hook.output.data.throttleSeconds}'
145
+
146
+ worker:
147
+ title: Main Worker - Calls linked Workflow functions
148
+ type: worker
149
+ topic: '{trigger.output.data.workflowTopic}'
150
+ emit: '{$job.data.done}'
151
+ input:
152
+ schema:
153
+ type: object
154
+ properties:
155
+ originJobId:
156
+ type: string
157
+ workflowId:
158
+ type: string
159
+ arguments:
160
+ type: array
161
+ workflowTopic:
162
+ type: string
163
+ canRetry:
164
+ type: boolean
165
+ maps:
166
+ originJobId: '{trigger.output.data.originJobId}'
167
+ workflowId: '{trigger.output.data.workflowId}'
168
+ arguments: '{trigger.output.data.arguments}'
169
+ workflowTopic: '{trigger.output.data.workflowTopic}'
170
+ canRetry:
171
+ '@pipe':
172
+ - '@pipe':
173
+ - ['{cycle_hook.output.data.retryCount}']
174
+ - '@pipe':
175
+ - ['{trigger.output.data.maximumAttempts}', 5]
176
+ - ['{@conditional.nullish}']
177
+ - ['{@conditional.less_than}']
178
+ output:
179
+ schema:
180
+ type: object
181
+ properties:
182
+ response:
183
+ type: any
184
+ 589:
185
+ schema:
186
+ type: object
187
+ properties:
188
+ workflowId:
189
+ type: string
190
+ parentWorkflowId:
191
+ type: string
192
+ originJobId:
193
+ type: string
194
+ index:
195
+ type: number
196
+ workflowDimension:
197
+ type: string
198
+ description: empty string or dimensionsal path (,0,0,1)
199
+ items:
200
+ type: array
201
+ description: the items to pass
202
+ items:
203
+ type: object
204
+ size:
205
+ type: number
206
+ description: the number of items to pass
207
+ 590:
208
+ schema:
209
+ type: object
210
+ properties:
211
+ workflowId:
212
+ type: string
213
+ parentWorkflowId:
214
+ type: string
215
+ originJobId:
216
+ type: string
217
+ workflowName:
218
+ type: string
219
+ index:
220
+ type: number
221
+ workflowDimension:
222
+ type: string
223
+ description: empty string or dimensionsal path (,0,0,1)
224
+ arguments:
225
+ type: array
226
+ description: the arguments to pass to the flow (recursive)
227
+ items:
228
+ type: any
229
+ backoffCoefficient:
230
+ type: number
231
+ maximumAttempts:
232
+ type: number
233
+ maximumInterval:
234
+ type: number
235
+ await:
236
+ type: string
237
+ description: when set to false, do not await the child flow's completion
238
+ 591:
239
+ schema:
240
+ type: object
241
+ properties:
242
+ activityName:
243
+ type: string
244
+ index:
245
+ type: number
246
+ workflowDimension:
247
+ type: string
248
+ description: empty string or dimensionsal path (,0,0,1)
249
+ arguments:
250
+ type: array
251
+ description: the arguments to pass to the activity
252
+ items:
253
+ type: any
254
+ workflowId:
255
+ type: string
256
+ workflowTopic:
257
+ type: string
258
+ parentWorkflowId:
259
+ type: string
260
+ originJobId:
261
+ type: string
262
+ backoffCoefficient:
263
+ type: number
264
+ maximumAttempts:
265
+ type: number
266
+ maximumInterval:
267
+ type: number
268
+ 588:
269
+ schema:
270
+ type: object
271
+ properties:
272
+ duration:
273
+ type: number
274
+ description: sleepFor duration in seconds
275
+ index:
276
+ type: number
277
+ description: the replay index (COUNTER++)
278
+ 595:
279
+ schema:
280
+ type: object
281
+ properties:
282
+ index:
283
+ type: number
284
+ description: the index of the first signal in the array
285
+ signal:
286
+ type: object
287
+ properties:
288
+ signal:
289
+ type: string
290
+ job:
291
+ maps:
292
+ response: '{$self.output.data.response}'
293
+
294
+ sleeper:
295
+ title: Pauses the main thread for a set amount of time; all other subprocess threads remain active, and new ones may be started
296
+ type: hook
297
+ sleep: '{worker.output.data.duration}'
298
+ job:
299
+ maps:
300
+ idempotentcy-marker[-]:
301
+ '@pipe':
302
+ - '@pipe':
303
+ - ['-sleep', '{worker.output.data.workflowDimension}', '-', '{worker.output.data.index}', '-']
304
+ - ['{@string.concat}']
305
+ - '@pipe':
306
+ - [duration, '{worker.output.data.duration}', ac, '{$self.output.metadata.ac}', au, '{$self.output.metadata.au}']
307
+ - ['{@object.create}']
308
+ - ['{@object.create}']
309
+
310
+ sleep_cycler:
311
+ title: Cycles back to the cycle_hook pivot
312
+ type: cycle
313
+ ancestor: cycle_hook
314
+ input:
315
+ maps:
316
+ retryCount: 0
317
+ throttleSeconds: 0
318
+
319
+ childer:
320
+ title: Awaits a child flow to be executed/started
321
+ type: await
322
+ topic: ${app}.execute
323
+ await: '{worker.output.data.await}'
324
+ input:
325
+ schema:
326
+ type: object
327
+ properties:
328
+ workflowTopic:
329
+ type: string
330
+ backoffCoefficient:
331
+ type: number
332
+ maximumAttempts:
333
+ type: number
334
+ maximumInterval:
335
+ type: number
336
+ expire:
337
+ type: number
338
+ parentWorkflowId:
339
+ type: string
340
+ description: used to forge the cleanup key
341
+ originJobId:
342
+ type: string
343
+ description: used for dependency cleanup
344
+ workflowId:
345
+ type: string
346
+ description: the baseId + index
347
+ arguments:
348
+ type: array
349
+ description: the arguments to pass to the activity
350
+ items:
351
+ type: string
352
+ maps:
353
+ arguments: '{worker.output.data.arguments}'
354
+ workflowDimension: '{worker.output.data.workflowDimension}'
355
+ index: '{worker.output.data.index}'
356
+ originJobId: '{worker.output.data.originJobId}'
357
+ parentWorkflowId: '{worker.output.data.parentWorkflowId}'
358
+ workflowId: '{worker.output.data.workflowId}'
359
+ workflowName: '{worker.output.data.workflowName}'
360
+ workflowTopic: '{worker.output.data.workflowTopic}'
361
+ backoffCoefficient:
362
+ '@pipe':
363
+ - ['{worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
364
+ - ['{@conditional.nullish}', 10]
365
+ - ['{@conditional.nullish}']
366
+ maximumAttempts:
367
+ '@pipe':
368
+ - ['{worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
369
+ - ['{@conditional.nullish}', 5]
370
+ - ['{@conditional.nullish}']
371
+ maximumInterval:
372
+ '@pipe':
373
+ - ['{worker.output.data.maximumInterval}','{trigger.output.data.maximumInterval}']
374
+ - ['{@conditional.nullish}', 120]
375
+ - ['{@conditional.nullish}']
376
+ job:
377
+ maps:
378
+ idempotentcy-marker[-]:
379
+ '@pipe':
380
+ - '@pipe':
381
+ - ['{worker.output.data.await}', true]
382
+ - ['{@conditional.nullish}', '-child', '-start']
383
+ - ['{@conditional.ternary}', '{worker.output.data.workflowDimension}', '-', '{worker.output.data.index}', '-']
384
+ - ['{@string.concat}']
385
+ - '@pipe':
386
+ - '@pipe':
387
+ - ['{$self.output.data.$error}', '{$self.output.metadata.$error}']
388
+ - ['{@logical.or}']
389
+ - '@pipe':
390
+ - '@pipe':
391
+ - [$error]
392
+ - '@pipe':
393
+ - ['{$self.output.data.$error}', '{$self.output.metadata.$error}']
394
+ - ['{@logical.or}']
395
+ - '@pipe':
396
+ - [ac]
397
+ - '@pipe':
398
+ - ['{$self.output.data.jc}', '{$self.output.metadata.ac}']
399
+ - ['{@logical.or}']
400
+ - '@pipe':
401
+ - [au]
402
+ - '@pipe':
403
+ - ['{$self.output.data.ju}', '{$self.output.metadata.au}']
404
+ - ['{@logical.or}']
405
+ - '@pipe':
406
+ - [job_id]
407
+ - '@pipe':
408
+ - ['{$self.output.data.workflowId}']
409
+ - ['{@object.create}']
410
+ - '@pipe':
411
+ - '@pipe':
412
+ - ['{$self.output.data.done}']
413
+ - '@pipe':
414
+ - '@pipe':
415
+ - [data]
416
+ - '@pipe':
417
+ - ['{$self.output.data.response}']
418
+ - '@pipe':
419
+ - [ac]
420
+ - '@pipe':
421
+ - ['{$self.output.data.jc}']
422
+ - '@pipe':
423
+ - [au]
424
+ - '@pipe':
425
+ - ['{$self.output.data.ju}']
426
+ - '@pipe':
427
+ - [job_id]
428
+ - '@pipe':
429
+ - ['{$self.output.data.workflowId}']
430
+ - ['{@object.create}']
431
+ - '@pipe':
432
+ - '@pipe':
433
+ - [data]
434
+ - '@pipe':
435
+ - ['{$self.output.data.job_id}']
436
+ - '@pipe':
437
+ - [ac]
438
+ - '@pipe':
439
+ - ['{$self.output.data.jc}']
440
+ - '@pipe':
441
+ - [au]
442
+ - '@pipe':
443
+ - ['{$self.output.data.ju}']
444
+ - '@pipe':
445
+ - [job_id]
446
+ - '@pipe':
447
+ - ['{$self.output.data.job_id}']
448
+ - ['{@object.create}']
449
+ - ['{@conditional.ternary}']
450
+ - ['{@conditional.ternary}']
451
+ - ['{@object.create}']
452
+
453
+ child_cycler:
454
+ title: Cycles back to the cycle_hook
455
+ type: cycle
456
+ ancestor: cycle_hook
457
+ input:
458
+ maps:
459
+ retryCount:
460
+ '@pipe':
461
+ - '@pipe':
462
+ - ['{childer.output.metadata.err}']
463
+ - '@pipe':
464
+ - ['{cycle_hook.output.data.retryCount}', 0]
465
+ - ['{@logical.or}', 1]
466
+ - ['{@math.add}']
467
+ - '@pipe':
468
+ - [0]
469
+ - ['{@conditional.ternary}']
470
+ throttleSeconds:
471
+ '@pipe':
472
+ - '@pipe':
473
+ - ['{childer.output.metadata.err}']
474
+ - '@pipe':
475
+ - '@pipe':
476
+ - '@pipe':
477
+ - ['{trigger.output.data.backoffCoefficient}', 10]
478
+ - ['{@conditional.nullish}']
479
+ - '@pipe':
480
+ - ['{cycle_hook.output.data.retryCount}', 0]
481
+ - ['{@conditional.nullish}']
482
+ - ['{@math.pow}']
483
+ - '@pipe':
484
+ - ['{trigger.output.data.maximumInterval}', 120]
485
+ - ['{@logical.or}']
486
+ - ['{@math.min}']
487
+ - '@pipe':
488
+ - [0]
489
+ - ['{@conditional.ternary}']
490
+
491
+ proxyer:
492
+ title: Invokes the activity flow and awaits the response
493
+ type: await
494
+ topic: ${app}.activity.execute
495
+ input:
496
+ schema:
497
+ type: object
498
+ properties:
499
+ activityName:
500
+ type: string
501
+ parentWorkflowId:
502
+ type: string
503
+ description: used to forge the cleanup key
504
+ originJobId:
505
+ type: string
506
+ description: used for dependency cleanup
507
+ workflowId:
508
+ type: string
509
+ description: the baseId + index
510
+ arguments:
511
+ type: array
512
+ description: the arguments to pass to the activity
513
+ items:
514
+ type: string
515
+ backoffCoefficient:
516
+ type: number
517
+ maximumAttempts:
518
+ type: number
519
+ maximumInterval:
520
+ type: number
521
+ maps:
522
+ activityName: '{worker.output.data.activityName}'
523
+ arguments: '{worker.output.data.arguments}'
524
+ workflowDimension: '{worker.output.data.workflowDimension}'
525
+ index: '{worker.output.data.index}'
526
+ originJobId: '{worker.output.data.originJobId}'
527
+ parentWorkflowId: '{worker.output.data.workflowId}'
528
+ workflowId: '{worker.output.data.workflowId}'
529
+ workflowTopic: '{worker.output.data.workflowTopic}'
530
+ backoffCoefficient:
531
+ '@pipe':
532
+ - ['{worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
533
+ - ['{@conditional.nullish}', 10]
534
+ - ['{@conditional.nullish}']
535
+ maximumAttempts:
536
+ '@pipe':
537
+ - ['{worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
538
+ - ['{@conditional.nullish}', 5]
539
+ - ['{@conditional.nullish}']
540
+ maximumInterval:
541
+ '@pipe':
542
+ - ['{worker.output.data.maximumInterval}','{trigger.output.data.maximumInterval}']
543
+ - ['{@conditional.nullish}', 120]
544
+ - ['{@conditional.nullish}']
545
+ job:
546
+ maps:
547
+ idempotentcy-marker[-]:
548
+ '@pipe':
549
+ - '@pipe':
550
+ - ['-proxy', '{worker.output.data.workflowDimension}', '-', '{worker.output.data.index}', '-']
551
+ - ['{@string.concat}']
552
+ - '@pipe':
553
+ - '@pipe':
554
+ - ['{$self.output.data.$error}']
555
+ - '@pipe':
556
+ - '@pipe':
557
+ - [$error]
558
+ - '@pipe':
559
+ - ['{$self.output.data.$error}']
560
+ - '@pipe':
561
+ - [ac]
562
+ - '@pipe':
563
+ - ['{$self.output.data.jc}']
564
+ - '@pipe':
565
+ - [au]
566
+ - '@pipe':
567
+ - ['{$self.output.data.ju}']
568
+ - '@pipe':
569
+ - ['job_id']
570
+ - '@pipe':
571
+ - ['{$self.output.data.workflowId}']
572
+ - ['{@object.create}']
573
+ - '@pipe':
574
+ - '@pipe':
575
+ - [data]
576
+ - '@pipe':
577
+ - ['{$self.output.data.response}']
578
+ - '@pipe':
579
+ - [ac]
580
+ - '@pipe':
581
+ - ['{$self.output.data.jc}']
582
+ - '@pipe':
583
+ - [au]
584
+ - '@pipe':
585
+ - ['{$self.output.data.ju}']
586
+ - '@pipe':
587
+ - ['job_id']
588
+ - '@pipe':
589
+ - ['{$self.output.data.workflowId}']
590
+ - ['{@object.create}']
591
+ - ['{@conditional.ternary}']
592
+ - ['{@object.create}']
593
+
594
+ proxy_cycler:
595
+ title: Cycles back to the cycle_hook
596
+ type: cycle
597
+ ancestor: cycle_hook
598
+ input:
599
+ maps:
600
+ retryCount:
601
+ '@pipe':
602
+ - '@pipe':
603
+ - ['{proxyer.output.metadata.err}']
604
+ - '@pipe':
605
+ - ['{cycle_hook.output.data.retryCount}', 0]
606
+ - ['{@logical.or}', 1]
607
+ - ['{@math.add}']
608
+ - '@pipe':
609
+ - [0]
610
+ - ['{@conditional.ternary}']
611
+ throttleSeconds:
612
+ '@pipe':
613
+ - '@pipe':
614
+ - ['{proxyer.output.metadata.err}']
615
+ - '@pipe':
616
+ - '@pipe':
617
+ - '@pipe':
618
+ - ['{trigger.output.data.backoffCoefficient}', 10]
619
+ - ['{@conditional.nullish}']
620
+ - '@pipe':
621
+ - ['{cycle_hook.output.data.retryCount}', 0]
622
+ - ['{@conditional.nullish}']
623
+ - ['{@math.pow}']
624
+ - '@pipe':
625
+ - ['{trigger.output.data.maximumInterval}', 120]
626
+ - ['{@logical.or}']
627
+ - ['{@math.min}']
628
+ - '@pipe':
629
+ - [0]
630
+ - ['{@conditional.ternary}']
631
+
632
+ collator:
633
+ title: Awaits the collator flow to simultaneously resolve the idempotent items and return as a sequential set
634
+ type: await
635
+ topic: ${app}.collator.execute
636
+ input:
637
+ schema:
638
+ type: object
639
+ properties:
640
+ parentWorkflowId:
641
+ type: string
642
+ description: used to forge the cleanup key
643
+ originJobId:
644
+ type: string
645
+ description: used for dependency cleanup
646
+ workflowId:
647
+ type: string
648
+ size:
649
+ type: number
650
+ description: the number of idempotent items to resolve
651
+ items:
652
+ type: array
653
+ description: the idempotent items to resolve
654
+ items:
655
+ type: object
656
+ properties:
657
+ index:
658
+ type: number
659
+ data:
660
+ type: object
661
+ maps:
662
+ items: '{worker.output.data.items}'
663
+ size: '{worker.output.data.size}'
664
+ workflowDimension: '{worker.output.data.workflowDimension}'
665
+ index: '{worker.output.data.index}'
666
+ originJobId: '{worker.output.data.originJobId}'
667
+ parentWorkflowId: '{worker.output.data.workflowId}'
668
+ workflowId: '{worker.output.data.workflowId}'
669
+ workflowTopic: '{worker.output.data.workflowTopic}'
670
+ output:
671
+ schema:
672
+ type: object
673
+ properties:
674
+ size:
675
+ type: number
676
+ data:
677
+ type: object
678
+ properties:
679
+ response:
680
+ description: the collated response, returned as a object with numeric keys, representing the order in the Promise.all array
681
+ type: object
682
+ patternProperties:
683
+ '^[0-9]+$':
684
+ type: object
685
+ properties:
686
+ type:
687
+ type: string
688
+ enum: [wait, proxy, child, start, sleep]
689
+ data:
690
+ type: unknown
691
+ job:
692
+ maps:
693
+ idempotentcy-marker[-]:
694
+ '@pipe':
695
+ - ['{$self.output.data.response}', {}]
696
+ - '@reduce':
697
+ - '@pipe':
698
+ - - '{$output}'
699
+ - '@pipe':
700
+ - '@pipe':
701
+ - - '-'
702
+ - '@pipe':
703
+ - - '{$item}'
704
+ - type
705
+ - - '{@object.get}'
706
+ - '@pipe':
707
+ - - '{worker.output.data.workflowDimension}'
708
+ - '@pipe':
709
+ - - '-'
710
+ - '@pipe':
711
+ - '@pipe':
712
+ - - '{worker.output.data.index}'
713
+ - '@pipe':
714
+ - - '{$index}'
715
+ - - '{@math.add}'
716
+ - '@pipe':
717
+ - - '-'
718
+ - - '{@string.concat}'
719
+ - '@pipe':
720
+ - - '{$item}'
721
+ - - '{@object.set}'
722
+
723
+ collate_cycler:
724
+ title: Cycles back to the cycle_hook after collating the results
725
+ type: cycle
726
+ ancestor: cycle_hook
727
+ input:
728
+ maps:
729
+ retryCount: 0
730
+ throttleSeconds: 0
731
+
732
+ retryer:
733
+ title: Cycles back to the cycle_hook pivot, increasing the retryCount (the exponential)
734
+ type: cycle
735
+ ancestor: cycle_hook
736
+ input:
737
+ maps:
738
+ retryCount:
739
+ '@pipe':
740
+ - ['{cycle_hook.output.data.retryCount}', 0]
741
+ - ['{@logical.or}', 1]
742
+ - ['{@math.add}']
743
+ throttleSeconds:
744
+ '@pipe':
745
+ - '@pipe':
746
+ - '@pipe':
747
+ - ['{trigger.output.data.backoffCoefficient}', 10]
748
+ - ['{@conditional.nullish}']
749
+ - '@pipe':
750
+ - ['{cycle_hook.output.data.retryCount}', 0]
751
+ - ['{@conditional.nullish}']
752
+ - ['{@math.pow}']
753
+ - '@pipe':
754
+ - ['{trigger.output.data.maximumInterval}', 120]
755
+ - ['{@logical.or}']
756
+ - ['{@math.min}']
757
+
758
+ closer:
759
+ title: Closes the \`Signal In\` Hook Channel, so the workflow can exit
760
+ type: signal
761
+ subtype: one
762
+ topic: ${app}.flow.signal
763
+ signal:
764
+ schema:
765
+ type: object
766
+ properties:
767
+ id:
768
+ type: string
769
+ maps:
770
+ id: '{$job.metadata.jid}'
771
+ job:
772
+ maps:
773
+ done: true
774
+ $error: '{worker.output.data.$error}'
775
+ jc: '{$job.metadata.jc}'
776
+ ju:
777
+ '@pipe':
778
+ - ['{@date.toISOXString}']
779
+
780
+ stopper:
781
+ title: Stops 'Signal In' when retryCount is exceeded (and as a result ends the job)
782
+ type: signal
783
+ subtype: one
784
+ topic: ${app}.flow.signal
785
+ signal:
786
+ schema:
787
+ type: object
788
+ properties:
789
+ id:
790
+ type: string
791
+ maps:
792
+ id: '{$job.metadata.jid}'
793
+ job:
794
+ maps:
795
+ done: true
796
+ $error:
797
+ '@pipe':
798
+ - ['{worker.output.data.$error}', 'code', 597]
799
+ - ['{@object.set}']
800
+ jc: '{$job.metadata.jc}'
801
+ ju:
802
+ '@pipe':
803
+ - ['{@date.toISOXString}']
804
+
805
+ ######## SIGNAL-IN ACTIVITIES (RESPONSIBLE FOR FLOW REENTRY) ########
806
+ signaler:
807
+ title: Signal-In Reentry point for subordinated hook flows
808
+ type: hook
809
+ hook:
810
+ type: object
811
+ properties:
812
+ id:
813
+ type: string
814
+ arguments:
815
+ type: array
816
+ workflowTopic:
817
+ type: string
818
+ job:
819
+ maps:
820
+ workflowId: '{trigger.output.data.workflowId}'
821
+
822
+ signaler_cycle_hook:
823
+ title: Signal In Cycle Pivot - Cycling Descendants Send Execution Back Here
824
+ type: hook
825
+ cycle: true
826
+ output:
827
+ schema:
828
+ type: object
829
+ properties:
830
+ retryCount:
831
+ type: number
832
+ maps:
833
+ retryCount: 0
834
+ throttleSeconds: 0
835
+
836
+ signaler_throttler:
837
+ title: Pauses between failed hook executions for an exponentially-throttled amount of time after a retryable error
838
+ type: hook
839
+ sleep: '{signaler_cycle_hook.output.data.throttleSeconds}'
840
+
841
+ signaler_worker:
842
+ title: Signal In - Worker
843
+ type: worker
844
+ topic: '{signaler.hook.data.workflowTopic}'
845
+ input:
846
+ schema:
847
+ type: object
848
+ properties:
849
+ workflowId:
850
+ type: string
851
+ originJobId:
852
+ type: string
853
+ workflowDimension:
854
+ type: string
855
+ arguments:
856
+ type: array
857
+ canRetry:
858
+ type: boolean
859
+ maps:
860
+ workflowId: '{trigger.output.data.workflowId}'
861
+ originJobId: '{trigger.output.data.originJobId}'
862
+ workflowDimension: '{signaler.output.metadata.dad}'
863
+ arguments: '{signaler.hook.data.arguments}'
864
+ canRetry:
865
+ '@pipe':
866
+ - '@pipe':
867
+ - ['{signaler_cycle_hook.output.data.retryCount}']
868
+ - '@pipe':
869
+ - ['{trigger.output.data.maximumAttempts}', 5]
870
+ - ['{@conditional.nullish}']
871
+ - ['{@conditional.less_than}']
872
+
873
+ output:
874
+ schema:
875
+ type: object
876
+ 589:
877
+ schema:
878
+ description: the worker function output when Promise.all is used
879
+ type: object
880
+ properties:
881
+ workflowId:
882
+ type: string
883
+ description: the id for the new child workflow to spawn
884
+ parentWorkflowId:
885
+ type: string
886
+ description: parent workflow id (this workflow's id)
887
+ originJobId:
888
+ type: string
889
+ description: entry flow id (where outside world met the mesh)
890
+ index:
891
+ type: number
892
+ description: the replay index (COUNTER++)
893
+ workflowDimension:
894
+ type: string
895
+ description: empty string or dimensionsal path (,0,0,1)
896
+ items:
897
+ type: array
898
+ description: the items to collate
899
+ items:
900
+ type: object
901
+ size:
902
+ type: number
903
+ description: the number of items to collate
904
+ 590:
905
+ schema:
906
+ description: the worker function output when execChild or startChild are called
907
+ type: object
908
+ properties:
909
+ workflowId:
910
+ type: string
911
+ description: the id for the new child workflow to spawn
912
+ parentWorkflowId:
913
+ type: string
914
+ description: parent workflow id (this workflow's id)
915
+ originJobId:
916
+ type: string
917
+ description: entry flow id (where outside world met the mesh)
918
+ workflowName:
919
+ type: string
920
+ description: the linked function name
921
+ index:
922
+ type: number
923
+ description: the replay index (COUNTER++)
924
+ workflowDimension:
925
+ type: string
926
+ description: empty string or dimensionsal path (,0,0,1)
927
+ arguments:
928
+ type: array
929
+ description: the arguments to pass to the flow (recursive)
930
+ items:
931
+ type: any
932
+ backoffCoefficient:
933
+ type: number
934
+ description: the time multiple in seconds to backoff before retrying
935
+ maximumAttempts:
936
+ type: number
937
+ description: the maximum number of retries to attempt before failing the workflow
938
+ maximumInterval:
939
+ type: number
940
+ description: the maximum time in seconds to wait between retries; provides a fixed limit to exponential backoff growth
941
+ await:
942
+ type: string
943
+ description: when set to false, do not await the child flow's completion
944
+ 591:
945
+ schema:
946
+ type: object
947
+ properties:
948
+ activityName:
949
+ type: string
950
+ index:
951
+ type: number
952
+ workflowDimension:
953
+ type: string
954
+ description: empty string or dimensionsal path (,0,0,1)
955
+ arguments:
956
+ type: array
957
+ description: the arguments to pass to the activity
958
+ items:
959
+ type: any
960
+ workflowId:
961
+ type: string
962
+ workflowTopic:
963
+ type: string
964
+ parentWorkflowId:
965
+ type: string
966
+ originJobId:
967
+ type: string
968
+ backoffCoefficient:
969
+ type: number
970
+ maximumAttempts:
971
+ type: number
972
+ maximumInterval:
973
+ type: number
974
+ 588:
975
+ schema:
976
+ type: object
977
+ properties:
978
+ duration:
979
+ type: number
980
+ description: sleepFor duration in seconds
981
+ index:
982
+ type: number
983
+ description: the replay index (COUNTER++)
984
+ 595:
985
+ schema:
986
+ type: object
987
+ properties:
988
+ index:
989
+ type: number
990
+ description: the index of the first signal in the array
991
+ signal:
992
+ type: object
993
+ properties:
994
+ signal:
995
+ type: string
996
+
997
+ signaler_sleeper:
998
+ title: Pauses a single thread within the worker for a set amount of seconds while the main flow thread and all other subthreads remain active
999
+ type: hook
1000
+ sleep: '{signaler_worker.output.data.duration}'
1001
+ job:
1002
+ maps:
1003
+ idempotentcy-marker[-]:
1004
+ '@pipe':
1005
+ - '@pipe':
1006
+ - ['-sleep', '{signaler_worker.output.data.workflowDimension}', '-', '{signaler_worker.output.data.index}', '-']
1007
+ - ['{@string.concat}']
1008
+ - '@pipe':
1009
+ - [duration, '{signaler_worker.output.data.duration}', ac, '{$self.output.metadata.ac}', au, '{$self.output.metadata.au}']
1010
+ - ['{@object.create}']
1011
+ - ['{@object.create}']
1012
+
1013
+ signaler_sleep_cycler:
1014
+ title: Cycles back to the signaler_cycle_hook pivot
1015
+ type: cycle
1016
+ ancestor: signaler_cycle_hook
1017
+ input:
1018
+ maps:
1019
+ retryCount: 0
1020
+ throttleSeconds: 0
1021
+
1022
+ signaler_childer:
1023
+ title: Awaits a child flow to be executed/started
1024
+ type: await
1025
+ topic: ${app}.execute
1026
+ await: '{signaler_worker.output.data.await}'
1027
+ input:
1028
+ schema:
1029
+ type: object
1030
+ properties:
1031
+ workflowTopic:
1032
+ type: string
1033
+ backoffCoefficient:
1034
+ type: number
1035
+ maximumAttempts:
1036
+ type: number
1037
+ maximumInterval:
1038
+ type: number
1039
+ expire:
1040
+ type: number
1041
+ parentWorkflowId:
1042
+ type: string
1043
+ description: used to forge the cleanup key
1044
+ originJobId:
1045
+ type: string
1046
+ description: used for dependency cleanup
1047
+ workflowId:
1048
+ type: string
1049
+ description: the baseId + index
1050
+ arguments:
1051
+ type: array
1052
+ description: the arguments to pass to the activity
1053
+ items:
1054
+ type: string
1055
+ maps:
1056
+ arguments: '{signaler_worker.output.data.arguments}'
1057
+ workflowDimension: '{signaler_worker.output.data.workflowDimension}'
1058
+ index: '{signaler_worker.output.data.index}'
1059
+ originJobId: '{signaler_worker.output.data.originJobId}'
1060
+ parentWorkflowId: '{signaler_worker.output.data.parentWorkflowId}'
1061
+ workflowId: '{signaler_worker.output.data.workflowId}'
1062
+ workflowName: '{signaler_worker.output.data.workflowName}'
1063
+ workflowTopic: '{signaler_worker.output.data.workflowTopic}'
1064
+ backoffCoefficient:
1065
+ '@pipe':
1066
+ - ['{signaler_worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
1067
+ - ['{@conditional.nullish}', 10]
1068
+ - ['{@conditional.nullish}']
1069
+ maximumAttempts:
1070
+ '@pipe':
1071
+ - ['{signaler_worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
1072
+ - ['{@conditional.nullish}', 5]
1073
+ - ['{@conditional.nullish}']
1074
+ maximumInterval:
1075
+ '@pipe':
1076
+ - ['{signaler_worker.output.data.maximumInterval}','{trigger.output.data.maximumInterval}']
1077
+ - ['{@conditional.nullish}', 120]
1078
+ - ['{@conditional.nullish}']
1079
+ job:
1080
+ maps:
1081
+ idempotentcy-marker[-]:
1082
+ '@pipe':
1083
+ - '@pipe':
1084
+ - ['{signaler_worker.output.data.await}', true]
1085
+ - ['{@conditional.nullish}', '-child', '-start']
1086
+ - ['{@conditional.ternary}', '{signaler_worker.output.data.workflowDimension}', '-', '{signaler_worker.output.data.index}', '-']
1087
+ - ['{@string.concat}']
1088
+ - '@pipe':
1089
+ - '@pipe':
1090
+ - ['{$self.output.data.$error}', '{$self.output.metadata.$error}']
1091
+ - ['{@logical.or}']
1092
+ - '@pipe':
1093
+ - '@pipe':
1094
+ - [$error]
1095
+ - '@pipe':
1096
+ - ['{$self.output.data.$error}', '{$self.output.metadata.$error}']
1097
+ - ['{@logical.or}']
1098
+ - '@pipe':
1099
+ - [ac]
1100
+ - '@pipe':
1101
+ - ['{$self.output.data.jc}', '{$self.output.metadata.ac}']
1102
+ - ['{@logical.or}']
1103
+ - '@pipe':
1104
+ - [au]
1105
+ - '@pipe':
1106
+ - ['{$self.output.data.ju}', '{$self.output.metadata.au}']
1107
+ - ['{@logical.or}']
1108
+ - '@pipe':
1109
+ - ['job_id']
1110
+ - '@pipe':
1111
+ - ['{$self.output.data.workflowId}']
1112
+ - ['{@object.create}']
1113
+ - '@pipe':
1114
+ - '@pipe':
1115
+ - ['{$self.output.data.done}']
1116
+ - '@pipe':
1117
+ - '@pipe':
1118
+ - [data]
1119
+ - '@pipe':
1120
+ - ['{$self.output.data.response}']
1121
+ - '@pipe':
1122
+ - [ac]
1123
+ - '@pipe':
1124
+ - ['{$self.output.data.jc}']
1125
+ - '@pipe':
1126
+ - [au]
1127
+ - '@pipe':
1128
+ - ['{$self.output.data.ju}']
1129
+ - '@pipe':
1130
+ - [job_id]
1131
+ - '@pipe':
1132
+ - ['{$self.output.data.workflowId}']
1133
+ - ['{@object.create}']
1134
+ - '@pipe':
1135
+ - '@pipe':
1136
+ - [data]
1137
+ - '@pipe':
1138
+ - ['{$self.output.data.job_id}']
1139
+ - '@pipe':
1140
+ - [ac]
1141
+ - '@pipe':
1142
+ - ['{$self.output.data.jc}']
1143
+ - '@pipe':
1144
+ - [au]
1145
+ - '@pipe':
1146
+ - ['{$self.output.data.ju}']
1147
+ - '@pipe':
1148
+ - ['job_id']
1149
+ - '@pipe':
1150
+ - ['{$self.output.data.job_id}']
1151
+ - ['{@object.create}']
1152
+ - ['{@conditional.ternary}']
1153
+ - ['{@conditional.ternary}']
1154
+ - ['{@object.create}']
1155
+
1156
+ signaler_child_cycler:
1157
+ title: Cycles back to the signaler_cycle_hook
1158
+ type: cycle
1159
+ ancestor: signaler_cycle_hook
1160
+ input:
1161
+ maps:
1162
+ retryCount:
1163
+ '@pipe':
1164
+ - '@pipe':
1165
+ - ['{signaler_childer.output.metadata.err}']
1166
+ - '@pipe':
1167
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1168
+ - ['{@logical.or}', 1]
1169
+ - ['{@math.add}']
1170
+ - '@pipe':
1171
+ - [0]
1172
+ - ['{@conditional.ternary}']
1173
+ throttleSeconds:
1174
+ '@pipe':
1175
+ - '@pipe':
1176
+ - ['{signaler_childer.output.metadata.err}']
1177
+ - '@pipe':
1178
+ - '@pipe':
1179
+ - '@pipe':
1180
+ - ['{trigger.output.data.backoffCoefficient}', 10]
1181
+ - ['{@conditional.nullish}']
1182
+ - '@pipe':
1183
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1184
+ - ['{@conditional.nullish}']
1185
+ - ['{@math.pow}']
1186
+ - '@pipe':
1187
+ - ['{trigger.output.data.maximumInterval}', 120]
1188
+ - ['{@logical.or}']
1189
+ - ['{@math.min}']
1190
+ - '@pipe':
1191
+ - [0]
1192
+ - ['{@conditional.ternary}']
1193
+
1194
+ signaler_proxyer:
1195
+ title: Invokes the activity flow and awaits the response
1196
+ type: await
1197
+ topic: ${app}.activity.execute
1198
+ input:
1199
+ schema:
1200
+ type: object
1201
+ properties:
1202
+ activityName:
1203
+ type: string
1204
+ parentWorkflowId:
1205
+ type: string
1206
+ description: used to forge the cleanup key
1207
+ originJobId:
1208
+ type: string
1209
+ description: used for dependency cleanup
1210
+ workflowId:
1211
+ type: string
1212
+ description: the baseId + index
1213
+ arguments:
1214
+ type: array
1215
+ description: the arguments to pass to the activity
1216
+ items:
1217
+ type: string
1218
+ backoffCoefficient:
1219
+ type: number
1220
+ maximumAttempts:
1221
+ type: number
1222
+ maximumInterval:
1223
+ type: number
1224
+ maps:
1225
+ activityName: '{signaler_worker.output.data.activityName}'
1226
+ arguments: '{signaler_worker.output.data.arguments}'
1227
+ workflowDimension: '{signaler_worker.output.data.workflowDimension}'
1228
+ index: '{signaler_worker.output.data.index}'
1229
+ originJobId: '{signaler_worker.output.data.originJobId}'
1230
+ parentWorkflowId: '{signaler_worker.output.data.workflowId}'
1231
+ workflowId: '{signaler_worker.output.data.workflowId}'
1232
+ workflowTopic: '{signaler_worker.output.data.workflowTopic}'
1233
+ backoffCoefficient:
1234
+ '@pipe':
1235
+ - ['{signaler_worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
1236
+ - ['{@conditional.nullish}', 10]
1237
+ - ['{@conditional.nullish}']
1238
+ maximumAttempts:
1239
+ '@pipe':
1240
+ - ['{signaler_worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
1241
+ - ['{@conditional.nullish}', 5]
1242
+ - ['{@conditional.nullish}']
1243
+ maximumInterval:
1244
+ '@pipe':
1245
+ - ['{signaler_worker.output.data.maximumInterval}','{trigger.output.data.maximumInterval}']
1246
+ - ['{@conditional.nullish}', 120]
1247
+ - ['{@conditional.nullish}']
1248
+ job:
1249
+ maps:
1250
+ idempotentcy-marker[-]:
1251
+ '@pipe':
1252
+ - '@pipe':
1253
+ - ['-proxy', '{signaler_worker.output.data.workflowDimension}', '-', '{signaler_worker.output.data.index}', '-']
1254
+ - ['{@string.concat}']
1255
+ - '@pipe':
1256
+ - '@pipe':
1257
+ - ['{$self.output.data.$error}']
1258
+ - '@pipe':
1259
+ - '@pipe':
1260
+ - [$error]
1261
+ - '@pipe':
1262
+ - ['{$self.output.data.$error}']
1263
+ - '@pipe':
1264
+ - [ac]
1265
+ - '@pipe':
1266
+ - ['{$self.output.data.jc}']
1267
+ - '@pipe':
1268
+ - [au]
1269
+ - '@pipe':
1270
+ - ['{$self.output.data.ju}']
1271
+ - '@pipe':
1272
+ - ['job_id']
1273
+ - '@pipe':
1274
+ - ['{$self.output.data.workflowId}']
1275
+ - ['{@object.create}']
1276
+ - '@pipe':
1277
+ - '@pipe':
1278
+ - [data]
1279
+ - '@pipe':
1280
+ - ['{$self.output.data.response}']
1281
+ - '@pipe':
1282
+ - [ac]
1283
+ - '@pipe':
1284
+ - ['{$self.output.data.jc}']
1285
+ - '@pipe':
1286
+ - [au]
1287
+ - '@pipe':
1288
+ - ['{$self.output.data.ju}']
1289
+ - '@pipe':
1290
+ - ['job_id']
1291
+ - '@pipe':
1292
+ - ['{$self.output.data.workflowId}']
1293
+ - ['{@object.create}']
1294
+ - ['{@conditional.ternary}']
1295
+ - ['{@object.create}']
1296
+
1297
+ signaler_proxy_cycler:
1298
+ title: Cycles back to the signaler_cycle_hook
1299
+ type: cycle
1300
+ ancestor: signaler_cycle_hook
1301
+ input:
1302
+ maps:
1303
+ retryCount:
1304
+ '@pipe':
1305
+ - '@pipe':
1306
+ - ['{signaler_proxyer.output.metadata.err}']
1307
+ - '@pipe':
1308
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1309
+ - ['{@logical.or}', 1]
1310
+ - ['{@math.add}']
1311
+ - '@pipe':
1312
+ - [0]
1313
+ - ['{@conditional.ternary}']
1314
+ throttleSeconds:
1315
+ '@pipe':
1316
+ - '@pipe':
1317
+ - ['{signaler_proxyer.output.metadata.err}']
1318
+ - '@pipe':
1319
+ - '@pipe':
1320
+ - '@pipe':
1321
+ - ['{trigger.output.data.backoffCoefficient}', 10]
1322
+ - ['{@conditional.nullish}']
1323
+ - '@pipe':
1324
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1325
+ - ['{@conditional.nullish}']
1326
+ - ['{@math.pow}']
1327
+ - '@pipe':
1328
+ - ['{trigger.output.data.maximumInterval}', 120]
1329
+ - ['{@logical.or}']
1330
+ - ['{@math.min}']
1331
+ - '@pipe':
1332
+ - [0]
1333
+ - ['{@conditional.ternary}']
1334
+
1335
+ signaler_collator:
1336
+ title: Awaits the collator to resolve the idempotent items as a sequential set
1337
+ type: await
1338
+ topic: ${app}.collator.execute
1339
+ input:
1340
+ schema:
1341
+ type: object
1342
+ properties:
1343
+ parentWorkflowId:
1344
+ type: string
1345
+ description: used to forge the cleanup key
1346
+ originJobId:
1347
+ type: string
1348
+ description: used for dependency cleanup
1349
+ workflowId:
1350
+ type: string
1351
+ size:
1352
+ type: number
1353
+ description: the number of idempotent items to collate
1354
+ items:
1355
+ type: array
1356
+ description: the idempotent items to collate
1357
+ items:
1358
+ type: object
1359
+ properties:
1360
+ index:
1361
+ type: number
1362
+ data:
1363
+ type: object
1364
+ maps:
1365
+ items: '{signaler_worker.output.data.items}'
1366
+ size: '{signaler_worker.output.data.size}'
1367
+ workflowDimension: '{signaler_worker.output.data.workflowDimension}'
1368
+ index: '{signaler_worker.output.data.index}'
1369
+ originJobId: '{signaler_worker.output.data.originJobId}'
1370
+ parentWorkflowId: '{signaler_worker.output.data.workflowId}'
1371
+ workflowId: '{signaler_worker.output.data.workflowId}'
1372
+ workflowTopic: '{signaler_worker.output.data.workflowTopic}'
1373
+ output:
1374
+ schema:
1375
+ type: object
1376
+ properties:
1377
+ size:
1378
+ type: number
1379
+ data:
1380
+ type: object
1381
+ properties:
1382
+ response:
1383
+ description: the collated response, returned as a object with numeric keys, representing the order in the Promise.all array
1384
+ type: object
1385
+ patternProperties:
1386
+ '^[0-9]+$':
1387
+ type: object
1388
+ properties:
1389
+ type:
1390
+ type: string
1391
+ enum: [wait, proxy, child, start, sleep]
1392
+ data:
1393
+ type: unknown
1394
+ job:
1395
+ maps:
1396
+ idempotentcy-marker[-]:
1397
+ '@pipe':
1398
+ - ['{$self.output.data.response}', {}]
1399
+ - '@reduce':
1400
+ - '@pipe':
1401
+ - - '{$output}'
1402
+ - '@pipe':
1403
+ - '@pipe':
1404
+ - - '-'
1405
+ - '@pipe':
1406
+ - - '{$item}'
1407
+ - type
1408
+ - - '{@object.get}'
1409
+ - '@pipe':
1410
+ - - '{signaler_worker.output.data.workflowDimension}'
1411
+ - '@pipe':
1412
+ - - '-'
1413
+ - '@pipe':
1414
+ - '@pipe':
1415
+ - - '{signaler_worker.output.data.index}'
1416
+ - '@pipe':
1417
+ - - '{$index}'
1418
+ - - '{@math.add}'
1419
+ - '@pipe':
1420
+ - - '-'
1421
+ - - '{@string.concat}'
1422
+ - '@pipe':
1423
+ - - '{$item}'
1424
+ - - '{@object.set}'
1425
+
1426
+ signaler_collate_cycler:
1427
+ title: Cycles back to the signaler_cycle_hook after collating the results
1428
+ type: cycle
1429
+ ancestor: signaler_cycle_hook
1430
+ input:
1431
+ maps:
1432
+ retryCount: 0
1433
+ throttleSeconds: 0
1434
+
1435
+ signaler_retryer:
1436
+ title: Cycles back to the signaler_cycle_hook pivot, increasing the retryCount (the exponential)
1437
+ type: cycle
1438
+ ancestor: signaler_cycle_hook
1439
+ input:
1440
+ maps:
1441
+ retryCount:
1442
+ '@pipe':
1443
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1444
+ - ['{@logical.or}', 1]
1445
+ - ['{@math.add}']
1446
+ throttleSeconds:
1447
+ '@pipe':
1448
+ - '@pipe':
1449
+ - '@pipe':
1450
+ - ['{trigger.output.data.backoffCoefficient}', 10]
1451
+ - ['{@conditional.nullish}']
1452
+ - '@pipe':
1453
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1454
+ - ['{@conditional.nullish}']
1455
+ - ['{@math.pow}']
1456
+ - '@pipe':
1457
+ - ['{trigger.output.data.maximumInterval}', 120]
1458
+ - ['{@logical.or}']
1459
+ - ['{@math.min}']
1460
+
1461
+ transitions:
1462
+ trigger:
1463
+ - to: cycle_hook
1464
+ - to: signaler
1465
+ ## MAIN PROCESS TRANSITIONS ##
1466
+ cycle_hook:
1467
+ - to: throttler
1468
+ throttler:
1469
+ - to: worker
1470
+ worker:
1471
+ - to: closer
1472
+ conditions:
1473
+ code: [200, 596, 597, 598]
1474
+ - to: sleeper
1475
+ conditions:
1476
+ code: 588
1477
+ - to: collator
1478
+ conditions:
1479
+ code: 589
1480
+ - to: childer
1481
+ conditions:
1482
+ code: 590
1483
+ match:
1484
+ - expected: true
1485
+ actual:
1486
+ '@pipe':
1487
+ - '@pipe':
1488
+ - ['{cycle_hook.output.data.retryCount}']
1489
+ - '@pipe':
1490
+ - ['{trigger.output.data.maximumAttempts}', 5]
1491
+ - ['{@conditional.nullish}']
1492
+ - ['{@conditional.less_than}']
1493
+ - to: proxyer
1494
+ conditions:
1495
+ code: 591
1496
+ - to: retryer
1497
+ conditions:
1498
+ code: 599
1499
+ match:
1500
+ - expected: true
1501
+ actual:
1502
+ '@pipe':
1503
+ - '@pipe':
1504
+ - ['{cycle_hook.output.data.retryCount}']
1505
+ - '@pipe':
1506
+ - ['{trigger.output.data.maximumAttempts}', 5]
1507
+ - ['{@conditional.nullish}']
1508
+ - ['{@conditional.less_than}']
1509
+ - to: stopper
1510
+ conditions:
1511
+ code: [590, 591, 596, 597, 598, 599]
1512
+ match:
1513
+ - expected: true
1514
+ actual:
1515
+ '@pipe':
1516
+ - '@pipe':
1517
+ - ['{cycle_hook.output.data.retryCount}']
1518
+ - '@pipe':
1519
+ - ['{trigger.output.data.maximumAttempts}', 5]
1520
+ - ['{@conditional.nullish}']
1521
+ - ['{@conditional.greater_than_or_equal}']
1522
+ collator:
1523
+ - to: collate_cycler
1524
+ childer:
1525
+ - to: child_cycler
1526
+ proxyer:
1527
+ - to: proxy_cycler
1528
+ sleeper:
1529
+ - to: sleep_cycler
1530
+ ### SUBPROCESS TRANSITIONS (REENTRY) ###
1531
+ signaler:
1532
+ - to: signaler_cycle_hook
1533
+ conditions:
1534
+ code: 202
1535
+ signaler_cycle_hook:
1536
+ - to: signaler_throttler
1537
+ signaler_throttler:
1538
+ - to: signaler_worker
1539
+ signaler_worker:
1540
+ - to: signaler_sleeper
1541
+ conditions:
1542
+ code: 588
1543
+ - to: signaler_collator
1544
+ conditions:
1545
+ code: 589
1546
+ - to: signaler_childer
1547
+ conditions:
1548
+ code: 590
1549
+ match:
1550
+ - expected: true
1551
+ actual:
1552
+ '@pipe':
1553
+ - '@pipe':
1554
+ - ['{signaler_cycle_hook.output.data.retryCount}']
1555
+ - '@pipe':
1556
+ - ['{trigger.output.data.maximumAttempts}', 5]
1557
+ - ['{@conditional.nullish}']
1558
+ - ['{@conditional.less_than}']
1559
+ - to: signaler_proxyer
1560
+ conditions:
1561
+ code: 591
1562
+ - to: signaler_retryer
1563
+ conditions:
1564
+ code: 599
1565
+ match:
1566
+ - expected: true
1567
+ actual:
1568
+ '@pipe':
1569
+ - '@pipe':
1570
+ - ['{signaler_cycle_hook.output.data.retryCount}']
1571
+ - '@pipe':
1572
+ - ['{trigger.output.data.maximumAttempts}', 5]
1573
+ - ['{@conditional.nullish}']
1574
+ - ['{@conditional.less_than}']
1575
+ signaler_collator:
1576
+ - to: signaler_collate_cycler
1577
+ signaler_childer:
1578
+ - to: signaler_child_cycler
1579
+ signaler_proxyer:
1580
+ - to: signaler_proxy_cycler
1581
+ signaler_sleeper:
1582
+ - to: signaler_sleep_cycler
1583
+
1584
+ hooks:
1585
+ ${app}.flow.signal:
1586
+ - to: signaler
1587
+ conditions:
1588
+ match:
1589
+ - expected: '{trigger.output.data.workflowId}'
1590
+ actual: '{$self.hook.data.id}'
1591
+
1592
+
1593
+
1594
+ ###################################################
1595
+ # THE REENTRANT COLLATOR FLOW #
1596
+ # #
1597
+ - subscribes: ${app}.collator.execute
1598
+ publishes: ${app}.collator.executed
1599
+
1600
+ expire: 0
1601
+
1602
+ input:
1603
+ schema:
1604
+ type: object
1605
+ properties:
1606
+ parentWorkflowId:
1607
+ type: string
1608
+ originJobId:
1609
+ type: string
1610
+ workflowId:
1611
+ type: string
1612
+ workflowTopic:
1613
+ type: string
1614
+ size:
1615
+ title: The number of idempotent items to resolve
1616
+ type: number
1617
+ items:
1618
+ title: Idempotent items to resolve
1619
+ type: array
1620
+ items:
1621
+ type: object
1622
+ properties:
1623
+ index:
1624
+ type: index
1625
+ data:
1626
+ type: object
1627
+ output:
1628
+ schema:
1629
+ type: object
1630
+ properties:
1631
+ responses:
1632
+ type: array
1633
+ items:
1634
+ type: object
1635
+ properties:
1636
+ index:
1637
+ type: number
1638
+ response:
1639
+ type: any
1640
+ $error:
1641
+ type: object
1642
+ properties:
1643
+ code:
1644
+ type: number
1645
+ message:
1646
+ type: string
1647
+ stack:
1648
+ type: string
1649
+
1650
+ activities:
1651
+ collator_trigger:
1652
+ title: Collator Flow Trigger
1653
+ type: trigger
1654
+ stats:
1655
+ id: '{$self.input.data.workflowId}'
1656
+ key: '{$self.input.data.parentWorkflowId}'
1657
+ parent: '{$self.input.data.originJobId}'
1658
+ adjacent: '{$self.input.data.parentWorkflowId}'
1659
+ job:
1660
+ maps:
1661
+ cur_index: 0
1662
+
1663
+ collator_cycle_hook:
1664
+ title: Pivot - Cycling Descendant Points Here
1665
+ type: hook
1666
+ cycle: true
1667
+ job:
1668
+ maps:
1669
+ size:
1670
+ '@pipe':
1671
+ - ['{collator_trigger.output.data.items}']
1672
+ - ['{@array.length}']
1673
+ cur_index:
1674
+ '@pipe':
1675
+ - ['{$job.data.cur_index}', 1]
1676
+ - ['{@math.add}']
1677
+ output:
1678
+ maps:
1679
+ cur_index: '{$job.data.cur_index}'
1680
+
1681
+ collator_cycler:
1682
+ title: Cycles back to the collator_cycle_hook pivot
1683
+ type: cycle
1684
+ ancestor: collator_cycle_hook
1685
+ input:
1686
+ maps:
1687
+ cur_index: '{$job.data.cur_index}'
1688
+
1689
+ collator_sleeper:
1690
+ title: Pauses a single thread within the collator for a set amount of time while all other threads remain active
1691
+ type: hook
1692
+ sleep:
1693
+ '@pipe':
1694
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1695
+ - ['{@array.get}', duration]
1696
+ - ['{@object.get}']
1697
+ job:
1698
+ maps:
1699
+ response[25]:
1700
+ '@pipe':
1701
+ - '@pipe':
1702
+ - ['{collator_cycle_hook.output.data.cur_index}']
1703
+ - '@pipe':
1704
+ - '@pipe':
1705
+ - [type]
1706
+ - '@pipe':
1707
+ - [sleep]
1708
+ - '@pipe':
1709
+ - [duration]
1710
+ - '@pipe':
1711
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1712
+ - ['{@array.get}', duration]
1713
+ - ['{@object.get}']
1714
+ - '@pipe':
1715
+ - [ac]
1716
+ - '@pipe':
1717
+ - ['{$self.output.metadata.ac}']
1718
+ - '@pipe':
1719
+ - [au]
1720
+ - '@pipe':
1721
+ - ['{$self.output.metadata.au}']
1722
+ - ['{@object.create}']
1723
+ - ['{@object.create}']
1724
+
1725
+ collator_waiter:
1726
+ title: Waits for a matching signal to be sent to the collator workflow
1727
+ type: hook
1728
+ hook:
1729
+ type: object
1730
+ properties:
1731
+ signalData:
1732
+ type: object
1733
+ job:
1734
+ maps:
1735
+ response[25]:
1736
+ '@pipe':
1737
+ - ['{collator_trigger.output.data.items}']
1738
+ - '@pipe':
1739
+ - ['{collator_cycle_hook.output.data.cur_index}']
1740
+ - '@pipe':
1741
+ - [type, wait, data, '{$self.hook.data}', ac, '{$job.metadata.jc}', au, '{$self.output.metadata.au}']
1742
+ - ['{@object.create}']
1743
+ - ['{@object.create}']
1744
+
1745
+ collator_childer:
1746
+ title: Awaits a call for a child flow to be executed/started
1747
+ type: await
1748
+ topic: ${app}.execute
1749
+ await:
1750
+ '@pipe':
1751
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1752
+ - ['{@array.get}', await]
1753
+ - ['{@object.get}']
1754
+ input:
1755
+ schema:
1756
+ type: object
1757
+ properties:
1758
+ workflowTopic:
1759
+ type: string
1760
+ backoffCoefficient:
1761
+ type: number
1762
+ maximumAttempts:
1763
+ type: number
1764
+ maximumInterval:
1765
+ type: number
1766
+ expire:
1767
+ type: number
1768
+ parentWorkflowId:
1769
+ type: string
1770
+ description: used to forge the cleanup key
1771
+ originJobId:
1772
+ type: string
1773
+ description: used for dependency cleanup
1774
+ workflowId:
1775
+ type: string
1776
+ arguments:
1777
+ type: array
1778
+ description: the arguments to pass to the activity
1779
+ items:
1780
+ type: string
1781
+ maps:
1782
+ arguments:
1783
+ '@pipe':
1784
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1785
+ - ['{@array.get}', arguments]
1786
+ - ['{@object.get}']
1787
+ workflowDimension:
1788
+ '@pipe':
1789
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1790
+ - ['{@array.get}', workflowDimension]
1791
+ - ['{@object.get}']
1792
+ index:
1793
+ '@pipe':
1794
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1795
+ - ['{@array.get}', index]
1796
+ - ['{@object.get}']
1797
+ originJobId:
1798
+ '@pipe':
1799
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1800
+ - ['{@array.get}', originJobId]
1801
+ - ['{@object.get}']
1802
+ parentWorkflowId:
1803
+ '@pipe':
1804
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1805
+ - ['{@array.get}', parentWorkflowId]
1806
+ - ['{@object.get}']
1807
+ workflowId:
1808
+ '@pipe':
1809
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1810
+ - ['{@array.get}', workflowId]
1811
+ - ['{@object.get}']
1812
+ workflowName:
1813
+ '@pipe':
1814
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1815
+ - ['{@array.get}', workflowName]
1816
+ - ['{@object.get}']
1817
+ workflowTopic:
1818
+ '@pipe':
1819
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1820
+ - ['{@array.get}', workflowTopic]
1821
+ - ['{@object.get}']
1822
+ backoffCoefficient:
1823
+ '@pipe':
1824
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1825
+ - ['{@array.get}', backoffCoefficient]
1826
+ - ['{@object.get}']
1827
+ maximumAttempts:
1828
+ '@pipe':
1829
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1830
+ - ['{@array.get}', maximumAttempts]
1831
+ - ['{@object.get}']
1832
+ maximumInterval:
1833
+ '@pipe':
1834
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1835
+ - ['{@array.get}', maximumInterval]
1836
+ - ['{@object.get}']
1837
+ output:
1838
+ schema:
1839
+ type: object
1840
+ properties:
1841
+ response:
1842
+ type: any
1843
+ $error:
1844
+ type: object
1845
+ properties:
1846
+ code:
1847
+ type: number
1848
+ message:
1849
+ type: string
1850
+ stack:
1851
+ type: string
1852
+ done:
1853
+ type: boolean
1854
+ workflowId:
1855
+ type: string
1856
+ jc:
1857
+ type: string
1858
+ ju:
1859
+ type: string
1860
+ job:
1861
+ maps:
1862
+ response[25]:
1863
+ '@pipe':
1864
+ - '@pipe':
1865
+ - ['{collator_cycle_hook.output.data.cur_index}']
1866
+ - '@pipe':
1867
+ - '@pipe':
1868
+ - ['{$self.output.data.$error}']
1869
+ - '@pipe':
1870
+ - '@pipe':
1871
+ - [type]
1872
+ - '@pipe':
1873
+ - [child]
1874
+ - '@pipe':
1875
+ - [$error]
1876
+ - '@pipe':
1877
+ - ['{$self.output.data.$error}']
1878
+ - '@pipe':
1879
+ - [ac]
1880
+ - '@pipe':
1881
+ - ['{$job.metadata.jc}']
1882
+ - '@pipe':
1883
+ - [au]
1884
+ - '@pipe':
1885
+ - ['{@date.toISOXString}']
1886
+ - '@pipe':
1887
+ - [job_id]
1888
+ - '@pipe':
1889
+ - ['{$self.output.data.workflowId}']
1890
+ - ['{@object.create}']
1891
+ - '@pipe':
1892
+ - '@pipe':
1893
+ - ['{$self.output.data.done}']
1894
+ - '@pipe':
1895
+ - '@pipe':
1896
+ - [type]
1897
+ - '@pipe':
1898
+ - [child]
1899
+ - '@pipe':
1900
+ - [data]
1901
+ - '@pipe':
1902
+ - ['{$self.output.data.response}']
1903
+ - '@pipe':
1904
+ - [ac]
1905
+ - '@pipe':
1906
+ - ['{$job.metadata.jc}']
1907
+ - '@pipe':
1908
+ - [au]
1909
+ - '@pipe':
1910
+ - ['{@date.toISOXString}']
1911
+ - '@pipe':
1912
+ - [job_id]
1913
+ - '@pipe':
1914
+ - ['{$self.output.data.workflowId}']
1915
+ - ['{@object.create}']
1916
+ - '@pipe':
1917
+ - '@pipe':
1918
+ - [type]
1919
+ - '@pipe':
1920
+ - [start]
1921
+ - '@pipe':
1922
+ - [data]
1923
+ - '@pipe':
1924
+ - ['{$self.output.data.job_id}']
1925
+ - '@pipe':
1926
+ - [ac]
1927
+ - '@pipe':
1928
+ - ['{$job.metadata.jc}']
1929
+ - '@pipe':
1930
+ - [au]
1931
+ - '@pipe':
1932
+ - ['{@date.toISOXString}']
1933
+ - '@pipe':
1934
+ - [job_id]
1935
+ - '@pipe':
1936
+ - ['{$self.output.data.job_id}']
1937
+ - ['{@object.create}']
1938
+ - ['{@conditional.ternary}']
1939
+ - ['{@conditional.ternary}']
1940
+ - ['{@object.create}']
1941
+
1942
+ collator_proxyer:
1943
+ title: Invokes the activity flow and awaits the response
1944
+ type: await
1945
+ topic: ${app}.activity.execute
1946
+ input:
1947
+ schema:
1948
+ type: object
1949
+ properties:
1950
+ activityName:
1951
+ type: string
1952
+ parentWorkflowId:
1953
+ type: string
1954
+ description: used to forge the cleanup key
1955
+ originJobId:
1956
+ type: string
1957
+ description: used for dependency cleanup
1958
+ workflowId:
1959
+ type: string
1960
+ arguments:
1961
+ type: array
1962
+ description: the arguments to pass to the activity
1963
+ items:
1964
+ type: string
1965
+ backoffCoefficient:
1966
+ type: number
1967
+ maximumAttempts:
1968
+ type: number
1969
+ maximumInterval:
1970
+ type: number
1971
+ maps:
1972
+ activityName:
1973
+ '@pipe':
1974
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1975
+ - ['{@array.get}', activityName]
1976
+ - ['{@object.get}']
1977
+ arguments:
1978
+ '@pipe':
1979
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1980
+ - ['{@array.get}', arguments]
1981
+ - ['{@object.get}']
1982
+ workflowDimension:
1983
+ '@pipe':
1984
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1985
+ - ['{@array.get}', workflowDimension]
1986
+ - ['{@object.get}']
1987
+ index:
1988
+ '@pipe':
1989
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1990
+ - ['{@array.get}', index]
1991
+ - ['{@object.get}']
1992
+ originJobId:
1993
+ '@pipe':
1994
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1995
+ - ['{@array.get}', originJobId]
1996
+ - ['{@object.get}']
1997
+ parentWorkflowId:
1998
+ '@pipe':
1999
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2000
+ - ['{@array.get}', parentWorkflowId]
2001
+ - ['{@object.get}']
2002
+ workflowId:
2003
+ '@pipe':
2004
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2005
+ - ['{@array.get}', workflowId]
2006
+ - ['{@object.get}']
2007
+ workflowTopic:
2008
+ '@pipe':
2009
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2010
+ - ['{@array.get}', workflowTopic]
2011
+ - ['{@object.get}']
2012
+ backoffCoefficient: '{collator_trigger.output.data.backoffCoefficient}'
2013
+ maximumAttempts: '{collator_trigger.output.data.maximumAttempts}'
2014
+ maximumInterval: '{collator_trigger.output.data.maximumInterval}'
2015
+ output:
2016
+ schema:
2017
+ type: object
2018
+ properties:
2019
+ response:
2020
+ type: any
2021
+ $error:
2022
+ type: object
2023
+ properties:
2024
+ code:
2025
+ type: number
2026
+ message:
2027
+ type: string
2028
+ stack:
2029
+ type: string
2030
+ done:
2031
+ type: boolean
2032
+ workflowId:
2033
+ type: string
2034
+ jc:
2035
+ type: string
2036
+ ju:
2037
+ type: string
2038
+ job:
2039
+ maps:
2040
+ response[25]:
2041
+ '@pipe':
2042
+ - '@pipe':
2043
+ - ['{collator_cycle_hook.output.data.cur_index}']
2044
+ - '@pipe':
2045
+ - '@pipe':
2046
+ - ['{$self.output.data.response}']
2047
+ - '@pipe':
2048
+ - '@pipe':
2049
+ - [type]
2050
+ - '@pipe':
2051
+ - ['proxy']
2052
+ - '@pipe':
2053
+ - [data]
2054
+ - '@pipe':
2055
+ - ['{$self.output.data.response}']
2056
+ - '@pipe':
2057
+ - [ac]
2058
+ - '@pipe':
2059
+ - ['{$job.metadata.jc}']
2060
+ - '@pipe':
2061
+ - [au]
2062
+ - '@pipe':
2063
+ - ['{@date.toISOXString}']
2064
+ - '@pipe':
2065
+ - [job_id]
2066
+ - '@pipe':
2067
+ - ['{$self.output.data.workflowId}']
2068
+ - ['{@object.create}']
2069
+ - '@pipe':
2070
+ - '@pipe':
2071
+ - [$error]
2072
+ - '@pipe':
2073
+ - ['{$self.output.data}']
2074
+ - '@pipe':
2075
+ - [ac]
2076
+ - '@pipe':
2077
+ - ['{$job.metadata.jc}']
2078
+ - '@pipe':
2079
+ - [au]
2080
+ - '@pipe':
2081
+ - ['{@date.toISOXString}']
2082
+ - '@pipe':
2083
+ - [job_id]
2084
+ - '@pipe':
2085
+ - ['{$self.output.data.workflowId}']
2086
+ - ['{@object.create}']
2087
+ - ['{@conditional.ternary}']
2088
+ - ['{@object.create}']
2089
+
2090
+ transitions:
2091
+ collator_trigger:
2092
+ - to: collator_cycle_hook
2093
+ collator_cycle_hook:
2094
+ - to: collator_cycler
2095
+ conditions:
2096
+ code: 200
2097
+ match:
2098
+ - expected: true
2099
+ actual:
2100
+ '@pipe':
2101
+ - '@pipe':
2102
+ - ['{$job.data.cur_index}']
2103
+ - '@pipe':
2104
+ - ['{collator_trigger.output.data.items}']
2105
+ - ['{@array.length}']
2106
+ - ['{@conditional.less_than}']
2107
+ - to: collator_childer
2108
+ conditions:
2109
+ code: 200
2110
+ match:
2111
+ - expected: 590
2112
+ actual:
2113
+ '@pipe':
2114
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2115
+ - ['{@array.get}', code]
2116
+ - ['{@object.get}']
2117
+ - to: collator_proxyer
2118
+ conditions:
2119
+ code: 200
2120
+ match:
2121
+ - expected: 591
2122
+ actual:
2123
+ '@pipe':
2124
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2125
+ - ['{@array.get}', code]
2126
+ - ['{@object.get}']
2127
+ - to: collator_sleeper
2128
+ conditions:
2129
+ code: 200
2130
+ match:
2131
+ - expected: 588
2132
+ actual:
2133
+ '@pipe':
2134
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2135
+ - ['{@array.get}', code]
2136
+ - ['{@object.get}']
2137
+ - to: collator_waiter
2138
+ conditions:
2139
+ code: 200
2140
+ match:
2141
+ - expected: 595
2142
+ actual:
2143
+ '@pipe':
2144
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2145
+ - ['{@array.get}', code]
2146
+ - ['{@object.get}']
2147
+
2148
+ hooks:
2149
+ ${app}.wfs.signal:
2150
+ - to: collator_waiter
2151
+ conditions:
2152
+ match:
2153
+ - expected:
2154
+ '@pipe':
2155
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2156
+ - ['{@array.get}', signalId]
2157
+ - ['{@object.get}']
2158
+ actual: '{$self.hook.data.id}'
2159
+
2160
+
2161
+
2162
+ ###################################################
2163
+ # THE REENTRANT ACTIVITY FLOW #
2164
+ # #
2165
+ - subscribes: ${app}.activity.execute
2166
+ publishes: ${app}.activity.executed
2167
+
2168
+ expire: 0
2169
+
2170
+ input:
2171
+ schema:
2172
+ type: object
2173
+ properties:
2174
+ parentWorkflowId:
2175
+ type: string
2176
+ originJobId:
2177
+ type: string
2178
+ workflowId:
2179
+ type: string
2180
+ workflowTopic:
2181
+ type: string
2182
+ activityName:
2183
+ type: string
2184
+ arguments:
2185
+ type: array
2186
+ backoffCoefficient:
2187
+ type: number
2188
+ maximumAttempts:
2189
+ type: number
2190
+ maximumInterval:
2191
+ type: number
2192
+ output:
2193
+ schema:
2194
+ type: object
2195
+ properties:
2196
+ response:
2197
+ type: any
2198
+ done:
2199
+ type: boolean
2200
+ workflowId:
2201
+ type: string
2202
+ jc:
2203
+ type: string
2204
+ ju:
2205
+ type: string
2206
+
2207
+ activities:
2208
+ activity_trigger:
2209
+ title: Activity Flow Trigger
2210
+ type: trigger
2211
+ stats:
2212
+ id: '{$self.input.data.workflowId}'
2213
+ key: '{$self.input.data.parentWorkflowId}'
2214
+ parent: '{$self.input.data.originJobId}'
2215
+ adjacent: '{$self.input.data.parentWorkflowId}'
2216
+ job:
2217
+ maps:
2218
+ workflowId: '{$self.input.data.workflowId}'
2219
+
2220
+ activity_cycle_hook:
2221
+ title: Activity Flow Pivot - Cycling Descendants Point Here
2222
+ type: hook
2223
+ cycle: true
2224
+ output:
2225
+ schema:
2226
+ type: object
2227
+ properties:
2228
+ retryCount:
2229
+ type: number
2230
+ maps:
2231
+ retryCount: 0
2232
+
2233
+ activity_worker:
2234
+ title: Activity Worker - Calls Activity Functions
2235
+ type: worker
2236
+ topic: '{activity_trigger.output.data.workflowTopic}'
2237
+ input:
2238
+ schema:
2239
+ type: object
2240
+ properties:
2241
+ parentWorkflowId:
2242
+ type: string
2243
+ workflowId:
2244
+ type: string
2245
+ workflowTopic:
2246
+ type: string
2247
+ activityName:
2248
+ type: string
2249
+ arguments:
2250
+ type: array
2251
+ maps:
2252
+ parentWorkflowId: '{activity_trigger.output.data.parentWorkflowId}'
2253
+ workflowId: '{activity_trigger.output.data.workflowId}'
2254
+ workflowTopic: '{activity_trigger.output.data.workflowTopic}'
2255
+ activityName: '{activity_trigger.output.data.activityName}'
2256
+ arguments: '{activity_trigger.output.data.arguments}'
2257
+ output:
2258
+ schema:
2259
+ type: object
2260
+ properties:
2261
+ response:
2262
+ type: any
2263
+ job:
2264
+ maps:
2265
+ response: '{$self.output.data.response}'
2266
+
2267
+ activity_retryer:
2268
+ title: Pauses for an exponentially-throttled amount of time after a 599 (retryable) error
2269
+ type: hook
2270
+ sleep:
2271
+ '@pipe':
2272
+ - '@pipe':
2273
+ - ['{activity_trigger.output.data.backoffCoefficient}', 10]
2274
+ - ['{@logical.or}', '{activity_cycle_hook.output.data.retryCount}']
2275
+ - ['{@math.pow}']
2276
+ - '@pipe':
2277
+ - ['{activity_trigger.output.data.maximumInterval}', 120]
2278
+ - ['{@math.min}']
2279
+ - ['{@math.min}']
2280
+
2281
+ activity_retry_cycler:
2282
+ title: Cycles back to the activity_cycle_hook pivot, incrementing the \`retryCount\` (the exponential)
2283
+ type: cycle
2284
+ ancestor: activity_cycle_hook
2285
+ input:
2286
+ maps:
2287
+ retryCount:
2288
+ '@pipe':
2289
+ - ['{activity_cycle_hook.output.data.retryCount}', 1]
2290
+ - ['{@math.add}']
2291
+
2292
+ activity_closer:
2293
+ title: Marks the activity workflow as done
2294
+ type: hook
2295
+ job:
2296
+ maps:
2297
+ done: true
2298
+ $error: '{activity_worker.output.data.$error}'
2299
+ jc: '{$job.metadata.jc}'
2300
+ ju:
2301
+ '@pipe':
2302
+ - ['{@date.toISOXString}']
2303
+
2304
+ activity_stopper:
2305
+ title: Stops the activity after retry count has been maxed
2306
+ type: hook
2307
+ job:
2308
+ maps:
2309
+ done: true
2310
+ $error: '{activity_worker.output.data.$error}'
2311
+ jc: '{$job.metadata.jc}'
2312
+ ju:
2313
+ '@pipe':
2314
+ - ['{@date.toISOXString}']
2315
+
2316
+ transitions:
2317
+ activity_trigger:
2318
+ - to: activity_cycle_hook
2319
+ activity_cycle_hook:
2320
+ - to: activity_worker
2321
+ activity_worker:
2322
+ - to: activity_closer
2323
+ conditions:
2324
+ code: [200, 598, 597, 596]
2325
+ - to: activity_stopper
2326
+ conditions:
2327
+ code: 599
2328
+ match:
2329
+ - expected: true
2330
+ actual:
2331
+ '@pipe':
2332
+ - '@pipe':
2333
+ - ['{activity_cycle_hook.output.data.retryCount}']
2334
+ - '@pipe':
2335
+ - ['{activity_trigger.output.data.maximumAttempts}', 5]
2336
+ - ['{@conditional.nullish}']
2337
+ - ['{@conditional.greater_than_or_equal}']
2338
+
2339
+ - to: activity_retryer
2340
+ conditions:
2341
+ code: 599
2342
+ match:
2343
+ - expected: true
2344
+ actual:
2345
+ '@pipe':
2346
+ - '@pipe':
2347
+ - ['{activity_cycle_hook.output.data.retryCount}']
2348
+ - '@pipe':
2349
+ - ['{activity_trigger.output.data.maximumAttempts}', 5]
2350
+ - ['{@conditional.nullish}']
2351
+ - ['{@conditional.less_than}']
2352
+ activity_retryer:
2353
+ - to: activity_retry_cycler
2354
+ `;
2355
+ };
2356
+ exports.getWorkflowYAML = getWorkflowYAML;