@hotmeshio/hotmesh 0.0.34 → 0.0.35

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 (91) hide show
  1. package/README.md +30 -18
  2. package/build/modules/enums.d.ts +22 -0
  3. package/build/modules/enums.js +29 -0
  4. package/build/modules/errors.d.ts +10 -2
  5. package/build/modules/errors.js +14 -3
  6. package/build/modules/key.d.ts +16 -15
  7. package/build/modules/key.js +18 -15
  8. package/build/modules/utils.d.ts +1 -0
  9. package/build/modules/utils.js +6 -1
  10. package/build/package.json +3 -1
  11. package/build/services/activities/activity.d.ts +5 -0
  12. package/build/services/activities/activity.js +27 -6
  13. package/build/services/activities/await.js +11 -3
  14. package/build/services/activities/cycle.js +10 -2
  15. package/build/services/activities/hook.js +8 -2
  16. package/build/services/activities/index.d.ts +2 -2
  17. package/build/services/activities/index.js +2 -2
  18. package/build/services/activities/interrupt.d.ts +16 -0
  19. package/build/services/activities/interrupt.js +129 -0
  20. package/build/services/activities/signal.js +9 -2
  21. package/build/services/activities/trigger.d.ts +4 -0
  22. package/build/services/activities/trigger.js +14 -4
  23. package/build/services/activities/worker.js +10 -2
  24. package/build/services/collator/index.d.ts +4 -0
  25. package/build/services/collator/index.js +8 -0
  26. package/build/services/compiler/deployer.js +1 -3
  27. package/build/services/connector/index.js +2 -3
  28. package/build/services/durable/client.js +7 -3
  29. package/build/services/durable/factory.js +65 -284
  30. package/build/services/durable/handle.d.ts +37 -0
  31. package/build/services/durable/handle.js +52 -9
  32. package/build/services/durable/meshos.js +2 -2
  33. package/build/services/durable/worker.js +9 -2
  34. package/build/services/durable/workflow.d.ts +24 -0
  35. package/build/services/durable/workflow.js +56 -1
  36. package/build/services/engine/index.d.ts +14 -6
  37. package/build/services/engine/index.js +52 -27
  38. package/build/services/hotmesh/index.d.ts +3 -1
  39. package/build/services/hotmesh/index.js +11 -3
  40. package/build/services/quorum/index.d.ts +1 -0
  41. package/build/services/quorum/index.js +10 -0
  42. package/build/services/signaler/stream.js +25 -29
  43. package/build/services/store/index.d.ts +40 -4
  44. package/build/services/store/index.js +114 -9
  45. package/build/services/task/index.d.ts +5 -4
  46. package/build/services/task/index.js +12 -14
  47. package/build/types/activity.d.ts +35 -5
  48. package/build/types/durable.d.ts +4 -0
  49. package/build/types/index.d.ts +1 -1
  50. package/build/types/job.d.ts +18 -1
  51. package/build/types/quorum.d.ts +11 -7
  52. package/build/types/stream.d.ts +4 -1
  53. package/build/types/stream.js +2 -0
  54. package/modules/enums.ts +32 -0
  55. package/modules/errors.ts +24 -9
  56. package/modules/key.ts +4 -1
  57. package/modules/utils.ts +5 -0
  58. package/package.json +3 -1
  59. package/services/activities/activity.ts +34 -8
  60. package/services/activities/await.ts +11 -4
  61. package/services/activities/cycle.ts +10 -3
  62. package/services/activities/hook.ts +8 -3
  63. package/services/activities/index.ts +2 -2
  64. package/services/activities/interrupt.ts +159 -0
  65. package/services/activities/signal.ts +9 -3
  66. package/services/activities/trigger.ts +21 -5
  67. package/services/activities/worker.ts +10 -3
  68. package/services/collator/index.ts +10 -1
  69. package/services/compiler/deployer.ts +1 -3
  70. package/services/connector/index.ts +3 -5
  71. package/services/durable/client.ts +8 -4
  72. package/services/durable/factory.ts +65 -284
  73. package/services/durable/handle.ts +55 -9
  74. package/services/durable/meshos.ts +2 -3
  75. package/services/durable/worker.ts +9 -2
  76. package/services/durable/workflow.ts +66 -2
  77. package/services/engine/index.ts +74 -26
  78. package/services/hotmesh/index.ts +14 -4
  79. package/services/quorum/index.ts +9 -0
  80. package/services/signaler/stream.ts +27 -24
  81. package/services/store/index.ts +119 -11
  82. package/services/task/index.ts +18 -18
  83. package/types/activity.ts +38 -8
  84. package/types/durable.ts +8 -4
  85. package/types/index.ts +1 -1
  86. package/types/job.ts +30 -1
  87. package/types/quorum.ts +13 -8
  88. package/types/stream.ts +3 -0
  89. package/build/services/activities/iterate.d.ts +0 -9
  90. package/build/services/activities/iterate.js +0 -13
  91. package/services/activities/iterate.ts +0 -26
@@ -21,13 +21,19 @@ const getWorkflowYAML = (app, version) => {
21
21
  graphs:
22
22
  - subscribes: ${app}.execute
23
23
  publishes: ${app}.executed
24
- expire: 120
24
+ expire:
25
+ '@pipe':
26
+ - ['{t1.output.data.originJobId}', 0, '{t1.output.data.expire}']
27
+ - ['{@conditional.ternary}']
28
+
25
29
  input:
26
30
  schema:
27
31
  type: object
28
32
  properties:
29
33
  parentWorkflowId:
30
34
  type: string
35
+ originJobId:
36
+ type: string
31
37
  workflowId:
32
38
  type: string
33
39
  arguments:
@@ -36,6 +42,8 @@ const getWorkflowYAML = (app, version) => {
36
42
  type: string
37
43
  backoffCoefficient:
38
44
  type: number
45
+ expire:
46
+ type: number
39
47
  output:
40
48
  schema:
41
49
  type: object
@@ -52,10 +60,7 @@ const getWorkflowYAML = (app, version) => {
52
60
  stats:
53
61
  id: '{$self.input.data.workflowId}'
54
62
  key: '{$self.input.data.parentWorkflowId}'
55
- granularity: infinity
56
- measures:
57
- - measure: index
58
- target: '{$self.input.data.parentWorkflowId}'
63
+ parent: '{$self.input.data.originJobId}'
59
64
  job:
60
65
  maps:
61
66
  done: false
@@ -86,10 +91,13 @@ const getWorkflowYAML = (app, version) => {
86
91
  properties:
87
92
  workflowId:
88
93
  type: string
94
+ originJobId:
95
+ type: string
89
96
  arguments:
90
97
  type: array
91
98
  maps:
92
99
  workflowId: '{t1.output.data.workflowId}'
100
+ originJobId: '{t1.output.data.originJobId}'
93
101
  arguments: '{t1.output.data.arguments}'
94
102
  output:
95
103
  schema:
@@ -149,18 +157,6 @@ const getWorkflowYAML = (app, version) => {
149
157
  response: '{$self.output.data.response}'
150
158
  done: '{$self.output.data.done}'
151
159
 
152
- a2:
153
- title: Wait for cleanup signal
154
- type: hook
155
- hook:
156
- type: object
157
- properties:
158
- done:
159
- type: boolean
160
- job:
161
- maps:
162
- workflowId: '{t1.output.data.workflowId}'
163
-
164
160
  sig:
165
161
  title: Signal In - Receive signals
166
162
  type: hook
@@ -202,12 +198,15 @@ const getWorkflowYAML = (app, version) => {
202
198
  properties:
203
199
  workflowId:
204
200
  type: string
201
+ originJobId:
202
+ type: string
205
203
  workflowDimension:
206
204
  type: string
207
205
  arguments:
208
206
  type: array
209
207
  maps:
210
208
  workflowId: '{t1.output.data.workflowId}'
209
+ originJobId: '{t1.output.data.originJobId}'
211
210
  workflowDimension: '{sig.output.metadata.dad}'
212
211
  arguments: '{sig.hook.data.arguments}'
213
212
  output:
@@ -259,7 +258,7 @@ const getWorkflowYAML = (app, version) => {
259
258
  maps:
260
259
  duration: '{$self.output.data.duration}'
261
260
  index: '{$self.output.data.index}'
262
-
261
+
263
262
  siga594:
264
263
  title: Signal In - Wait for signals
265
264
  type: await
@@ -282,6 +281,8 @@ const getWorkflowYAML = (app, version) => {
282
281
  type: number
283
282
  parentWorkflowId:
284
283
  type: string
284
+ originJobId:
285
+ type: string
285
286
  cycleWorkflowId:
286
287
  type: string
287
288
  baseWorkflowId:
@@ -293,6 +294,10 @@ const getWorkflowYAML = (app, version) => {
293
294
  '@pipe':
294
295
  - ['{$job.metadata.jid}', '-w']
295
296
  - ['{@string.concat}']
297
+ originJobId:
298
+ '@pipe':
299
+ - ['{t1.output.data.originJobId}', '{t1.output.data.originJobId}', '{$job.metadata.jid}']
300
+ - ['{@conditional.ternary}']
296
301
  cycleWorkflowId:
297
302
  '@pipe':
298
303
  - ['-', '{$job.metadata.jid}', '-$wfc', '{sig.output.metadata.dad}', '-', '{sigw1.output.data.index}']
@@ -334,6 +339,8 @@ const getWorkflowYAML = (app, version) => {
334
339
  type: string
335
340
  parentWorkflowId:
336
341
  type: string
342
+ originJobId:
343
+ type: string
337
344
  maps:
338
345
  duration: '{sigw1.output.data.duration}'
339
346
  index: '{sigw1.output.data.index}'
@@ -341,6 +348,11 @@ const getWorkflowYAML = (app, version) => {
341
348
  '@pipe':
342
349
  - ['{$job.metadata.jid}', '-s']
343
350
  - ['{@string.concat}']
351
+ originJobId:
352
+ '@pipe':
353
+ - ['{t1.output.data.originJobId}', '{t1.output.data.originJobId}', '{$job.metadata.jid}']
354
+ - ['{@conditional.ternary}']
355
+
344
356
  workflowId:
345
357
  '@pipe':
346
358
  - ['-', '{$job.metadata.jid}', '-$sleep', '{sig.output.metadata.dad}', '-', '{sigw1.output.data.index}']
@@ -413,6 +425,8 @@ const getWorkflowYAML = (app, version) => {
413
425
  type: number
414
426
  parentWorkflowId:
415
427
  type: string
428
+ originJobId:
429
+ type: string
416
430
  cycleWorkflowId:
417
431
  type: string
418
432
  baseWorkflowId:
@@ -424,6 +438,10 @@ const getWorkflowYAML = (app, version) => {
424
438
  '@pipe':
425
439
  - ['{$job.metadata.jid}', '-w']
426
440
  - ['{@string.concat}']
441
+ originJobId:
442
+ '@pipe':
443
+ - ['{t1.output.data.originJobId}', '{t1.output.data.originJobId}', '{$job.metadata.jid}']
444
+ - ['{@conditional.ternary}']
427
445
  cycleWorkflowId:
428
446
  '@pipe':
429
447
  - ['-', '{$job.metadata.jid}', '-$wfc-', '{w1.output.data.index}']
@@ -465,6 +483,8 @@ const getWorkflowYAML = (app, version) => {
465
483
  type: string
466
484
  parentWorkflowId:
467
485
  type: string
486
+ originJobId:
487
+ type: string
468
488
  maps:
469
489
  duration: '{w1.output.data.duration}'
470
490
  index: '{w1.output.data.index}'
@@ -472,6 +492,10 @@ const getWorkflowYAML = (app, version) => {
472
492
  '@pipe':
473
493
  - ['{$job.metadata.jid}', '-s']
474
494
  - ['{@string.concat}']
495
+ originJobId:
496
+ '@pipe':
497
+ - ['{t1.output.data.originJobId}', '{t1.output.data.originJobId}', '{$job.metadata.jid}']
498
+ - ['{@conditional.ternary}']
475
499
  workflowId:
476
500
  '@pipe':
477
501
  - ['-', '{$job.metadata.jid}', '-$sleep-', '{w1.output.data.index}']
@@ -522,154 +546,6 @@ const getWorkflowYAML = (app, version) => {
522
546
  - ['{a1.output.data.duration}', '{t1.output.data.backoffCoefficient}']
523
547
  - ['{@math.multiply}']
524
548
 
525
- s1:
526
- title: Awaken activity flows so they end and self-clean
527
- type: signal
528
- subtype: all
529
- key_name: parentWorkflowId
530
- key_value:
531
- '@pipe':
532
- - ['{$job.metadata.jid}', '-a']
533
- - ['{@string.concat}']
534
- topic: ${app}.activity.awaken
535
- resolver:
536
- schema:
537
- type: object
538
- properties:
539
- data:
540
- type: object
541
- properties:
542
- parentWorkflowId:
543
- type: string
544
- scrub:
545
- type: boolean
546
- maps:
547
- data:
548
- parentWorkflowId:
549
- '@pipe':
550
- - ['{$job.metadata.jid}', '-a']
551
- - ['{@string.concat}']
552
-
553
- scrub: true
554
- signal:
555
- schema:
556
- type: object
557
- properties:
558
- done:
559
- type: boolean
560
- maps:
561
- done: true
562
-
563
- s2:
564
- title: Awaken sleeping flows so they end and self-clean
565
- type: signal
566
- subtype: all
567
- key_name: parentWorkflowId
568
- key_value:
569
- '@pipe':
570
- - ['{$job.metadata.jid}', '-s']
571
- - ['{@string.concat}']
572
- topic: ${app}.sleep.awaken
573
- resolver:
574
- schema:
575
- type: object
576
- properties:
577
- data:
578
- type: object
579
- properties:
580
- parentWorkflowId:
581
- type: string
582
- scrub:
583
- type: boolean
584
- maps:
585
- data:
586
- parentWorkflowId:
587
- '@pipe':
588
- - ['{$job.metadata.jid}', '-s']
589
- - ['{@string.concat}']
590
- scrub: true
591
- signal:
592
- schema:
593
- type: object
594
- properties:
595
- done:
596
- type: boolean
597
- maps:
598
- done: true
599
-
600
- s3:
601
- title: Awaken WFS flows so they end and self-clean
602
- type: signal
603
- subtype: all
604
- key_name: parentWorkflowId
605
- key_value:
606
- '@pipe':
607
- - ['{$job.metadata.jid}', '-w']
608
- - ['{@string.concat}']
609
- topic: ${app}.wfs.awaken
610
- resolver:
611
- schema:
612
- type: object
613
- properties:
614
- data:
615
- type: object
616
- properties:
617
- parentWorkflowId:
618
- type: string
619
- scrub:
620
- type: boolean
621
- maps:
622
- data:
623
- parentWorkflowId:
624
- '@pipe':
625
- - ['{$job.metadata.jid}', '-w']
626
- - ['{@string.concat}']
627
- scrub: true
628
- signal:
629
- schema:
630
- type: object
631
- properties:
632
- done:
633
- type: boolean
634
- maps:
635
- done: true
636
-
637
- s4:
638
- title: Awaken child flows so they end and self-clean
639
- type: signal
640
- subtype: all
641
- key_name: parentWorkflowId
642
- key_value:
643
- '@pipe':
644
- - ['{$job.metadata.jid}', '-f']
645
- - ['{@string.concat}']
646
- topic: ${app}.childflow.awaken
647
- resolver:
648
- schema:
649
- type: object
650
- properties:
651
- data:
652
- type: object
653
- properties:
654
- parentWorkflowId:
655
- type: string
656
- scrub:
657
- type: boolean
658
- maps:
659
- data:
660
- parentWorkflowId:
661
- '@pipe':
662
- - ['{$job.metadata.jid}', '-f']
663
- - ['{@string.concat}']
664
- scrub: true
665
- signal:
666
- schema:
667
- type: object
668
- properties:
669
- done:
670
- type: boolean
671
- maps:
672
- done: true
673
549
  s5:
674
550
  title: Close Signal In Channel
675
551
  type: signal
@@ -687,14 +563,6 @@ const getWorkflowYAML = (app, version) => {
687
563
  transitions:
688
564
  t1:
689
565
  - to: a1
690
- - to: a2
691
- conditions:
692
- match:
693
- - expected: true
694
- actual:
695
- '@pipe':
696
- - ['{$job.metadata.key}', true, false]
697
- - ['{@conditional.ternary}']
698
566
  - to: sig
699
567
  sig:
700
568
  - to: siga1
@@ -717,12 +585,8 @@ const getWorkflowYAML = (app, version) => {
717
585
  code: 599
718
586
  siga594:
719
587
  - to: sigc594
720
- conditions:
721
- code: 202
722
588
  siga595:
723
589
  - to: sigc595
724
- conditions:
725
- code: 202
726
590
  siga592:
727
591
  - to: sigc592
728
592
  siga599:
@@ -742,42 +606,19 @@ const getWorkflowYAML = (app, version) => {
742
606
  - to: a599
743
607
  conditions:
744
608
  code: 599
745
- - to: s3
746
- conditions:
747
- code: [200, 598, 597, 596]
748
- - to: s1
749
- conditions:
750
- code: [200, 598, 597, 596]
751
- - to: s2
752
- conditions:
753
- code: [200, 598, 597, 596]
754
- - to: s4
755
- conditions:
756
- code: [200, 598, 597, 596]
757
609
  - to: s5
758
610
  conditions:
759
611
  code: [200, 598, 597, 596]
760
612
  a594:
761
613
  - to: c594
762
- conditions:
763
- code: 202
764
614
  a595:
765
615
  - to: c595
766
- conditions:
767
- code: 202
768
616
  a592:
769
617
  - to: c592
770
618
  a599:
771
619
  - to: c599
772
620
 
773
621
  hooks:
774
- ${app}.childflow.awaken:
775
- - to: a2
776
- conditions:
777
- match:
778
- - expected: '{t1.output.data.workflowId}'
779
- actual: '{$self.hook.data.id}'
780
-
781
622
  ${app}.flow.signal:
782
623
  - to: sig
783
624
  conditions:
@@ -788,7 +629,7 @@ const getWorkflowYAML = (app, version) => {
788
629
  - subscribes: ${app}.activity.execute
789
630
  publishes: ${app}.activity.executed
790
631
 
791
- expire: 120
632
+ expire: 0
792
633
 
793
634
  input:
794
635
  schema:
@@ -796,6 +637,8 @@ const getWorkflowYAML = (app, version) => {
796
637
  properties:
797
638
  parentWorkflowId:
798
639
  type: string
640
+ originJobId:
641
+ type: string
799
642
  workflowId:
800
643
  type: string
801
644
  workflowTopic:
@@ -820,16 +663,12 @@ const getWorkflowYAML = (app, version) => {
820
663
  stats:
821
664
  id: '{$self.input.data.workflowId}'
822
665
  key: '{$self.input.data.parentWorkflowId}'
823
- granularity: infinity
824
- measures:
825
- - measure: index
826
- target: '{$self.input.data.parentWorkflowId}'
666
+ parent: '{$self.input.data.originJobId}'
827
667
 
828
668
  w1a:
829
669
  title: Activity Worker - Calls Activity Functions
830
670
  type: worker
831
671
  topic: '{t1a.output.data.workflowTopic}'
832
- emit: true
833
672
  input:
834
673
  schema:
835
674
  type: object
@@ -861,36 +700,14 @@ const getWorkflowYAML = (app, version) => {
861
700
  response: '{$self.output.data.response}'
862
701
  done: true
863
702
 
864
- s1a:
865
- title: Awaken activity flows so they end and self-clean
866
- type: hook
867
- hook:
868
- type: object
869
- properties:
870
- done:
871
- type: boolean
872
- job:
873
- maps:
874
- workflowId: '{t1a.output.data.workflowId}'
875
-
876
703
  transitions:
877
704
  t1a:
878
705
  - to: w1a
879
- w1a:
880
- - to: s1a
881
-
882
- hooks:
883
- ${app}.activity.awaken:
884
- - to: s1a
885
- conditions:
886
- match:
887
- - expected: '{t1a.output.data.workflowId}'
888
- actual: '{$self.hook.data.id}'
889
706
 
890
707
  - subscribes: ${app}.sleep.execute
891
708
  publishes: ${app}.sleep.executed
892
709
 
893
- expire: 120
710
+ expire: 0
894
711
 
895
712
  input:
896
713
  schema:
@@ -898,6 +715,8 @@ const getWorkflowYAML = (app, version) => {
898
715
  properties:
899
716
  parentWorkflowId:
900
717
  type: string
718
+ originJobId:
719
+ type: string
901
720
  workflowId:
902
721
  type: string
903
722
  duration:
@@ -923,50 +742,27 @@ const getWorkflowYAML = (app, version) => {
923
742
  stats:
924
743
  id: '{$self.input.data.workflowId}'
925
744
  key: '{$self.input.data.parentWorkflowId}'
926
- granularity: infinity
927
- measures:
928
- - measure: index
929
- target: '{$self.input.data.parentWorkflowId}'
745
+ parent: '{$self.input.data.originJobId}'
930
746
 
931
747
  a1s:
932
748
  title: Sleep for a duration
933
749
  type: hook
934
750
  sleep: '{t1s.output.data.duration}'
935
- emit: true
936
-
937
- a2s:
938
- title: Awaken sleep flows so they end and self-clean
939
- type: hook
940
- hook:
941
- type: object
942
- properties:
943
- done:
944
- type: boolean
945
751
  job:
946
752
  maps:
947
753
  done: true
948
754
  duration: '{t1s.output.data.duration}'
949
755
  index: '{t1s.output.data.index}'
950
756
  workflowId: '{t1s.output.data.workflowId}'
951
-
757
+
952
758
  transitions:
953
759
  t1s:
954
760
  - to: a1s
955
- a1s:
956
- - to: a2s
957
-
958
- hooks:
959
- ${app}.sleep.awaken:
960
- - to: a2s
961
- conditions:
962
- match:
963
- - expected: '{t1s.output.data.workflowId}'
964
- actual: '{$self.hook.data.id}'
965
761
 
966
762
  - subscribes: ${app}.wfsc.execute
967
763
  publishes: ${app}.wfsc.executed
968
764
 
969
- expire: 120
765
+ expire: 0
970
766
 
971
767
  input:
972
768
  schema:
@@ -986,6 +782,8 @@ const getWorkflowYAML = (app, version) => {
986
782
  type: number
987
783
  parentWorkflowId:
988
784
  type: string
785
+ originJobId:
786
+ type: string
989
787
  cycleWorkflowId:
990
788
  type: string
991
789
  baseWorkflowId:
@@ -1004,6 +802,7 @@ const getWorkflowYAML = (app, version) => {
1004
802
  type: trigger
1005
803
  stats:
1006
804
  id: '{$self.input.data.cycleWorkflowId}'
805
+ parent: '{$self.input.data.originJobId}'
1007
806
 
1008
807
  a1wc:
1009
808
  title: Pivot - All Cycling Descendants Point Here
@@ -1079,7 +878,6 @@ const getWorkflowYAML = (app, version) => {
1079
878
  title: Call WFS workflow
1080
879
  type: await
1081
880
  topic: ${app}.wfs.execute
1082
- emit: true
1083
881
  input:
1084
882
  schema:
1085
883
  type: object
@@ -1087,6 +885,9 @@ const getWorkflowYAML = (app, version) => {
1087
885
  parentWorkflowId:
1088
886
  type: string
1089
887
  description: used to forge the cleanup key
888
+ originJobId:
889
+ type: string
890
+ description: used for dependency cleanup
1090
891
  signalId:
1091
892
  type: string
1092
893
  description: used to forge the custom hookid
@@ -1095,6 +896,7 @@ const getWorkflowYAML = (app, version) => {
1095
896
  description: the baseId + index
1096
897
  maps:
1097
898
  parentWorkflowId: '{t1wc.output.data.parentWorkflowId}'
899
+ originJobId: '{t1wc.output.data.originJobId}'
1098
900
  signalId: '{a1wc.output.data.targetSignal.signal}'
1099
901
  workflowId:
1100
902
  '@pipe':
@@ -1135,7 +937,7 @@ const getWorkflowYAML = (app, version) => {
1135
937
  - subscribes: ${app}.wfs.execute
1136
938
  publishes: ${app}.wfs.executed
1137
939
 
1138
- expire: 120
940
+ expire: 0
1139
941
 
1140
942
  input:
1141
943
  schema:
@@ -1144,6 +946,9 @@ const getWorkflowYAML = (app, version) => {
1144
946
  parentWorkflowId:
1145
947
  type: string
1146
948
  description: used to forge the cleanup key
949
+ originJobId:
950
+ type: string
951
+ description: used for dependency cleanup
1147
952
  workflowId:
1148
953
  type: string
1149
954
  description: used to forge the cleanup hookid
@@ -1168,15 +973,11 @@ const getWorkflowYAML = (app, version) => {
1168
973
  stats:
1169
974
  id: '{$self.input.data.workflowId}'
1170
975
  key: '{$self.input.data.parentWorkflowId}'
1171
- granularity: infinity
1172
- measures:
1173
- - measure: index
1174
- target: '{$self.input.data.parentWorkflowId}'
976
+ parent: '{$self.input.data.originJobId}'
1175
977
 
1176
978
  a1ww:
1177
979
  title: WFS - signal entry point
1178
980
  type: hook
1179
- emit: true
1180
981
  hook:
1181
982
  type: object
1182
983
  properties:
@@ -1187,24 +988,11 @@ const getWorkflowYAML = (app, version) => {
1187
988
  signalData: '{$self.hook.data}'
1188
989
  workflowId: '{t1ww.output.data.workflowId}'
1189
990
  signalId: '{t1ww.output.data.signalId}'
1190
-
1191
- a2ww:
1192
- title: WFS - cleanup signal entry point
1193
- type: hook
1194
- hook:
1195
- type: object
1196
- properties:
1197
- done:
1198
- type: boolean
1199
- job:
1200
- maps:
1201
991
  done: true
1202
- workflowId: '{t1ww.output.data.workflowId}'
1203
992
 
1204
993
  transitions:
1205
994
  t1ww:
1206
995
  - to: a1ww
1207
- - to: a2ww
1208
996
 
1209
997
  hooks:
1210
998
  ${app}.wfs.signal:
@@ -1212,14 +1000,7 @@ const getWorkflowYAML = (app, version) => {
1212
1000
  conditions:
1213
1001
  match:
1214
1002
  - expected: '{t1ww.output.data.signalId}'
1215
- actual: '{$self.hook.data.id}'
1216
- ${app}.wfs.awaken:
1217
- - to: a2ww
1218
- conditions:
1219
- match:
1220
- - expected: '{t1ww.output.data.workflowId}'
1221
- actual: '{$self.hook.data.id}'
1222
-
1003
+ actual: '{$self.hook.data.id}'
1223
1004
  `;
1224
1005
  };
1225
1006
  exports.getWorkflowYAML = getWorkflowYAML;
@@ -1,12 +1,49 @@
1
1
  import { HotMeshService as HotMesh } from '../hotmesh';
2
+ import { JobInterruptOptions } from '../../types/job';
2
3
  export declare class WorkflowHandleService {
3
4
  hotMesh: HotMesh;
4
5
  workflowTopic: string;
5
6
  workflowId: string;
6
7
  constructor(hotMesh: HotMesh, workflowTopic: string, workflowId: string);
8
+ /**
9
+ * Sends a signal to the workflow. This is a way to send
10
+ * a message to a workflow that is paused due to having
11
+ * executed a `waitForSignal` workflow extension. Awakens
12
+ * the workflow if no other signals are pending.
13
+ */
7
14
  signal(signalId: string, data: Record<any, any>): Promise<void>;
15
+ /**
16
+ * Returns the job state of the workflow. If the workflow has completed
17
+ * this is also the job output. If the workflow is still running, this
18
+ * is the current state of the job, but it may change depending upon
19
+ * the activities that remain.
20
+ */
8
21
  state(metadata?: boolean): Promise<Record<string, any>>;
22
+ /**
23
+ * Returns the current search state of the workflow. This is
24
+ * different than the job state or individual activity state.
25
+ * Search state represents name/value pairs that were added
26
+ * to the workflow. As the workflow is stored in a Redis hash,
27
+ * this is a way to store additional data that is indexed
28
+ * and searchable using the RediSearch module.
29
+ */
9
30
  queryState(fields: string[]): Promise<Record<string, any>>;
31
+ /**
32
+ * Returns the current status of the workflow. This is a semaphore
33
+ * value that represents the current state of the workflow, where
34
+ * 0 is complete and a negative value represents that the flow was
35
+ * interrupted.
36
+ */
10
37
  status(): Promise<number>;
38
+ /**
39
+ * Interrupts a running workflow. Standard Job Completion tasks will
40
+ * run. Subscribers will be notified and the job hash will be expired.
41
+ */
42
+ interrupt(options?: JobInterruptOptions): Promise<string>;
43
+ /**
44
+ * Awaits for the workflow to complete and returns the result. If
45
+ * the workflow thows and error, this method will likewise throw
46
+ * an error.
47
+ */
11
48
  result(loadState?: boolean): Promise<any>;
12
49
  }