@hotmeshio/hotmesh 0.8.0 → 0.10.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.
- package/README.md +178 -43
- package/build/index.d.ts +12 -11
- package/build/index.js +15 -13
- package/build/modules/enums.d.ts +23 -34
- package/build/modules/enums.js +26 -38
- package/build/modules/errors.d.ts +16 -16
- package/build/modules/errors.js +37 -37
- package/build/package.json +63 -67
- package/build/services/activities/activity.d.ts +58 -7
- package/build/services/activities/activity.js +67 -38
- package/build/services/activities/await.d.ts +101 -0
- package/build/services/activities/await.js +101 -0
- package/build/services/activities/cycle.d.ts +82 -0
- package/build/services/activities/cycle.js +86 -8
- package/build/services/activities/hook.d.ts +139 -1
- package/build/services/activities/hook.js +140 -2
- package/build/services/activities/interrupt.d.ts +112 -0
- package/build/services/activities/interrupt.js +118 -5
- package/build/services/activities/signal.d.ts +108 -3
- package/build/services/activities/signal.js +113 -8
- package/build/services/activities/trigger.d.ts +56 -4
- package/build/services/activities/trigger.js +119 -35
- package/build/services/activities/worker.d.ts +107 -0
- package/build/services/activities/worker.js +107 -0
- package/build/services/collator/index.d.ts +3 -15
- package/build/services/collator/index.js +7 -34
- package/build/services/dba/index.d.ts +171 -0
- package/build/services/dba/index.js +280 -0
- package/build/services/{memflow → durable}/client.d.ts +3 -3
- package/build/services/{memflow → durable}/client.js +15 -15
- package/build/services/{memflow → durable}/connection.d.ts +2 -2
- package/build/services/{memflow → durable}/connection.js +1 -1
- package/build/services/{memflow → durable}/exporter.d.ts +6 -6
- package/build/services/{memflow → durable}/exporter.js +2 -2
- package/build/services/{memflow → durable}/handle.d.ts +4 -4
- package/build/services/{memflow → durable}/handle.js +3 -3
- package/build/services/{memflow → durable}/index.d.ts +126 -34
- package/build/services/{memflow → durable}/index.js +146 -50
- package/build/services/{memflow → durable}/interceptor.d.ts +45 -22
- package/build/services/{memflow → durable}/interceptor.js +54 -21
- package/build/services/{memflow → durable}/schemas/factory.d.ts +4 -4
- package/build/services/{memflow → durable}/schemas/factory.js +5 -5
- package/build/services/{memflow → durable}/search.d.ts +1 -1
- package/build/services/{memflow → durable}/search.js +4 -4
- package/build/services/{memflow → durable}/worker.d.ts +11 -11
- package/build/services/{memflow → durable}/worker.js +61 -60
- package/build/services/durable/workflow/all.d.ts +32 -0
- package/build/services/durable/workflow/all.js +40 -0
- package/build/services/{memflow → durable}/workflow/common.d.ts +5 -5
- package/build/services/durable/workflow/common.js +47 -0
- package/build/services/durable/workflow/context.d.ts +49 -0
- package/build/services/durable/workflow/context.js +88 -0
- package/build/services/durable/workflow/didRun.d.ts +27 -0
- package/build/services/durable/workflow/didRun.js +42 -0
- package/build/services/durable/workflow/emit.d.ts +50 -0
- package/build/services/durable/workflow/emit.js +68 -0
- package/build/services/durable/workflow/enrich.d.ts +37 -0
- package/build/services/durable/workflow/enrich.js +45 -0
- package/build/services/durable/workflow/entityMethods.d.ts +61 -0
- package/build/services/durable/workflow/entityMethods.js +80 -0
- package/build/services/durable/workflow/execChild.d.ts +106 -0
- package/build/services/durable/workflow/execChild.js +194 -0
- package/build/services/durable/workflow/execHook.d.ts +80 -0
- package/build/services/durable/workflow/execHook.js +97 -0
- package/build/services/durable/workflow/execHookBatch.d.ts +107 -0
- package/build/services/durable/workflow/execHookBatch.js +129 -0
- package/build/services/durable/workflow/hook.d.ts +74 -0
- package/build/services/durable/workflow/hook.js +123 -0
- package/build/services/durable/workflow/index.d.ts +129 -0
- package/build/services/{memflow → durable}/workflow/index.js +66 -11
- package/build/services/durable/workflow/interrupt.d.ts +55 -0
- package/build/services/durable/workflow/interrupt.js +70 -0
- package/build/services/durable/workflow/interruption.d.ts +61 -0
- package/build/services/durable/workflow/interruption.js +76 -0
- package/build/services/durable/workflow/isSideEffectAllowed.d.ts +27 -0
- package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.js +21 -4
- package/build/services/durable/workflow/proxyActivities.d.ts +119 -0
- package/build/services/durable/workflow/proxyActivities.js +214 -0
- package/build/services/durable/workflow/random.d.ts +36 -0
- package/build/services/durable/workflow/random.js +46 -0
- package/build/services/durable/workflow/searchMethods.d.ts +53 -0
- package/build/services/durable/workflow/searchMethods.js +72 -0
- package/build/services/durable/workflow/signal.d.ts +58 -0
- package/build/services/durable/workflow/signal.js +79 -0
- package/build/services/durable/workflow/sleepFor.d.ts +63 -0
- package/build/services/durable/workflow/sleepFor.js +91 -0
- package/build/services/durable/workflow/trace.d.ts +47 -0
- package/build/services/durable/workflow/trace.js +66 -0
- package/build/services/durable/workflow/waitFor.d.ts +66 -0
- package/build/services/durable/workflow/waitFor.js +93 -0
- package/build/services/engine/index.d.ts +18 -2
- package/build/services/engine/index.js +14 -4
- package/build/services/exporter/index.d.ts +2 -0
- package/build/services/exporter/index.js +1 -0
- package/build/services/hotmesh/index.d.ts +471 -236
- package/build/services/hotmesh/index.js +473 -238
- package/build/services/store/index.d.ts +1 -1
- package/build/services/store/providers/postgres/postgres.d.ts +1 -1
- package/build/services/store/providers/postgres/postgres.js +4 -3
- package/build/services/telemetry/index.js +6 -0
- package/build/services/{meshcall → virtual}/index.d.ts +29 -29
- package/build/services/{meshcall → virtual}/index.js +49 -49
- package/build/services/{meshcall → virtual}/schemas/factory.d.ts +1 -1
- package/build/services/{meshcall → virtual}/schemas/factory.js +1 -1
- package/build/types/activity.d.ts +1 -1
- package/build/types/dba.d.ts +64 -0
- package/build/types/{memflow.d.ts → durable.d.ts} +75 -19
- package/build/types/error.d.ts +5 -5
- package/build/types/exporter.d.ts +1 -1
- package/build/types/hotmesh.d.ts +1 -1
- package/build/types/index.d.ts +5 -4
- package/build/types/job.d.ts +1 -1
- package/build/types/quorum.d.ts +2 -2
- package/build/types/{meshcall.d.ts → virtual.d.ts} +15 -15
- package/build/types/virtual.js +2 -0
- package/index.ts +15 -13
- package/package.json +63 -67
- package/vitest.config.ts +17 -0
- package/.claude/settings.local.json +0 -7
- package/build/services/memflow/workflow/all.d.ts +0 -7
- package/build/services/memflow/workflow/all.js +0 -15
- package/build/services/memflow/workflow/common.js +0 -47
- package/build/services/memflow/workflow/context.d.ts +0 -6
- package/build/services/memflow/workflow/context.js +0 -45
- package/build/services/memflow/workflow/didRun.d.ts +0 -7
- package/build/services/memflow/workflow/didRun.js +0 -22
- package/build/services/memflow/workflow/emit.d.ts +0 -11
- package/build/services/memflow/workflow/emit.js +0 -29
- package/build/services/memflow/workflow/enrich.d.ts +0 -9
- package/build/services/memflow/workflow/enrich.js +0 -17
- package/build/services/memflow/workflow/entityMethods.d.ts +0 -14
- package/build/services/memflow/workflow/entityMethods.js +0 -33
- package/build/services/memflow/workflow/execChild.d.ts +0 -18
- package/build/services/memflow/workflow/execChild.js +0 -106
- package/build/services/memflow/workflow/execHook.d.ts +0 -65
- package/build/services/memflow/workflow/execHook.js +0 -83
- package/build/services/memflow/workflow/execHookBatch.d.ts +0 -54
- package/build/services/memflow/workflow/execHookBatch.js +0 -77
- package/build/services/memflow/workflow/hook.d.ts +0 -9
- package/build/services/memflow/workflow/hook.js +0 -58
- package/build/services/memflow/workflow/index.d.ts +0 -74
- package/build/services/memflow/workflow/interrupt.d.ts +0 -9
- package/build/services/memflow/workflow/interrupt.js +0 -24
- package/build/services/memflow/workflow/interruption.d.ts +0 -28
- package/build/services/memflow/workflow/interruption.js +0 -43
- package/build/services/memflow/workflow/isSideEffectAllowed.d.ts +0 -10
- package/build/services/memflow/workflow/proxyActivities.d.ts +0 -91
- package/build/services/memflow/workflow/proxyActivities.js +0 -176
- package/build/services/memflow/workflow/random.d.ts +0 -6
- package/build/services/memflow/workflow/random.js +0 -16
- package/build/services/memflow/workflow/searchMethods.d.ts +0 -6
- package/build/services/memflow/workflow/searchMethods.js +0 -25
- package/build/services/memflow/workflow/signal.d.ts +0 -29
- package/build/services/memflow/workflow/signal.js +0 -50
- package/build/services/memflow/workflow/sleepFor.d.ts +0 -24
- package/build/services/memflow/workflow/sleepFor.js +0 -52
- package/build/services/memflow/workflow/trace.d.ts +0 -14
- package/build/services/memflow/workflow/trace.js +0 -33
- package/build/services/memflow/workflow/waitFor.d.ts +0 -29
- package/build/services/memflow/workflow/waitFor.js +0 -56
- /package/build/services/{memflow → durable}/entity.d.ts +0 -0
- /package/build/services/{memflow → durable}/entity.js +0 -0
- /package/build/types/{memflow.js → dba.js} +0 -0
- /package/build/types/{meshcall.js → durable.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivityDuplex } from '../types/activity';
|
|
2
2
|
import { CollationFaultType, CollationStage } from '../types/collator';
|
|
3
|
-
import {
|
|
3
|
+
import { DurableChildErrorType, DurableProxyErrorType, DurableSleepErrorType, DurableWaitForAllErrorType, DurableWaitForErrorType } from '../types/error';
|
|
4
4
|
declare class GetStateError extends Error {
|
|
5
5
|
jobId: string;
|
|
6
6
|
code: number;
|
|
@@ -9,16 +9,16 @@ declare class GetStateError extends Error {
|
|
|
9
9
|
declare class SetStateError extends Error {
|
|
10
10
|
constructor();
|
|
11
11
|
}
|
|
12
|
-
declare class
|
|
12
|
+
declare class DurableWaitForError extends Error {
|
|
13
13
|
code: number;
|
|
14
14
|
signalId: string;
|
|
15
15
|
workflowId: string;
|
|
16
16
|
index: number;
|
|
17
17
|
workflowDimension: string;
|
|
18
18
|
type: string;
|
|
19
|
-
constructor(params:
|
|
19
|
+
constructor(params: DurableWaitForErrorType);
|
|
20
20
|
}
|
|
21
|
-
declare class
|
|
21
|
+
declare class DurableProxyError extends Error {
|
|
22
22
|
activityName: string;
|
|
23
23
|
arguments: string[];
|
|
24
24
|
backoffCoefficient: number;
|
|
@@ -33,9 +33,9 @@ declare class MemFlowProxyError extends Error {
|
|
|
33
33
|
workflowId: string;
|
|
34
34
|
workflowTopic: string;
|
|
35
35
|
type: string;
|
|
36
|
-
constructor(params:
|
|
36
|
+
constructor(params: DurableProxyErrorType);
|
|
37
37
|
}
|
|
38
|
-
declare class
|
|
38
|
+
declare class DurableChildError extends Error {
|
|
39
39
|
await: boolean;
|
|
40
40
|
entity: string;
|
|
41
41
|
arguments: string[];
|
|
@@ -53,9 +53,9 @@ declare class MemFlowChildError extends Error {
|
|
|
53
53
|
workflowId: string;
|
|
54
54
|
workflowTopic: string;
|
|
55
55
|
type: string;
|
|
56
|
-
constructor(params:
|
|
56
|
+
constructor(params: DurableChildErrorType);
|
|
57
57
|
}
|
|
58
|
-
declare class
|
|
58
|
+
declare class DurableWaitForAllError extends Error {
|
|
59
59
|
items: any[];
|
|
60
60
|
code: number;
|
|
61
61
|
workflowDimension: string;
|
|
@@ -66,33 +66,33 @@ declare class MemFlowWaitForAllError extends Error {
|
|
|
66
66
|
workflowId: string;
|
|
67
67
|
workflowTopic: string;
|
|
68
68
|
type: string;
|
|
69
|
-
constructor(params:
|
|
69
|
+
constructor(params: DurableWaitForAllErrorType);
|
|
70
70
|
}
|
|
71
|
-
declare class
|
|
71
|
+
declare class DurableSleepError extends Error {
|
|
72
72
|
workflowId: string;
|
|
73
73
|
code: number;
|
|
74
74
|
duration: number;
|
|
75
75
|
index: number;
|
|
76
76
|
workflowDimension: string;
|
|
77
77
|
type: string;
|
|
78
|
-
constructor(params:
|
|
78
|
+
constructor(params: DurableSleepErrorType);
|
|
79
79
|
}
|
|
80
|
-
declare class
|
|
80
|
+
declare class DurableTimeoutError extends Error {
|
|
81
81
|
code: number;
|
|
82
82
|
type: string;
|
|
83
83
|
constructor(message: string, stack?: string);
|
|
84
84
|
}
|
|
85
|
-
declare class
|
|
85
|
+
declare class DurableMaxedError extends Error {
|
|
86
86
|
code: number;
|
|
87
87
|
type: string;
|
|
88
88
|
constructor(message: string, stackTrace?: string);
|
|
89
89
|
}
|
|
90
|
-
declare class
|
|
90
|
+
declare class DurableFatalError extends Error {
|
|
91
91
|
code: number;
|
|
92
92
|
type: string;
|
|
93
93
|
constructor(message: string, stackTrace?: string);
|
|
94
94
|
}
|
|
95
|
-
declare class
|
|
95
|
+
declare class DurableRetryError extends Error {
|
|
96
96
|
code: number;
|
|
97
97
|
type: string;
|
|
98
98
|
constructor(message: string, stackTrace?: string);
|
|
@@ -131,4 +131,4 @@ declare class CollationError extends Error {
|
|
|
131
131
|
fault: CollationFaultType;
|
|
132
132
|
constructor(status: number, leg: ActivityDuplex, stage: CollationStage, fault?: CollationFaultType);
|
|
133
133
|
}
|
|
134
|
-
export { CollationError,
|
|
134
|
+
export { CollationError, DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForAllError, DurableWaitForError, DuplicateJobError, ExecActivityError, GenerationalError, GetStateError, InactiveJobError, MapDataError, RegisterTimeoutError, SetStateError, };
|
package/build/modules/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetStateError = exports.RegisterTimeoutError = exports.MapDataError = exports.InactiveJobError = exports.GetStateError = exports.GenerationalError = exports.ExecActivityError = exports.DuplicateJobError = exports.
|
|
3
|
+
exports.SetStateError = exports.RegisterTimeoutError = exports.MapDataError = exports.InactiveJobError = exports.GetStateError = exports.GenerationalError = exports.ExecActivityError = exports.DuplicateJobError = exports.DurableWaitForError = exports.DurableWaitForAllError = exports.DurableTimeoutError = exports.DurableSleepError = exports.DurableRetryError = exports.DurableProxyError = exports.DurableMaxedError = exports.DurableFatalError = exports.DurableChildError = exports.CollationError = void 0;
|
|
4
4
|
const enums_1 = require("./enums");
|
|
5
5
|
class GetStateError extends Error {
|
|
6
6
|
constructor(jobId) {
|
|
@@ -16,21 +16,21 @@ class SetStateError extends Error {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.SetStateError = SetStateError;
|
|
19
|
-
class
|
|
19
|
+
class DurableWaitForError extends Error {
|
|
20
20
|
constructor(params) {
|
|
21
21
|
super(`WaitFor Interruption`);
|
|
22
|
-
this.type = '
|
|
22
|
+
this.type = 'DurableWaitForError';
|
|
23
23
|
this.signalId = params.signalId;
|
|
24
24
|
this.index = params.index;
|
|
25
25
|
this.workflowDimension = params.workflowDimension;
|
|
26
|
-
this.code = enums_1.
|
|
26
|
+
this.code = enums_1.HMSH_CODE_DURABLE_WAIT;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
exports.
|
|
30
|
-
class
|
|
29
|
+
exports.DurableWaitForError = DurableWaitForError;
|
|
30
|
+
class DurableProxyError extends Error {
|
|
31
31
|
constructor(params) {
|
|
32
32
|
super(`ProxyActivity Interruption`);
|
|
33
|
-
this.type = '
|
|
33
|
+
this.type = 'DurableProxyError';
|
|
34
34
|
this.arguments = params.arguments;
|
|
35
35
|
this.workflowId = params.workflowId;
|
|
36
36
|
this.workflowTopic = params.workflowTopic;
|
|
@@ -43,14 +43,14 @@ class MemFlowProxyError extends Error {
|
|
|
43
43
|
this.backoffCoefficient = params.backoffCoefficient;
|
|
44
44
|
this.maximumAttempts = params.maximumAttempts;
|
|
45
45
|
this.maximumInterval = params.maximumInterval;
|
|
46
|
-
this.code = enums_1.
|
|
46
|
+
this.code = enums_1.HMSH_CODE_DURABLE_PROXY;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
exports.
|
|
50
|
-
class
|
|
49
|
+
exports.DurableProxyError = DurableProxyError;
|
|
50
|
+
class DurableChildError extends Error {
|
|
51
51
|
constructor(params) {
|
|
52
52
|
super(`ExecChild Interruption`);
|
|
53
|
-
this.type = '
|
|
53
|
+
this.type = 'DurableChildError';
|
|
54
54
|
this.arguments = params.arguments;
|
|
55
55
|
this.workflowId = params.workflowId;
|
|
56
56
|
this.workflowTopic = params.workflowTopic;
|
|
@@ -62,18 +62,18 @@ class MemFlowChildError extends Error {
|
|
|
62
62
|
this.entity = params.entity;
|
|
63
63
|
this.index = params.index;
|
|
64
64
|
this.workflowDimension = params.workflowDimension;
|
|
65
|
-
this.code = enums_1.
|
|
65
|
+
this.code = enums_1.HMSH_CODE_DURABLE_CHILD;
|
|
66
66
|
this.await = params.await;
|
|
67
67
|
this.backoffCoefficient = params.backoffCoefficient;
|
|
68
68
|
this.maximumAttempts = params.maximumAttempts;
|
|
69
69
|
this.maximumInterval = params.maximumInterval;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
exports.
|
|
73
|
-
class
|
|
72
|
+
exports.DurableChildError = DurableChildError;
|
|
73
|
+
class DurableWaitForAllError extends Error {
|
|
74
74
|
constructor(params) {
|
|
75
75
|
super(`Collation Interruption`);
|
|
76
|
-
this.type = '
|
|
76
|
+
this.type = 'DurableWaitForAllError';
|
|
77
77
|
this.items = params.items;
|
|
78
78
|
this.size = params.size;
|
|
79
79
|
this.workflowId = params.workflowId;
|
|
@@ -82,66 +82,66 @@ class MemFlowWaitForAllError extends Error {
|
|
|
82
82
|
this.originJobId = params.originJobId;
|
|
83
83
|
this.index = params.index;
|
|
84
84
|
this.workflowDimension = params.workflowDimension;
|
|
85
|
-
this.code = enums_1.
|
|
85
|
+
this.code = enums_1.HMSH_CODE_DURABLE_ALL;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
exports.
|
|
89
|
-
class
|
|
88
|
+
exports.DurableWaitForAllError = DurableWaitForAllError;
|
|
89
|
+
class DurableSleepError extends Error {
|
|
90
90
|
constructor(params) {
|
|
91
91
|
super(`SleepFor Interruption`);
|
|
92
|
-
this.type = '
|
|
92
|
+
this.type = 'DurableSleepError';
|
|
93
93
|
this.duration = params.duration;
|
|
94
94
|
this.workflowId = params.workflowId;
|
|
95
95
|
this.index = params.index;
|
|
96
96
|
this.workflowDimension = params.workflowDimension;
|
|
97
|
-
this.code = enums_1.
|
|
97
|
+
this.code = enums_1.HMSH_CODE_DURABLE_SLEEP;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
exports.
|
|
101
|
-
class
|
|
100
|
+
exports.DurableSleepError = DurableSleepError;
|
|
101
|
+
class DurableTimeoutError extends Error {
|
|
102
102
|
constructor(message, stack) {
|
|
103
103
|
super(message);
|
|
104
|
-
this.type = '
|
|
104
|
+
this.type = 'DurableTimeoutError';
|
|
105
105
|
if (this.stack) {
|
|
106
106
|
this.stack = stack;
|
|
107
107
|
}
|
|
108
|
-
this.code = enums_1.
|
|
108
|
+
this.code = enums_1.HMSH_CODE_DURABLE_TIMEOUT;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
exports.
|
|
112
|
-
class
|
|
111
|
+
exports.DurableTimeoutError = DurableTimeoutError;
|
|
112
|
+
class DurableMaxedError extends Error {
|
|
113
113
|
constructor(message, stackTrace) {
|
|
114
114
|
super(message);
|
|
115
|
-
this.type = '
|
|
115
|
+
this.type = 'DurableMaxedError';
|
|
116
116
|
if (stackTrace) {
|
|
117
117
|
this.stack = stackTrace;
|
|
118
118
|
}
|
|
119
|
-
this.code = enums_1.
|
|
119
|
+
this.code = enums_1.HMSH_CODE_DURABLE_MAXED;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
exports.
|
|
123
|
-
class
|
|
122
|
+
exports.DurableMaxedError = DurableMaxedError;
|
|
123
|
+
class DurableFatalError extends Error {
|
|
124
124
|
constructor(message, stackTrace) {
|
|
125
125
|
super(message);
|
|
126
|
-
this.type = '
|
|
126
|
+
this.type = 'DurableFatalError';
|
|
127
127
|
if (stackTrace) {
|
|
128
128
|
this.stack = stackTrace;
|
|
129
129
|
}
|
|
130
|
-
this.code = enums_1.
|
|
130
|
+
this.code = enums_1.HMSH_CODE_DURABLE_FATAL;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
exports.
|
|
134
|
-
class
|
|
133
|
+
exports.DurableFatalError = DurableFatalError;
|
|
134
|
+
class DurableRetryError extends Error {
|
|
135
135
|
constructor(message, stackTrace) {
|
|
136
136
|
super(message);
|
|
137
|
-
this.type = '
|
|
137
|
+
this.type = 'DurableRetryError';
|
|
138
138
|
if (stackTrace) {
|
|
139
139
|
this.stack = stackTrace;
|
|
140
140
|
}
|
|
141
|
-
this.code = enums_1.
|
|
141
|
+
this.code = enums_1.HMSH_CODE_DURABLE_RETRYABLE;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
exports.
|
|
144
|
+
exports.DurableRetryError = DurableRetryError;
|
|
145
145
|
class MapDataError extends Error {
|
|
146
146
|
constructor() {
|
|
147
147
|
super('Error occurred while mapping data');
|
package/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Permanent-Memory Workflows & AI Agents",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -19,72 +19,70 @@
|
|
|
19
19
|
"lint": "eslint . --ext .ts",
|
|
20
20
|
"lint:fix": "eslint . --fix --ext .ts",
|
|
21
21
|
"start": "ts-node src/index.ts",
|
|
22
|
-
"test": "
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
25
|
-
"test:
|
|
26
|
-
"test:connect
|
|
27
|
-
"test:connect:
|
|
28
|
-
"test:
|
|
29
|
-
"test:
|
|
30
|
-
"test:
|
|
31
|
-
"test:
|
|
32
|
-
"test:
|
|
33
|
-
"test:
|
|
34
|
-
"test:
|
|
35
|
-
"test:
|
|
36
|
-
"test:
|
|
37
|
-
"test:
|
|
38
|
-
"test:
|
|
39
|
-
"test:
|
|
40
|
-
"test:
|
|
41
|
-
"test:
|
|
42
|
-
"test:
|
|
43
|
-
"test:
|
|
44
|
-
"test:
|
|
45
|
-
"test:
|
|
46
|
-
"test:
|
|
47
|
-
"test:
|
|
48
|
-
"test:
|
|
49
|
-
"test:
|
|
50
|
-
"test:
|
|
51
|
-
"test:
|
|
52
|
-
"test:
|
|
53
|
-
"test:
|
|
54
|
-
"test:
|
|
55
|
-
"test:
|
|
56
|
-
"test:
|
|
57
|
-
"test:
|
|
58
|
-
"test:
|
|
59
|
-
"test:
|
|
60
|
-
"test:
|
|
61
|
-
"test:
|
|
62
|
-
"test:
|
|
63
|
-
"test:
|
|
64
|
-
"test:
|
|
65
|
-
"test:
|
|
66
|
-
"test:
|
|
67
|
-
"test:
|
|
68
|
-
"test:
|
|
69
|
-
"test:
|
|
70
|
-
"test:
|
|
71
|
-
"test:
|
|
72
|
-
"test:
|
|
73
|
-
"test:
|
|
74
|
-
"test:
|
|
75
|
-
"test:
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"test:await": "vitest run tests/functional/awaiter/postgres.test.ts",
|
|
25
|
+
"test:compile": "vitest run tests/functional/compile/index.test.ts",
|
|
26
|
+
"test:connect": "vitest run tests/unit/services/connector",
|
|
27
|
+
"test:connect:postgres": "vitest run tests/unit/services/connector/providers/postgres.test.ts",
|
|
28
|
+
"test:connect:nats": "vitest run tests/unit/services/connector/providers/nats.test.ts",
|
|
29
|
+
"test:durable": "vitest run tests/durable",
|
|
30
|
+
"test:durable:postgres": "HMSH_LOGLEVEL=info vitest run tests/durable",
|
|
31
|
+
"test:durable:basic": "HMSH_LOGLEVEL=info vitest run tests/durable/basic/postgres.test.ts",
|
|
32
|
+
"test:durable:collision": "vitest run tests/durable/collision/postgres.test.ts",
|
|
33
|
+
"test:durable:fatal": "vitest run tests/durable/fatal",
|
|
34
|
+
"test:durable:goodbye": "HMSH_LOGLEVEL=debug vitest run tests/durable/goodbye/postgres.test.ts",
|
|
35
|
+
"test:durable:interceptor": "HMSH_LOGLEVEL=info vitest run tests/durable/interceptor/postgres.test.ts",
|
|
36
|
+
"test:durable:entity": "HMSH_LOGLEVEL=debug vitest run tests/durable/entity/postgres.test.ts",
|
|
37
|
+
"test:durable:agent": "HMSH_LOGLEVEL=debug vitest run tests/durable/agent/postgres.test.ts",
|
|
38
|
+
"test:durable:hello": "HMSH_TELEMETRY=debug HMSH_LOGLEVEL=info vitest run tests/durable/helloworld/postgres.test.ts",
|
|
39
|
+
"test:durable:hook": "vitest run tests/durable/hook/postgres.test.ts",
|
|
40
|
+
"test:durable:interrupt": "vitest run tests/durable/interrupt/postgres.test.ts",
|
|
41
|
+
"test:durable:loopactivity": "vitest run tests/durable/loopactivity/postgres.test.ts",
|
|
42
|
+
"test:durable:nested": "vitest run tests/durable/nested/postgres.test.ts",
|
|
43
|
+
"test:durable:pipeline": "vitest run tests/durable/pipeline/postgres.test.ts",
|
|
44
|
+
"test:durable:retry": "vitest run tests/durable/retry/postgres.test.ts",
|
|
45
|
+
"test:durable:retrypolicy": "vitest run tests/durable/retry-policy",
|
|
46
|
+
"test:durable:sleep": "vitest run tests/durable/sleep/postgres.test.ts",
|
|
47
|
+
"test:durable:signal": "vitest run tests/durable/signal/postgres.test.ts",
|
|
48
|
+
"test:durable:unknown": "vitest run tests/durable/unknown/postgres.test.ts",
|
|
49
|
+
"test:dba": "vitest run tests/dba",
|
|
50
|
+
"test:cycle": "vitest run tests/functional/cycle",
|
|
51
|
+
"test:functional": "vitest run tests/functional",
|
|
52
|
+
"test:emit": "vitest run tests/functional/emit",
|
|
53
|
+
"test:pending": "vitest run tests/functional/pending/index.test.ts",
|
|
54
|
+
"test:hmsh": "vitest run tests/functional/postgres.test.ts",
|
|
55
|
+
"test:hook": "vitest run tests/functional/hook/postgres.test.ts",
|
|
56
|
+
"test:interrupt": "vitest run tests/functional/interrupt/postgres.test.ts",
|
|
57
|
+
"test:parallel": "vitest run tests/functional/parallel/index.test.ts",
|
|
58
|
+
"test:pipe": "vitest run tests/unit/services/pipe/index.test.ts",
|
|
59
|
+
"test:quorum": "vitest run tests/functional/quorum/postgres.test.ts",
|
|
60
|
+
"test:reclaim": "vitest run tests/functional/reclaim/postgres.test.ts",
|
|
61
|
+
"test:redeploy": "vitest run tests/functional/redeploy/postgres.test.ts",
|
|
62
|
+
"test:reporter": "vitest run tests/unit/services/reporter/index.test.ts",
|
|
63
|
+
"test:reentrant": "vitest run tests/functional/reentrant/postgres.test.ts",
|
|
64
|
+
"test:retry": "vitest run tests/functional/retry/postgres.test.ts",
|
|
65
|
+
"test:retrypolicy": "vitest run tests/functional/retry-policy",
|
|
66
|
+
"test:sequence": "HMSH_LOGLEVEL=info vitest run tests/functional/sequence/postgres.test.ts",
|
|
67
|
+
"test:signal": "vitest run tests/functional/signal/postgres.test.ts",
|
|
68
|
+
"test:status": "vitest run tests/functional/status/index.test.ts",
|
|
69
|
+
"test:providers": "vitest run tests/functional/*/providers",
|
|
70
|
+
"test:store:postgres": "vitest run tests/functional/store/providers/postgres/postgres.test.ts",
|
|
71
|
+
"test:stream:postgres": "vitest run tests/functional/stream/providers/postgres/postgres.test.ts",
|
|
72
|
+
"test:stream:nats": "vitest run tests/functional/stream/providers/nats/nats.test.ts",
|
|
73
|
+
"test:sub:postgres": "vitest run tests/functional/sub/providers/postgres/postgres.test.ts",
|
|
74
|
+
"test:sub:nats": "vitest run tests/functional/sub/providers/nats/nats.test.ts",
|
|
75
|
+
"test:trigger": "vitest run tests/unit/services/activities/trigger.test.ts",
|
|
76
|
+
"test:virtual": "vitest run tests/virtual",
|
|
77
|
+
"test:unit": "vitest run tests/unit"
|
|
76
78
|
},
|
|
77
79
|
"keywords": [
|
|
78
80
|
"Headless Orchestration",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"Operational Data",
|
|
81
|
+
"Durable Workflows",
|
|
82
|
+
"Data in Motion",
|
|
82
83
|
"Service Mesh",
|
|
83
84
|
"HotMesh",
|
|
84
|
-
"Postgres"
|
|
85
|
-
"OLAP",
|
|
86
|
-
"OLTP",
|
|
87
|
-
"HTAP"
|
|
85
|
+
"Postgres"
|
|
88
86
|
],
|
|
89
87
|
"author": "luke.birdeau@gmail.com",
|
|
90
88
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -99,8 +97,7 @@
|
|
|
99
97
|
"winston": "^3.8.2"
|
|
100
98
|
},
|
|
101
99
|
"devDependencies": {
|
|
102
|
-
"@types/
|
|
103
|
-
"@types/node": "^18.15.11",
|
|
100
|
+
"@types/node": "^20.19.33",
|
|
104
101
|
"@types/pg": "^8.10.0",
|
|
105
102
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
106
103
|
"@typescript-eslint/parser": "^5.62.0",
|
|
@@ -110,17 +107,16 @@
|
|
|
110
107
|
"eslint-plugin-import": "^2.29.1",
|
|
111
108
|
"eslint-plugin-prettier": "^5.1.3",
|
|
112
109
|
"javascript-obfuscator": "^0.6.2",
|
|
113
|
-
"jest": "^29.5.0",
|
|
114
110
|
"nats": "^2.28.0",
|
|
115
111
|
"openai": "^5.9.0",
|
|
116
112
|
"pg": "^8.10.0",
|
|
117
113
|
"rimraf": "^4.4.1",
|
|
118
114
|
"terser": "^5.37.0",
|
|
119
|
-
"ts-jest": "^29.0.5",
|
|
120
115
|
"ts-node": "^10.9.1",
|
|
121
116
|
"ts-node-dev": "^2.0.0",
|
|
122
117
|
"typedoc": "^0.26.4",
|
|
123
|
-
"typescript": "^5.0.4"
|
|
118
|
+
"typescript": "^5.0.4",
|
|
119
|
+
"vitest": "^2.1.9"
|
|
124
120
|
},
|
|
125
121
|
"peerDependencies": {
|
|
126
122
|
"nats": "^2.0.0",
|
|
@@ -7,13 +7,69 @@ import { JobState, JobStatus } from '../../types/job';
|
|
|
7
7
|
import { StringAnyType } from '../../types/serializer';
|
|
8
8
|
import { StreamCode, StreamData, StreamStatus } from '../../types/stream';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Base class for all HotMesh activity types. Activities are the execution
|
|
11
|
+
* units within a YAML-defined workflow graph. Each activity represents a
|
|
12
|
+
* node in a Directed Acyclic Graph (DAG) that the engine orchestrates.
|
|
13
|
+
*
|
|
14
|
+
* ## Activity Categories
|
|
15
|
+
*
|
|
16
|
+
* Activities fall into three execution categories:
|
|
17
|
+
*
|
|
18
|
+
* - **Category A (Duplex)**: Two-phase activities with Leg 1 (dispatch) and
|
|
19
|
+
* Leg 2 (response). Used by `Worker` and `Await`. Leg 1
|
|
20
|
+
* publishes a message and waits; Leg 2 handles the response via
|
|
21
|
+
* `processEvent` and transitions to adjacent activities.
|
|
22
|
+
*
|
|
23
|
+
* - **Category B (Leg1-only with children)**: Single-phase activities that
|
|
24
|
+
* execute work and transition to children using the crash-safe
|
|
25
|
+
* `executeLeg1StepProtocol`. Used by `Hook` (passthrough mode),
|
|
26
|
+
* `Signal`, and `Interrupt` (target mode).
|
|
27
|
+
*
|
|
28
|
+
* - **Category C (Leg1-only, no children)**: Terminal activities that
|
|
29
|
+
* execute without spawning children. Used by `Interrupt` (self mode).
|
|
30
|
+
*
|
|
31
|
+
* ## Shared YAML Configuration
|
|
32
|
+
*
|
|
33
|
+
* All activity types support these base properties in the YAML descriptor:
|
|
34
|
+
*
|
|
35
|
+
* | Property | Type | Description |
|
|
36
|
+
* |----------------------|---------|-------------|
|
|
37
|
+
* | `type` | string | Activity type: `trigger`, `worker`, `await`, `hook`, `signal`, `interrupt`, `cycle` |
|
|
38
|
+
* | `title` | string | Human-readable label for the activity |
|
|
39
|
+
* | `input.schema` | object | JSON Schema for input validation |
|
|
40
|
+
* | `input.maps` | object | Maps data from other activities into this activity's input |
|
|
41
|
+
* | `output.schema` | object | JSON Schema for output validation |
|
|
42
|
+
* | `output.maps` | object | Maps/transforms the activity's own output data |
|
|
43
|
+
* | `job.maps` | object | Maps activity data to the shared job state |
|
|
44
|
+
* | `emit` | boolean | If `true`, emits a message to the graph's `publishes` topic |
|
|
45
|
+
* | `persist` | boolean | If `true`, emits the job-completed event while keeping the job active |
|
|
46
|
+
* | `expire` | number | Seconds until the job expires after completion (`-1` = forever) |
|
|
47
|
+
* | `statusThreshold` | number | Custom semaphore threshold for Dynamic Activation Control |
|
|
48
|
+
* | `cycle` | boolean | If `true`, leaves Leg 2 open so the activity can be re-entered |
|
|
49
|
+
*
|
|
50
|
+
* ## Data Mapping Syntax
|
|
51
|
+
*
|
|
52
|
+
* Mapping expressions use curly-brace references to bind data between
|
|
53
|
+
* activities and the shared job state:
|
|
54
|
+
*
|
|
55
|
+
* ```yaml
|
|
56
|
+
* input:
|
|
57
|
+
* maps:
|
|
58
|
+
* x: '{t1.output.data.fieldName}' # reference another activity's output
|
|
59
|
+
* y: '{$self.output.data.fieldName}' # reference own output
|
|
60
|
+
* z: '{$job.data.fieldName}' # reference shared job state
|
|
61
|
+
* s: '{$app.settings.configKey}' # reference app-level settings
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @see {@link https://hotmeshio.github.io/sdk-typescript/docs/quickstart | Quick Start Guide}
|
|
65
|
+
* @see [Model Driven Development](https://hotmeshio.github.io/sdk-typescript/docs/model_driven_development)
|
|
11
66
|
*/
|
|
12
67
|
declare class Activity {
|
|
13
68
|
config: ActivityType;
|
|
14
69
|
data: ActivityData;
|
|
15
70
|
hook: ActivityData;
|
|
16
71
|
metadata: ActivityMetadata;
|
|
72
|
+
/** @hidden */
|
|
17
73
|
store: StoreService<ProviderClient, ProviderTransaction>;
|
|
18
74
|
context: JobState;
|
|
19
75
|
engine: EngineService;
|
|
@@ -95,7 +151,7 @@ declare class Activity {
|
|
|
95
151
|
getTriggerConfig(): Promise<ActivityType>;
|
|
96
152
|
getJobStatus(): null | number;
|
|
97
153
|
setStatus(amount: number, transaction?: ProviderTransaction): Promise<void | any>;
|
|
98
|
-
authorizeEntry(
|
|
154
|
+
authorizeEntry(_state: StringAnyType): string[];
|
|
99
155
|
bindDimensionalAddress(state: StringAnyType): void;
|
|
100
156
|
setState(transaction?: ProviderTransaction): Promise<string>;
|
|
101
157
|
bindJobMetadata(): void;
|
|
@@ -127,11 +183,6 @@ declare class Activity {
|
|
|
127
183
|
* @private
|
|
128
184
|
*/
|
|
129
185
|
shouldPersistJob(): boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Transition method for Category C (Leg1-only, no children, no semaphore change)
|
|
132
|
-
* and Category D (Trigger) activities. NOT used by the Leg2 step protocol.
|
|
133
|
-
*/
|
|
134
|
-
transition(adjacencyList: StreamData[], jobStatus: JobStatus): Promise<string[]>;
|
|
135
186
|
/**
|
|
136
187
|
* A job with a vale < -100_000_000 is considered interrupted,
|
|
137
188
|
* as the interruption event decrements the job status by 1billion.
|