@hotmeshio/hotmesh 0.1.15 → 0.1.16
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 +623 -209
- package/build/index.d.ts +14 -3
- package/build/index.js +17 -4
- package/build/modules/enums.d.ts +12 -12
- package/build/modules/enums.js +15 -25
- package/build/modules/errors.d.ts +16 -16
- package/build/modules/errors.js +28 -28
- package/build/modules/key.d.ts +0 -37
- package/build/modules/key.js +4 -45
- package/build/modules/utils.d.ts +7 -15
- package/build/modules/utils.js +21 -44
- package/build/package.json +18 -15
- package/build/services/activities/activity.d.ts +0 -31
- package/build/services/activities/activity.js +1 -50
- package/build/services/activities/await.js +0 -4
- package/build/services/activities/cycle.d.ts +0 -7
- package/build/services/activities/cycle.js +1 -16
- package/build/services/activities/hook.d.ts +0 -6
- package/build/services/activities/hook.js +2 -12
- package/build/services/activities/interrupt.js +0 -8
- package/build/services/activities/signal.d.ts +0 -6
- package/build/services/activities/signal.js +0 -15
- package/build/services/activities/trigger.d.ts +4 -5
- package/build/services/activities/trigger.js +22 -16
- package/build/services/activities/worker.js +0 -4
- package/build/services/collator/index.d.ts +0 -70
- package/build/services/collator/index.js +1 -91
- package/build/services/compiler/deployer.js +6 -38
- package/build/services/compiler/index.d.ts +0 -15
- package/build/services/compiler/index.js +0 -20
- package/build/services/compiler/validator.d.ts +0 -3
- package/build/services/compiler/validator.js +0 -25
- package/build/services/connector/clients/ioredis.js +0 -2
- package/build/services/connector/clients/redis.js +0 -2
- package/build/services/connector/index.js +0 -2
- package/build/services/engine/index.d.ts +1 -10
- package/build/services/engine/index.js +1 -48
- package/build/services/exporter/index.d.ts +0 -27
- package/build/services/exporter/index.js +0 -33
- package/build/services/hotmesh/index.d.ts +8 -4
- package/build/services/hotmesh/index.js +20 -19
- package/build/services/logger/index.js +0 -2
- package/build/services/mapper/index.d.ts +0 -14
- package/build/services/mapper/index.js +0 -14
- package/build/services/meshcall/index.d.ts +21 -0
- package/build/services/meshcall/index.js +202 -0
- package/build/services/meshcall/schemas/factory.d.ts +2 -0
- package/build/services/meshcall/schemas/factory.js +179 -0
- package/build/services/meshdata/index.d.ts +75 -0
- package/build/services/meshdata/index.js +541 -0
- package/build/services/meshflow/client.d.ts +18 -0
- package/build/services/{durable → meshflow}/client.js +9 -40
- package/build/services/{durable → meshflow}/connection.d.ts +2 -1
- package/build/services/{durable → meshflow}/connection.js +1 -0
- package/build/services/meshflow/exporter.d.ts +29 -0
- package/build/services/{durable → meshflow}/exporter.js +0 -29
- package/build/services/meshflow/handle.d.ts +22 -0
- package/build/services/{durable → meshflow}/handle.js +0 -46
- package/build/services/meshflow/index.d.ts +17 -0
- package/build/services/meshflow/index.js +23 -0
- package/build/services/meshflow/schemas/factory.d.ts +4 -0
- package/build/services/{durable → meshflow}/schemas/factory.js +2 -30
- package/build/services/meshflow/search.d.ts +23 -0
- package/build/services/{durable → meshflow}/search.js +0 -99
- package/build/services/{durable → meshflow}/worker.d.ts +3 -2
- package/build/services/{durable → meshflow}/worker.js +23 -39
- package/build/services/meshflow/workflow.d.ts +27 -0
- package/build/services/{durable → meshflow}/workflow.js +27 -169
- package/build/services/pipe/functions/date.d.ts +0 -7
- package/build/services/pipe/functions/date.js +0 -7
- package/build/services/pipe/functions/math.js +0 -2
- package/build/services/pipe/index.d.ts +0 -15
- package/build/services/pipe/index.js +2 -23
- package/build/services/quorum/index.d.ts +1 -7
- package/build/services/quorum/index.js +0 -21
- package/build/services/reporter/index.d.ts +0 -5
- package/build/services/reporter/index.js +0 -9
- package/build/services/router/index.d.ts +0 -9
- package/build/services/router/index.js +2 -30
- package/build/services/serializer/index.js +6 -23
- package/build/services/store/cache.d.ts +0 -19
- package/build/services/store/cache.js +0 -19
- package/build/services/store/clients/ioredis.d.ts +0 -6
- package/build/services/store/clients/ioredis.js +0 -7
- package/build/services/store/clients/redis.d.ts +0 -6
- package/build/services/store/clients/redis.js +0 -6
- package/build/services/store/index.d.ts +0 -55
- package/build/services/store/index.js +14 -87
- package/build/services/stream/clients/ioredis.js +1 -4
- package/build/services/task/index.d.ts +0 -9
- package/build/services/task/index.js +0 -31
- package/build/services/telemetry/index.d.ts +0 -7
- package/build/services/telemetry/index.js +1 -13
- package/build/services/worker/index.d.ts +1 -4
- package/build/services/worker/index.js +0 -6
- package/build/types/activity.d.ts +0 -81
- package/build/types/error.d.ts +5 -5
- package/build/types/exporter.d.ts +1 -14
- package/build/types/hotmesh.d.ts +4 -12
- package/build/types/hotmesh.js +0 -3
- package/build/types/index.d.ts +5 -3
- package/build/types/index.js +1 -1
- package/build/types/job.d.ts +1 -95
- package/build/types/meshcall.d.ts +54 -0
- package/build/types/meshdata.d.ts +59 -0
- package/build/types/meshdata.js +2 -0
- package/build/types/meshflow.d.ts +202 -0
- package/build/types/meshflow.js +2 -0
- package/build/types/pipe.d.ts +0 -65
- package/build/types/quorum.d.ts +0 -12
- package/build/types/redis.d.ts +0 -6
- package/build/types/stream.d.ts +0 -59
- package/build/types/stream.js +0 -4
- package/index.ts +22 -3
- package/package.json +18 -15
- package/typedoc.json +38 -0
- package/types/error.ts +5 -5
- package/types/exporter.ts +1 -1
- package/types/hotmesh.ts +3 -2
- package/types/index.ts +25 -7
- package/types/job.ts +19 -1
- package/types/meshcall.ts +123 -0
- package/types/meshdata.ts +273 -0
- package/types/{durable.ts → meshflow.ts} +33 -9
- package/build/services/durable/client.d.ts +0 -49
- package/build/services/durable/exporter.d.ts +0 -51
- package/build/services/durable/handle.d.ts +0 -58
- package/build/services/durable/index.d.ts +0 -19
- package/build/services/durable/index.js +0 -25
- package/build/services/durable/schemas/factory.d.ts +0 -33
- package/build/services/durable/search.d.ts +0 -120
- package/build/services/durable/workflow.d.ts +0 -143
- package/build/types/durable.d.ts +0 -467
- /package/build/types/{durable.js → meshcall.js} +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { WorkflowHandleService } from '../services/meshflow/handle';
|
|
2
|
+
import { LogLevel } from './logger';
|
|
3
|
+
import { RedisClass, RedisOptions } from './redis';
|
|
4
|
+
import { StringAnyType, StringStringType } from './serializer';
|
|
5
|
+
import { StreamData, StreamError } from './stream';
|
|
6
|
+
type WorkflowConfig = {
|
|
7
|
+
backoffCoefficient?: number;
|
|
8
|
+
maximumAttempts?: number;
|
|
9
|
+
maximumInterval?: string;
|
|
10
|
+
throwOnError?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type WorkflowContext = {
|
|
13
|
+
canRetry: boolean;
|
|
14
|
+
COUNTER: {
|
|
15
|
+
counter: number;
|
|
16
|
+
};
|
|
17
|
+
counter: number;
|
|
18
|
+
cursor: string;
|
|
19
|
+
replay: StringStringType;
|
|
20
|
+
namespace: string;
|
|
21
|
+
interruptionRegistry: any[];
|
|
22
|
+
originJobId: string;
|
|
23
|
+
workflowId: string;
|
|
24
|
+
workflowDimension: string;
|
|
25
|
+
workflowTopic: string;
|
|
26
|
+
workflowTrace: string;
|
|
27
|
+
workflowSpan: string;
|
|
28
|
+
raw: StreamData;
|
|
29
|
+
connection: Connection;
|
|
30
|
+
};
|
|
31
|
+
export type WorkflowSearchSchema = Record<string, {
|
|
32
|
+
type: 'TEXT' | 'NUMERIC' | 'TAG';
|
|
33
|
+
sortable?: boolean;
|
|
34
|
+
nostem?: boolean;
|
|
35
|
+
noindex?: boolean;
|
|
36
|
+
indexed?: boolean;
|
|
37
|
+
examples?: string[];
|
|
38
|
+
nilable?: boolean;
|
|
39
|
+
primitive?: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
40
|
+
required?: boolean;
|
|
41
|
+
enum?: string[];
|
|
42
|
+
pattern?: string;
|
|
43
|
+
fieldName?: string;
|
|
44
|
+
}>;
|
|
45
|
+
type WorkflowSearchOptions = {
|
|
46
|
+
index?: string;
|
|
47
|
+
prefix?: string[];
|
|
48
|
+
schema?: WorkflowSearchSchema;
|
|
49
|
+
data?: StringStringType;
|
|
50
|
+
};
|
|
51
|
+
type SearchResults = {
|
|
52
|
+
count: number;
|
|
53
|
+
query: string;
|
|
54
|
+
data: StringStringType[];
|
|
55
|
+
};
|
|
56
|
+
type WorkflowOptions = {
|
|
57
|
+
namespace?: string;
|
|
58
|
+
taskQueue?: string;
|
|
59
|
+
args: any[];
|
|
60
|
+
workflowId?: string;
|
|
61
|
+
entity?: string;
|
|
62
|
+
workflowName?: string;
|
|
63
|
+
parentWorkflowId?: string;
|
|
64
|
+
originJobId?: string;
|
|
65
|
+
workflowTrace?: string;
|
|
66
|
+
workflowSpan?: string;
|
|
67
|
+
search?: WorkflowSearchOptions;
|
|
68
|
+
marker?: StringStringType;
|
|
69
|
+
config?: WorkflowConfig;
|
|
70
|
+
expire?: number;
|
|
71
|
+
signalIn?: boolean;
|
|
72
|
+
await?: boolean;
|
|
73
|
+
pending?: number;
|
|
74
|
+
guid?: string;
|
|
75
|
+
};
|
|
76
|
+
type HookOptions = {
|
|
77
|
+
namespace?: string;
|
|
78
|
+
taskQueue?: string;
|
|
79
|
+
args: any[];
|
|
80
|
+
entity?: string;
|
|
81
|
+
workflowId?: string;
|
|
82
|
+
workflowName?: string;
|
|
83
|
+
search?: WorkflowSearchOptions;
|
|
84
|
+
config?: WorkflowConfig;
|
|
85
|
+
};
|
|
86
|
+
type SignalOptions = {
|
|
87
|
+
taskQueue: string;
|
|
88
|
+
data: StringAnyType;
|
|
89
|
+
workflowId: string;
|
|
90
|
+
workflowName?: string;
|
|
91
|
+
};
|
|
92
|
+
type ActivityWorkflowDataType = {
|
|
93
|
+
activityName: string;
|
|
94
|
+
arguments: any[];
|
|
95
|
+
workflowId: string;
|
|
96
|
+
workflowTopic: string;
|
|
97
|
+
};
|
|
98
|
+
type WorkflowDataType = {
|
|
99
|
+
arguments: any[];
|
|
100
|
+
workflowId: string;
|
|
101
|
+
workflowTopic: string;
|
|
102
|
+
workflowDimension?: string;
|
|
103
|
+
originJobId?: string;
|
|
104
|
+
canRetry?: boolean;
|
|
105
|
+
};
|
|
106
|
+
type ConnectionConfig = {
|
|
107
|
+
class: Partial<RedisClass>;
|
|
108
|
+
options: Partial<RedisOptions>;
|
|
109
|
+
};
|
|
110
|
+
type Connection = ConnectionConfig;
|
|
111
|
+
type ClientConfig = {
|
|
112
|
+
connection: Connection;
|
|
113
|
+
};
|
|
114
|
+
type Registry = {
|
|
115
|
+
[key: string]: Function;
|
|
116
|
+
};
|
|
117
|
+
type WorkerConfig = {
|
|
118
|
+
connection: Connection;
|
|
119
|
+
namespace?: string;
|
|
120
|
+
taskQueue: string;
|
|
121
|
+
workflow: Function | Record<string | symbol, Function>;
|
|
122
|
+
options?: WorkerOptions;
|
|
123
|
+
search?: WorkflowSearchOptions;
|
|
124
|
+
guid?: string;
|
|
125
|
+
};
|
|
126
|
+
type FindWhereQuery = {
|
|
127
|
+
field: string;
|
|
128
|
+
is: '=' | '==' | '>=' | '<=' | '[]';
|
|
129
|
+
value: string | boolean | number | [number, number];
|
|
130
|
+
type?: string;
|
|
131
|
+
};
|
|
132
|
+
type FindOptions = {
|
|
133
|
+
workflowName?: string;
|
|
134
|
+
taskQueue?: string;
|
|
135
|
+
namespace?: string;
|
|
136
|
+
index?: string;
|
|
137
|
+
search?: WorkflowSearchOptions;
|
|
138
|
+
};
|
|
139
|
+
type FindWhereOptions = {
|
|
140
|
+
options?: FindOptions;
|
|
141
|
+
count?: boolean;
|
|
142
|
+
query: FindWhereQuery[];
|
|
143
|
+
return?: string[];
|
|
144
|
+
limit?: {
|
|
145
|
+
start: number;
|
|
146
|
+
size: number;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
type FindJobsOptions = {
|
|
150
|
+
match?: string;
|
|
151
|
+
namespace?: string;
|
|
152
|
+
limit?: number;
|
|
153
|
+
batch?: number;
|
|
154
|
+
cursor?: string;
|
|
155
|
+
};
|
|
156
|
+
type WorkerOptions = {
|
|
157
|
+
logLevel?: LogLevel;
|
|
158
|
+
maximumAttempts?: number;
|
|
159
|
+
backoffCoefficient?: number;
|
|
160
|
+
maximumInterval?: string;
|
|
161
|
+
};
|
|
162
|
+
type ContextType = {
|
|
163
|
+
workflowId: string;
|
|
164
|
+
workflowTopic: string;
|
|
165
|
+
};
|
|
166
|
+
type FunctionSignature<T> = T extends (...args: infer A) => infer R ? (...args: A) => R : never;
|
|
167
|
+
type ProxyType<ACT> = {
|
|
168
|
+
[K in keyof ACT]: FunctionSignature<ACT[K]>;
|
|
169
|
+
};
|
|
170
|
+
type ActivityConfig = {
|
|
171
|
+
expire?: number;
|
|
172
|
+
startToCloseTimeout?: string;
|
|
173
|
+
activities?: any;
|
|
174
|
+
retryPolicy?: {
|
|
175
|
+
maximumAttempts?: number;
|
|
176
|
+
backoffCoefficient?: number;
|
|
177
|
+
maximumInterval?: string;
|
|
178
|
+
throwOnError?: boolean;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
type ProxyResponseType<T> = {
|
|
182
|
+
data?: T;
|
|
183
|
+
$error?: StreamError;
|
|
184
|
+
done?: boolean;
|
|
185
|
+
jc: string;
|
|
186
|
+
ju: string;
|
|
187
|
+
};
|
|
188
|
+
type ChildResponseType<T> = {
|
|
189
|
+
data?: T;
|
|
190
|
+
$error?: StreamError;
|
|
191
|
+
done?: boolean;
|
|
192
|
+
jc: string;
|
|
193
|
+
ju: string;
|
|
194
|
+
};
|
|
195
|
+
interface ClientWorkflow {
|
|
196
|
+
start(options: WorkflowOptions): Promise<WorkflowHandleService>;
|
|
197
|
+
signal(signalId: string, data: StringAnyType, namespace?: string): Promise<string>;
|
|
198
|
+
hook(options: HookOptions): Promise<string>;
|
|
199
|
+
getHandle(taskQueue: string, workflowName: string, workflowId: string, namespace?: string): Promise<WorkflowHandleService>;
|
|
200
|
+
search(taskQueue: string, workflowName: string, namespace: string | null, index: string, ...query: string[]): Promise<string[]>;
|
|
201
|
+
}
|
|
202
|
+
export { ActivityConfig, ActivityWorkflowDataType, ChildResponseType, ClientConfig, ClientWorkflow, ContextType, ConnectionConfig, Connection, ProxyResponseType, ProxyType, Registry, SignalOptions, FindJobsOptions, FindOptions, FindWhereOptions, FindWhereQuery, HookOptions, SearchResults, WorkerConfig, WorkflowConfig, WorkerOptions, WorkflowSearchOptions, WorkflowDataType, WorkflowOptions, WorkflowContext, };
|
package/build/types/pipe.d.ts
CHANGED
|
@@ -1,82 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a single cell value in a pipeline row
|
|
3
|
-
* If the value is a string, the value will be a literal OR mapping expression
|
|
4
|
-
*/
|
|
5
1
|
type PipeItem = string | boolean | number | null | object;
|
|
6
|
-
/**
|
|
7
|
-
* Array of `PipeItem` types.
|
|
8
|
-
*/
|
|
9
2
|
type PipeItems = PipeItem[];
|
|
10
|
-
/**
|
|
11
|
-
* Represents a new nested context in the pipeline.
|
|
12
|
-
* As the structure is recursive, the nested pipe may contain an
|
|
13
|
-
* array of `PipeItem[]`, `PipeObject`, OR `ReduceObject` items.
|
|
14
|
-
*/
|
|
15
3
|
type PipeObject = {
|
|
16
4
|
'@pipe': Array<PipeItem[] | PipeObject | ReduceObject>;
|
|
17
5
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Reduce is similar to Pipe in that it represents a new context
|
|
20
|
-
* and may include an array of `PipeItem[]`, `PipeObject`, or `ReduceObject`.
|
|
21
|
-
* But it also iterates and produces output. The context variables,
|
|
22
|
-
* `$input`, `$output`, `$item`, `$key`, and `$index` are available.
|
|
23
|
-
* @example
|
|
24
|
-
*
|
|
25
|
-
* // Example of a reduce expression. The optional object is empty and
|
|
26
|
-
* // serves as the $output during iteration. The last step in the iteration
|
|
27
|
-
* // sets $output. if ther are no more iterations, the $output is returned
|
|
28
|
-
* // and provided to the next step in the pipeline.
|
|
29
|
-
*
|
|
30
|
-
* // If data is:
|
|
31
|
-
* // { response: ['a', 'b', 'c'] }
|
|
32
|
-
*
|
|
33
|
-
* // The reduced/transformed expression will be:
|
|
34
|
-
* // { 'a': 0, 'b': 1, 'c': 2 }
|
|
35
|
-
*
|
|
36
|
-
* // Arrays and objects may be iterated over and transformed.
|
|
37
|
-
*
|
|
38
|
-
* //YAML
|
|
39
|
-
* '@pipe':
|
|
40
|
-
* - ['{data.response}', {}]
|
|
41
|
-
* - '@reduce':
|
|
42
|
-
* - '@pipe':
|
|
43
|
-
* - ['{$output}']
|
|
44
|
-
* - '@pipe':
|
|
45
|
-
* - ['{$item}']
|
|
46
|
-
* - '@pipe':
|
|
47
|
-
* - ['{$index}']
|
|
48
|
-
* - ['{@object.set}']
|
|
49
|
-
*/
|
|
50
6
|
type ReduceObject = {
|
|
51
7
|
'@reduce': Array<PipeItem[] | PipeObject | ReduceObject>;
|
|
52
8
|
};
|
|
53
|
-
/**
|
|
54
|
-
* Represents a sequence in the pipeline that can include arrays of `PipeItem`, `PipeObject`, or `ReduceObject`.
|
|
55
|
-
*/
|
|
56
9
|
type Pipe = (PipeItem[] | PipeObject | ReduceObject)[];
|
|
57
|
-
/**
|
|
58
|
-
* Defines the context of a pipeline operation.
|
|
59
|
-
*/
|
|
60
10
|
type PipeContext = {
|
|
61
|
-
/**
|
|
62
|
-
* Input of the current iteration.
|
|
63
|
-
*/
|
|
64
11
|
$input: unknown[];
|
|
65
|
-
/**
|
|
66
|
-
* Output of the current iteration and the final output for the reducer.
|
|
67
|
-
*/
|
|
68
12
|
$output: unknown;
|
|
69
|
-
/**
|
|
70
|
-
* Target item in the iterator.
|
|
71
|
-
*/
|
|
72
13
|
$item: unknown;
|
|
73
|
-
/**
|
|
74
|
-
* Array index as string or object key.
|
|
75
|
-
*/
|
|
76
14
|
$key: string;
|
|
77
|
-
/**
|
|
78
|
-
* Numeric index of the iterator.
|
|
79
|
-
*/
|
|
80
15
|
$index: number;
|
|
81
16
|
};
|
|
82
17
|
export { Pipe, PipeContext, PipeItem, PipeItems, PipeObject, ReduceObject };
|
package/build/types/quorum.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ interface NetworkStat {
|
|
|
15
15
|
tx_sec: number;
|
|
16
16
|
ms: number;
|
|
17
17
|
}
|
|
18
|
-
/** reveals: memory, cpu, network */
|
|
19
18
|
export interface SystemHealth {
|
|
20
19
|
TotalMemoryGB: string;
|
|
21
20
|
FreeMemoryGB: string;
|
|
@@ -24,15 +23,10 @@ export interface SystemHealth {
|
|
|
24
23
|
NetworkStats: NetworkStat[];
|
|
25
24
|
}
|
|
26
25
|
export type ThrottleOptions = {
|
|
27
|
-
/** target an engine OR worker by GUID */
|
|
28
26
|
guid?: string;
|
|
29
|
-
/** target a worker quorum */
|
|
30
27
|
topic?: string;
|
|
31
|
-
/** entity/noun */
|
|
32
28
|
entity?: string;
|
|
33
|
-
/** in milliseconds; set to -1 for indefinite throttle */
|
|
34
29
|
throttle: number;
|
|
35
|
-
/** namespace */
|
|
36
30
|
namespace?: string;
|
|
37
31
|
};
|
|
38
32
|
export interface QuorumProfile {
|
|
@@ -121,11 +115,5 @@ export type RollCallOptions = {
|
|
|
121
115
|
export type SubscriptionOptions = {
|
|
122
116
|
namespace?: string;
|
|
123
117
|
};
|
|
124
|
-
/**
|
|
125
|
-
* The types in this file are used to define those messages that are sent
|
|
126
|
-
* to hotmesh client instances when a new version is about to be activated.
|
|
127
|
-
* These messages serve to coordinate the cache invalidation and switch-over
|
|
128
|
-
* to the new version without any downtime and a coordinating parent server.
|
|
129
|
-
*/
|
|
130
118
|
export type QuorumMessage = PingMessage | PongMessage | ActivateMessage | WorkMessage | JobMessage | ThrottleMessage | RollCallMessage | CronMessage;
|
|
131
119
|
export {};
|
package/build/types/redis.d.ts
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import { StringStringType } from './serializer';
|
|
3
3
|
import { ReclaimedMessageType } from './stream';
|
|
4
4
|
type MultiResponseFlags = (string | number)[];
|
|
5
|
-
/**
|
|
6
|
-
* Redis types
|
|
7
|
-
*/
|
|
8
5
|
interface ConnectionOptions {
|
|
9
6
|
host?: string;
|
|
10
7
|
port?: number;
|
|
@@ -144,9 +141,6 @@ interface RedisRedisClientType {
|
|
|
144
141
|
interface RedisRedisClassType {
|
|
145
142
|
createClient(options: RedisRedisClientOptions): Partial<RedisRedisClientType>;
|
|
146
143
|
}
|
|
147
|
-
/**
|
|
148
|
-
* IORedis types
|
|
149
|
-
*/
|
|
150
144
|
interface IORedisClientOptions {
|
|
151
145
|
port?: number;
|
|
152
146
|
host?: string;
|
package/build/types/stream.d.ts
CHANGED
|
@@ -1,38 +1,19 @@
|
|
|
1
|
-
/** Represents a policy for retrying stream operations based on error codes */
|
|
2
1
|
export interface StreamRetryPolicy {
|
|
3
|
-
/**
|
|
4
|
-
* Key is error code, value is the retry profile.
|
|
5
|
-
* Tuple contains: [max retry count, retry type].
|
|
6
|
-
* 'x' denotes exponential backoff (default). Only 10, 100, 1000, 10000 are allowed retry intervals.
|
|
7
|
-
*/
|
|
8
2
|
[key: string]: [number, 'x'?];
|
|
9
3
|
}
|
|
10
|
-
/** A 3-digit status code representing the outcome of a stream operation */
|
|
11
4
|
export type StreamCode = number;
|
|
12
|
-
/** Describes the structure of a stream error */
|
|
13
5
|
export type StreamError = {
|
|
14
|
-
/** Descriptive message of the error */
|
|
15
6
|
message: string;
|
|
16
|
-
/** Numeric code corresponding to the type of error */
|
|
17
7
|
code: number;
|
|
18
|
-
/** Optional job identifier, used when communicating errors externally */
|
|
19
8
|
job_id?: string;
|
|
20
|
-
/** Stack trace of the error if unhandled */
|
|
21
9
|
stack?: string;
|
|
22
|
-
/** Name of the error if unhandled */
|
|
23
10
|
name?: string;
|
|
24
|
-
/** Custom user-defined error details */
|
|
25
11
|
error?: Record<string, unknown>;
|
|
26
|
-
/** True if originating via a standard transition message with an `error` status */
|
|
27
12
|
is_stream_error?: boolean;
|
|
28
13
|
};
|
|
29
|
-
/** Enumerated status values for stream operations */
|
|
30
14
|
export declare enum StreamStatus {
|
|
31
|
-
/** Indicates successful completion of the stream operation */
|
|
32
15
|
SUCCESS = "success",
|
|
33
|
-
/** Indicates an error occurred during the stream operation */
|
|
34
16
|
ERROR = "error",
|
|
35
|
-
/** Indicates the stream operation is still pending */
|
|
36
17
|
PENDING = "pending"
|
|
37
18
|
}
|
|
38
19
|
export declare enum StreamDataType {
|
|
@@ -46,88 +27,48 @@ export declare enum StreamDataType {
|
|
|
46
27
|
SIGNAL = "signal",
|
|
47
28
|
INTERRUPT = "interrupt"
|
|
48
29
|
}
|
|
49
|
-
/** Defines the structure of stream data used when passing stream messages (transitions) */
|
|
50
30
|
export interface StreamData {
|
|
51
|
-
/** Metadata associated with the stream data */
|
|
52
31
|
metadata: {
|
|
53
|
-
/** Globally unique identifier for the StreamData message to distinguish `retries` from new 'reentry/cycles' */
|
|
54
32
|
guid: string;
|
|
55
|
-
/** Workflow/job topic */
|
|
56
33
|
topic?: string;
|
|
57
|
-
/** Workflow/job ID */
|
|
58
34
|
jid?: string;
|
|
59
|
-
/** Workflow Generational ID (internal GUID) */
|
|
60
35
|
gid?: string;
|
|
61
|
-
/** Dimensional address indicating the message routing specifics */
|
|
62
36
|
dad?: string;
|
|
63
|
-
/** Activity ID */
|
|
64
37
|
aid: string;
|
|
65
|
-
/** OpenTelemetry Trace identifier */
|
|
66
38
|
trc?: string;
|
|
67
|
-
/** OpenTelemetry Span identifier */
|
|
68
39
|
spn?: string;
|
|
69
|
-
/** Current try count, used for retry logic */
|
|
70
40
|
try?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Indicates if the message should wait for a response.
|
|
73
|
-
* If explicitly false, the connection is severed immediately
|
|
74
|
-
* upon verifying (and returning) the Job ID.
|
|
75
|
-
*/
|
|
76
41
|
await?: boolean;
|
|
77
42
|
};
|
|
78
|
-
/** Type of the data being streamed, optional */
|
|
79
43
|
type?: StreamDataType;
|
|
80
|
-
/** Actual data being transmitted as a record of key-value pairs */
|
|
81
44
|
data: Record<string, unknown>;
|
|
82
|
-
/** Policies related to retry logic, optional */
|
|
83
45
|
policies?: {
|
|
84
46
|
retry?: StreamRetryPolicy;
|
|
85
47
|
};
|
|
86
|
-
/** Status of the stream, default assumed as 'success' */
|
|
87
48
|
status?: StreamStatus;
|
|
88
|
-
/** HTTP-like status code for the stream, default assumed as 200 */
|
|
89
49
|
code?: number;
|
|
90
|
-
/** Error stack trace */
|
|
91
50
|
stack?: string;
|
|
92
51
|
}
|
|
93
|
-
/** Extends StreamData for responses, allowing for inheritance of the base properties */
|
|
94
52
|
export type StreamDataResponse = StreamData;
|
|
95
53
|
export declare enum StreamRole {
|
|
96
54
|
WORKER = "worker",
|
|
97
55
|
ENGINE = "engine",
|
|
98
56
|
SYSTEM = "system"
|
|
99
57
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Represents a type for messages that have been reclaimed from a stream.
|
|
102
|
-
* Each item is a tuple containing a messageId and its details.
|
|
103
|
-
*/
|
|
104
58
|
export type ReclaimedMessageType = [
|
|
105
|
-
/** The stream ID, typically formatted as `<timestamp>-<count>` */
|
|
106
59
|
messageId: string,
|
|
107
|
-
/** Details of the message, consisting of a key and its value */
|
|
108
60
|
details: [
|
|
109
|
-
/** Key is always 'message' */
|
|
110
61
|
key: string,
|
|
111
|
-
/** Value is a stringified representation of StreamData */
|
|
112
62
|
value: string
|
|
113
63
|
]
|
|
114
64
|
][];
|
|
115
|
-
/** Configuration parameters for a stream */
|
|
116
65
|
export type StreamConfig = {
|
|
117
|
-
/** Namespace under which the stream operates */
|
|
118
66
|
namespace: string;
|
|
119
|
-
/** Application identifier */
|
|
120
67
|
appId: string;
|
|
121
|
-
/** Globally unique identifier for the stream */
|
|
122
68
|
guid: string;
|
|
123
|
-
/** Role associated with the stream */
|
|
124
69
|
role: StreamRole;
|
|
125
|
-
/** Default throttle (read from KeyType.THROTTLE_RATE) */
|
|
126
70
|
throttle: number;
|
|
127
|
-
/** Optional topic for the stream */
|
|
128
71
|
topic?: string;
|
|
129
|
-
/** Delay before a message can be reclaimed, defaults to 60,000 milliseconds */
|
|
130
72
|
reclaimDelay?: number;
|
|
131
|
-
/** Maximum number of reclaims allowed, defaults to 3. Values greater throw an error */
|
|
132
73
|
reclaimCount?: number;
|
|
133
74
|
};
|
package/build/types/stream.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamRole = exports.StreamDataType = exports.StreamStatus = void 0;
|
|
4
|
-
/** Enumerated status values for stream operations */
|
|
5
4
|
var StreamStatus;
|
|
6
5
|
(function (StreamStatus) {
|
|
7
|
-
/** Indicates successful completion of the stream operation */
|
|
8
6
|
StreamStatus["SUCCESS"] = "success";
|
|
9
|
-
/** Indicates an error occurred during the stream operation */
|
|
10
7
|
StreamStatus["ERROR"] = "error";
|
|
11
|
-
/** Indicates the stream operation is still pending */
|
|
12
8
|
StreamStatus["PENDING"] = "pending";
|
|
13
9
|
})(StreamStatus = exports.StreamStatus || (exports.StreamStatus = {}));
|
|
14
10
|
var StreamDataType;
|
package/index.ts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MeshCall } from './services/meshcall';
|
|
2
|
+
import { MeshData } from './services/meshdata';
|
|
3
|
+
import { HotMesh } from './services/hotmesh';
|
|
4
|
+
import { ClientService } from './services/meshflow/client';
|
|
5
|
+
import { WorkerService } from './services/meshflow/worker';
|
|
6
|
+
import { WorkflowService } from './services/meshflow/workflow';
|
|
7
|
+
import { ConnectionService } from './services/meshflow/connection';
|
|
3
8
|
import { HotMeshConfig } from './types/hotmesh';
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
const MeshFlow = {
|
|
11
|
+
Client: ClientService,
|
|
12
|
+
Worker: WorkerService,
|
|
13
|
+
workflow: WorkflowService,
|
|
14
|
+
Connection: ConnectionService,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
HotMesh,
|
|
19
|
+
MeshCall,
|
|
20
|
+
MeshData,
|
|
21
|
+
MeshFlow,
|
|
22
|
+
HotMeshConfig,
|
|
23
|
+
};
|
|
24
|
+
|
|
6
25
|
export * as Types from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Unbreakable Workflows",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"test:connect:ioredis": "NODE_ENV=test jest ./tests/unit/services/connector/clients/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
27
27
|
"test:connect:redis": "NODE_ENV=test jest ./tests/unit/services/connector/clients/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
28
28
|
"test:cycle": "NODE_ENV=test jest ./tests/functional/cycle/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
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:
|
|
29
|
+
"test:meshflow": "NODE_ENV=test jest ./tests/meshflow/*/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
30
|
+
"test:meshflow:basic": "NODE_ENV=test jest ./tests/meshflow/basic/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
31
|
+
"test:meshflow:collision": "NODE_ENV=test jest ./tests/meshflow/collision/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
32
|
+
"test:meshflow:fatal": "NODE_ENV=test jest ./tests/meshflow/fatal/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
33
|
+
"test:meshflow:goodbye": "NODE_ENV=test jest ./tests/meshflow/goodbye/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
34
|
+
"test:meshflow:hello": "HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/meshflow/helloworld/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
35
|
+
"test:meshflow:hook": "NODE_ENV=test jest ./tests/meshflow/hook/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
36
|
+
"test:meshflow:interrupt": "NODE_ENV=test jest ./tests/meshflow/interrupt/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
37
|
+
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
38
|
+
"test:meshflow:nested": "NODE_ENV=test jest ./tests/meshflow/nested/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
39
|
+
"test:meshflow:retry": "NODE_ENV=test jest ./tests/meshflow/retry/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
40
|
+
"test:meshflow:sleep": "NODE_ENV=test jest ./tests/meshflow/sleep/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
41
|
+
"test:meshflow:signal": "NODE_ENV=test jest ./tests/meshflow/signal/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
42
|
+
"test:meshflow:unknown": "NODE_ENV=test jest ./tests/meshflow/unknown/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
43
43
|
"test:emit": "NODE_ENV=test jest ./tests/functional/emit/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
44
44
|
"test:pending": "NODE_ENV=test jest ./tests/functional/pending/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
45
45
|
"test:functional": "NODE_ENV=test jest ./tests/functional/*/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -63,6 +63,8 @@
|
|
|
63
63
|
"test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/clients/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
64
64
|
"test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/clients/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
65
65
|
"test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
|
|
66
|
+
"test:meshdata": "NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshdata/index.test.ts --forceExit --verbose --detectOpenHandles",
|
|
67
|
+
"test:meshcall": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/meshcall/index.test.ts --forceExit --verbose --detectOpenHandles",
|
|
66
68
|
"test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
|
|
67
69
|
},
|
|
68
70
|
"keywords": [
|
|
@@ -102,6 +104,7 @@
|
|
|
102
104
|
"ts-jest": "^29.0.5",
|
|
103
105
|
"ts-node": "^10.9.1",
|
|
104
106
|
"ts-node-dev": "^2.0.0",
|
|
107
|
+
"typedoc": "^0.26.4",
|
|
105
108
|
"typescript": "^5.0.4"
|
|
106
109
|
},
|
|
107
110
|
"peerDependencies": {
|
package/typedoc.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entryPoints": [
|
|
3
|
+
"modules/enums.ts",
|
|
4
|
+
"modules/errors.ts",
|
|
5
|
+
"modules/key.ts",
|
|
6
|
+
"modules/utils.ts",
|
|
7
|
+
"services/hotmesh/index.ts",
|
|
8
|
+
"services/meshcall/index.ts",
|
|
9
|
+
"services/meshdata/index.ts",
|
|
10
|
+
"services/meshflow/index.ts",
|
|
11
|
+
"services/meshflow/client.ts",
|
|
12
|
+
"services/meshflow/handle.ts",
|
|
13
|
+
"services/meshflow/search.ts",
|
|
14
|
+
"services/meshflow/worker.ts",
|
|
15
|
+
"services/meshflow/workflow.ts",
|
|
16
|
+
"services/meshflow/connection.ts",
|
|
17
|
+
"types/*.ts"
|
|
18
|
+
],
|
|
19
|
+
"highlightLanguages": [
|
|
20
|
+
"bash",
|
|
21
|
+
"console",
|
|
22
|
+
"css",
|
|
23
|
+
"html",
|
|
24
|
+
"javascript",
|
|
25
|
+
"json",
|
|
26
|
+
"jsonc",
|
|
27
|
+
"json5",
|
|
28
|
+
"tsx",
|
|
29
|
+
"typescript",
|
|
30
|
+
"yaml"
|
|
31
|
+
],
|
|
32
|
+
"exclude": ["types/index.ts"],
|
|
33
|
+
"out": "docs/hotmesh",
|
|
34
|
+
"name": "",
|
|
35
|
+
"excludePrivate": true,
|
|
36
|
+
"theme": "default",
|
|
37
|
+
"customCss": "docs/css/custom.css"
|
|
38
|
+
}
|
package/types/error.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type MeshFlowChildErrorType = {
|
|
2
2
|
arguments: string[];
|
|
3
3
|
await?: boolean;
|
|
4
4
|
backoffCoefficient?: number;
|
|
@@ -14,7 +14,7 @@ export type DurableChildErrorType = {
|
|
|
14
14
|
workflowTopic: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type
|
|
17
|
+
export type MeshFlowWaitForAllErrorType = {
|
|
18
18
|
items: string[];
|
|
19
19
|
workflowId: string;
|
|
20
20
|
workflowTopic: string;
|
|
@@ -25,7 +25,7 @@ export type DurableWaitForAllErrorType = {
|
|
|
25
25
|
workflowDimension: string;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export type
|
|
28
|
+
export type MeshFlowProxyErrorType = {
|
|
29
29
|
arguments: string[];
|
|
30
30
|
activityName: string;
|
|
31
31
|
backoffCoefficient?: number;
|
|
@@ -40,14 +40,14 @@ export type DurableProxyErrorType = {
|
|
|
40
40
|
workflowTopic: string;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type MeshFlowWaitForErrorType = {
|
|
44
44
|
signalId: string;
|
|
45
45
|
index: number;
|
|
46
46
|
workflowDimension: string;
|
|
47
47
|
workflowId: string;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
export type
|
|
50
|
+
export type MeshFlowSleepErrorType = {
|
|
51
51
|
duration: number;
|
|
52
52
|
index: number;
|
|
53
53
|
workflowDimension: string;
|