@hotmeshio/hotmesh 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -22
- package/build/modules/enums.d.ts +60 -5
- package/build/modules/enums.js +62 -7
- package/build/modules/errors.d.ts +15 -3
- package/build/modules/errors.js +17 -2
- package/build/package.json +6 -1
- package/build/services/activities/activity/context.d.ts +22 -0
- package/build/services/activities/activity/context.js +76 -0
- package/build/services/activities/activity/index.d.ts +116 -0
- package/build/services/activities/activity/index.js +299 -0
- package/build/services/activities/activity/mapping.d.ts +12 -0
- package/build/services/activities/activity/mapping.js +63 -0
- package/build/services/activities/activity/process.d.ts +28 -0
- package/build/services/activities/activity/process.js +100 -0
- package/build/services/activities/activity/protocol.d.ts +39 -0
- package/build/services/activities/activity/protocol.js +151 -0
- package/build/services/activities/activity/state.d.ts +40 -0
- package/build/services/activities/activity/state.js +143 -0
- package/build/services/activities/activity/transition.d.ts +23 -0
- package/build/services/activities/activity/transition.js +71 -0
- package/build/services/activities/activity/verify.d.ts +22 -0
- package/build/services/activities/activity/verify.js +85 -0
- package/build/services/activities/await.d.ts +1 -4
- package/build/services/activities/await.js +2 -36
- package/build/services/activities/cycle.d.ts +1 -11
- package/build/services/activities/cycle.js +3 -46
- package/build/services/activities/hook.d.ts +2 -11
- package/build/services/activities/hook.js +30 -50
- package/build/services/activities/interrupt.d.ts +2 -4
- package/build/services/activities/interrupt.js +4 -38
- package/build/services/activities/signal.d.ts +1 -11
- package/build/services/activities/signal.js +3 -48
- package/build/services/activities/trigger.d.ts +1 -3
- package/build/services/activities/trigger.js +0 -3
- package/build/services/activities/worker.d.ts +3 -6
- package/build/services/activities/worker.js +4 -40
- package/build/services/connector/factory.d.ts +6 -0
- package/build/services/connector/factory.js +24 -0
- package/build/services/durable/activity.d.ts +1 -1
- package/build/services/durable/activity.js +2 -2
- package/build/services/durable/client.d.ts +24 -29
- package/build/services/durable/client.js +24 -29
- package/build/services/durable/connection.d.ts +13 -7
- package/build/services/durable/connection.js +13 -7
- package/build/services/durable/handle.d.ts +58 -40
- package/build/services/durable/handle.js +60 -40
- package/build/services/durable/index.d.ts +148 -286
- package/build/services/durable/index.js +157 -292
- package/build/services/durable/interceptor.d.ts +43 -33
- package/build/services/durable/interceptor.js +59 -39
- package/build/services/durable/schemas/factory.d.ts +1 -1
- package/build/services/durable/schemas/factory.js +168 -38
- package/build/services/durable/telemetry.d.ts +80 -0
- package/build/services/durable/telemetry.js +137 -0
- package/build/services/durable/worker.d.ts +100 -21
- package/build/services/durable/worker.js +304 -63
- package/build/services/durable/workflow/all.d.ts +1 -1
- package/build/services/durable/workflow/all.js +1 -1
- package/build/services/durable/workflow/cancellationScope.d.ts +104 -0
- package/build/services/durable/workflow/cancellationScope.js +139 -0
- package/build/services/durable/workflow/common.d.ts +5 -4
- package/build/services/durable/workflow/common.js +6 -1
- package/build/services/durable/workflow/{waitFor.d.ts → condition.d.ts} +9 -8
- package/build/services/durable/workflow/{waitFor.js → condition.js} +44 -11
- package/build/services/durable/workflow/continueAsNew.d.ts +65 -0
- package/build/services/durable/workflow/continueAsNew.js +92 -0
- package/build/services/durable/workflow/didRun.d.ts +1 -1
- package/build/services/durable/workflow/didRun.js +3 -3
- package/build/services/durable/workflow/enrich.d.ts +5 -0
- package/build/services/durable/workflow/enrich.js +5 -0
- package/build/services/durable/workflow/entityMethods.d.ts +7 -0
- package/build/services/durable/workflow/entityMethods.js +7 -0
- package/build/services/durable/workflow/execHook.js +3 -3
- package/build/services/durable/workflow/execHookBatch.js +2 -2
- package/build/services/durable/workflow/{execChild.d.ts → executeChild.d.ts} +4 -40
- package/build/services/durable/workflow/{execChild.js → executeChild.js} +36 -45
- package/build/services/durable/workflow/hook.d.ts +1 -1
- package/build/services/durable/workflow/hook.js +4 -3
- package/build/services/durable/workflow/index.d.ts +45 -50
- package/build/services/durable/workflow/index.js +46 -51
- package/build/services/durable/workflow/interruption.d.ts +7 -6
- package/build/services/durable/workflow/interruption.js +11 -7
- package/build/services/durable/workflow/patched.d.ts +72 -0
- package/build/services/durable/workflow/patched.js +110 -0
- package/build/services/durable/workflow/proxyActivities.d.ts +7 -7
- package/build/services/durable/workflow/proxyActivities.js +50 -15
- package/build/services/durable/workflow/searchMethods.d.ts +7 -0
- package/build/services/durable/workflow/searchMethods.js +7 -0
- package/build/services/durable/workflow/signal.d.ts +4 -4
- package/build/services/durable/workflow/signal.js +4 -4
- package/build/services/durable/workflow/{sleepFor.d.ts → sleep.d.ts} +7 -7
- package/build/services/durable/workflow/{sleepFor.js → sleep.js} +39 -10
- package/build/services/durable/workflow/terminate.d.ts +55 -0
- package/build/services/durable/workflow/{interrupt.js → terminate.js} +21 -21
- package/build/services/durable/workflow/trace.js +2 -2
- package/build/services/durable/workflow/uuid4.d.ts +14 -0
- package/build/services/durable/workflow/uuid4.js +39 -0
- package/build/services/durable/workflow/{context.d.ts → workflowInfo.d.ts} +5 -5
- package/build/services/durable/workflow/{context.js → workflowInfo.js} +7 -7
- package/build/services/engine/compiler.d.ts +19 -0
- package/build/services/engine/compiler.js +20 -0
- package/build/services/engine/completion.d.ts +46 -0
- package/build/services/engine/completion.js +145 -0
- package/build/services/engine/dispatch.d.ts +24 -0
- package/build/services/engine/dispatch.js +98 -0
- package/build/services/engine/index.d.ts +49 -81
- package/build/services/engine/index.js +175 -573
- package/build/services/engine/init.d.ts +42 -0
- package/build/services/engine/init.js +74 -0
- package/build/services/engine/pubsub.d.ts +50 -0
- package/build/services/engine/pubsub.js +118 -0
- package/build/services/engine/reporting.d.ts +20 -0
- package/build/services/engine/reporting.js +38 -0
- package/build/services/engine/schema.d.ts +23 -0
- package/build/services/engine/schema.js +62 -0
- package/build/services/engine/signal.d.ts +57 -0
- package/build/services/engine/signal.js +117 -0
- package/build/services/engine/state.d.ts +35 -0
- package/build/services/engine/state.js +61 -0
- package/build/services/engine/version.d.ts +31 -0
- package/build/services/engine/version.js +73 -0
- package/build/services/hotmesh/deployment.d.ts +21 -0
- package/build/services/hotmesh/deployment.js +25 -0
- package/build/services/hotmesh/index.d.ts +141 -532
- package/build/services/hotmesh/index.js +222 -673
- package/build/services/hotmesh/init.d.ts +42 -0
- package/build/services/hotmesh/init.js +93 -0
- package/build/services/hotmesh/jobs.d.ts +67 -0
- package/build/services/hotmesh/jobs.js +99 -0
- package/build/services/hotmesh/pubsub.d.ts +38 -0
- package/build/services/hotmesh/pubsub.js +54 -0
- package/build/services/hotmesh/quorum.d.ts +30 -0
- package/build/services/hotmesh/quorum.js +62 -0
- package/build/services/hotmesh/validation.d.ts +6 -0
- package/build/services/hotmesh/validation.js +28 -0
- package/build/services/quorum/index.js +1 -0
- package/build/services/router/consumption/index.d.ts +11 -5
- package/build/services/router/consumption/index.js +24 -17
- package/build/services/router/error-handling/index.d.ts +2 -2
- package/build/services/router/error-handling/index.js +21 -15
- package/build/services/router/index.d.ts +1 -1
- package/build/services/router/index.js +2 -2
- package/build/services/serializer/index.d.ts +22 -0
- package/build/services/serializer/index.js +39 -1
- package/build/services/store/index.d.ts +1 -0
- package/build/services/store/providers/postgres/exporter-sql.d.ts +2 -2
- package/build/services/store/providers/postgres/exporter-sql.js +4 -4
- package/build/services/store/providers/postgres/kvtables.js +7 -6
- package/build/services/store/providers/postgres/kvtypes/hash/basic.js +67 -52
- package/build/services/store/providers/postgres/kvtypes/hash/jsonb.js +87 -72
- package/build/services/store/providers/postgres/kvtypes/hash/udata.js +106 -79
- package/build/services/store/providers/postgres/kvtypes/hash/utils.d.ts +16 -0
- package/build/services/store/providers/postgres/kvtypes/hash/utils.js +29 -16
- package/build/services/store/providers/postgres/postgres.d.ts +1 -0
- package/build/services/store/providers/postgres/postgres.js +14 -4
- package/build/services/stream/factory.d.ts +3 -1
- package/build/services/stream/factory.js +2 -2
- package/build/services/stream/index.d.ts +1 -0
- package/build/services/stream/providers/nats/nats.d.ts +1 -0
- package/build/services/stream/providers/nats/nats.js +1 -0
- package/build/services/stream/providers/postgres/credentials.d.ts +56 -0
- package/build/services/stream/providers/postgres/credentials.js +129 -0
- package/build/services/stream/providers/postgres/kvtables.js +18 -0
- package/build/services/stream/providers/postgres/messages.js +7 -7
- package/build/services/stream/providers/postgres/notifications.js +16 -2
- package/build/services/stream/providers/postgres/postgres.d.ts +7 -0
- package/build/services/stream/providers/postgres/postgres.js +35 -4
- package/build/services/stream/providers/postgres/procedures.d.ts +21 -0
- package/build/services/stream/providers/postgres/procedures.js +213 -0
- package/build/services/stream/providers/postgres/secured.d.ts +34 -0
- package/build/services/stream/providers/postgres/secured.js +146 -0
- package/build/services/stream/providers/postgres/stats.d.ts +1 -0
- package/build/services/stream/providers/postgres/stats.js +1 -0
- package/build/services/stream/registry.d.ts +1 -1
- package/build/services/stream/registry.js +5 -2
- package/build/services/telemetry/index.d.ts +10 -1
- package/build/services/telemetry/index.js +40 -7
- package/build/services/worker/credentials.d.ts +51 -0
- package/build/services/worker/credentials.js +87 -0
- package/build/services/worker/index.d.ts +2 -2
- package/build/services/worker/index.js +7 -6
- package/build/types/codec.d.ts +84 -0
- package/build/types/codec.js +2 -0
- package/build/types/durable.d.ts +104 -28
- package/build/types/error.d.ts +10 -1
- package/build/types/hotmesh.d.ts +67 -4
- package/build/types/index.d.ts +2 -1
- package/build/types/provider.d.ts +2 -2
- package/build/types/quorum.d.ts +35 -1
- package/build/types/stream.d.ts +12 -6
- package/package.json +6 -1
- package/build/services/activities/activity.d.ts +0 -192
- package/build/services/activities/activity.js +0 -786
- package/build/services/durable/workflow/interrupt.d.ts +0 -55
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.APP_ID = exports.APP_VERSION = exports.getWorkflowYAML = void 0;
|
|
22
|
-
const APP_VERSION = '
|
|
22
|
+
const APP_VERSION = '11';
|
|
23
23
|
exports.APP_VERSION = APP_VERSION;
|
|
24
24
|
const APP_ID = 'durable';
|
|
25
25
|
exports.APP_ID = APP_ID;
|
|
@@ -76,6 +76,9 @@ const getWorkflowYAML = (app, version) => {
|
|
|
76
76
|
backoffCoefficient:
|
|
77
77
|
description: the time multiple in seconds to backoff before retrying
|
|
78
78
|
type: number
|
|
79
|
+
initialInterval:
|
|
80
|
+
description: the initial interval in seconds before the first retry
|
|
81
|
+
type: number
|
|
79
82
|
maximumAttempts:
|
|
80
83
|
description: the maximum number of retries to attempt before failing the workflow
|
|
81
84
|
type: number
|
|
@@ -183,10 +186,14 @@ const getWorkflowYAML = (app, version) => {
|
|
|
183
186
|
maps:
|
|
184
187
|
originJobId: '{trigger.output.data.originJobId}'
|
|
185
188
|
workflowId: '{trigger.output.data.workflowId}'
|
|
186
|
-
arguments:
|
|
189
|
+
arguments:
|
|
190
|
+
'@pipe':
|
|
191
|
+
- ['{cycle_hook.output.data.continueArgs}', '{trigger.output.data.arguments}']
|
|
192
|
+
- ['{@conditional.nullish}']
|
|
187
193
|
workflowTopic: '{trigger.output.data.workflowTopic}'
|
|
188
194
|
workflowName: '{trigger.output.data.workflowName}'
|
|
189
195
|
expire: '{trigger.output.data.expire}'
|
|
196
|
+
continueGeneration: '{cycle_hook.output.data.continueGeneration}'
|
|
190
197
|
canRetry:
|
|
191
198
|
'@pipe':
|
|
192
199
|
- '@pipe':
|
|
@@ -304,6 +311,19 @@ const getWorkflowYAML = (app, version) => {
|
|
|
304
311
|
index:
|
|
305
312
|
type: number
|
|
306
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
|
|
307
327
|
595:
|
|
308
328
|
schema:
|
|
309
329
|
type: object
|
|
@@ -319,6 +339,7 @@ const getWorkflowYAML = (app, version) => {
|
|
|
319
339
|
job:
|
|
320
340
|
maps:
|
|
321
341
|
response: '{$self.output.data.response}'
|
|
342
|
+
patch-marker[-]: '{$self.output.data.patchMarkers}'
|
|
322
343
|
|
|
323
344
|
sleeper:
|
|
324
345
|
title: Pauses the main thread for a set amount of time; all other subprocess threads remain active, and new ones may be started
|
|
@@ -344,6 +365,8 @@ const getWorkflowYAML = (app, version) => {
|
|
|
344
365
|
maps:
|
|
345
366
|
retryCount: 0
|
|
346
367
|
throttleSeconds: 0
|
|
368
|
+
continueGeneration: '{cycle_hook.output.data.continueGeneration}'
|
|
369
|
+
continueArgs: '{cycle_hook.output.data.continueArgs}'
|
|
347
370
|
|
|
348
371
|
childer:
|
|
349
372
|
title: Awaits a child flow to be executed/started
|
|
@@ -408,6 +431,11 @@ const getWorkflowYAML = (app, version) => {
|
|
|
408
431
|
- ['{worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
|
|
409
432
|
- ['{@conditional.nullish}', 10]
|
|
410
433
|
- ['{@conditional.nullish}']
|
|
434
|
+
initialInterval:
|
|
435
|
+
'@pipe':
|
|
436
|
+
- ['{worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
|
|
437
|
+
- ['{@conditional.nullish}', 1]
|
|
438
|
+
- ['{@conditional.nullish}']
|
|
411
439
|
maximumAttempts:
|
|
412
440
|
'@pipe':
|
|
413
441
|
- ['{worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
|
|
@@ -519,12 +547,17 @@ const getWorkflowYAML = (app, version) => {
|
|
|
519
547
|
- '@pipe':
|
|
520
548
|
- '@pipe':
|
|
521
549
|
- '@pipe':
|
|
522
|
-
-
|
|
523
|
-
|
|
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}']
|
|
524
557
|
- '@pipe':
|
|
525
|
-
- ['{
|
|
558
|
+
- ['{trigger.output.data.initialInterval}', 1]
|
|
526
559
|
- ['{@conditional.nullish}']
|
|
527
|
-
- ['{@math.
|
|
560
|
+
- ['{@math.multiply}']
|
|
528
561
|
- '@pipe':
|
|
529
562
|
- ['{trigger.output.data.maximumInterval}', 120]
|
|
530
563
|
- ['{@logical.or}']
|
|
@@ -532,6 +565,8 @@ const getWorkflowYAML = (app, version) => {
|
|
|
532
565
|
- '@pipe':
|
|
533
566
|
- [0]
|
|
534
567
|
- ['{@conditional.ternary}']
|
|
568
|
+
continueGeneration: '{cycle_hook.output.data.continueGeneration}'
|
|
569
|
+
continueArgs: '{cycle_hook.output.data.continueArgs}'
|
|
535
570
|
|
|
536
571
|
proxyer:
|
|
537
572
|
title: Invokes the activity flow and awaits the response
|
|
@@ -557,7 +592,7 @@ const getWorkflowYAML = (app, version) => {
|
|
|
557
592
|
description: the arguments to pass to the activity
|
|
558
593
|
items:
|
|
559
594
|
type: string
|
|
560
|
-
|
|
595
|
+
headers:
|
|
561
596
|
type: object
|
|
562
597
|
description: optional metadata to pass alongside activity arguments
|
|
563
598
|
expire:
|
|
@@ -568,10 +603,12 @@ const getWorkflowYAML = (app, version) => {
|
|
|
568
603
|
type: number
|
|
569
604
|
maximumInterval:
|
|
570
605
|
type: number
|
|
606
|
+
startToCloseTimeout:
|
|
607
|
+
type: number
|
|
571
608
|
maps:
|
|
572
609
|
activityName: '{worker.output.data.activityName}'
|
|
573
610
|
arguments: '{worker.output.data.arguments}'
|
|
574
|
-
|
|
611
|
+
headers: '{worker.output.data.headers}'
|
|
575
612
|
workflowDimension: '{worker.output.data.workflowDimension}'
|
|
576
613
|
index: '{worker.output.data.index}'
|
|
577
614
|
originJobId: '{worker.output.data.originJobId}'
|
|
@@ -579,11 +616,17 @@ const getWorkflowYAML = (app, version) => {
|
|
|
579
616
|
workflowId: '{worker.output.data.workflowId}'
|
|
580
617
|
workflowTopic: '{worker.output.data.workflowTopic}'
|
|
581
618
|
expire: '{worker.output.data.expire}'
|
|
619
|
+
startToCloseTimeout: '{worker.output.data.startToCloseTimeout}'
|
|
582
620
|
backoffCoefficient:
|
|
583
621
|
'@pipe':
|
|
584
622
|
- ['{worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
|
|
585
623
|
- ['{@conditional.nullish}', 10]
|
|
586
624
|
- ['{@conditional.nullish}']
|
|
625
|
+
initialInterval:
|
|
626
|
+
'@pipe':
|
|
627
|
+
- ['{worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
|
|
628
|
+
- ['{@conditional.nullish}', 1]
|
|
629
|
+
- ['{@conditional.nullish}']
|
|
587
630
|
maximumAttempts:
|
|
588
631
|
'@pipe':
|
|
589
632
|
- ['{worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
|
|
@@ -667,12 +710,17 @@ const getWorkflowYAML = (app, version) => {
|
|
|
667
710
|
- '@pipe':
|
|
668
711
|
- '@pipe':
|
|
669
712
|
- '@pipe':
|
|
670
|
-
-
|
|
671
|
-
|
|
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}']
|
|
672
720
|
- '@pipe':
|
|
673
|
-
- ['{
|
|
721
|
+
- ['{trigger.output.data.initialInterval}', 1]
|
|
674
722
|
- ['{@conditional.nullish}']
|
|
675
|
-
- ['{@math.
|
|
723
|
+
- ['{@math.multiply}']
|
|
676
724
|
- '@pipe':
|
|
677
725
|
- ['{trigger.output.data.maximumInterval}', 120]
|
|
678
726
|
- ['{@logical.or}']
|
|
@@ -680,6 +728,8 @@ const getWorkflowYAML = (app, version) => {
|
|
|
680
728
|
- '@pipe':
|
|
681
729
|
- [0]
|
|
682
730
|
- ['{@conditional.ternary}']
|
|
731
|
+
continueGeneration: '{cycle_hook.output.data.continueGeneration}'
|
|
732
|
+
continueArgs: '{cycle_hook.output.data.continueArgs}'
|
|
683
733
|
|
|
684
734
|
collator:
|
|
685
735
|
title: Awaits the collator flow to simultaneously resolve the idempotent items and return as a sequential set
|
|
@@ -783,6 +833,8 @@ const getWorkflowYAML = (app, version) => {
|
|
|
783
833
|
maps:
|
|
784
834
|
retryCount: 0
|
|
785
835
|
throttleSeconds: 0
|
|
836
|
+
continueGeneration: '{cycle_hook.output.data.continueGeneration}'
|
|
837
|
+
continueArgs: '{cycle_hook.output.data.continueArgs}'
|
|
786
838
|
|
|
787
839
|
retryer:
|
|
788
840
|
title: Cycles back to the cycle_hook pivot, increasing the retryCount (the exponential)
|
|
@@ -809,6 +861,24 @@ const getWorkflowYAML = (app, version) => {
|
|
|
809
861
|
- ['{trigger.output.data.maximumInterval}', 120]
|
|
810
862
|
- ['{@logical.or}']
|
|
811
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
|
+
|
|
812
882
|
ender:
|
|
813
883
|
title: Sets job data; ignores the \`Signal In\` Hook Channel which was suppressed; sends the final response
|
|
814
884
|
type: hook
|
|
@@ -1165,6 +1235,11 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1165
1235
|
- ['{signaler_worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
|
|
1166
1236
|
- ['{@conditional.nullish}', 10]
|
|
1167
1237
|
- ['{@conditional.nullish}']
|
|
1238
|
+
initialInterval:
|
|
1239
|
+
'@pipe':
|
|
1240
|
+
- ['{signaler_worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
|
|
1241
|
+
- ['{@conditional.nullish}', 1]
|
|
1242
|
+
- ['{@conditional.nullish}']
|
|
1168
1243
|
maximumAttempts:
|
|
1169
1244
|
'@pipe':
|
|
1170
1245
|
- ['{signaler_worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
|
|
@@ -1276,12 +1351,17 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1276
1351
|
- '@pipe':
|
|
1277
1352
|
- '@pipe':
|
|
1278
1353
|
- '@pipe':
|
|
1279
|
-
-
|
|
1280
|
-
|
|
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}']
|
|
1281
1361
|
- '@pipe':
|
|
1282
|
-
- ['{
|
|
1362
|
+
- ['{trigger.output.data.initialInterval}', 1]
|
|
1283
1363
|
- ['{@conditional.nullish}']
|
|
1284
|
-
- ['{@math.
|
|
1364
|
+
- ['{@math.multiply}']
|
|
1285
1365
|
- '@pipe':
|
|
1286
1366
|
- ['{trigger.output.data.maximumInterval}', 120]
|
|
1287
1367
|
- ['{@logical.or}']
|
|
@@ -1314,7 +1394,7 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1314
1394
|
description: the arguments to pass to the activity
|
|
1315
1395
|
items:
|
|
1316
1396
|
type: string
|
|
1317
|
-
|
|
1397
|
+
headers:
|
|
1318
1398
|
type: object
|
|
1319
1399
|
description: optional metadata to pass alongside activity arguments
|
|
1320
1400
|
expire:
|
|
@@ -1325,10 +1405,12 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1325
1405
|
type: number
|
|
1326
1406
|
maximumInterval:
|
|
1327
1407
|
type: number
|
|
1408
|
+
startToCloseTimeout:
|
|
1409
|
+
type: number
|
|
1328
1410
|
maps:
|
|
1329
1411
|
activityName: '{signaler_worker.output.data.activityName}'
|
|
1330
1412
|
arguments: '{signaler_worker.output.data.arguments}'
|
|
1331
|
-
|
|
1413
|
+
headers: '{signaler_worker.output.data.headers}'
|
|
1332
1414
|
workflowDimension: '{signaler_worker.output.data.workflowDimension}'
|
|
1333
1415
|
index: '{signaler_worker.output.data.index}'
|
|
1334
1416
|
originJobId: '{signaler_worker.output.data.originJobId}'
|
|
@@ -1336,11 +1418,17 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1336
1418
|
workflowId: '{signaler_worker.output.data.workflowId}'
|
|
1337
1419
|
workflowTopic: '{signaler_worker.output.data.workflowTopic}'
|
|
1338
1420
|
expire: '{signaler_worker.output.data.expire}'
|
|
1421
|
+
startToCloseTimeout: '{signaler_worker.output.data.startToCloseTimeout}'
|
|
1339
1422
|
backoffCoefficient:
|
|
1340
1423
|
'@pipe':
|
|
1341
1424
|
- ['{signaler_worker.output.data.backoffCoefficient}','{trigger.output.data.backoffCoefficient}']
|
|
1342
1425
|
- ['{@conditional.nullish}', 10]
|
|
1343
1426
|
- ['{@conditional.nullish}']
|
|
1427
|
+
initialInterval:
|
|
1428
|
+
'@pipe':
|
|
1429
|
+
- ['{signaler_worker.output.data.initialInterval}','{trigger.output.data.initialInterval}']
|
|
1430
|
+
- ['{@conditional.nullish}', 1]
|
|
1431
|
+
- ['{@conditional.nullish}']
|
|
1344
1432
|
maximumAttempts:
|
|
1345
1433
|
'@pipe':
|
|
1346
1434
|
- ['{signaler_worker.output.data.maximumAttempts}','{trigger.output.data.maximumAttempts}']
|
|
@@ -1424,12 +1512,17 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1424
1512
|
- '@pipe':
|
|
1425
1513
|
- '@pipe':
|
|
1426
1514
|
- '@pipe':
|
|
1427
|
-
-
|
|
1428
|
-
|
|
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}']
|
|
1429
1522
|
- '@pipe':
|
|
1430
|
-
- ['{
|
|
1523
|
+
- ['{trigger.output.data.initialInterval}', 1]
|
|
1431
1524
|
- ['{@conditional.nullish}']
|
|
1432
|
-
- ['{@math.
|
|
1525
|
+
- ['{@math.multiply}']
|
|
1433
1526
|
- '@pipe':
|
|
1434
1527
|
- ['{trigger.output.data.maximumInterval}', 120]
|
|
1435
1528
|
- ['{@logical.or}']
|
|
@@ -1624,6 +1717,9 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1624
1717
|
- to: proxyer
|
|
1625
1718
|
conditions:
|
|
1626
1719
|
code: 591
|
|
1720
|
+
- to: continuer
|
|
1721
|
+
conditions:
|
|
1722
|
+
code: 592
|
|
1627
1723
|
- to: retryer
|
|
1628
1724
|
conditions:
|
|
1629
1725
|
code: 599
|
|
@@ -1859,8 +1955,13 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1859
1955
|
- ['{@object.create}']
|
|
1860
1956
|
|
|
1861
1957
|
collator_waiter:
|
|
1862
|
-
title: Waits for a matching signal
|
|
1958
|
+
title: Waits for a matching signal or optional timeout
|
|
1863
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}']
|
|
1864
1965
|
hook:
|
|
1865
1966
|
type: object
|
|
1866
1967
|
properties:
|
|
@@ -1870,12 +1971,18 @@ const getWorkflowYAML = (app, version) => {
|
|
|
1870
1971
|
maps:
|
|
1871
1972
|
response[25]:
|
|
1872
1973
|
'@pipe':
|
|
1873
|
-
- ['{collator_trigger.output.data.items}']
|
|
1874
1974
|
- '@pipe':
|
|
1875
1975
|
- ['{collator_cycle_hook.output.data.cur_index}']
|
|
1876
1976
|
- '@pipe':
|
|
1877
|
-
-
|
|
1878
|
-
|
|
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}']
|
|
1879
1986
|
- ['{@object.create}']
|
|
1880
1987
|
|
|
1881
1988
|
collator_childer:
|
|
@@ -2130,7 +2237,7 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2130
2237
|
description: the arguments to pass to the activity
|
|
2131
2238
|
items:
|
|
2132
2239
|
type: string
|
|
2133
|
-
|
|
2240
|
+
headers:
|
|
2134
2241
|
type: object
|
|
2135
2242
|
description: optional metadata to pass alongside activity arguments
|
|
2136
2243
|
expire:
|
|
@@ -2141,6 +2248,8 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2141
2248
|
type: number
|
|
2142
2249
|
maximumInterval:
|
|
2143
2250
|
type: number
|
|
2251
|
+
startToCloseTimeout:
|
|
2252
|
+
type: number
|
|
2144
2253
|
maps:
|
|
2145
2254
|
activityName:
|
|
2146
2255
|
'@pipe':
|
|
@@ -2152,10 +2261,10 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2152
2261
|
- ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
|
|
2153
2262
|
- ['{@array.get}', arguments]
|
|
2154
2263
|
- ['{@object.get}']
|
|
2155
|
-
|
|
2264
|
+
headers:
|
|
2156
2265
|
'@pipe':
|
|
2157
2266
|
- ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
|
|
2158
|
-
- ['{@array.get}',
|
|
2267
|
+
- ['{@array.get}', headers]
|
|
2159
2268
|
- ['{@object.get}']
|
|
2160
2269
|
workflowDimension:
|
|
2161
2270
|
'@pipe':
|
|
@@ -2207,6 +2316,11 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2207
2316
|
- ['{collator_trigger.output.data.items}', '{collator_cycle_hook.output.data.cur_index}']
|
|
2208
2317
|
- ['{@array.get}', maximumInterval]
|
|
2209
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}']
|
|
2210
2324
|
output:
|
|
2211
2325
|
schema:
|
|
2212
2326
|
type: object
|
|
@@ -2362,7 +2476,11 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2362
2476
|
|
|
2363
2477
|
expire:
|
|
2364
2478
|
'@pipe':
|
|
2365
|
-
-
|
|
2479
|
+
- '@pipe':
|
|
2480
|
+
- ['{activity_trigger.output.data.startToCloseTimeout}']
|
|
2481
|
+
- '@pipe':
|
|
2482
|
+
- ['{activity_trigger.output.data.expire}', 1]
|
|
2483
|
+
- ['{@conditional.nullish}']
|
|
2366
2484
|
- ['{@conditional.nullish}']
|
|
2367
2485
|
|
|
2368
2486
|
input:
|
|
@@ -2381,14 +2499,18 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2381
2499
|
type: string
|
|
2382
2500
|
arguments:
|
|
2383
2501
|
type: array
|
|
2384
|
-
|
|
2502
|
+
headers:
|
|
2385
2503
|
type: object
|
|
2386
2504
|
backoffCoefficient:
|
|
2387
2505
|
type: number
|
|
2506
|
+
initialInterval:
|
|
2507
|
+
type: number
|
|
2388
2508
|
maximumAttempts:
|
|
2389
2509
|
type: number
|
|
2390
2510
|
maximumInterval:
|
|
2391
2511
|
type: number
|
|
2512
|
+
startToCloseTimeout:
|
|
2513
|
+
type: number
|
|
2392
2514
|
expire:
|
|
2393
2515
|
type: number
|
|
2394
2516
|
output:
|
|
@@ -2450,15 +2572,18 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2450
2572
|
type: string
|
|
2451
2573
|
arguments:
|
|
2452
2574
|
type: array
|
|
2453
|
-
|
|
2575
|
+
headers:
|
|
2454
2576
|
type: object
|
|
2577
|
+
startToCloseTimeout:
|
|
2578
|
+
type: number
|
|
2455
2579
|
maps:
|
|
2456
2580
|
parentWorkflowId: '{activity_trigger.output.data.parentWorkflowId}'
|
|
2457
2581
|
workflowId: '{activity_trigger.output.data.workflowId}'
|
|
2458
2582
|
workflowTopic: '{activity_trigger.output.data.workflowTopic}'
|
|
2459
2583
|
activityName: '{activity_trigger.output.data.activityName}'
|
|
2460
2584
|
arguments: '{activity_trigger.output.data.arguments}'
|
|
2461
|
-
|
|
2585
|
+
headers: '{activity_trigger.output.data.headers}'
|
|
2586
|
+
startToCloseTimeout: '{activity_trigger.output.data.startToCloseTimeout}'
|
|
2462
2587
|
output:
|
|
2463
2588
|
schema:
|
|
2464
2589
|
type: object
|
|
@@ -2475,9 +2600,14 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2475
2600
|
sleep:
|
|
2476
2601
|
'@pipe':
|
|
2477
2602
|
- '@pipe':
|
|
2478
|
-
-
|
|
2479
|
-
|
|
2480
|
-
|
|
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}']
|
|
2481
2611
|
- '@pipe':
|
|
2482
2612
|
- ['{activity_trigger.output.data.maximumInterval}', 120]
|
|
2483
2613
|
- ['{@math.min}']
|
|
@@ -2537,7 +2667,7 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2537
2667
|
- '@pipe':
|
|
2538
2668
|
- ['{activity_cycle_hook.output.data.retryCount}']
|
|
2539
2669
|
- '@pipe':
|
|
2540
|
-
- ['{activity_trigger.output.data.maximumAttempts}',
|
|
2670
|
+
- ['{activity_trigger.output.data.maximumAttempts}', 50]
|
|
2541
2671
|
- ['{@conditional.nullish}']
|
|
2542
2672
|
- ['{@conditional.greater_than_or_equal}']
|
|
2543
2673
|
|
|
@@ -2551,7 +2681,7 @@ const getWorkflowYAML = (app, version) => {
|
|
|
2551
2681
|
- '@pipe':
|
|
2552
2682
|
- ['{activity_cycle_hook.output.data.retryCount}']
|
|
2553
2683
|
- '@pipe':
|
|
2554
|
-
- ['{activity_trigger.output.data.maximumAttempts}',
|
|
2684
|
+
- ['{activity_trigger.output.data.maximumAttempts}', 50]
|
|
2555
2685
|
- ['{@conditional.nullish}']
|
|
2556
2686
|
- ['{@conditional.less_than}']
|
|
2557
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
|
+
}
|