@hotmeshio/hotmesh 0.0.52 → 0.0.54
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 +22 -18
- package/build/index.d.ts +1 -2
- package/build/index.js +1 -3
- package/build/modules/enums.d.ts +8 -3
- package/build/modules/enums.js +16 -8
- package/build/modules/errors.d.ts +58 -20
- package/build/modules/errors.js +90 -33
- package/build/package.json +7 -2
- package/build/services/activities/activity.d.ts +8 -0
- package/build/services/activities/activity.js +63 -14
- package/build/services/activities/await.js +6 -6
- package/build/services/activities/cycle.d.ts +2 -2
- package/build/services/activities/cycle.js +5 -5
- package/build/services/activities/hook.js +9 -5
- package/build/services/activities/interrupt.d.ts +3 -3
- package/build/services/activities/interrupt.js +15 -6
- package/build/services/activities/signal.d.ts +2 -2
- package/build/services/activities/signal.js +4 -4
- package/build/services/activities/trigger.d.ts +5 -2
- package/build/services/activities/trigger.js +34 -4
- package/build/services/activities/worker.js +6 -6
- package/build/services/compiler/deployer.js +33 -5
- package/build/services/compiler/validator.d.ts +2 -0
- package/build/services/compiler/validator.js +5 -1
- package/build/services/durable/client.d.ts +7 -1
- package/build/services/durable/client.js +57 -38
- package/build/services/durable/exporter.d.ts +27 -81
- package/build/services/durable/exporter.js +153 -325
- package/build/services/durable/handle.d.ts +13 -8
- package/build/services/durable/handle.js +61 -48
- package/build/services/durable/index.d.ts +0 -2
- package/build/services/durable/index.js +0 -2
- package/build/services/durable/schemas/factory.d.ts +33 -0
- package/build/services/durable/schemas/factory.js +2356 -0
- package/build/services/durable/search.js +8 -8
- package/build/services/durable/worker.js +117 -25
- package/build/services/durable/workflow.d.ts +67 -52
- package/build/services/durable/workflow.js +322 -306
- package/build/services/engine/index.d.ts +2 -2
- package/build/services/engine/index.js +5 -2
- package/build/services/exporter/index.d.ts +2 -4
- package/build/services/exporter/index.js +4 -5
- package/build/services/hotmesh/index.d.ts +2 -2
- package/build/services/hotmesh/index.js +2 -2
- package/build/services/mapper/index.d.ts +6 -2
- package/build/services/mapper/index.js +6 -2
- package/build/services/pipe/functions/array.d.ts +2 -10
- package/build/services/pipe/functions/array.js +30 -28
- package/build/services/pipe/functions/conditional.d.ts +1 -0
- package/build/services/pipe/functions/conditional.js +3 -0
- package/build/services/pipe/functions/date.d.ts +1 -0
- package/build/services/pipe/functions/date.js +4 -0
- package/build/services/pipe/functions/index.d.ts +2 -0
- package/build/services/pipe/functions/index.js +2 -0
- package/build/services/pipe/functions/logical.d.ts +5 -0
- package/build/services/pipe/functions/logical.js +12 -0
- package/build/services/pipe/functions/object.d.ts +3 -0
- package/build/services/pipe/functions/object.js +25 -7
- package/build/services/pipe/index.d.ts +20 -3
- package/build/services/pipe/index.js +82 -16
- package/build/services/router/index.js +14 -3
- package/build/services/serializer/index.d.ts +3 -2
- package/build/services/serializer/index.js +11 -4
- package/build/services/store/clients/ioredis.js +6 -6
- package/build/services/store/clients/redis.js +7 -7
- package/build/services/store/index.d.ts +2 -0
- package/build/services/store/index.js +4 -1
- package/build/services/stream/clients/ioredis.js +8 -8
- package/build/services/stream/clients/redis.js +1 -1
- package/build/types/activity.d.ts +60 -5
- package/build/types/durable.d.ts +183 -36
- package/build/types/error.d.ts +48 -0
- package/build/types/error.js +2 -0
- package/build/types/exporter.d.ts +35 -7
- package/build/types/index.d.ts +4 -3
- package/build/types/job.d.ts +93 -6
- package/build/types/pipe.d.ts +81 -3
- package/build/types/stream.d.ts +61 -1
- package/build/types/stream.js +4 -0
- package/index.ts +1 -2
- package/modules/enums.ts +16 -8
- package/modules/errors.ts +139 -34
- package/package.json +7 -2
- package/services/activities/activity.ts +63 -14
- package/services/activities/await.ts +6 -6
- package/services/activities/cycle.ts +7 -6
- package/services/activities/hook.ts +12 -5
- package/services/activities/interrupt.ts +19 -9
- package/services/activities/signal.ts +6 -5
- package/services/activities/trigger.ts +43 -6
- package/services/activities/worker.ts +7 -7
- package/services/compiler/deployer.ts +33 -6
- package/services/compiler/validator.ts +7 -3
- package/services/durable/client.ts +49 -22
- package/services/durable/exporter.ts +162 -349
- package/services/durable/handle.ts +66 -53
- package/services/durable/index.ts +0 -2
- package/services/durable/schemas/factory.ts +2358 -0
- package/services/durable/search.ts +8 -8
- package/services/durable/worker.ts +128 -29
- package/services/durable/workflow.ts +371 -322
- package/services/engine/index.ts +8 -3
- package/services/exporter/index.ts +10 -12
- package/services/hotmesh/index.ts +4 -3
- package/services/mapper/index.ts +6 -2
- package/services/pipe/functions/array.ts +24 -37
- package/services/pipe/functions/conditional.ts +4 -0
- package/services/pipe/functions/date.ts +6 -0
- package/services/pipe/functions/index.ts +7 -5
- package/services/pipe/functions/logical.ts +11 -0
- package/services/pipe/functions/object.ts +26 -7
- package/services/pipe/index.ts +99 -21
- package/services/quorum/index.ts +1 -3
- package/services/router/index.ts +14 -3
- package/services/serializer/index.ts +12 -5
- package/services/store/clients/ioredis.ts +6 -6
- package/services/store/clients/redis.ts +7 -7
- package/services/store/index.ts +4 -1
- package/services/stream/clients/ioredis.ts +8 -8
- package/services/stream/clients/redis.ts +1 -1
- package/types/activity.ts +87 -15
- package/types/durable.ts +263 -75
- package/types/error.ts +52 -0
- package/types/exporter.ts +43 -9
- package/types/index.ts +14 -8
- package/types/job.ts +157 -36
- package/types/pipe.ts +84 -3
- package/types/stream.ts +82 -23
- package/build/services/durable/factory.d.ts +0 -17
- package/build/services/durable/factory.js +0 -817
- package/build/services/durable/meshos.d.ts +0 -127
- package/build/services/durable/meshos.js +0 -380
- package/services/durable/factory.ts +0 -818
- package/services/durable/meshos.ts +0 -441
package/types/durable.ts
CHANGED
|
@@ -1,16 +1,53 @@
|
|
|
1
1
|
import { LogLevel } from './logger';
|
|
2
2
|
import { RedisClass, RedisOptions } from './redis';
|
|
3
|
-
import { StringStringType } from './serializer';
|
|
3
|
+
import { StringAnyType, StringStringType } from './serializer';
|
|
4
|
+
import { StreamData, StreamError } from './stream';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Type definition for workflow configuration.
|
|
8
|
+
*/
|
|
5
9
|
type WorkflowConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Backoff coefficient for retry mechanism.
|
|
12
|
+
* @default 10 (HMSH_DURABLE_EXP_BACKOFF)
|
|
13
|
+
*/
|
|
14
|
+
backoffCoefficient?: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Maximum number of attempts for retries.
|
|
18
|
+
* @default 5 (HMSH_DURABLE_MAX_ATTEMPTS)
|
|
19
|
+
*/
|
|
20
|
+
maximumAttempts?: number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Maximum interval between retries.
|
|
24
|
+
* @default 120s (HMSH_DURABLE_MAX_INTERVAL)
|
|
25
|
+
*/
|
|
26
|
+
maximumInterval?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether to throw an error on final failure after retries are exhausted
|
|
30
|
+
* or return the error object as a standard response containing error-related
|
|
31
|
+
* fields like `stack`, `code`, `message`.
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
throwOnError?: boolean;
|
|
10
35
|
}
|
|
11
36
|
|
|
12
37
|
type WorkflowContext = {
|
|
13
38
|
|
|
39
|
+
/**
|
|
40
|
+
* can the workflow be retried if an error occurs
|
|
41
|
+
*/
|
|
42
|
+
canRetry: boolean;
|
|
43
|
+
|
|
44
|
+
COUNTER: {
|
|
45
|
+
/**
|
|
46
|
+
* the reentrant semaphore parent counter object for object reference during increment
|
|
47
|
+
*/
|
|
48
|
+
counter: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
14
51
|
/**
|
|
15
52
|
* the reentrant semaphore, incremented in real-time as idempotent statements are re-traversed upon reentry. Indicates the current semaphore count.
|
|
16
53
|
*/
|
|
@@ -31,6 +68,16 @@ type WorkflowContext = {
|
|
|
31
68
|
*/
|
|
32
69
|
namespace: string;
|
|
33
70
|
|
|
71
|
+
/**
|
|
72
|
+
* holds list of interruption payloads; if list is longer than 1 when the error is thrown, a `collator` subflow will be used
|
|
73
|
+
*/
|
|
74
|
+
interruptionRegistry: any[];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* entry point ancestor flow; might be the parent; will never be self
|
|
78
|
+
*/
|
|
79
|
+
originJobId: string;
|
|
80
|
+
|
|
34
81
|
/**
|
|
35
82
|
* the workflow/job ID
|
|
36
83
|
*/
|
|
@@ -55,47 +102,165 @@ type WorkflowContext = {
|
|
|
55
102
|
* the open telemetry span context for the workflow, used for logging and tracing. If a sink is enabled, this will be sent to the sink.
|
|
56
103
|
*/
|
|
57
104
|
workflowSpan: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* the native HotMesh message that encapsulates the arguments, metadata, and raw data for the workflow
|
|
108
|
+
*/
|
|
109
|
+
raw: StreamData;
|
|
58
110
|
}
|
|
59
111
|
|
|
60
112
|
type WorkflowSearchOptions = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
113
|
+
/** FT index name (myapp:myindex) */
|
|
114
|
+
index?: string;
|
|
115
|
+
|
|
116
|
+
/** FT prefixes (['myapp:myindex:prefix1', 'myapp:myindex:prefix2']) */
|
|
117
|
+
prefix?: string[];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Schema mapping each field to a type with an optional sortable flag
|
|
121
|
+
*/
|
|
122
|
+
schema?: Record<string, { type: 'TEXT' | 'NUMERIC' | 'TAG', sortable?: boolean }>;
|
|
123
|
+
|
|
124
|
+
/** Additional data as a key-value record */
|
|
125
|
+
data?: StringStringType;
|
|
65
126
|
}
|
|
66
127
|
|
|
128
|
+
|
|
67
129
|
type WorkflowOptions = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* the namespace for the workflow; `durable` is the default namespace if not provided
|
|
133
|
+
*/
|
|
134
|
+
namespace?: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* the task queue for the workflow; optional if entity is provided
|
|
138
|
+
*/
|
|
139
|
+
taskQueue?: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* input arguments to pass in
|
|
143
|
+
*/
|
|
144
|
+
args: any[];
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* the job id
|
|
148
|
+
*/
|
|
149
|
+
workflowId?: string;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* if invoking a workflow, passing 'entity' will apply the value as the workflowName, taskQueue, and prefix, ensuring the FT.SEARCH index is properly scoped. This is a convenience method but limits options.
|
|
153
|
+
*/
|
|
154
|
+
entity?: string;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* the name of the user's workflow function; optional if 'entity' is provided
|
|
158
|
+
*/
|
|
159
|
+
workflowName?: string;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* the parent workflow id; adjacent ancestor ID
|
|
163
|
+
*/
|
|
164
|
+
parentWorkflowId?: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* the entry point workflow id
|
|
168
|
+
*/
|
|
169
|
+
originJobId?: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* OpenTelemetry trace context for the workflow
|
|
173
|
+
*/
|
|
76
174
|
workflowTrace?: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* OpenTelemetry span context for the workflow
|
|
178
|
+
*/
|
|
77
179
|
workflowSpan?: string;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* the full-text-search (RediSearch) options for the workflow
|
|
183
|
+
*/
|
|
78
184
|
search?: WorkflowSearchOptions
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* marker data (begins with a -)
|
|
188
|
+
*/
|
|
189
|
+
marker?: StringStringType
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* the workflow configuration object
|
|
193
|
+
*/
|
|
79
194
|
config?: WorkflowConfig;
|
|
80
|
-
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* sets the number of seconds a workflow may exist after completion. As the process engine is an in-memory cache, the default policy is to expire and scrub the job hash as soon as it completes.
|
|
198
|
+
*/
|
|
199
|
+
expire?: number;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* default is true; if false, will not await the execution
|
|
203
|
+
*/
|
|
204
|
+
await?: boolean;
|
|
81
205
|
}
|
|
82
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Options for setting up a hook.
|
|
209
|
+
* 'durable' is the default namespace if not provided; similar to setting `appid` in the YAML
|
|
210
|
+
*/
|
|
83
211
|
type HookOptions = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
212
|
+
/** Optional namespace under which the hook function will be grouped */
|
|
213
|
+
namespace?: string;
|
|
214
|
+
|
|
215
|
+
/** Optional task queue, needed unless 'entity' is provided */
|
|
216
|
+
taskQueue?: string;
|
|
217
|
+
|
|
218
|
+
/** Input arguments to pass into the hook */
|
|
219
|
+
args: any[];
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Optional entity name. If provided, applies as the workflowName,
|
|
223
|
+
* taskQueue, and prefix. This scopes the FT.SEARCH index appropriately.
|
|
224
|
+
* This is a convenience method but limits options.
|
|
225
|
+
*/
|
|
226
|
+
entity?: string;
|
|
227
|
+
|
|
228
|
+
/** Execution ID, also known as the job ID to hook into */
|
|
229
|
+
workflowId?: string;
|
|
230
|
+
|
|
231
|
+
/** The name of the user's hook function */
|
|
232
|
+
workflowName?: string;
|
|
233
|
+
|
|
234
|
+
/** Bind additional search terms immediately before hook reentry */
|
|
235
|
+
search?: WorkflowSearchOptions
|
|
236
|
+
|
|
237
|
+
/** Hook function constraints (backoffCoefficient, maximumAttempts, maximumInterval) */
|
|
238
|
+
config?: WorkflowConfig;
|
|
92
239
|
}
|
|
93
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Options for sending signals in a workflow.
|
|
243
|
+
*/
|
|
94
244
|
type SignalOptions = {
|
|
245
|
+
/**
|
|
246
|
+
* Task queue associated with the workflow
|
|
247
|
+
*/
|
|
95
248
|
taskQueue: string;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Input data for the signal (any serializable object)
|
|
252
|
+
*/
|
|
253
|
+
data: StringAnyType;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Execution ID, also known as the job ID
|
|
257
|
+
*/
|
|
258
|
+
workflowId: string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Optional name of the user's workflow function
|
|
262
|
+
*/
|
|
263
|
+
workflowName?: string;
|
|
99
264
|
}
|
|
100
265
|
|
|
101
266
|
type ActivityWorkflowDataType = {
|
|
@@ -111,19 +276,7 @@ type WorkflowDataType = {
|
|
|
111
276
|
workflowTopic: string;
|
|
112
277
|
workflowDimension?: string; //is present if hook (not main workflow)
|
|
113
278
|
originJobId?: string; //is present if there is an originating ancestor job (should rename to originJobId)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
type MeshOSClassConfig = {
|
|
117
|
-
namespace: string;
|
|
118
|
-
taskQueue: string;
|
|
119
|
-
redisOptions: RedisOptions;
|
|
120
|
-
redisClass: RedisClass;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
type MeshOSConfig = {
|
|
124
|
-
id?: string; //guid for the workflow when instancing
|
|
125
|
-
await?: boolean; //default is false; must explicitly send true to await the final result
|
|
126
|
-
taskQueue?: string; //optional target queue isolate for the function
|
|
279
|
+
canRetry?: boolean;
|
|
127
280
|
}
|
|
128
281
|
|
|
129
282
|
type ConnectionConfig = {
|
|
@@ -139,16 +292,30 @@ type ClientConfig = {
|
|
|
139
292
|
type Registry = {
|
|
140
293
|
[key: string]: Function
|
|
141
294
|
};
|
|
142
|
-
|
|
143
295
|
type WorkerConfig = {
|
|
296
|
+
/** Connection configuration for the worker */
|
|
144
297
|
connection: Connection;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Namespace used in the app configuration, denoted as `appid` in the YAML (e.g., 'durable')
|
|
301
|
+
* @default durable
|
|
302
|
+
*/
|
|
303
|
+
namespace?: string;
|
|
304
|
+
|
|
305
|
+
/** Task queue name, denoted as `subscribes` in the YAML (e.g., 'hello-world') */
|
|
306
|
+
taskQueue: string;
|
|
307
|
+
|
|
308
|
+
/** Target function or a record type with a name (string) and reference function */
|
|
309
|
+
workflow: Function | Record<string | symbol, Function>;
|
|
310
|
+
|
|
311
|
+
/** Additional options for configuring the worker */
|
|
148
312
|
options?: WorkerOptions;
|
|
313
|
+
|
|
314
|
+
/** Search options for workflow execution details */
|
|
149
315
|
search?: WorkflowSearchOptions;
|
|
150
316
|
}
|
|
151
317
|
|
|
318
|
+
|
|
152
319
|
type FindWhereQuery = {
|
|
153
320
|
field: string;
|
|
154
321
|
is: '=' | '==' | '>=' | '<=' | '[]';
|
|
@@ -160,7 +327,7 @@ type FindOptions = {
|
|
|
160
327
|
workflowName?: string; //also the function name
|
|
161
328
|
taskQueue?: string;
|
|
162
329
|
namespace?: string;
|
|
163
|
-
index?: string;
|
|
330
|
+
index?: string;
|
|
164
331
|
}
|
|
165
332
|
|
|
166
333
|
type FindWhereOptions = {
|
|
@@ -174,28 +341,18 @@ type FindWhereOptions = {
|
|
|
174
341
|
}
|
|
175
342
|
}
|
|
176
343
|
|
|
177
|
-
type
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
344
|
+
type WorkerOptions = {
|
|
345
|
+
/** Log level: debug, info, warn, error */
|
|
346
|
+
logLevel?: LogLevel;
|
|
181
347
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
options: ActivityConfig;
|
|
185
|
-
}
|
|
348
|
+
/** Maximum number of attempts, default 5 (HMSH_DURABLE_MAX_ATTEMPTS) */
|
|
349
|
+
maximumAttempts?: number;
|
|
186
350
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
allowList?: Array<MeshOSOptions | string>; //limit which `hook` and `workflow` workers start
|
|
190
|
-
logLevel?: LogLevel; //debug, info, warn, error
|
|
191
|
-
maxSystemRetries?: number; //1-3 (10ms, 100ms, 1_000ms)
|
|
192
|
-
backoffCoefficient?: number; //2-10ish
|
|
193
|
-
}
|
|
351
|
+
/** Backoff coefficient for retry logic, default 10 (HMSH_DURABLE_EXP_BACKOFF) */
|
|
352
|
+
backoffCoefficient?: number;
|
|
194
353
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
maxSystemRetries?: number; //1-3 (10ms, 100ms, 1_000ms)
|
|
198
|
-
backoffCoefficient?: number; //2-10ish
|
|
354
|
+
/** Maximum interval between retries, default 120s (HMSH_DURABLE_MAX_INTERVAL) */
|
|
355
|
+
maximumInterval?: string;
|
|
199
356
|
}
|
|
200
357
|
|
|
201
358
|
type ContextType = {
|
|
@@ -208,24 +365,60 @@ type ProxyType<ACT> = {
|
|
|
208
365
|
[K in keyof ACT]: FunctionSignature<ACT[K]>;
|
|
209
366
|
};
|
|
210
367
|
|
|
368
|
+
/**
|
|
369
|
+
* Configuration settings for activities within a workflow.
|
|
370
|
+
*/
|
|
211
371
|
type ActivityConfig = {
|
|
372
|
+
/** Start to close timeout for the activity; not yet implemented */
|
|
212
373
|
startToCloseTimeout?: string;
|
|
374
|
+
|
|
375
|
+
/** Configuration for specific activities, type not yet specified */
|
|
213
376
|
activities?: any;
|
|
377
|
+
|
|
378
|
+
/** Retry policy configuration for activities */
|
|
214
379
|
retryPolicy?: {
|
|
215
|
-
|
|
216
|
-
maximumAttempts
|
|
217
|
-
|
|
218
|
-
|
|
380
|
+
/** Maximum number of retry attempts, default is 5 (HMSH_DURABLE_MAX_ATTEMPTS) */
|
|
381
|
+
maximumAttempts?: number;
|
|
382
|
+
/** Factor by which the retry timeout increases, default is 10 (HMSH_DURABLE_MAX_INTERVAL) */
|
|
383
|
+
backoffCoefficient?: number;
|
|
384
|
+
/** Maximum interval between retries, default is '120s' (HMSH_DURABLE_EXP_BACKOFF) */
|
|
385
|
+
maximumInterval?: string;
|
|
386
|
+
/** Whether to throw an error on failure, default is true */
|
|
387
|
+
throwOnError?: boolean;
|
|
219
388
|
};
|
|
220
389
|
};
|
|
221
390
|
|
|
391
|
+
/**
|
|
392
|
+
* The proxy response object returned from the activity proxy flow
|
|
393
|
+
*/
|
|
394
|
+
type ProxyResponseType<T> = {
|
|
395
|
+
data?: T, //expected data
|
|
396
|
+
$error?: StreamError,
|
|
397
|
+
done?: boolean, //non-existent if error was thrown in transition (not during execution)
|
|
398
|
+
jc: string,
|
|
399
|
+
ju: string
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* The child flow response object returned from the main flow during recursion
|
|
404
|
+
*/
|
|
405
|
+
type ChildResponseType<T> = {
|
|
406
|
+
data?: T, //expected data
|
|
407
|
+
$error?: StreamError,
|
|
408
|
+
done?: boolean, //non-existent if error was thrown in transition (not during execution)
|
|
409
|
+
jc: string,
|
|
410
|
+
ju: string
|
|
411
|
+
};
|
|
412
|
+
|
|
222
413
|
export {
|
|
223
414
|
ActivityConfig,
|
|
224
415
|
ActivityWorkflowDataType,
|
|
416
|
+
ChildResponseType,
|
|
225
417
|
ClientConfig,
|
|
226
418
|
ContextType,
|
|
227
419
|
ConnectionConfig,
|
|
228
420
|
Connection,
|
|
421
|
+
ProxyResponseType,
|
|
229
422
|
ProxyType,
|
|
230
423
|
Registry,
|
|
231
424
|
SignalOptions,
|
|
@@ -233,11 +426,6 @@ export {
|
|
|
233
426
|
FindWhereOptions,
|
|
234
427
|
FindWhereQuery,
|
|
235
428
|
HookOptions,
|
|
236
|
-
MeshOSActivityOptions,
|
|
237
|
-
MeshOSWorkerOptions,
|
|
238
|
-
MeshOSClassConfig,
|
|
239
|
-
MeshOSConfig,
|
|
240
|
-
MeshOSOptions,
|
|
241
429
|
WorkerConfig,
|
|
242
430
|
WorkflowConfig,
|
|
243
431
|
WorkerOptions,
|
package/types/error.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type DurableChildErrorType = {
|
|
2
|
+
arguments: string[],
|
|
3
|
+
await?: boolean,
|
|
4
|
+
backoffCoefficient?: number,
|
|
5
|
+
index: number,
|
|
6
|
+
maximumAttempts?: number,
|
|
7
|
+
maximumInterval?: number,
|
|
8
|
+
originJobId: string | null,
|
|
9
|
+
parentWorkflowId: string,
|
|
10
|
+
workflowDimension: string,
|
|
11
|
+
workflowId: string,
|
|
12
|
+
workflowTopic: string,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type DurableWaitForAllErrorType = {
|
|
16
|
+
items: string[],
|
|
17
|
+
workflowId: string,
|
|
18
|
+
workflowTopic: string,
|
|
19
|
+
parentWorkflowId: string,
|
|
20
|
+
originJobId: string | null,
|
|
21
|
+
size: number,
|
|
22
|
+
index: number,
|
|
23
|
+
workflowDimension: string
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type DurableProxyErrorType = {
|
|
27
|
+
arguments: string[],
|
|
28
|
+
activityName: string,
|
|
29
|
+
backoffCoefficient?: number,
|
|
30
|
+
index: number,
|
|
31
|
+
maximumAttempts?: number,
|
|
32
|
+
maximumInterval?: number,
|
|
33
|
+
originJobId: string | null,
|
|
34
|
+
parentWorkflowId: string,
|
|
35
|
+
workflowDimension: string,
|
|
36
|
+
workflowId: string,
|
|
37
|
+
workflowTopic: string,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type DurableWaitForErrorType = {
|
|
41
|
+
signalId: string,
|
|
42
|
+
index: number,
|
|
43
|
+
workflowDimension: string
|
|
44
|
+
workflowId: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type DurableSleepErrorType = {
|
|
48
|
+
duration: number,
|
|
49
|
+
index: number,
|
|
50
|
+
workflowDimension: string,
|
|
51
|
+
workflowId: string,
|
|
52
|
+
};
|
package/types/exporter.ts
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
import { StringAnyType
|
|
1
|
+
import { StringAnyType } from "./serializer";
|
|
2
2
|
|
|
3
3
|
export type ExportItem = [(string | null), string, any];
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* job export data can be large, particularly transitions the timeline
|
|
7
|
+
*/
|
|
8
|
+
export type ExportFields = 'data' | 'state' | 'status' | 'timeline' | 'transitions';
|
|
9
|
+
|
|
10
|
+
export interface ExportOptions {
|
|
11
|
+
/**
|
|
12
|
+
* limit the export byte size by specifying an allowlist
|
|
13
|
+
*/
|
|
14
|
+
allow?: Array<ExportFields>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* limit the export byte size by specifying a block list
|
|
18
|
+
*/
|
|
19
|
+
block?: Array<ExportFields>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* If false, do not return timeline values (like child job response, proxy activity response, etc)
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
values?: boolean;
|
|
26
|
+
};
|
|
6
27
|
|
|
7
28
|
export type JobAction = {
|
|
8
29
|
cursor: number;
|
|
@@ -46,14 +67,27 @@ export interface ExportCycles {
|
|
|
46
67
|
[key: string]: string[];
|
|
47
68
|
};
|
|
48
69
|
|
|
70
|
+
export type TimelineType = {
|
|
71
|
+
key: string;
|
|
72
|
+
value: Record<string, any> | string | number | null;
|
|
73
|
+
index: number;
|
|
74
|
+
secondary?: number;
|
|
75
|
+
dimension?: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export interface TransitionType {
|
|
79
|
+
activity: string;
|
|
80
|
+
dimensions: string;
|
|
81
|
+
created: string;
|
|
82
|
+
updated: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
49
85
|
export interface DurableJobExport {
|
|
50
|
-
data
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
transitions: ExportTransitions;
|
|
56
|
-
cycles: ExportCycles;
|
|
86
|
+
data?: StringAnyType;
|
|
87
|
+
state?: StringAnyType;
|
|
88
|
+
status?: number;
|
|
89
|
+
timeline?: TimelineType[];
|
|
90
|
+
transitions?: TransitionType[];
|
|
57
91
|
};
|
|
58
92
|
|
|
59
93
|
export interface JobExport {
|
package/types/index.ts
CHANGED
|
@@ -30,10 +30,12 @@ export {
|
|
|
30
30
|
export {
|
|
31
31
|
ActivityConfig,
|
|
32
32
|
ActivityWorkflowDataType,
|
|
33
|
+
ChildResponseType,
|
|
33
34
|
ClientConfig,
|
|
34
35
|
ContextType,
|
|
35
36
|
ConnectionConfig,
|
|
36
37
|
Connection,
|
|
38
|
+
ProxyResponseType,
|
|
37
39
|
ProxyType,
|
|
38
40
|
Registry,
|
|
39
41
|
SignalOptions,
|
|
@@ -41,11 +43,6 @@ export {
|
|
|
41
43
|
FindWhereOptions,
|
|
42
44
|
FindWhereQuery,
|
|
43
45
|
HookOptions,
|
|
44
|
-
MeshOSActivityOptions,
|
|
45
|
-
MeshOSWorkerOptions,
|
|
46
|
-
MeshOSClassConfig,
|
|
47
|
-
MeshOSConfig,
|
|
48
|
-
MeshOSOptions,
|
|
49
46
|
WorkflowConfig,
|
|
50
47
|
WorkerConfig,
|
|
51
48
|
WorkerOptions,
|
|
@@ -54,6 +51,12 @@ export {
|
|
|
54
51
|
WorkflowDataType,
|
|
55
52
|
WorkflowOptions,
|
|
56
53
|
} from './durable';
|
|
54
|
+
export {
|
|
55
|
+
DurableChildErrorType,
|
|
56
|
+
DurableProxyErrorType,
|
|
57
|
+
DurableSleepErrorType,
|
|
58
|
+
DurableWaitForAllErrorType,
|
|
59
|
+
DurableWaitForErrorType } from "./error";
|
|
57
60
|
export {
|
|
58
61
|
ActivityAction,
|
|
59
62
|
DependencyExport,
|
|
@@ -86,12 +89,16 @@ export {
|
|
|
86
89
|
JobOutput,
|
|
87
90
|
JobState,
|
|
88
91
|
JobStatus,
|
|
89
|
-
PartialJobState
|
|
92
|
+
PartialJobState,
|
|
93
|
+
ExtensionType } from './job';
|
|
90
94
|
export { MappingStatements } from './map';
|
|
91
95
|
export {
|
|
92
96
|
Pipe,
|
|
97
|
+
PipeContext,
|
|
93
98
|
PipeItem,
|
|
94
|
-
PipeItems
|
|
99
|
+
PipeItems,
|
|
100
|
+
PipeObject,
|
|
101
|
+
ReduceObject } from './pipe';
|
|
95
102
|
export {
|
|
96
103
|
HotMesh,
|
|
97
104
|
HotMeshApp,
|
|
@@ -187,4 +194,3 @@ export {
|
|
|
187
194
|
TransitionMatch,
|
|
188
195
|
TransitionRule,
|
|
189
196
|
Transitions } from './transition';
|
|
190
|
-
|