@hotmeshio/hotmesh 0.12.1 → 0.14.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.
Files changed (202) hide show
  1. package/README.md +18 -22
  2. package/build/modules/enums.d.ts +60 -5
  3. package/build/modules/enums.js +62 -7
  4. package/build/modules/errors.d.ts +15 -2
  5. package/build/modules/errors.js +17 -1
  6. package/build/modules/storage.d.ts +1 -0
  7. package/build/modules/storage.js +2 -1
  8. package/build/package.json +8 -2
  9. package/build/services/activities/activity/context.d.ts +22 -0
  10. package/build/services/activities/activity/context.js +76 -0
  11. package/build/services/activities/activity/index.d.ts +116 -0
  12. package/build/services/activities/activity/index.js +299 -0
  13. package/build/services/activities/activity/mapping.d.ts +12 -0
  14. package/build/services/activities/activity/mapping.js +63 -0
  15. package/build/services/activities/activity/process.d.ts +28 -0
  16. package/build/services/activities/activity/process.js +100 -0
  17. package/build/services/activities/activity/protocol.d.ts +39 -0
  18. package/build/services/activities/activity/protocol.js +151 -0
  19. package/build/services/activities/activity/state.d.ts +40 -0
  20. package/build/services/activities/activity/state.js +143 -0
  21. package/build/services/activities/activity/transition.d.ts +23 -0
  22. package/build/services/activities/activity/transition.js +71 -0
  23. package/build/services/activities/activity/verify.d.ts +22 -0
  24. package/build/services/activities/activity/verify.js +85 -0
  25. package/build/services/activities/await.d.ts +1 -4
  26. package/build/services/activities/await.js +2 -36
  27. package/build/services/activities/cycle.d.ts +1 -11
  28. package/build/services/activities/cycle.js +3 -46
  29. package/build/services/activities/hook.d.ts +2 -11
  30. package/build/services/activities/hook.js +30 -50
  31. package/build/services/activities/interrupt.d.ts +2 -4
  32. package/build/services/activities/interrupt.js +4 -38
  33. package/build/services/activities/signal.d.ts +1 -11
  34. package/build/services/activities/signal.js +3 -48
  35. package/build/services/activities/trigger.d.ts +1 -3
  36. package/build/services/activities/trigger.js +0 -3
  37. package/build/services/activities/worker.d.ts +3 -6
  38. package/build/services/activities/worker.js +4 -40
  39. package/build/services/connector/factory.d.ts +6 -0
  40. package/build/services/connector/factory.js +24 -0
  41. package/build/services/dba/index.d.ts +14 -4
  42. package/build/services/dba/index.js +57 -18
  43. package/build/services/durable/activity.d.ts +30 -0
  44. package/build/services/durable/activity.js +46 -0
  45. package/build/services/durable/client.d.ts +26 -31
  46. package/build/services/durable/client.js +26 -31
  47. package/build/services/durable/connection.d.ts +13 -7
  48. package/build/services/durable/connection.js +13 -7
  49. package/build/services/durable/exporter.d.ts +2 -2
  50. package/build/services/durable/exporter.js +27 -12
  51. package/build/services/durable/handle.d.ts +59 -41
  52. package/build/services/durable/handle.js +61 -41
  53. package/build/services/durable/index.d.ts +152 -283
  54. package/build/services/durable/index.js +161 -289
  55. package/build/services/durable/interceptor.d.ts +43 -33
  56. package/build/services/durable/interceptor.js +59 -39
  57. package/build/services/durable/schemas/factory.d.ts +2 -3
  58. package/build/services/durable/schemas/factory.js +180 -30
  59. package/build/services/durable/telemetry.d.ts +80 -0
  60. package/build/services/durable/telemetry.js +137 -0
  61. package/build/services/durable/worker.d.ts +100 -21
  62. package/build/services/durable/worker.js +314 -60
  63. package/build/services/durable/workflow/all.d.ts +1 -1
  64. package/build/services/durable/workflow/all.js +1 -1
  65. package/build/services/durable/workflow/cancellationScope.d.ts +104 -0
  66. package/build/services/durable/workflow/cancellationScope.js +139 -0
  67. package/build/services/durable/workflow/common.d.ts +5 -4
  68. package/build/services/durable/workflow/common.js +6 -1
  69. package/build/services/durable/workflow/{waitFor.d.ts → condition.d.ts} +9 -8
  70. package/build/services/durable/workflow/{waitFor.js → condition.js} +44 -11
  71. package/build/services/durable/workflow/continueAsNew.d.ts +65 -0
  72. package/build/services/durable/workflow/continueAsNew.js +92 -0
  73. package/build/services/durable/workflow/didRun.d.ts +2 -2
  74. package/build/services/durable/workflow/didRun.js +4 -4
  75. package/build/services/durable/workflow/enrich.d.ts +5 -0
  76. package/build/services/durable/workflow/enrich.js +5 -0
  77. package/build/services/durable/workflow/entityMethods.d.ts +7 -0
  78. package/build/services/durable/workflow/entityMethods.js +7 -0
  79. package/build/services/durable/workflow/execHook.js +3 -3
  80. package/build/services/durable/workflow/execHookBatch.js +2 -2
  81. package/build/services/durable/workflow/{execChild.d.ts → executeChild.d.ts} +4 -40
  82. package/build/services/durable/workflow/{execChild.js → executeChild.js} +36 -45
  83. package/build/services/durable/workflow/hook.d.ts +1 -1
  84. package/build/services/durable/workflow/hook.js +4 -3
  85. package/build/services/durable/workflow/index.d.ts +45 -50
  86. package/build/services/durable/workflow/index.js +46 -51
  87. package/build/services/durable/workflow/interruption.d.ts +7 -6
  88. package/build/services/durable/workflow/interruption.js +11 -7
  89. package/build/services/durable/workflow/patched.d.ts +72 -0
  90. package/build/services/durable/workflow/patched.js +110 -0
  91. package/build/services/durable/workflow/proxyActivities.d.ts +7 -7
  92. package/build/services/durable/workflow/proxyActivities.js +51 -15
  93. package/build/services/durable/workflow/searchMethods.d.ts +7 -0
  94. package/build/services/durable/workflow/searchMethods.js +7 -0
  95. package/build/services/durable/workflow/signal.d.ts +4 -4
  96. package/build/services/durable/workflow/signal.js +4 -4
  97. package/build/services/durable/workflow/{sleepFor.d.ts → sleep.d.ts} +7 -7
  98. package/build/services/durable/workflow/{sleepFor.js → sleep.js} +39 -10
  99. package/build/services/durable/workflow/terminate.d.ts +55 -0
  100. package/build/services/durable/workflow/{interrupt.js → terminate.js} +21 -21
  101. package/build/services/durable/workflow/trace.js +2 -2
  102. package/build/services/durable/workflow/uuid4.d.ts +14 -0
  103. package/build/services/durable/workflow/uuid4.js +39 -0
  104. package/build/services/durable/workflow/{context.d.ts → workflowInfo.d.ts} +5 -5
  105. package/build/services/durable/workflow/{context.js → workflowInfo.js} +7 -7
  106. package/build/services/engine/compiler.d.ts +19 -0
  107. package/build/services/engine/compiler.js +20 -0
  108. package/build/services/engine/completion.d.ts +46 -0
  109. package/build/services/engine/completion.js +145 -0
  110. package/build/services/engine/dispatch.d.ts +24 -0
  111. package/build/services/engine/dispatch.js +98 -0
  112. package/build/services/engine/index.d.ts +49 -81
  113. package/build/services/engine/index.js +175 -573
  114. package/build/services/engine/init.d.ts +42 -0
  115. package/build/services/engine/init.js +74 -0
  116. package/build/services/engine/pubsub.d.ts +50 -0
  117. package/build/services/engine/pubsub.js +118 -0
  118. package/build/services/engine/reporting.d.ts +20 -0
  119. package/build/services/engine/reporting.js +38 -0
  120. package/build/services/engine/schema.d.ts +23 -0
  121. package/build/services/engine/schema.js +62 -0
  122. package/build/services/engine/signal.d.ts +57 -0
  123. package/build/services/engine/signal.js +117 -0
  124. package/build/services/engine/state.d.ts +35 -0
  125. package/build/services/engine/state.js +61 -0
  126. package/build/services/engine/version.d.ts +31 -0
  127. package/build/services/engine/version.js +73 -0
  128. package/build/services/hotmesh/deployment.d.ts +21 -0
  129. package/build/services/hotmesh/deployment.js +25 -0
  130. package/build/services/hotmesh/index.d.ts +142 -533
  131. package/build/services/hotmesh/index.js +223 -674
  132. package/build/services/hotmesh/init.d.ts +42 -0
  133. package/build/services/hotmesh/init.js +93 -0
  134. package/build/services/hotmesh/jobs.d.ts +67 -0
  135. package/build/services/hotmesh/jobs.js +99 -0
  136. package/build/services/hotmesh/pubsub.d.ts +38 -0
  137. package/build/services/hotmesh/pubsub.js +54 -0
  138. package/build/services/hotmesh/quorum.d.ts +30 -0
  139. package/build/services/hotmesh/quorum.js +62 -0
  140. package/build/services/hotmesh/validation.d.ts +6 -0
  141. package/build/services/hotmesh/validation.js +28 -0
  142. package/build/services/quorum/index.js +1 -0
  143. package/build/services/router/consumption/index.d.ts +11 -5
  144. package/build/services/router/consumption/index.js +24 -17
  145. package/build/services/router/error-handling/index.d.ts +2 -2
  146. package/build/services/router/error-handling/index.js +14 -14
  147. package/build/services/router/index.d.ts +1 -1
  148. package/build/services/router/index.js +2 -2
  149. package/build/services/serializer/index.d.ts +22 -0
  150. package/build/services/serializer/index.js +39 -1
  151. package/build/services/store/index.d.ts +1 -0
  152. package/build/services/store/providers/postgres/exporter-sql.d.ts +2 -2
  153. package/build/services/store/providers/postgres/exporter-sql.js +4 -4
  154. package/build/services/store/providers/postgres/kvtables.js +7 -6
  155. package/build/services/store/providers/postgres/kvtypes/hash/basic.js +67 -52
  156. package/build/services/store/providers/postgres/kvtypes/hash/jsonb.js +87 -72
  157. package/build/services/store/providers/postgres/kvtypes/hash/udata.js +106 -79
  158. package/build/services/store/providers/postgres/kvtypes/hash/utils.d.ts +16 -0
  159. package/build/services/store/providers/postgres/kvtypes/hash/utils.js +29 -16
  160. package/build/services/store/providers/postgres/postgres.d.ts +1 -0
  161. package/build/services/store/providers/postgres/postgres.js +14 -4
  162. package/build/services/stream/factory.d.ts +3 -1
  163. package/build/services/stream/factory.js +2 -2
  164. package/build/services/stream/index.d.ts +1 -0
  165. package/build/services/stream/providers/nats/nats.d.ts +1 -0
  166. package/build/services/stream/providers/nats/nats.js +1 -0
  167. package/build/services/stream/providers/postgres/credentials.d.ts +56 -0
  168. package/build/services/stream/providers/postgres/credentials.js +129 -0
  169. package/build/services/stream/providers/postgres/kvtables.js +18 -0
  170. package/build/services/stream/providers/postgres/messages.js +7 -7
  171. package/build/services/stream/providers/postgres/notifications.js +16 -2
  172. package/build/services/stream/providers/postgres/postgres.d.ts +7 -0
  173. package/build/services/stream/providers/postgres/postgres.js +35 -4
  174. package/build/services/stream/providers/postgres/procedures.d.ts +21 -0
  175. package/build/services/stream/providers/postgres/procedures.js +213 -0
  176. package/build/services/stream/providers/postgres/secured.d.ts +34 -0
  177. package/build/services/stream/providers/postgres/secured.js +146 -0
  178. package/build/services/stream/providers/postgres/stats.d.ts +1 -0
  179. package/build/services/stream/providers/postgres/stats.js +1 -0
  180. package/build/services/stream/registry.d.ts +1 -1
  181. package/build/services/stream/registry.js +5 -2
  182. package/build/services/telemetry/index.d.ts +10 -1
  183. package/build/services/telemetry/index.js +40 -7
  184. package/build/services/worker/credentials.d.ts +51 -0
  185. package/build/services/worker/credentials.js +87 -0
  186. package/build/services/worker/index.d.ts +2 -2
  187. package/build/services/worker/index.js +7 -6
  188. package/build/types/codec.d.ts +84 -0
  189. package/build/types/codec.js +2 -0
  190. package/build/types/dba.d.ts +39 -3
  191. package/build/types/durable.d.ts +123 -25
  192. package/build/types/error.d.ts +10 -0
  193. package/build/types/exporter.d.ts +1 -1
  194. package/build/types/hotmesh.d.ts +67 -4
  195. package/build/types/index.d.ts +2 -1
  196. package/build/types/provider.d.ts +2 -2
  197. package/build/types/quorum.d.ts +35 -1
  198. package/build/types/stream.d.ts +12 -6
  199. package/package.json +8 -2
  200. package/build/services/activities/activity.d.ts +0 -192
  201. package/build/services/activities/activity.js +0 -786
  202. package/build/services/durable/workflow/interrupt.d.ts +0 -55
@@ -3,8 +3,7 @@
3
3
  *********** HOTMESH 'DURABLE' MODULE APPLICATION GRAPH **********
4
4
  *
5
5
  * This HotMesh application spec uses 50 activities and 25 transitions
6
- * to model and emulate the Temporal Application & Query servers using
7
- * a pluggable backend.
6
+ * to model a durable workflow engine using a pluggable backend.
8
7
  *
9
8
  * This YAML file can also serve as a useful starting point for building
10
9
  * Integration/BPM/Workflow servers in general (MuleSoft, etc) without the need
@@ -20,7 +19,7 @@
20
19
  */
21
20
  Object.defineProperty(exports, "__esModule", { value: true });
22
21
  exports.APP_ID = exports.APP_VERSION = exports.getWorkflowYAML = void 0;
23
- const APP_VERSION = '8';
22
+ const APP_VERSION = '11';
24
23
  exports.APP_VERSION = APP_VERSION;
25
24
  const APP_ID = 'durable';
26
25
  exports.APP_ID = APP_ID;
@@ -77,6 +76,9 @@ const getWorkflowYAML = (app, version) => {
77
76
  backoffCoefficient:
78
77
  description: the time multiple in seconds to backoff before retrying
79
78
  type: number
79
+ initialInterval:
80
+ description: the initial interval in seconds before the first retry
81
+ type: number
80
82
  maximumAttempts:
81
83
  description: the maximum number of retries to attempt before failing the workflow
82
84
  type: number
@@ -184,10 +186,14 @@ const getWorkflowYAML = (app, version) => {
184
186
  maps:
185
187
  originJobId: '{trigger.output.data.originJobId}'
186
188
  workflowId: '{trigger.output.data.workflowId}'
187
- arguments: '{trigger.output.data.arguments}'
189
+ arguments:
190
+ '@pipe':
191
+ - ['{cycle_hook.output.data.continueArgs}', '{trigger.output.data.arguments}']
192
+ - ['{@conditional.nullish}']
188
193
  workflowTopic: '{trigger.output.data.workflowTopic}'
189
194
  workflowName: '{trigger.output.data.workflowName}'
190
195
  expire: '{trigger.output.data.expire}'
196
+ continueGeneration: '{cycle_hook.output.data.continueGeneration}'
191
197
  canRetry:
192
198
  '@pipe':
193
199
  - '@pipe':
@@ -305,6 +311,19 @@ const getWorkflowYAML = (app, version) => {
305
311
  index:
306
312
  type: number
307
313
  description: the replay index (COUNTER++)
314
+ 592:
315
+ schema:
316
+ type: object
317
+ properties:
318
+ arguments:
319
+ type: array
320
+ description: the arguments to pass to the restarted workflow
321
+ items:
322
+ type: any
323
+ index:
324
+ type: number
325
+ workflowDimension:
326
+ type: string
308
327
  595:
309
328
  schema:
310
329
  type: object
@@ -320,6 +339,7 @@ const getWorkflowYAML = (app, version) => {
320
339
  job:
321
340
  maps:
322
341
  response: '{$self.output.data.response}'
342
+ patch-marker[-]: '{$self.output.data.patchMarkers}'
323
343
 
324
344
  sleeper:
325
345
  title: Pauses the main thread for a set amount of time; all other subprocess threads remain active, and new ones may be started
@@ -345,6 +365,8 @@ const getWorkflowYAML = (app, version) => {
345
365
  maps:
346
366
  retryCount: 0
347
367
  throttleSeconds: 0
368
+ continueGeneration: '{cycle_hook.output.data.continueGeneration}'
369
+ continueArgs: '{cycle_hook.output.data.continueArgs}'
348
370
 
349
371
  childer:
350
372
  title: Awaits a child flow to be executed/started
@@ -409,6 +431,11 @@ const getWorkflowYAML = (app, version) => {
409
431
  - ['{worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
410
432
  - ['{@conditional.nullish}', 10]
411
433
  - ['{@conditional.nullish}']
434
+ initialInterval:
435
+ '@pipe':
436
+ - ['{worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
437
+ - ['{@conditional.nullish}', 1]
438
+ - ['{@conditional.nullish}']
412
439
  maximumAttempts:
413
440
  '@pipe':
414
441
  - ['{worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
@@ -520,12 +547,17 @@ const getWorkflowYAML = (app, version) => {
520
547
  - '@pipe':
521
548
  - '@pipe':
522
549
  - '@pipe':
523
- - ['{trigger.output.data.backoffCoefficient}', 10]
524
- - ['{@conditional.nullish}']
550
+ - '@pipe':
551
+ - ['{trigger.output.data.backoffCoefficient}', 10]
552
+ - ['{@conditional.nullish}']
553
+ - '@pipe':
554
+ - ['{cycle_hook.output.data.retryCount}', 0]
555
+ - ['{@conditional.nullish}']
556
+ - ['{@math.pow}']
525
557
  - '@pipe':
526
- - ['{cycle_hook.output.data.retryCount}', 0]
558
+ - ['{trigger.output.data.initialInterval}', 1]
527
559
  - ['{@conditional.nullish}']
528
- - ['{@math.pow}']
560
+ - ['{@math.multiply}']
529
561
  - '@pipe':
530
562
  - ['{trigger.output.data.maximumInterval}', 120]
531
563
  - ['{@logical.or}']
@@ -533,6 +565,8 @@ const getWorkflowYAML = (app, version) => {
533
565
  - '@pipe':
534
566
  - [0]
535
567
  - ['{@conditional.ternary}']
568
+ continueGeneration: '{cycle_hook.output.data.continueGeneration}'
569
+ continueArgs: '{cycle_hook.output.data.continueArgs}'
536
570
 
537
571
  proxyer:
538
572
  title: Invokes the activity flow and awaits the response
@@ -558,6 +592,9 @@ const getWorkflowYAML = (app, version) => {
558
592
  description: the arguments to pass to the activity
559
593
  items:
560
594
  type: string
595
+ headers:
596
+ type: object
597
+ description: optional metadata to pass alongside activity arguments
561
598
  expire:
562
599
  type: number
563
600
  backoffCoefficient:
@@ -566,9 +603,12 @@ const getWorkflowYAML = (app, version) => {
566
603
  type: number
567
604
  maximumInterval:
568
605
  type: number
606
+ startToCloseTimeout:
607
+ type: number
569
608
  maps:
570
609
  activityName: '{worker.output.data.activityName}'
571
610
  arguments: '{worker.output.data.arguments}'
611
+ headers: '{worker.output.data.headers}'
572
612
  workflowDimension: '{worker.output.data.workflowDimension}'
573
613
  index: '{worker.output.data.index}'
574
614
  originJobId: '{worker.output.data.originJobId}'
@@ -576,11 +616,17 @@ const getWorkflowYAML = (app, version) => {
576
616
  workflowId: '{worker.output.data.workflowId}'
577
617
  workflowTopic: '{worker.output.data.workflowTopic}'
578
618
  expire: '{worker.output.data.expire}'
619
+ startToCloseTimeout: '{worker.output.data.startToCloseTimeout}'
579
620
  backoffCoefficient:
580
621
  '@pipe':
581
622
  - ['{worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
582
623
  - ['{@conditional.nullish}', 10]
583
624
  - ['{@conditional.nullish}']
625
+ initialInterval:
626
+ '@pipe':
627
+ - ['{worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
628
+ - ['{@conditional.nullish}', 1]
629
+ - ['{@conditional.nullish}']
584
630
  maximumAttempts:
585
631
  '@pipe':
586
632
  - ['{worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
@@ -664,12 +710,17 @@ const getWorkflowYAML = (app, version) => {
664
710
  - '@pipe':
665
711
  - '@pipe':
666
712
  - '@pipe':
667
- - ['{trigger.output.data.backoffCoefficient}', 10]
668
- - ['{@conditional.nullish}']
713
+ - '@pipe':
714
+ - ['{trigger.output.data.backoffCoefficient}', 10]
715
+ - ['{@conditional.nullish}']
716
+ - '@pipe':
717
+ - ['{cycle_hook.output.data.retryCount}', 0]
718
+ - ['{@conditional.nullish}']
719
+ - ['{@math.pow}']
669
720
  - '@pipe':
670
- - ['{cycle_hook.output.data.retryCount}', 0]
721
+ - ['{trigger.output.data.initialInterval}', 1]
671
722
  - ['{@conditional.nullish}']
672
- - ['{@math.pow}']
723
+ - ['{@math.multiply}']
673
724
  - '@pipe':
674
725
  - ['{trigger.output.data.maximumInterval}', 120]
675
726
  - ['{@logical.or}']
@@ -677,6 +728,8 @@ const getWorkflowYAML = (app, version) => {
677
728
  - '@pipe':
678
729
  - [0]
679
730
  - ['{@conditional.ternary}']
731
+ continueGeneration: '{cycle_hook.output.data.continueGeneration}'
732
+ continueArgs: '{cycle_hook.output.data.continueArgs}'
680
733
 
681
734
  collator:
682
735
  title: Awaits the collator flow to simultaneously resolve the idempotent items and return as a sequential set
@@ -780,6 +833,8 @@ const getWorkflowYAML = (app, version) => {
780
833
  maps:
781
834
  retryCount: 0
782
835
  throttleSeconds: 0
836
+ continueGeneration: '{cycle_hook.output.data.continueGeneration}'
837
+ continueArgs: '{cycle_hook.output.data.continueArgs}'
783
838
 
784
839
  retryer:
785
840
  title: Cycles back to the cycle_hook pivot, increasing the retryCount (the exponential)
@@ -806,6 +861,24 @@ const getWorkflowYAML = (app, version) => {
806
861
  - ['{trigger.output.data.maximumInterval}', 120]
807
862
  - ['{@logical.or}']
808
863
  - ['{@math.min}']
864
+ continueGeneration: '{cycle_hook.output.data.continueGeneration}'
865
+ continueArgs: '{cycle_hook.output.data.continueArgs}'
866
+
867
+ continuer:
868
+ title: Cycles back to cycle_hook after continueAsNew, resetting execution with new arguments
869
+ type: cycle
870
+ ancestor: cycle_hook
871
+ input:
872
+ maps:
873
+ retryCount: 0
874
+ throttleSeconds: 0
875
+ continueArgs: '{worker.output.data.arguments}'
876
+ continueGeneration:
877
+ '@pipe':
878
+ - ['{cycle_hook.output.data.continueGeneration}', 0]
879
+ - ['{@logical.or}', 1]
880
+ - ['{@math.add}']
881
+
809
882
  ender:
810
883
  title: Sets job data; ignores the \`Signal In\` Hook Channel which was suppressed; sends the final response
811
884
  type: hook
@@ -1162,6 +1235,11 @@ const getWorkflowYAML = (app, version) => {
1162
1235
  - ['{signaler_worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
1163
1236
  - ['{@conditional.nullish}', 10]
1164
1237
  - ['{@conditional.nullish}']
1238
+ initialInterval:
1239
+ '@pipe':
1240
+ - ['{signaler_worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
1241
+ - ['{@conditional.nullish}', 1]
1242
+ - ['{@conditional.nullish}']
1165
1243
  maximumAttempts:
1166
1244
  '@pipe':
1167
1245
  - ['{signaler_worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
@@ -1273,12 +1351,17 @@ const getWorkflowYAML = (app, version) => {
1273
1351
  - '@pipe':
1274
1352
  - '@pipe':
1275
1353
  - '@pipe':
1276
- - ['{trigger.output.data.backoffCoefficient}', 10]
1277
- - ['{@conditional.nullish}']
1354
+ - '@pipe':
1355
+ - ['{trigger.output.data.backoffCoefficient}', 10]
1356
+ - ['{@conditional.nullish}']
1357
+ - '@pipe':
1358
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1359
+ - ['{@conditional.nullish}']
1360
+ - ['{@math.pow}']
1278
1361
  - '@pipe':
1279
- - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1362
+ - ['{trigger.output.data.initialInterval}', 1]
1280
1363
  - ['{@conditional.nullish}']
1281
- - ['{@math.pow}']
1364
+ - ['{@math.multiply}']
1282
1365
  - '@pipe':
1283
1366
  - ['{trigger.output.data.maximumInterval}', 120]
1284
1367
  - ['{@logical.or}']
@@ -1311,6 +1394,9 @@ const getWorkflowYAML = (app, version) => {
1311
1394
  description: the arguments to pass to the activity
1312
1395
  items:
1313
1396
  type: string
1397
+ headers:
1398
+ type: object
1399
+ description: optional metadata to pass alongside activity arguments
1314
1400
  expire:
1315
1401
  type: number
1316
1402
  backoffCoefficient:
@@ -1319,9 +1405,12 @@ const getWorkflowYAML = (app, version) => {
1319
1405
  type: number
1320
1406
  maximumInterval:
1321
1407
  type: number
1408
+ startToCloseTimeout:
1409
+ type: number
1322
1410
  maps:
1323
1411
  activityName: '{signaler_worker.output.data.activityName}'
1324
1412
  arguments: '{signaler_worker.output.data.arguments}'
1413
+ headers: '{signaler_worker.output.data.headers}'
1325
1414
  workflowDimension: '{signaler_worker.output.data.workflowDimension}'
1326
1415
  index: '{signaler_worker.output.data.index}'
1327
1416
  originJobId: '{signaler_worker.output.data.originJobId}'
@@ -1329,11 +1418,17 @@ const getWorkflowYAML = (app, version) => {
1329
1418
  workflowId: '{signaler_worker.output.data.workflowId}'
1330
1419
  workflowTopic: '{signaler_worker.output.data.workflowTopic}'
1331
1420
  expire: '{signaler_worker.output.data.expire}'
1421
+ startToCloseTimeout: '{signaler_worker.output.data.startToCloseTimeout}'
1332
1422
  backoffCoefficient:
1333
1423
  '@pipe':
1334
1424
  - ['{signaler_worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
1335
1425
  - ['{@conditional.nullish}', 10]
1336
1426
  - ['{@conditional.nullish}']
1427
+ initialInterval:
1428
+ '@pipe':
1429
+ - ['{signaler_worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
1430
+ - ['{@conditional.nullish}', 1]
1431
+ - ['{@conditional.nullish}']
1337
1432
  maximumAttempts:
1338
1433
  '@pipe':
1339
1434
  - ['{signaler_worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
@@ -1417,12 +1512,17 @@ const getWorkflowYAML = (app, version) => {
1417
1512
  - '@pipe':
1418
1513
  - '@pipe':
1419
1514
  - '@pipe':
1420
- - ['{trigger.output.data.backoffCoefficient}', 10]
1421
- - ['{@conditional.nullish}']
1515
+ - '@pipe':
1516
+ - ['{trigger.output.data.backoffCoefficient}', 10]
1517
+ - ['{@conditional.nullish}']
1518
+ - '@pipe':
1519
+ - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1520
+ - ['{@conditional.nullish}']
1521
+ - ['{@math.pow}']
1422
1522
  - '@pipe':
1423
- - ['{signaler_cycle_hook.output.data.retryCount}', 0]
1523
+ - ['{trigger.output.data.initialInterval}', 1]
1424
1524
  - ['{@conditional.nullish}']
1425
- - ['{@math.pow}']
1525
+ - ['{@math.multiply}']
1426
1526
  - '@pipe':
1427
1527
  - ['{trigger.output.data.maximumInterval}', 120]
1428
1528
  - ['{@logical.or}']
@@ -1617,6 +1717,9 @@ const getWorkflowYAML = (app, version) => {
1617
1717
  - to: proxyer
1618
1718
  conditions:
1619
1719
  code: 591
1720
+ - to: continuer
1721
+ conditions:
1722
+ code: 592
1620
1723
  - to: retryer
1621
1724
  conditions:
1622
1725
  code: 599
@@ -1852,8 +1955,13 @@ const getWorkflowYAML = (app, version) => {
1852
1955
  - ['{@object.create}']
1853
1956
 
1854
1957
  collator_waiter:
1855
- title: Waits for a matching signal to be sent to the collator workflow
1958
+ title: Waits for a matching signal or optional timeout
1856
1959
  type: hook
1960
+ sleep:
1961
+ '@pipe':
1962
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
1963
+ - ['{@array.get}', duration]
1964
+ - ['{@object.get}']
1857
1965
  hook:
1858
1966
  type: object
1859
1967
  properties:
@@ -1863,12 +1971,18 @@ const getWorkflowYAML = (app, version) => {
1863
1971
  maps:
1864
1972
  response[25]:
1865
1973
  '@pipe':
1866
- - ['{collator_trigger.output.data.items}']
1867
1974
  - '@pipe':
1868
1975
  - ['{collator_cycle_hook.output.data.cur_index}']
1869
1976
  - '@pipe':
1870
- - [type, wait, data, '{$self.hook.data}', ac, '{$job.metadata.jc}', au, '{$self.output.metadata.au}']
1871
- - ['{@object.create}']
1977
+ - '@pipe':
1978
+ - ['{$self.hook.data.id}']
1979
+ - '@pipe':
1980
+ - [type, wait, data, '{$self.hook.data}', ac, '{$job.metadata.jc}', au, '{$self.output.metadata.au}']
1981
+ - ['{@object.create}']
1982
+ - '@pipe':
1983
+ - [type, wait, timedOut, true, ac, '{$self.output.metadata.ac}', au, '{$self.output.metadata.au}']
1984
+ - ['{@object.create}']
1985
+ - ['{@conditional.ternary}']
1872
1986
  - ['{@object.create}']
1873
1987
 
1874
1988
  collator_childer:
@@ -2123,6 +2237,9 @@ const getWorkflowYAML = (app, version) => {
2123
2237
  description: the arguments to pass to the activity
2124
2238
  items:
2125
2239
  type: string
2240
+ headers:
2241
+ type: object
2242
+ description: optional metadata to pass alongside activity arguments
2126
2243
  expire:
2127
2244
  type: number
2128
2245
  backoffCoefficient:
@@ -2131,6 +2248,8 @@ const getWorkflowYAML = (app, version) => {
2131
2248
  type: number
2132
2249
  maximumInterval:
2133
2250
  type: number
2251
+ startToCloseTimeout:
2252
+ type: number
2134
2253
  maps:
2135
2254
  activityName:
2136
2255
  '@pipe':
@@ -2142,6 +2261,11 @@ const getWorkflowYAML = (app, version) => {
2142
2261
  - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2143
2262
  - ['{@array.get}', arguments]
2144
2263
  - ['{@object.get}']
2264
+ headers:
2265
+ '@pipe':
2266
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2267
+ - ['{@array.get}', headers]
2268
+ - ['{@object.get}']
2145
2269
  workflowDimension:
2146
2270
  '@pipe':
2147
2271
  - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
@@ -2192,6 +2316,11 @@ const getWorkflowYAML = (app, version) => {
2192
2316
  - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2193
2317
  - ['{@array.get}', maximumInterval]
2194
2318
  - ['{@object.get}']
2319
+ startToCloseTimeout:
2320
+ '@pipe':
2321
+ - ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
2322
+ - ['{@array.get}', startToCloseTimeout]
2323
+ - ['{@object.get}']
2195
2324
  output:
2196
2325
  schema:
2197
2326
  type: object
@@ -2347,7 +2476,11 @@ const getWorkflowYAML = (app, version) => {
2347
2476
 
2348
2477
  expire:
2349
2478
  '@pipe':
2350
- - ['{activity_trigger.output.data.expire}', 1]
2479
+ - '@pipe':
2480
+ - ['{activity_trigger.output.data.startToCloseTimeout}']
2481
+ - '@pipe':
2482
+ - ['{activity_trigger.output.data.expire}', 1]
2483
+ - ['{@conditional.nullish}']
2351
2484
  - ['{@conditional.nullish}']
2352
2485
 
2353
2486
  input:
@@ -2366,12 +2499,18 @@ const getWorkflowYAML = (app, version) => {
2366
2499
  type: string
2367
2500
  arguments:
2368
2501
  type: array
2502
+ headers:
2503
+ type: object
2369
2504
  backoffCoefficient:
2370
2505
  type: number
2506
+ initialInterval:
2507
+ type: number
2371
2508
  maximumAttempts:
2372
2509
  type: number
2373
2510
  maximumInterval:
2374
2511
  type: number
2512
+ startToCloseTimeout:
2513
+ type: number
2375
2514
  expire:
2376
2515
  type: number
2377
2516
  output:
@@ -2433,12 +2572,18 @@ const getWorkflowYAML = (app, version) => {
2433
2572
  type: string
2434
2573
  arguments:
2435
2574
  type: array
2575
+ headers:
2576
+ type: object
2577
+ startToCloseTimeout:
2578
+ type: number
2436
2579
  maps:
2437
2580
  parentWorkflowId: '{activity_trigger.output.data.parentWorkflowId}'
2438
2581
  workflowId: '{activity_trigger.output.data.workflowId}'
2439
2582
  workflowTopic: '{activity_trigger.output.data.workflowTopic}'
2440
2583
  activityName: '{activity_trigger.output.data.activityName}'
2441
2584
  arguments: '{activity_trigger.output.data.arguments}'
2585
+ headers: '{activity_trigger.output.data.headers}'
2586
+ startToCloseTimeout: '{activity_trigger.output.data.startToCloseTimeout}'
2442
2587
  output:
2443
2588
  schema:
2444
2589
  type: object
@@ -2455,9 +2600,14 @@ const getWorkflowYAML = (app, version) => {
2455
2600
  sleep:
2456
2601
  '@pipe':
2457
2602
  - '@pipe':
2458
- - ['{activity_trigger.output.data.backoffCoefficient}', 10]
2459
- - ['{@logical.or}', '{activity_cycle_hook.output.data.retryCount}']
2460
- - ['{@math.pow}']
2603
+ - '@pipe':
2604
+ - ['{activity_trigger.output.data.backoffCoefficient}', 10]
2605
+ - ['{@logical.or}', '{activity_cycle_hook.output.data.retryCount}']
2606
+ - ['{@math.pow}']
2607
+ - '@pipe':
2608
+ - ['{activity_trigger.output.data.initialInterval}', 1]
2609
+ - ['{@conditional.nullish}']
2610
+ - ['{@math.multiply}']
2461
2611
  - '@pipe':
2462
2612
  - ['{activity_trigger.output.data.maximumInterval}', 120]
2463
2613
  - ['{@math.min}']
@@ -2517,7 +2667,7 @@ const getWorkflowYAML = (app, version) => {
2517
2667
  - '@pipe':
2518
2668
  - ['{activity_cycle_hook.output.data.retryCount}']
2519
2669
  - '@pipe':
2520
- - ['{activity_trigger.output.data.maximumAttempts}', 5]
2670
+ - ['{activity_trigger.output.data.maximumAttempts}', 50]
2521
2671
  - ['{@conditional.nullish}']
2522
2672
  - ['{@conditional.greater_than_or_equal}']
2523
2673
 
@@ -2531,7 +2681,7 @@ const getWorkflowYAML = (app, version) => {
2531
2681
  - '@pipe':
2532
2682
  - ['{activity_cycle_hook.output.data.retryCount}']
2533
2683
  - '@pipe':
2534
- - ['{activity_trigger.output.data.maximumAttempts}', 5]
2684
+ - ['{activity_trigger.output.data.maximumAttempts}', 50]
2535
2685
  - ['{@conditional.nullish}']
2536
2686
  - ['{@conditional.less_than}']
2537
2687
  activity_retryer:
@@ -0,0 +1,80 @@
1
+ import { Context, Span, SpanStatusCode } from '../../types/telemetry';
2
+ /**
3
+ * Emits OpenTelemetry spans for durable workflow execution. All methods
4
+ * are no-ops when no OTel SDK is registered — `@opentelemetry/api`
5
+ * returns a no-op tracer by default, so there is zero overhead without
6
+ * a configured exporter.
7
+ *
8
+ * ## Span Categories
9
+ *
10
+ * | Span | When | Mode |
11
+ * |------|------|------|
12
+ * | `WORKFLOW/START/{name}` | First execution (not replay) | `info` |
13
+ * | `WORKFLOW/COMPLETE/{name}` | Workflow returns successfully | `info` |
14
+ * | `WORKFLOW/ERROR/{name}` | Workflow throws a fatal error | `info` |
15
+ * | `ACTIVITY/{name}` | Real wall-clock activity execution on the worker | `info` |
16
+ * | `DISPATCH/{type}/{name}/{idx}` | Operation dispatched (first execution only) | `debug` |
17
+ * | `RETURN/{type}/{name}/{idx}` | Operation result returned (with ac/au duration) | `debug` |
18
+ *
19
+ * ## Gating
20
+ *
21
+ * - `isEnabled()` — true when `HMSH_TELEMETRY` is set (any value)
22
+ * - `isVerbose()` — true only when `HMSH_TELEMETRY === 'debug'`
23
+ *
24
+ * In `info` mode, engine-layer spans (stream hops, DAG activity spans)
25
+ * are suppressed for durable workflows — only the spans above are
26
+ * emitted. This keeps dashboards clean and focused on the user's
27
+ * workflow story. Set `HMSH_TELEMETRY=debug` to also see engine
28
+ * internals and per-operation DISPATCH/RETURN spans.
29
+ *
30
+ * ## Setup
31
+ *
32
+ * Register an OTel SDK with a trace exporter before starting workers:
33
+ *
34
+ * ```typescript
35
+ * import { NodeSDK } from '@opentelemetry/sdk-node';
36
+ * import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
37
+ * import { resourceFromAttributes } from '@opentelemetry/resources';
38
+ * import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
39
+ *
40
+ * const sdk = new NodeSDK({
41
+ * resource: resourceFromAttributes({ [ATTR_SERVICE_NAME]: 'my-service' }),
42
+ * traceExporter: new OTLPTraceExporter({
43
+ * url: 'https://api.honeycomb.io/v1/traces',
44
+ * headers: { 'x-honeycomb-team': process.env.HONEYCOMB_API_KEY },
45
+ * }),
46
+ * });
47
+ * sdk.start();
48
+ * ```
49
+ *
50
+ * ```bash
51
+ * # Concise workflow telemetry (recommended for production)
52
+ * HMSH_TELEMETRY=info node worker.js
53
+ *
54
+ * # Full operational detail (debugging)
55
+ * HMSH_TELEMETRY=debug node worker.js
56
+ * ```
57
+ */
58
+ export declare class DurableTelemetryService {
59
+ static isEnabled(): boolean;
60
+ static isVerbose(): boolean;
61
+ static getParentContext(traceId: string, spanId: string): Context;
62
+ /**
63
+ * Emit a point-in-time span (starts and ends immediately).
64
+ */
65
+ static emitPointSpan(traceId: string, parentSpanId: string, spanName: string, attributes: Record<string, string | number | boolean>, statusCode?: SpanStatusCode, statusMessage?: string): void;
66
+ /**
67
+ * Emit a duration span with explicit start/end times.
68
+ * Used for reconstructing operation durations from stored timestamps.
69
+ */
70
+ static emitDurationSpan(traceId: string, parentSpanId: string, spanName: string, startTimeMs: number, endTimeMs: number, attributes: Record<string, string | number | boolean>): void;
71
+ /**
72
+ * Start a span and return it for manual end (e.g., wrapping activity execution).
73
+ */
74
+ static startSpan(traceId: string, parentSpanId: string, spanName: string, attributes: Record<string, string | number | boolean>): Span;
75
+ /**
76
+ * Parse ac/au timestamps from jmark results to epoch ms.
77
+ * Handles both ISO strings and numeric epoch values.
78
+ */
79
+ static parseTimestamp(ts: string | number): number;
80
+ }