@hotmeshio/hotmesh 0.0.19 → 0.0.21

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 (58) hide show
  1. package/README.md +4 -4
  2. package/build/modules/errors.d.ts +2 -1
  3. package/build/modules/errors.js +2 -1
  4. package/build/package.json +2 -1
  5. package/build/services/activities/activity.d.ts +2 -2
  6. package/build/services/activities/activity.js +10 -8
  7. package/build/services/activities/hook.d.ts +2 -1
  8. package/build/services/activities/hook.js +12 -9
  9. package/build/services/activities/signal.d.ts +4 -0
  10. package/build/services/activities/signal.js +16 -2
  11. package/build/services/durable/client.d.ts +15 -5
  12. package/build/services/durable/client.js +37 -14
  13. package/build/services/durable/factory.d.ts +2 -16
  14. package/build/services/durable/factory.js +276 -46
  15. package/build/services/durable/handle.d.ts +1 -1
  16. package/build/services/durable/handle.js +18 -5
  17. package/build/services/durable/search.d.ts +8 -1
  18. package/build/services/durable/search.js +36 -10
  19. package/build/services/durable/worker.d.ts +7 -9
  20. package/build/services/durable/worker.js +29 -23
  21. package/build/services/durable/workflow.d.ts +23 -2
  22. package/build/services/durable/workflow.js +143 -37
  23. package/build/services/engine/index.d.ts +2 -2
  24. package/build/services/engine/index.js +7 -12
  25. package/build/services/hotmesh/index.d.ts +2 -2
  26. package/build/services/hotmesh/index.js +2 -2
  27. package/build/services/signaler/store.d.ts +2 -2
  28. package/build/services/signaler/store.js +17 -7
  29. package/build/services/signaler/stream.js +1 -0
  30. package/build/services/store/clients/redis.js +1 -1
  31. package/build/services/store/index.js +3 -0
  32. package/build/services/telemetry/index.js +7 -1
  33. package/build/types/activity.d.ts +5 -3
  34. package/build/types/durable.d.ts +13 -2
  35. package/build/types/hook.d.ts +0 -1
  36. package/build/types/index.d.ts +1 -1
  37. package/modules/errors.ts +4 -2
  38. package/package.json +2 -1
  39. package/services/activities/activity.ts +10 -8
  40. package/services/activities/hook.ts +13 -10
  41. package/services/activities/signal.ts +17 -3
  42. package/services/durable/client.ts +40 -15
  43. package/services/durable/factory.ts +274 -46
  44. package/services/durable/handle.ts +18 -5
  45. package/services/durable/search.ts +38 -10
  46. package/services/durable/worker.ts +30 -24
  47. package/services/durable/workflow.ts +158 -40
  48. package/services/engine/index.ts +8 -12
  49. package/services/hotmesh/index.ts +3 -3
  50. package/services/signaler/store.ts +18 -8
  51. package/services/signaler/stream.ts +1 -0
  52. package/services/store/clients/redis.ts +1 -1
  53. package/services/store/index.ts +2 -0
  54. package/services/telemetry/index.ts +6 -1
  55. package/types/activity.ts +10 -8
  56. package/types/durable.ts +14 -1
  57. package/types/hook.ts +0 -1
  58. package/types/index.ts +1 -0
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'; //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
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
@@ -15,9 +15,10 @@ type WorkflowSearchOptions = {
15
15
  }
16
16
 
17
17
  type WorkflowOptions = {
18
+ namespace?: string; //'durable' is the default namespace if not provided; similar to setting `appid` in the YAML
18
19
  taskQueue: string;
19
20
  args: any[]; //input arguments to pass in
20
- workflowId: string; //execution id (the job id)
21
+ workflowId?: string; //execution id (the job id)
21
22
  workflowName?: string; //the name of the user's workflow function
22
23
  parentWorkflowId?: string; //system reserved; the id of the parent; if present the flow will not self-clean until the parent that spawned it self-cleans
23
24
  workflowTrace?: string;
@@ -26,6 +27,16 @@ type WorkflowOptions = {
26
27
  config?: WorkflowConfig;
27
28
  }
28
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
+
29
40
  type SignalOptions = {
30
41
  taskQueue: string;
31
42
  data: Record<string, any>; //input data (any serializable object)
@@ -71,6 +82,7 @@ type WorkerConfig = {
71
82
  }
72
83
 
73
84
  type WorkerOptions = {
85
+ logLevel?: string; //debug, info, warn, error
74
86
  maxSystemRetries?: number; //1-3 (10ms, 100ms, 1_000ms)
75
87
  backoffCoefficient?: number; //2-10ish
76
88
  }
@@ -107,6 +119,7 @@ export {
107
119
  ProxyType,
108
120
  Registry,
109
121
  SignalOptions,
122
+ HookOptions,
110
123
  WorkerConfig,
111
124
  WorkflowConfig,
112
125
  WorkerOptions,
package/types/hook.ts CHANGED
@@ -16,7 +16,6 @@ interface HookConditions {
16
16
 
17
17
  interface HookRule {
18
18
  to: string;
19
- keep_alive?: boolean; //if true, the hook will not be deleted after use
20
19
  conditions: HookConditions;
21
20
  }
22
21
 
package/types/index.ts CHANGED
@@ -37,6 +37,7 @@ export {
37
37
  NativeConnection,
38
38
  ProxyType,
39
39
  Registry,
40
+ HookOptions,
40
41
  WorkflowConfig,
41
42
  WorkerConfig,
42
43
  WorkerOptions,