@hotmeshio/hotmesh 0.4.0 → 0.4.1
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/build/modules/enums.d.ts +110 -0
- package/build/modules/enums.js +134 -0
- package/build/modules/errors.d.ts +124 -0
- package/build/modules/errors.js +191 -0
- package/build/modules/key.d.ts +66 -0
- package/build/modules/key.js +190 -0
- package/build/modules/storage.d.ts +3 -0
- package/build/modules/storage.js +5 -0
- package/build/modules/utils.d.ts +119 -0
- package/build/modules/utils.js +374 -0
- package/build/package.json +1 -1
- package/build/services/activities/activity.d.ts +104 -0
- package/build/services/activities/activity.js +549 -0
- package/build/services/activities/await.d.ts +12 -0
- package/build/services/activities/await.js +114 -0
- package/build/services/activities/cycle.d.ts +19 -0
- package/build/services/activities/cycle.js +112 -0
- package/build/services/activities/hook.d.ts +27 -0
- package/build/services/activities/hook.js +168 -0
- package/build/services/activities/index.d.ts +19 -0
- package/build/services/activities/index.js +20 -0
- package/build/services/activities/interrupt.d.ts +16 -0
- package/build/services/activities/interrupt.js +158 -0
- package/build/services/activities/signal.d.ts +20 -0
- package/build/services/activities/signal.js +134 -0
- package/build/services/activities/trigger.d.ts +37 -0
- package/build/services/activities/trigger.js +246 -0
- package/build/services/activities/worker.d.ts +12 -0
- package/build/services/activities/worker.js +106 -0
- package/build/services/collator/index.d.ts +111 -0
- package/build/services/collator/index.js +293 -0
- package/build/services/compiler/deployer.d.ts +40 -0
- package/build/services/compiler/deployer.js +488 -0
- package/build/services/compiler/index.d.ts +32 -0
- package/build/services/compiler/index.js +112 -0
- package/build/services/compiler/validator.d.ts +34 -0
- package/build/services/compiler/validator.js +147 -0
- package/build/services/connector/factory.d.ts +22 -0
- package/build/services/connector/factory.js +99 -0
- package/build/services/connector/index.d.ts +30 -0
- package/build/services/connector/index.js +54 -0
- package/build/services/connector/providers/ioredis.d.ts +9 -0
- package/build/services/connector/providers/ioredis.js +26 -0
- package/build/services/connector/providers/nats.d.ts +9 -0
- package/build/services/connector/providers/nats.js +34 -0
- package/build/services/connector/providers/postgres.d.ts +20 -0
- package/build/services/connector/providers/postgres.js +102 -0
- package/build/services/connector/providers/redis.d.ts +9 -0
- package/build/services/connector/providers/redis.js +38 -0
- package/build/services/engine/index.d.ts +264 -0
- package/build/services/engine/index.js +761 -0
- package/build/services/exporter/index.d.ts +44 -0
- package/build/services/exporter/index.js +126 -0
- package/build/services/hotmesh/index.d.ts +483 -0
- package/build/services/hotmesh/index.js +622 -0
- package/build/services/logger/index.d.ts +16 -0
- package/build/services/logger/index.js +54 -0
- package/build/services/mapper/index.d.ts +28 -0
- package/build/services/mapper/index.js +81 -0
- package/build/services/memflow/client.d.ts +108 -0
- package/build/services/memflow/client.js +372 -0
- package/build/services/memflow/connection.d.ts +23 -0
- package/build/services/memflow/connection.js +33 -0
- package/build/services/memflow/context.d.ts +143 -0
- package/build/services/memflow/context.js +299 -0
- package/build/services/memflow/exporter.d.ts +51 -0
- package/build/services/memflow/exporter.js +215 -0
- package/build/services/memflow/handle.d.ts +90 -0
- package/build/services/memflow/handle.js +176 -0
- package/build/services/memflow/index.d.ts +116 -0
- package/build/services/memflow/index.js +122 -0
- package/build/services/memflow/schemas/factory.d.ts +29 -0
- package/build/services/memflow/schemas/factory.js +2492 -0
- package/build/services/memflow/search.d.ts +142 -0
- package/build/services/memflow/search.js +320 -0
- package/build/services/memflow/worker.d.ts +124 -0
- package/build/services/memflow/worker.js +514 -0
- package/build/services/memflow/workflow/all.d.ts +7 -0
- package/build/services/memflow/workflow/all.js +15 -0
- package/build/services/memflow/workflow/common.d.ts +20 -0
- package/build/services/memflow/workflow/common.js +47 -0
- package/build/services/memflow/workflow/context.d.ts +6 -0
- package/build/services/memflow/workflow/context.js +45 -0
- package/build/services/memflow/workflow/contextMethods.d.ts +14 -0
- package/build/services/memflow/workflow/contextMethods.js +33 -0
- package/build/services/memflow/workflow/didRun.d.ts +7 -0
- package/build/services/memflow/workflow/didRun.js +22 -0
- package/build/services/memflow/workflow/emit.d.ts +11 -0
- package/build/services/memflow/workflow/emit.js +29 -0
- package/build/services/memflow/workflow/enrich.d.ts +9 -0
- package/build/services/memflow/workflow/enrich.js +17 -0
- package/build/services/memflow/workflow/execChild.d.ts +18 -0
- package/build/services/memflow/workflow/execChild.js +102 -0
- package/build/services/memflow/workflow/execHook.d.ts +65 -0
- package/build/services/memflow/workflow/execHook.js +73 -0
- package/build/services/memflow/workflow/hook.d.ts +9 -0
- package/build/services/memflow/workflow/hook.js +56 -0
- package/build/services/memflow/workflow/index.d.ts +74 -0
- package/build/services/memflow/workflow/index.js +87 -0
- package/build/services/memflow/workflow/interrupt.d.ts +9 -0
- package/build/services/memflow/workflow/interrupt.js +24 -0
- package/build/services/memflow/workflow/isSideEffectAllowed.d.ts +10 -0
- package/build/services/memflow/workflow/isSideEffectAllowed.js +33 -0
- package/build/services/memflow/workflow/proxyActivities.d.ts +20 -0
- package/build/services/memflow/workflow/proxyActivities.js +97 -0
- package/build/services/memflow/workflow/random.d.ts +6 -0
- package/build/services/memflow/workflow/random.js +16 -0
- package/build/services/memflow/workflow/searchMethods.d.ts +6 -0
- package/build/services/memflow/workflow/searchMethods.js +25 -0
- package/build/services/memflow/workflow/signal.d.ts +7 -0
- package/build/services/memflow/workflow/signal.js +28 -0
- package/build/services/memflow/workflow/sleepFor.d.ts +8 -0
- package/build/services/memflow/workflow/sleepFor.js +35 -0
- package/build/services/memflow/workflow/trace.d.ts +14 -0
- package/build/services/memflow/workflow/trace.js +33 -0
- package/build/services/memflow/workflow/waitFor.d.ts +8 -0
- package/build/services/memflow/workflow/waitFor.js +35 -0
- package/build/services/meshcall/index.d.ts +194 -0
- package/build/services/meshcall/index.js +452 -0
- package/build/services/meshcall/schemas/factory.d.ts +9 -0
- package/build/services/meshcall/schemas/factory.js +189 -0
- package/build/services/meshdata/index.d.ts +795 -0
- package/build/services/meshdata/index.js +1235 -0
- package/build/services/meshos/index.d.ts +293 -0
- package/build/services/meshos/index.js +547 -0
- package/build/services/pipe/functions/array.d.ts +17 -0
- package/build/services/pipe/functions/array.js +74 -0
- package/build/services/pipe/functions/bitwise.d.ts +9 -0
- package/build/services/pipe/functions/bitwise.js +24 -0
- package/build/services/pipe/functions/conditional.d.ts +13 -0
- package/build/services/pipe/functions/conditional.js +36 -0
- package/build/services/pipe/functions/cron.d.ts +12 -0
- package/build/services/pipe/functions/cron.js +40 -0
- package/build/services/pipe/functions/date.d.ts +58 -0
- package/build/services/pipe/functions/date.js +171 -0
- package/build/services/pipe/functions/index.d.ts +29 -0
- package/build/services/pipe/functions/index.js +30 -0
- package/build/services/pipe/functions/json.d.ts +5 -0
- package/build/services/pipe/functions/json.js +12 -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/math.d.ts +42 -0
- package/build/services/pipe/functions/math.js +184 -0
- package/build/services/pipe/functions/number.d.ts +21 -0
- package/build/services/pipe/functions/number.js +60 -0
- package/build/services/pipe/functions/object.d.ts +25 -0
- package/build/services/pipe/functions/object.js +81 -0
- package/build/services/pipe/functions/string.d.ts +23 -0
- package/build/services/pipe/functions/string.js +69 -0
- package/build/services/pipe/functions/symbol.d.ts +12 -0
- package/build/services/pipe/functions/symbol.js +33 -0
- package/build/services/pipe/functions/unary.d.ts +7 -0
- package/build/services/pipe/functions/unary.js +18 -0
- package/build/services/pipe/index.d.ts +48 -0
- package/build/services/pipe/index.js +242 -0
- package/build/services/quorum/index.d.ts +90 -0
- package/build/services/quorum/index.js +263 -0
- package/build/services/reporter/index.d.ts +50 -0
- package/build/services/reporter/index.js +348 -0
- package/build/services/router/config/index.d.ts +11 -0
- package/build/services/router/config/index.js +36 -0
- package/build/services/router/consumption/index.d.ts +34 -0
- package/build/services/router/consumption/index.js +395 -0
- package/build/services/router/error-handling/index.d.ts +8 -0
- package/build/services/router/error-handling/index.js +98 -0
- package/build/services/router/index.d.ts +57 -0
- package/build/services/router/index.js +121 -0
- package/build/services/router/lifecycle/index.d.ts +27 -0
- package/build/services/router/lifecycle/index.js +80 -0
- package/build/services/router/telemetry/index.d.ts +11 -0
- package/build/services/router/telemetry/index.js +32 -0
- package/build/services/router/throttling/index.d.ts +23 -0
- package/build/services/router/throttling/index.js +76 -0
- package/build/services/search/factory.d.ts +7 -0
- package/build/services/search/factory.js +24 -0
- package/build/services/search/index.d.ts +23 -0
- package/build/services/search/index.js +10 -0
- package/build/services/search/providers/postgres/postgres.d.ts +25 -0
- package/build/services/search/providers/postgres/postgres.js +149 -0
- package/build/services/search/providers/redis/ioredis.d.ts +19 -0
- package/build/services/search/providers/redis/ioredis.js +121 -0
- package/build/services/search/providers/redis/redis.d.ts +19 -0
- package/build/services/search/providers/redis/redis.js +134 -0
- package/build/services/serializer/index.d.ts +42 -0
- package/build/services/serializer/index.js +282 -0
- package/build/services/store/cache.d.ts +67 -0
- package/build/services/store/cache.js +128 -0
- package/build/services/store/factory.d.ts +8 -0
- package/build/services/store/factory.js +24 -0
- package/build/services/store/index.d.ts +89 -0
- package/build/services/store/index.js +9 -0
- package/build/services/store/providers/postgres/kvsql.d.ts +168 -0
- package/build/services/store/providers/postgres/kvsql.js +198 -0
- package/build/services/store/providers/postgres/kvtables.d.ts +20 -0
- package/build/services/store/providers/postgres/kvtables.js +441 -0
- package/build/services/store/providers/postgres/kvtransaction.d.ts +36 -0
- package/build/services/store/providers/postgres/kvtransaction.js +248 -0
- package/build/services/store/providers/postgres/kvtypes/hash.d.ts +60 -0
- package/build/services/store/providers/postgres/kvtypes/hash.js +1287 -0
- package/build/services/store/providers/postgres/kvtypes/list.d.ts +33 -0
- package/build/services/store/providers/postgres/kvtypes/list.js +194 -0
- package/build/services/store/providers/postgres/kvtypes/string.d.ts +20 -0
- package/build/services/store/providers/postgres/kvtypes/string.js +115 -0
- package/build/services/store/providers/postgres/kvtypes/zset.d.ts +41 -0
- package/build/services/store/providers/postgres/kvtypes/zset.js +214 -0
- package/build/services/store/providers/postgres/postgres.d.ts +145 -0
- package/build/services/store/providers/postgres/postgres.js +1036 -0
- package/build/services/store/providers/redis/_base.d.ts +137 -0
- package/build/services/store/providers/redis/_base.js +980 -0
- package/build/services/store/providers/redis/ioredis.d.ts +20 -0
- package/build/services/store/providers/redis/ioredis.js +180 -0
- package/build/services/store/providers/redis/redis.d.ts +18 -0
- package/build/services/store/providers/redis/redis.js +199 -0
- package/build/services/store/providers/store-initializable.d.ts +5 -0
- package/build/services/store/providers/store-initializable.js +2 -0
- package/build/services/stream/factory.d.ts +8 -0
- package/build/services/stream/factory.js +37 -0
- package/build/services/stream/index.d.ts +69 -0
- package/build/services/stream/index.js +11 -0
- package/build/services/stream/providers/nats/nats.d.ts +60 -0
- package/build/services/stream/providers/nats/nats.js +225 -0
- package/build/services/stream/providers/postgres/kvtables.d.ts +3 -0
- package/build/services/stream/providers/postgres/kvtables.js +146 -0
- package/build/services/stream/providers/postgres/postgres.d.ts +107 -0
- package/build/services/stream/providers/postgres/postgres.js +519 -0
- package/build/services/stream/providers/redis/ioredis.d.ts +61 -0
- package/build/services/stream/providers/redis/ioredis.js +272 -0
- package/build/services/stream/providers/redis/redis.d.ts +61 -0
- package/build/services/stream/providers/redis/redis.js +305 -0
- package/build/services/stream/providers/stream-initializable.d.ts +4 -0
- package/build/services/stream/providers/stream-initializable.js +2 -0
- package/build/services/sub/factory.d.ts +7 -0
- package/build/services/sub/factory.js +29 -0
- package/build/services/sub/index.d.ts +22 -0
- package/build/services/sub/index.js +10 -0
- package/build/services/sub/providers/nats/nats.d.ts +19 -0
- package/build/services/sub/providers/nats/nats.js +105 -0
- package/build/services/sub/providers/postgres/postgres.d.ts +19 -0
- package/build/services/sub/providers/postgres/postgres.js +92 -0
- package/build/services/sub/providers/redis/ioredis.d.ts +17 -0
- package/build/services/sub/providers/redis/ioredis.js +81 -0
- package/build/services/sub/providers/redis/redis.d.ts +17 -0
- package/build/services/sub/providers/redis/redis.js +72 -0
- package/build/services/task/index.d.ts +36 -0
- package/build/services/task/index.js +206 -0
- package/build/services/telemetry/index.d.ts +52 -0
- package/build/services/telemetry/index.js +306 -0
- package/build/services/worker/index.d.ts +77 -0
- package/build/services/worker/index.js +197 -0
- package/package.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/typedoc.json +0 -47
- package/types/activity.ts +0 -268
- package/types/app.ts +0 -20
- package/types/async.ts +0 -6
- package/types/cache.ts +0 -1
- package/types/collator.ts +0 -9
- package/types/error.ts +0 -56
- package/types/exporter.ts +0 -102
- package/types/hook.ts +0 -44
- package/types/hotmesh.ts +0 -314
- package/types/index.ts +0 -306
- package/types/job.ts +0 -233
- package/types/logger.ts +0 -8
- package/types/manifest.ts +0 -70
- package/types/map.ts +0 -5
- package/types/memflow.ts +0 -645
- package/types/meshcall.ts +0 -235
- package/types/meshdata.ts +0 -278
- package/types/ms.d.ts +0 -7
- package/types/nats.ts +0 -270
- package/types/pipe.ts +0 -90
- package/types/postgres.ts +0 -114
- package/types/provider.ts +0 -161
- package/types/quorum.ts +0 -167
- package/types/redis.ts +0 -404
- package/types/serializer.ts +0 -40
- package/types/stats.ts +0 -117
- package/types/stream.ts +0 -231
- package/types/task.ts +0 -7
- package/types/telemetry.ts +0 -16
- package/types/transition.ts +0 -20
package/types/memflow.ts
DELETED
|
@@ -1,645 +0,0 @@
|
|
|
1
|
-
import { WorkflowHandleService } from '../services/memflow/handle';
|
|
2
|
-
|
|
3
|
-
import { LogLevel } from './logger';
|
|
4
|
-
import { ProviderConfig, ProvidersConfig } from './provider';
|
|
5
|
-
import { StringAnyType, StringStringType } from './serializer';
|
|
6
|
-
import { StreamData, StreamError } from './stream';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Type definition for workflow configuration.
|
|
10
|
-
*/
|
|
11
|
-
type WorkflowConfig = {
|
|
12
|
-
/**
|
|
13
|
-
* Backoff coefficient for retry mechanism.
|
|
14
|
-
* @default 10 (HMSH_MEMFLOW_EXP_BACKOFF)
|
|
15
|
-
*/
|
|
16
|
-
backoffCoefficient?: number;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Maximum number of attempts for retries.
|
|
20
|
-
* @default 5 (HMSH_MEMFLOW_MAX_ATTEMPTS)
|
|
21
|
-
*/
|
|
22
|
-
maximumAttempts?: number;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Maximum interval between retries.
|
|
26
|
-
* @default 120s (HMSH_MEMFLOW_MAX_INTERVAL)
|
|
27
|
-
*/
|
|
28
|
-
maximumInterval?: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Whether to throw an error on final failure after retries are exhausted
|
|
32
|
-
* or return the error object as a standard response containing error-related
|
|
33
|
-
* fields like `stack`, `code`, `message`.
|
|
34
|
-
* @default true
|
|
35
|
-
*/
|
|
36
|
-
throwOnError?: boolean;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
type WorkflowContext = {
|
|
40
|
-
/**
|
|
41
|
-
* can the workflow be retried if an error occurs
|
|
42
|
-
*/
|
|
43
|
-
canRetry: boolean;
|
|
44
|
-
|
|
45
|
-
COUNTER: {
|
|
46
|
-
/**
|
|
47
|
-
* the reentrant semaphore parent counter object for object reference during increment
|
|
48
|
-
*/
|
|
49
|
-
counter: number;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* the reentrant semaphore, incremented in real-time as idempotent statements are re-traversed upon reentry. Indicates the current semaphore count.
|
|
54
|
-
*/
|
|
55
|
-
counter: number;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* number as string for the replay cursor
|
|
59
|
-
*/
|
|
60
|
-
cursor: string;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* the replay hash of name/value pairs representing prior executions
|
|
64
|
-
*/
|
|
65
|
-
replay: StringStringType;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* the HotMesh App namespace
|
|
69
|
-
* @default memflow
|
|
70
|
-
*/
|
|
71
|
-
namespace: string;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* holds list of interruption payloads; if list is longer than 1 when the error is thrown, a `collator` subflow will be used
|
|
75
|
-
*/
|
|
76
|
-
interruptionRegistry: any[];
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* entry point ancestor flow; might be the parent; will never be self
|
|
80
|
-
*/
|
|
81
|
-
originJobId: string;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* the workflow/job ID
|
|
85
|
-
*/
|
|
86
|
-
workflowId: string;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* the dimensional isolation for the reentrant hook, expressed in the format `0,0`, `0,1`, etc
|
|
90
|
-
*/
|
|
91
|
-
workflowDimension: string;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* a concatenation of the task queue and workflow name (e.g., `${taskQueueName}-${workflowName}`)
|
|
95
|
-
*/
|
|
96
|
-
workflowTopic: string;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* the open telemetry trace context for the workflow, used for logging and tracing. If a sink is enabled, this will be sent to the sink.
|
|
100
|
-
*/
|
|
101
|
-
workflowTrace: string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* 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.
|
|
105
|
-
*/
|
|
106
|
-
workflowSpan: string;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* the native HotMesh message that encapsulates the arguments, metadata, and raw data for the workflow
|
|
110
|
-
*/
|
|
111
|
-
raw: StreamData;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* the HotMesh connection configuration (io/redis NPM package reference and login credentials)
|
|
115
|
-
*/
|
|
116
|
-
connection: Connection;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* if present, the workflow will delay expiration for the specified number of seconds
|
|
120
|
-
*/
|
|
121
|
-
expire?: number;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* The schema for the full-text-search (RediSearch) index.
|
|
126
|
-
*/
|
|
127
|
-
export type WorkflowSearchSchema = Record<
|
|
128
|
-
string,
|
|
129
|
-
{
|
|
130
|
-
/**
|
|
131
|
-
* The FT.SEARCH field type. One of: TEXT, NUMERIC, TAG. TEXT is
|
|
132
|
-
* most expensive, but also most expressive.
|
|
133
|
-
*/
|
|
134
|
-
type: 'TEXT' | 'NUMERIC' | 'TAG';
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* FT.SEARCH SORTABLE field. If true, results may be sorted according to this field
|
|
138
|
-
* @default false
|
|
139
|
-
*/
|
|
140
|
-
sortable?: boolean;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* FT.SEARCH NOSTEM field. applies to TEXT fields types.
|
|
144
|
-
* If true, the text field index will not stem words
|
|
145
|
-
* @default false
|
|
146
|
-
*/
|
|
147
|
-
nostem?: boolean;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* FT.SEARCH NOINDEX field. If true and if the field is sortable, the field will aid
|
|
151
|
-
* in sorting results but not be directly indexed as a standalone
|
|
152
|
-
* @default false
|
|
153
|
-
*/
|
|
154
|
-
noindex?: boolean;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* if true, the field is indexed and searchable within the FT.SEARCH index
|
|
158
|
-
* This is different from `noindex` which is FT.SEARCH specific and relates
|
|
159
|
-
* to sorting and indexing. This is a general flag for the field that will
|
|
160
|
-
* enable or disable indexing and searching entirely. Use for fields with
|
|
161
|
-
* absolutely no meaning to query or sorting but which are important
|
|
162
|
-
* nonetheless as part of the data record that is saved and returned.
|
|
163
|
-
* @default true
|
|
164
|
-
*/
|
|
165
|
-
indexed?: boolean;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* An array of possible values for the field
|
|
169
|
-
*/
|
|
170
|
-
examples?: string[];
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* The 'nilable' setting may NOT be set to `true` for
|
|
174
|
-
* NUMBER types as it causes an indexing error;
|
|
175
|
-
* consider a custom (e.g., negative number) value to represent
|
|
176
|
-
* `null` if desired for a NUMERIC field.
|
|
177
|
-
* Set to true only if the field is a TEXT or TAG type and
|
|
178
|
-
* you wish to save the string `null` as a value to search
|
|
179
|
-
* on (the tag, {null}, or the string, (null)
|
|
180
|
-
* @default false
|
|
181
|
-
*/
|
|
182
|
-
nilable?: boolean;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* possible scalar/primitive types for the field. Use when
|
|
186
|
-
* serializing and restoring data to ensure the field is
|
|
187
|
-
* properly typed. If not provided, the field will be
|
|
188
|
-
* treated as a string.
|
|
189
|
-
*/
|
|
190
|
-
primitive?: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* if true, the field is required to be present in the data record
|
|
194
|
-
* @default false
|
|
195
|
-
*/
|
|
196
|
-
required?: boolean;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* an enumerated list of allowed values; if field is nilable, it is implied
|
|
200
|
-
* and therefore not necessary to include `null` in the list
|
|
201
|
-
* @default []
|
|
202
|
-
*/
|
|
203
|
-
enum?: string[];
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* a regular expression pattern for the field
|
|
207
|
-
* @default '.*'
|
|
208
|
-
* @example '^[a-zA-Z0-9_]*$'
|
|
209
|
-
*/
|
|
210
|
-
pattern?: string;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* literal value to use for the indexed field name (without including the standard underscore (_) prefix isolate)
|
|
214
|
-
*/
|
|
215
|
-
fieldName?: string;
|
|
216
|
-
}
|
|
217
|
-
>;
|
|
218
|
-
|
|
219
|
-
type WorkflowSearchOptions = {
|
|
220
|
-
/** FT index name (myapp:myindex) */
|
|
221
|
-
index?: string;
|
|
222
|
-
|
|
223
|
-
/** FT prefixes (['myapp:myindex:prefix1', 'myapp:myindex:prefix2']) */
|
|
224
|
-
prefix?: string[];
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Schema mapping each field. Each field is a key-value pair where the key is the field name
|
|
228
|
-
* and the value is a record of field options. If the fieldName is provided,
|
|
229
|
-
* it will be used as the indexed field name. If not provided
|
|
230
|
-
* key will be used as the indexed field name with an underscore prefix.
|
|
231
|
-
*
|
|
232
|
-
*/
|
|
233
|
-
schema?: WorkflowSearchSchema;
|
|
234
|
-
|
|
235
|
-
/** Additional data as a key-value record */
|
|
236
|
-
data?: StringStringType;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
type SearchResults = {
|
|
240
|
-
/**
|
|
241
|
-
* the total number of results
|
|
242
|
-
*/
|
|
243
|
-
count: number;
|
|
244
|
-
/**
|
|
245
|
-
* the raw FT.SEARCH query string
|
|
246
|
-
*/
|
|
247
|
-
query: string;
|
|
248
|
-
/**
|
|
249
|
-
* the raw FT.SEARCH results as an array of objects
|
|
250
|
-
*/
|
|
251
|
-
data: StringStringType[];
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
type WorkflowOptions = {
|
|
255
|
-
/**
|
|
256
|
-
* the namespace for the workflow
|
|
257
|
-
* @default memflow
|
|
258
|
-
*/
|
|
259
|
-
namespace?: string;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* the task queue for the workflow; optional if entity is provided
|
|
263
|
-
*/
|
|
264
|
-
taskQueue?: string;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* input arguments to pass in
|
|
268
|
-
*/
|
|
269
|
-
args: any[];
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* the job id
|
|
273
|
-
*/
|
|
274
|
-
workflowId?: string;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* 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.
|
|
278
|
-
*/
|
|
279
|
-
entity?: string;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* the name of the user's workflow function; optional if 'entity' is provided
|
|
283
|
-
*/
|
|
284
|
-
workflowName?: string;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* the parent workflow id; adjacent ancestor ID
|
|
288
|
-
*/
|
|
289
|
-
parentWorkflowId?: string;
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* the entry point workflow id
|
|
293
|
-
*/
|
|
294
|
-
originJobId?: string;
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* OpenTelemetry trace context for the workflow
|
|
298
|
-
*/
|
|
299
|
-
workflowTrace?: string;
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* OpenTelemetry span context for the workflow
|
|
303
|
-
*/
|
|
304
|
-
workflowSpan?: string;
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* the full-text-search (RediSearch) options for the workflow
|
|
308
|
-
*/
|
|
309
|
-
search?: WorkflowSearchOptions;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* marker data (begins with a -)
|
|
313
|
-
*/
|
|
314
|
-
marker?: StringStringType;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* the workflow configuration object
|
|
318
|
-
*/
|
|
319
|
-
config?: WorkflowConfig;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* 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.
|
|
323
|
-
*/
|
|
324
|
-
expire?: number;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* system flag to indicate that the flow should remain open beyond main method completion while still emitting the 'job done' event
|
|
328
|
-
*/
|
|
329
|
-
persistent?: boolean;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* default is true; set to false to optimize workflows that do not require a `signal in`
|
|
333
|
-
*/
|
|
334
|
-
signalIn?: boolean;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* default is true; if false, will not await the execution
|
|
338
|
-
*/
|
|
339
|
-
await?: boolean;
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* If provided, the job will initialize in a pending state, reserving
|
|
343
|
-
* only the job ID (HSETNX) and persisting search and marker (if provided).
|
|
344
|
-
* If a `resume` signal is sent before the specified number of seconds,
|
|
345
|
-
* the job will resume as normal, transitioning to the adjacent children
|
|
346
|
-
* of the trigger. If the job is not resumed within the number
|
|
347
|
-
* of seconds specified, the job will be scrubbed. No dependencies
|
|
348
|
-
* are added for a job in a pending state; however, dependencies
|
|
349
|
-
* will be added after the job is resumed if relevant.
|
|
350
|
-
*/
|
|
351
|
-
pending?: number;
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Provide to set the engine name. This MUST be unique, so do not
|
|
355
|
-
* provide unless it is guaranteed to be a unique engine/worker guid
|
|
356
|
-
* when identifying the point of presence within the mesh.
|
|
357
|
-
*/
|
|
358
|
-
guid?: string;
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Options for setting up a hook.
|
|
363
|
-
* 'memflow' is the default namespace if not provided;
|
|
364
|
-
* similar to setting `appid` in the YAML
|
|
365
|
-
*/
|
|
366
|
-
type HookOptions = {
|
|
367
|
-
/** Optional namespace under which the hook function will be grouped */
|
|
368
|
-
namespace?: string;
|
|
369
|
-
|
|
370
|
-
/** Optional task queue, needed unless 'entity' is provided */
|
|
371
|
-
taskQueue?: string;
|
|
372
|
-
|
|
373
|
-
/** Input arguments to pass into the hook */
|
|
374
|
-
args: any[];
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Optional entity name. If provided, applies as the workflowName,
|
|
378
|
-
* taskQueue, and prefix. This scopes the FT.SEARCH index appropriately.
|
|
379
|
-
* This is a convenience method but limits options.
|
|
380
|
-
*/
|
|
381
|
-
entity?: string;
|
|
382
|
-
|
|
383
|
-
/** Execution ID, also known as the job ID to hook into */
|
|
384
|
-
workflowId?: string;
|
|
385
|
-
|
|
386
|
-
/** The name of the user's hook function */
|
|
387
|
-
workflowName?: string;
|
|
388
|
-
|
|
389
|
-
/** Bind additional search terms immediately before hook reentry */
|
|
390
|
-
search?: WorkflowSearchOptions;
|
|
391
|
-
|
|
392
|
-
/** Hook function constraints (backoffCoefficient, maximumAttempts, maximumInterval) */
|
|
393
|
-
config?: WorkflowConfig;
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Options for sending signals in a workflow.
|
|
398
|
-
*/
|
|
399
|
-
type SignalOptions = {
|
|
400
|
-
/**
|
|
401
|
-
* Task queue associated with the workflow
|
|
402
|
-
*/
|
|
403
|
-
taskQueue: string;
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Input data for the signal (any serializable object)
|
|
407
|
-
*/
|
|
408
|
-
data: StringAnyType;
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Execution ID, also known as the job ID
|
|
412
|
-
*/
|
|
413
|
-
workflowId: string;
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Optional name of the user's workflow function
|
|
417
|
-
*/
|
|
418
|
-
workflowName?: string;
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
type ActivityWorkflowDataType = {
|
|
422
|
-
activityName: string;
|
|
423
|
-
arguments: any[];
|
|
424
|
-
workflowId: string;
|
|
425
|
-
workflowTopic: string;
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
type WorkflowDataType = {
|
|
429
|
-
arguments: any[];
|
|
430
|
-
workflowId: string;
|
|
431
|
-
workflowTopic: string;
|
|
432
|
-
workflowDimension?: string; //is present if hook (not main workflow)
|
|
433
|
-
originJobId?: string; //is present if there is an originating ancestor job
|
|
434
|
-
canRetry?: boolean;
|
|
435
|
-
expire?: number;
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
type Connection = ProviderConfig | ProvidersConfig;
|
|
439
|
-
|
|
440
|
-
type ClientConfig = {
|
|
441
|
-
connection: Connection;
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
type Registry = {
|
|
445
|
-
[key: string]: Function;
|
|
446
|
-
};
|
|
447
|
-
type WorkerConfig = {
|
|
448
|
-
/** Connection configuration for the worker */
|
|
449
|
-
connection: Connection;
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Namespace used in the app configuration, denoted as `appid` in the YAML
|
|
453
|
-
* @default memflow
|
|
454
|
-
*/
|
|
455
|
-
namespace?: string;
|
|
456
|
-
|
|
457
|
-
/** Task queue name, denoted as `subscribes` in the YAML (e.g., 'hello-world') */
|
|
458
|
-
taskQueue: string;
|
|
459
|
-
|
|
460
|
-
/** Target function or a record type with a name (string) and reference function */
|
|
461
|
-
workflow: Function | Record<string | symbol, Function>;
|
|
462
|
-
|
|
463
|
-
/** Additional options for configuring the worker */
|
|
464
|
-
options?: WorkerOptions;
|
|
465
|
-
|
|
466
|
-
/** Search options for workflow execution details */
|
|
467
|
-
search?: WorkflowSearchOptions;
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Provide to set the engine name. This MUST be unique, so do not
|
|
471
|
-
* provide unless it is guaranteed to be a unique engine/worker guid
|
|
472
|
-
* when identifying the point of presence within the mesh.
|
|
473
|
-
*/
|
|
474
|
-
guid?: string;
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
type FindWhereQuery = {
|
|
478
|
-
field: string;
|
|
479
|
-
is: '=' | '==' | '>=' | '<=' | '[]';
|
|
480
|
-
value: string | boolean | number | [number, number];
|
|
481
|
-
type?: string; //default is TEXT
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
type FindOptions = {
|
|
485
|
-
workflowName?: string; //also the function name
|
|
486
|
-
taskQueue?: string;
|
|
487
|
-
namespace?: string;
|
|
488
|
-
index?: string;
|
|
489
|
-
search?: WorkflowSearchOptions;
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
type FindWhereOptions = {
|
|
493
|
-
options?: FindOptions;
|
|
494
|
-
count?: boolean;
|
|
495
|
-
query: FindWhereQuery[];
|
|
496
|
-
return?: string[];
|
|
497
|
-
limit?: {
|
|
498
|
-
start: number;
|
|
499
|
-
size: number;
|
|
500
|
-
};
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
type FindJobsOptions = {
|
|
504
|
-
/** The workflow name; include an asterisk for wilcard search; refer to Redis SCAN for the allowed format */
|
|
505
|
-
match?: string;
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* application namespace
|
|
509
|
-
* @default memflow
|
|
510
|
-
*/
|
|
511
|
-
namespace?: string;
|
|
512
|
-
|
|
513
|
-
/** The suggested response limit. Reduce batch size to reduce the likelihood of large overages. */
|
|
514
|
-
limit?: number;
|
|
515
|
-
|
|
516
|
-
/** How many records to scan at a time */
|
|
517
|
-
batch?: number;
|
|
518
|
-
|
|
519
|
-
/** The start cursor; defaults to 0 */
|
|
520
|
-
cursor?: string;
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
type WorkerOptions = {
|
|
524
|
-
/** Log level: debug, info, warn, error */
|
|
525
|
-
logLevel?: LogLevel;
|
|
526
|
-
|
|
527
|
-
/** Maximum number of attempts, default 5 (HMSH_MEMFLOW_MAX_ATTEMPTS) */
|
|
528
|
-
maximumAttempts?: number;
|
|
529
|
-
|
|
530
|
-
/** Backoff coefficient for retry logic, default 10 (HMSH_MEMFLOW_EXP_BACKOFF) */
|
|
531
|
-
backoffCoefficient?: number;
|
|
532
|
-
|
|
533
|
-
/** Maximum interval between retries, default 120s (HMSH_MEMFLOW_MAX_INTERVAL) */
|
|
534
|
-
maximumInterval?: string;
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
type ContextType = {
|
|
538
|
-
workflowId: string;
|
|
539
|
-
workflowTopic: string;
|
|
540
|
-
};
|
|
541
|
-
|
|
542
|
-
type FunctionSignature<T> = T extends (...args: infer A) => infer R
|
|
543
|
-
? (...args: A) => R
|
|
544
|
-
: never;
|
|
545
|
-
type ProxyType<ACT> = {
|
|
546
|
-
[K in keyof ACT]: FunctionSignature<ACT[K]>;
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Configuration settings for activities within a workflow.
|
|
551
|
-
*/
|
|
552
|
-
type ActivityConfig = {
|
|
553
|
-
/** place holder setting; unused at this time (re: activity workflow expire configuration) */
|
|
554
|
-
expire?: number;
|
|
555
|
-
|
|
556
|
-
/** Start to close timeout for the activity; not yet implemented */
|
|
557
|
-
startToCloseTimeout?: string;
|
|
558
|
-
|
|
559
|
-
/** Configuration for specific activities, type not yet specified */
|
|
560
|
-
activities?: any;
|
|
561
|
-
|
|
562
|
-
/** Retry policy configuration for activities */
|
|
563
|
-
retryPolicy?: {
|
|
564
|
-
/** Maximum number of retry attempts, default is 5 (HMSH_MEMFLOW_MAX_ATTEMPTS) */
|
|
565
|
-
maximumAttempts?: number;
|
|
566
|
-
/** Factor by which the retry timeout increases, default is 10 (HMSH_MEMFLOW_MAX_INTERVAL) */
|
|
567
|
-
backoffCoefficient?: number;
|
|
568
|
-
/** Maximum interval between retries, default is '120s' (HMSH_MEMFLOW_EXP_BACKOFF) */
|
|
569
|
-
maximumInterval?: string;
|
|
570
|
-
/** Whether to throw an error on failure, default is true */
|
|
571
|
-
throwOnError?: boolean;
|
|
572
|
-
};
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* The proxy response object returned from the activity proxy flow
|
|
577
|
-
*/
|
|
578
|
-
type ProxyResponseType<T> = {
|
|
579
|
-
data?: T; //expected data
|
|
580
|
-
$error?: StreamError;
|
|
581
|
-
done?: boolean; //non-existent if error was thrown in transition (not during execution)
|
|
582
|
-
jc: string;
|
|
583
|
-
ju: string;
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* The child flow response object returned from the main flow during recursion
|
|
588
|
-
*/
|
|
589
|
-
type ChildResponseType<T> = {
|
|
590
|
-
data?: T; //expected data
|
|
591
|
-
$error?: StreamError;
|
|
592
|
-
done?: boolean; //non-existent if error was thrown in transition (not during execution)
|
|
593
|
-
jc: string;
|
|
594
|
-
ju: string;
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
interface ClientWorkflow {
|
|
598
|
-
start(options: WorkflowOptions): Promise<WorkflowHandleService>;
|
|
599
|
-
signal(
|
|
600
|
-
signalId: string,
|
|
601
|
-
data: StringAnyType,
|
|
602
|
-
namespace?: string,
|
|
603
|
-
): Promise<string>;
|
|
604
|
-
hook(options: HookOptions): Promise<string>;
|
|
605
|
-
getHandle(
|
|
606
|
-
taskQueue: string,
|
|
607
|
-
workflowName: string,
|
|
608
|
-
workflowId: string,
|
|
609
|
-
namespace?: string,
|
|
610
|
-
): Promise<WorkflowHandleService>;
|
|
611
|
-
search(
|
|
612
|
-
taskQueue: string,
|
|
613
|
-
workflowName: string,
|
|
614
|
-
namespace: string | null,
|
|
615
|
-
index: string,
|
|
616
|
-
...query: string[]
|
|
617
|
-
): Promise<string[]>;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
export {
|
|
621
|
-
ActivityConfig,
|
|
622
|
-
ActivityWorkflowDataType,
|
|
623
|
-
ChildResponseType,
|
|
624
|
-
ClientConfig,
|
|
625
|
-
ClientWorkflow,
|
|
626
|
-
ContextType,
|
|
627
|
-
Connection,
|
|
628
|
-
ProxyResponseType,
|
|
629
|
-
ProxyType,
|
|
630
|
-
Registry,
|
|
631
|
-
SignalOptions,
|
|
632
|
-
FindJobsOptions,
|
|
633
|
-
FindOptions,
|
|
634
|
-
FindWhereOptions,
|
|
635
|
-
FindWhereQuery,
|
|
636
|
-
HookOptions,
|
|
637
|
-
SearchResults,
|
|
638
|
-
WorkerConfig,
|
|
639
|
-
WorkflowConfig,
|
|
640
|
-
WorkerOptions,
|
|
641
|
-
WorkflowSearchOptions,
|
|
642
|
-
WorkflowDataType,
|
|
643
|
-
WorkflowOptions,
|
|
644
|
-
WorkflowContext,
|
|
645
|
-
};
|