@hotmeshio/hotmesh 0.0.18 → 0.0.20
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 +4 -4
- package/build/modules/errors.d.ts +2 -1
- package/build/modules/errors.js +2 -1
- package/build/modules/utils.js +7 -0
- package/build/package.json +2 -1
- package/build/services/activities/activity.d.ts +2 -2
- package/build/services/activities/activity.js +10 -8
- package/build/services/activities/hook.d.ts +4 -3
- package/build/services/activities/hook.js +15 -12
- package/build/services/activities/signal.d.ts +4 -0
- package/build/services/activities/signal.js +16 -2
- package/build/services/durable/client.d.ts +15 -5
- package/build/services/durable/client.js +45 -54
- package/build/services/durable/factory.d.ts +2 -16
- package/build/services/durable/factory.js +276 -46
- package/build/services/durable/handle.d.ts +1 -1
- package/build/services/durable/handle.js +18 -5
- package/build/services/durable/search.d.ts +8 -1
- package/build/services/durable/search.js +34 -7
- package/build/services/durable/worker.d.ts +10 -7
- package/build/services/durable/worker.js +59 -49
- package/build/services/durable/workflow.d.ts +20 -2
- package/build/services/durable/workflow.js +97 -84
- package/build/services/engine/index.d.ts +2 -2
- package/build/services/engine/index.js +7 -12
- package/build/services/hotmesh/index.d.ts +2 -2
- package/build/services/hotmesh/index.js +2 -2
- package/build/services/signaler/store.d.ts +2 -2
- package/build/services/signaler/store.js +17 -7
- package/build/services/signaler/stream.js +1 -0
- package/build/services/store/clients/redis.js +1 -1
- package/build/services/store/index.js +3 -0
- package/build/services/telemetry/index.js +7 -1
- package/build/types/activity.d.ts +5 -3
- package/build/types/durable.d.ts +17 -4
- package/build/types/hook.d.ts +0 -1
- package/build/types/index.d.ts +1 -1
- package/modules/errors.ts +4 -2
- package/modules/utils.ts +6 -0
- package/package.json +2 -1
- package/services/activities/activity.ts +10 -8
- package/services/activities/hook.ts +17 -14
- package/services/activities/signal.ts +17 -3
- package/services/durable/client.ts +48 -56
- package/services/durable/factory.ts +274 -46
- package/services/durable/handle.ts +18 -5
- package/services/durable/search.ts +36 -7
- package/services/durable/worker.ts +61 -51
- package/services/durable/workflow.ts +110 -84
- package/services/engine/index.ts +8 -12
- package/services/hotmesh/index.ts +3 -3
- package/services/signaler/store.ts +18 -8
- package/services/signaler/stream.ts +1 -0
- package/services/store/clients/redis.ts +1 -1
- package/services/store/index.ts +2 -0
- package/services/telemetry/index.ts +6 -1
- package/types/activity.ts +10 -8
- package/types/durable.ts +18 -3
- package/types/hook.ts +0 -1
- package/types/index.ts +1 -0
package/services/store/index.ts
CHANGED
|
@@ -252,10 +252,15 @@ class TelemetryService {
|
|
|
252
252
|
|
|
253
253
|
static bindActivityTelemetryToState(state: StringAnyType, config: ActivityType, metadata: ActivityMetadata, context: JobState, leg: number): void {
|
|
254
254
|
if (config.type === 'trigger') {
|
|
255
|
+
//trigger activities run non-duplexed and only have a single leg (2)
|
|
255
256
|
state[`${metadata.aid}/output/metadata/l1s`] = context['$self'].output.metadata.l1s;
|
|
256
257
|
state[`${metadata.aid}/output/metadata/l2s`] = context['$self'].output.metadata.l2s;
|
|
257
258
|
} else if (polyfill.resolveActivityType(config.type) === 'hook' && leg === 1) {
|
|
258
|
-
//activities run non-duplexed and only have a single leg
|
|
259
|
+
//hook activities run non-duplexed and only have a single leg (1)
|
|
260
|
+
state[`${metadata.aid}/output/metadata/l1s`] = context['$self'].output.metadata.l1s;
|
|
261
|
+
state[`${metadata.aid}/output/metadata/l2s`] = context['$self'].output.metadata.l1s;
|
|
262
|
+
} else if (config.type === 'signal' && leg === 1) {
|
|
263
|
+
//signal activities run non-duplexed and only have a single leg (1)
|
|
259
264
|
state[`${metadata.aid}/output/metadata/l1s`] = context['$self'].output.metadata.l1s;
|
|
260
265
|
state[`${metadata.aid}/output/metadata/l2s`] = context['$self'].output.metadata.l1s;
|
|
261
266
|
} else {
|
package/types/activity.ts
CHANGED
|
@@ -70,14 +70,16 @@ interface HookActivity extends BaseActivity {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
interface SignalActivity extends BaseActivity {
|
|
73
|
-
type: 'signal';
|
|
74
|
-
subtype: 'one' | 'all';
|
|
75
|
-
topic: string;
|
|
76
|
-
key_name
|
|
77
|
-
key_value
|
|
78
|
-
scrub
|
|
79
|
-
signal?: Record<string, any>; //used to define/map the signal input data
|
|
80
|
-
resolver?: Record<string, any>; //used to define/map the signal key resolver
|
|
73
|
+
type: 'signal'; //signal activities call hook/hookAll
|
|
74
|
+
subtype: 'one' | 'all'; //trigger: hook(One) or hookAll
|
|
75
|
+
topic: string; //e.g., 'hook.resume'
|
|
76
|
+
key_name?: string; //e.g., 'parent_job_id'
|
|
77
|
+
key_value?: string; //e.g., '1234567890'
|
|
78
|
+
scrub?: boolean; //if true, the index will be deleted after use
|
|
79
|
+
signal?: Record<string, any>; //used to define/map the signal input data (what to send/singnal into the job(s))
|
|
80
|
+
resolver?: Record<string, any>; //used to define/map the signal key resolver (the key used to lookup the job(s that are assigned to the key)
|
|
81
|
+
status?: string; //pending, success (default), error
|
|
82
|
+
code?: number; //202, 200 (default)
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
interface IterateActivity extends BaseActivity {
|
package/types/durable.ts
CHANGED
|
@@ -8,12 +8,14 @@ type WorkflowConfig = {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type WorkflowSearchOptions = {
|
|
11
|
-
index
|
|
12
|
-
prefix
|
|
13
|
-
schema
|
|
11
|
+
index?: string; //FT index name (myapp:myindex)
|
|
12
|
+
prefix?: string[]; //FT prefixes (['myapp:myindex:prefix1', 'myapp:myindex:prefix2'])
|
|
13
|
+
schema?: Record<string, {type: 'TEXT' | 'NUMERIC' | 'TAG', sortable: boolean}>;
|
|
14
|
+
data?: Record<string, string>;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
type WorkflowOptions = {
|
|
18
|
+
namespace?: string; //'durable' is the default namespace if not provided; similar to setting `appid` in the YAML
|
|
17
19
|
taskQueue: string;
|
|
18
20
|
args: any[]; //input arguments to pass in
|
|
19
21
|
workflowId: string; //execution id (the job id)
|
|
@@ -25,6 +27,16 @@ type WorkflowOptions = {
|
|
|
25
27
|
config?: WorkflowConfig;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
type HookOptions = {
|
|
31
|
+
namespace?: string; //'durable' is the default namespace if not provided; similar to setting `appid` in the YAML
|
|
32
|
+
taskQueue: string;
|
|
33
|
+
args: any[]; //input arguments to pass into the hook
|
|
34
|
+
workflowId: string; //execution id (the job id to hook into)
|
|
35
|
+
workflowName?: string; //the name of the user's hook function
|
|
36
|
+
search?: WorkflowSearchOptions //bind additional search terms immediately before hook reentry
|
|
37
|
+
config?: WorkflowConfig; //hook function constraints (backoffCoefficient, maximumAttempts, maximumInterval, initialInterval)
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
type SignalOptions = {
|
|
29
41
|
taskQueue: string;
|
|
30
42
|
data: Record<string, any>; //input data (any serializable object)
|
|
@@ -66,9 +78,11 @@ type WorkerConfig = {
|
|
|
66
78
|
taskQueue: string; //`subscribes` in the YAML (e.g, 'hello-world')
|
|
67
79
|
workflow: Function; //target function to run
|
|
68
80
|
options?: WorkerOptions;
|
|
81
|
+
search?: WorkflowSearchOptions;
|
|
69
82
|
}
|
|
70
83
|
|
|
71
84
|
type WorkerOptions = {
|
|
85
|
+
logLevel?: string; //debug, info, warn, error
|
|
72
86
|
maxSystemRetries?: number; //1-3 (10ms, 100ms, 1_000ms)
|
|
73
87
|
backoffCoefficient?: number; //2-10ish
|
|
74
88
|
}
|
|
@@ -105,6 +119,7 @@ export {
|
|
|
105
119
|
ProxyType,
|
|
106
120
|
Registry,
|
|
107
121
|
SignalOptions,
|
|
122
|
+
HookOptions,
|
|
108
123
|
WorkerConfig,
|
|
109
124
|
WorkflowConfig,
|
|
110
125
|
WorkerOptions,
|
package/types/hook.ts
CHANGED